XMLErrorReporter isn't set in XMLParserConfiguration when using
org.apache.xerces.parsers.XML11Configuration
------------------------------------------------------------------------------------------------------------
Key: XERCESJ-1532
URL: https://issues.apache.org/jira/browse/XERCESJ-1532
Project: Xerces2-J
Issue Type: Bug
Components: XNI
Affects Versions: 2.11.0
Environment: jdk 1.6.0
Reporter: Tom Coenen
Priority: Minor
public class XNIEncodingDetector extends XMLDocumentParser
{
public static void checkEncodingDecl(XMLInputSource document) throws
XNIException, IOException
{
XNIEncodingDetector parser = new XNIEncodingDetector();
parser.parse(document);
}
}
with the following JVM system property set:
-Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XML11Configuration
This results in:
Exception in thread "main" java.lang.NullPointerException
at
org.apache.xerces.impl.XMLEntityManager.createUTF8Reader(XMLEntityManager.java:2201)
at
org.apache.xerces.impl.XMLEntityManager.createReader(XMLEntityManager.java:2090)
at
org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:1040)
at
org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:144)
at
org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:832)
at
org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:798)
at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)
at
com.compumark.util.xni.XNIEncodingDetector.checkEncodingDecl(XNIEncodingDetector.java:36)
at TestXml.main(TestXml.java:16)
This can be fixed by adding the following lines:
XMLErrorReporter errorReporter = new XMLErrorReporter();
parser.fConfiguration.setProperty(Constants.XERCES_PROPERTY_PREFIX+Constants.ERROR_REPORTER_PROPERTY,
errorReporter);
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]