-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HADOOP-18575: try to avoid repeatedly hitting exceptions when transformer factories do not support attributes #5253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HADOOP-18575: try to avoid repeatedly hitting exceptions when transformer factories do not support attributes #5253
Conversation
💔 -1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to suggest a slight variant, which is
bestEffortSetAttribute()
takes an AtomicBoolean as a ref for something like
if (!flag.get()) {
try {
// do the set
return true
} catch (exception) {
flag.set(false)
return false;
}
}
then we could go
bestEffortSetAttribute(trfactory, XMLConstants.ACCESS_EXTERNAL_DTD, "", CAN_SET_TRANSFORMER_ACCESS_EXTERNAL_DTD)
bestEffortSetAttribute(trfactory, XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "", CAN_SET_TRANSFORMER_ACCESS_EXTERNAL_STYLESHEETpp);
… do not support attributes
fd6e298
to
3e24f62
Compare
updated PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
+1 pending Yetus
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
@steveloughran is it ok to proceed with merging this? |
I'm on holiday right now...see if you can get @mukund-thakur to handle it, or remind me next week |
+1 |
…en transformer factories do not support attributes (#5253) Part of HADOOP-18469 and the hardening of XML/XSL parsers. Followup to the main HADOOP-18575 patch, to improve performance when working with xml/xsl engines which don't support the relevant attributes. Include this change when backporting. Contributed by PJ Fanning.
…en transformer factories do not support attributes (#5253) Part of HADOOP-18469 and the hardening of XML/XSL parsers. Followup to the main HADOOP-18575 patch, to improve performance when working with xml/xsl engines which don't support the relevant attributes. Include this change when backporting. Contributed by PJ Fanning.
… + followups This change is a squash of below three patches from upstream: 1. HADOOP-18469. Add secure XML parser factories to XMLUtils (apache#4940) Add to XMLUtils a set of methods to create secure XML Parsers/transformers, locking down DTD, schema, XXE exposure. Use these wherever XML parsers are created. Contributed by PJ Fanning (cherry-picked from 8336b91) 2. HADOOP-18575. Make XML transformer factory more lenient (apache#5224) Due diligence followup to HADOOP-18469. Add secure XML parser factories to XMLUtils (apache#4940) Contributed by P J Fanning (cherry-picked from 6a07b5d) 3. HADOOP-18575: followup: try to avoid repeatedly hitting exceptions when transformer factories do not support attributes (apache#5253) Part of HADOOP-18469 and the hardening of XML/XSL parsers. Followup to the main HADOOP-18575 patch, to improve performance when working with xml/xsl engines which don't support the relevant attributes. Include this change when backporting. Contributed by PJ Fanning. (cherry-picked from d81d983) Change-Id: Ic519987c1f07d286fb3811b961a406bd280f039a
Description of PR
Concerns that the existing HADOOP-18575 solution could end up with 2 exceptions being raised, caught and ignored if Saxon is on the classpath.
How was this patch tested?
For code changes:
LICENSE
,LICENSE-binary
,NOTICE-binary
files?