pjfanning commented on code in PR #5224:
URL: https://github.com/apache/hadoop/pull/5224#discussion_r1049105381
##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/XMLUtils.java:
##########
@@ -156,8 +156,18 @@ public static SAXTransformerFactory
newSecureSAXTransformerFactory()
throws TransformerConfigurationException {
SAXTransformerFactory trfactory = (SAXTransformerFactory)
SAXTransformerFactory.newInstance();
trfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
- trfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
- trfactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
+ quietSet(trfactory, XMLConstants.ACCESS_EXTERNAL_DTD, "");
+ quietSet(trfactory, XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
return trfactory;
}
+
+ private static boolean quietSet(TransformerFactory transformerFactory,
String name, Object value) {
+ try {
+ transformerFactory.setAttribute(name, value);
+ return true;
+ } catch (Exception|Error e) {
+ // ok to ignore
Review Comment:
these logs can be noisy - when I've added similar code in Apache POI and
elsewhere, users gripe about the same lines appearing in the log even if it
isn't exactly a storm - could they be debug level logs?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]