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 di...@the-ecorp.com on 2001/01/24 12:32:17 UTC

NullpointerException when using external entity declarations (xer ces-j 1.2.3)

Hi

I have a small problem when using external entity declarations.

java.lang.NullPointerException
	at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:965)
	at
org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:12
3)
	at Main.main(Main.java:68)

E:\project\testing\phase2>java -version
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)


I tracked down the bug to DefaultEntityHandler.addExternalEntityDecl

The line:
int entityHandle = fEntityPool.addEntityDecl(name, -1, publicId, systemId,
fStringPool.addSymbol(fSystemId), -1, isExternal);

should be changed to somethink like:
String aname=fStringPool.toString(name);
int entityHandle = fEntityPool.addEntityDecl(name, -1, publicId, systemId,
fStringPool.addSymbol(aname), -1, isExternal);


addExternalPEDecl has the same error (fSystemId==null), the others I didn't
check.

Can somebody check this change and apply it to the official version ?

Included are 2 xml files and a sample java program.

 <<Main.java>>  <<main.xml>>  <<sub.xml>> 

Bye
Verbeeck Dirk