Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
Operating System: other
Platform: Other
-
38894
Description
The ParserFeatureSetterFactory relies on the presence of the
org.apache.xerces.impl.Version class in the classpath to determine that the
Xerces parser is being used. However it's not always the case and it's possible
that a different parser is actually being used. In this case the non-standard
features that are set on the parser factory in the XercesParser class will cause
an exception to be thrown. The following exception is thrown when using the
Crimson XML parser with Xercer parser in the classpath:
org.xml.sax.SAXNotRecognizedException: Feature:
http://apache.org/xml/features/validation/dynamic
at org.apache.crimson.parser.XMLReaderImpl.setFeature(XMLReaderImpl.java:219)
at org.apache.crimson.jaxp.SAXParserImpl.setFeatures(SAXParserImpl.java:150)
at org.apache.crimson.jaxp.SAXParserImpl.<init>(SAXParserImpl.java:133)
at
org.apache.crimson.jaxp.SAXParserFactoryImpl.newSAXParserImpl(SAXParserFactoryImpl.java:113)
at
org.apache.crimson.jaxp.SAXParserFactoryImpl.setFeature(SAXParserFactoryImpl.java:141)
at
org.apache.commons.digester.parser.XercesParser.configureXerces(XercesParser.java:185)
at
org.apache.commons.digester.parser.XercesParser.newSAXParser(XercesParser.java:138)
at
org.apache.commons.digester.ParserFeatureSetterFactory.newSAXParser(ParserFeatureSetterFactory.java:71)
at org.apache.commons.digester.Digester.getParser(Digester.java:692)
at org.apache.commons.digester.Digester.getXMLReader(Digester.java:899)
at org.apache.commons.digester.Digester.parse(Digester.java:1647)
This problem can be easily reproduced on JDK 1.4.2, which bundles the Crimson
parser, by forcing a non-Xerces using the following:
System.setProperty("javax.xml.parsers.SAXParserFactory",
"org.apache.crimson.jaxp.SAXParserFactoryImpl");
The test application must have the Xerces parser in the classpath. This bug is
present both in versions 1.6 and 1.7.