[
https://issues.apache.org/jira/browse/HADOOP-18575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17647777#comment-17647777
]
ASF GitHub Bot commented on HADOOP-18575:
-----------------------------------------
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?
> make transformer factory creation more lenient
> ----------------------------------------------
>
> Key: HADOOP-18575
> URL: https://issues.apache.org/jira/browse/HADOOP-18575
> Project: Hadoop Common
> Issue Type: Task
> Reporter: PJ Fanning
> Priority: Major
> Labels: pull-request-available
>
> Issues raised today in HADOOP-18469 about particular attributes that are not
> supported by Saxon transformer.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]