You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2022/12/16 14:45:53 UTC

[GitHub] [hadoop] steveloughran commented on a diff in pull request #5224: HADOOP-18575: make transformer factory more lenient

steveloughran commented on code in PR #5224:
URL: https://github.com/apache/hadoop/pull/5224#discussion_r1050830812


##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/XMLUtils.java:
##########
@@ -156,8 +161,19 @@ 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, "");
+    bestEffortSet(trfactory, XMLConstants.ACCESS_EXTERNAL_DTD, "");
+    bestEffortSet(trfactory, XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
     return trfactory;
   }
+
+  private static boolean bestEffortSet(TransformerFactory transformerFactory,

Review Comment:
   can you add a javadoc



-- 
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: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org