You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Michael Glavassevich (JIRA)" <xe...@xml.apache.org> on 2011/09/16 15:46:09 UTC

[jira] [Resolved] (XERCESJ-1532) XMLErrorReporter isn't set in XMLParserConfiguration when using org.apache.xerces.parsers.XML11Configuration

     [ https://issues.apache.org/jira/browse/XERCESJ-1532?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael Glavassevich resolved XERCESJ-1532.
-------------------------------------------

    Resolution: Cannot Reproduce

Works for me with the vanilla org.apache.xerces.parsers.XMLDocumentParser. XML11Configuration sets the XMLErrorReporter in its constructor. If this was truly a problem Xerces-J 2.11.0 wouldn't work for anyone, which implies you're either not using the official Apache release (the official binary doesn't have debug info / line numbers) or that com.compumark.util.xni.XNIEncodingDetector is extending Xerces' internals in a way that breaks the configuration.

> 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: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org