Repository: logging-log4j2 Updated Branches: refs/heads/master db66cf2dc -> 8e222830e
[LOG4J2-2026] java.lang.AbstractMethodError: javax.xml.parsers.DocumentBuilderFactory.setFeature(). Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/8e222830 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/8e222830 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/8e222830 Branch: refs/heads/master Commit: 8e222830e3beac05dd44ed7198d9f5099a26cdfd Parents: db66cf2 Author: Gary Gregory <[email protected]> Authored: Thu Aug 31 11:35:40 2017 -0600 Committer: Gary Gregory <[email protected]> Committed: Thu Aug 31 11:35:40 2017 -0600 ---------------------------------------------------------------------- .../log4j/core/config/xml/XmlConfiguration.java | 18 +++++++++++++++--- src/changes/changes.xml | 5 +++++ 2 files changed, 20 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8e222830/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XmlConfiguration.java ---------------------------------------------------------------------- diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XmlConfiguration.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XmlConfiguration.java index 81db0de..c9a69da 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XmlConfiguration.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XmlConfiguration.java @@ -202,9 +202,21 @@ public class XmlConfiguration extends AbstractConfiguration implements Reconfigu private static void disableDtdProcessing(final DocumentBuilderFactory factory) throws ParserConfigurationException { factory.setValidating(false); factory.setExpandEntityReferences(false); - factory.setFeature("http://xml.org/sax/features/external-general-entities", false); - factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false); - factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); + setFeature(factory, "http://xml.org/sax/features/external-general-entities", false); + setFeature(factory, "http://xml.org/sax/features/external-parameter-entities", false); + setFeature(factory, "http://apache.org/xml/features/nonvalidating/load-external-dtd", false); + } + + private static void setFeature(final DocumentBuilderFactory factory, final String featureName, final boolean value) + throws ParserConfigurationException { + try { + factory.setFeature(featureName, value); + } catch (ParserConfigurationException e) { + throw e; + } catch (Exception e) { + getStatusLogger().error("Caught {} setting feature {} to {} on DocumentBuilderFactory {}: {}", + e.getClass().getCanonicalName(), featureName, value, factory, e, e); + } } /** http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8e222830/src/changes/changes.xml ---------------------------------------------------------------------- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 1c01aa5..7f97ff0 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -30,6 +30,11 @@ - "update" - Change - "remove" - Removed --> + <release version="2.9.1" date="2017-MM-DD" description="GA Release 2.9.1"> + <action issue="LOG4J2-2026" dev="ggregory" type="fix" due-to="Leon Finker"> + java.lang.AbstractMethodError: javax.xml.parsers.DocumentBuilderFactory.setFeature(). + </action> + </release> <release version="2.9.0" date="2017-08-26" description="GA Release 2.9.0"> <action issue="LOG4J2-1928" dev="rgoers" type="update"> Add support for DirectWriteRolloverStrategy to RollingRandomAcessFileAppender.
