Return-Path: Mailing-List: contact general-help@xml.apache.org; run by ezmlm Delivered-To: mailing list general@xml.apache.org Received: (qmail 82517 invoked from network); 16 Feb 2001 17:59:18 -0000 Received: from lion.documentum.com (192.187.173.1) by h31.sny.collab.net with SMTP; 16 Feb 2001 17:59:18 -0000 Received: from corpismsg21.documentum.com (corpismsg21.documentum.com [172.31.0.201]) by lion.documentum.com (8.9.0/8.9.0) with ESMTP id JAA17922; Fri, 16 Feb 2001 09:54:49 -0800 (PST) Received: by corpismsg21 with Internet Mail Service (5.5.2653.19) id ; Fri, 16 Feb 2001 17:51:25 -0000 Message-ID: <379250A13595D31190660090278AC63C013D90C6@corpismsg02> From: "Rathi, Pradeep" To: "'aaz@leopard.com'" Cc: "'general@xml.apache.org'" Subject: RE: xerces 1.1.1 -> 1.3.0 probs Date: Fri, 16 Feb 2001 17:59:35 -0000 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C09842.38892770" X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N ------_=_NextPart_001_01C09842.38892770 Content-Type: text/plain; charset="iso-8859-1" Have you tried this. Pradeep -----Original Message----- From: Michael Bayer To: xerces-j-user@xml.apache.org Sent: 02/12/2001 2:27 PM Subject: NullPointerException in org.apache.xerces.utils.StringPool (example included!) This bug applies to versions 1.2.* and 1.3.* of Xerces. It does not exist in 1.0.* . It seems the XMLDTDScanner is relying upon the SystemId property of org.xml.sax.InputSource when an XML document contains external unparsed entities (example XML is below). If the SystemId is not set, you get a NullPointerException at org.apache.xerces.utils.StringPool.addSymbol(StringPool.java:348). Constructing an InputSource from a Reader or InputStream will create this behavior, i.e. getSystemId() returns null. The method setSystemId(String) can be called to manually set the systemid as a workaround. This requirement should be either fixed, or properly handled with a message (and documented). Example XML: ]> hello world Example program: import org.xml.sax.*; import org.xml.sax.helpers.*; import java.io.*; public class TestXerces { public static void main(String [] argv) { String uri = argv[0]; try { XMLReader reader = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser"); InputSource i = new InputSource(new FileReader(uri)); // uncomment this line to make it work //i.setSystemId(uri); reader.parse(i); } catch (SAXException se) { if (se.getException() != null) se.getException().printStackTrace(); se.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } } usage: java TestXerces --------------------------------------------------------------------- To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org For additional commands, e-mail: xerces-j-user-help@xml.apache.org > -----Original Message----- > From: aazz [mailto:aaz@leopard.com] > Sent: Friday, February 16, 2001 10:52 AM > To: general@xml.apache.org > Subject: xerces 1.1.1 -> 1.3.0 probs > > > Hi, > We have an app that has been running fine on Xerces 1.1.1 and we just > replaed our jar with Xerces 1.3.0. Everything compiles fine, but now > when we parse any of our XML files like the sample below, the > parser throws a > null pointer exception. It appears to be around our use of > ENTITY references. > Note the file noted in the SYSTEM ref does exist and the XML > in it is fine and > can be parsed on its own a-ok. Any Ideas? This works in 1.1.1 > > > > > > ]> > > > > &test_xml; > &test2_xml; > > > --------------------------------------------------------------------- > In case of troubles, e-mail: webmaster@xml.apache.org > To unsubscribe, e-mail: general-unsubscribe@xml.apache.org > For additional commands, e-mail: general-help@xml.apache.org > ------_=_NextPart_001_01C09842.38892770 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: xerces 1.1.1 -> 1.3.0 probs

Have you tried this.

Pradeep

-----Original Message-----
From: Michael Bayer
To: xerces-j-user@xml.apache.org
Sent: 02/12/2001 2:27 PM
Subject: NullPointerException in = org.apache.xerces.utils.StringPool
(example included!)



This bug applies to versions 1.2.* and 1.3.* of = Xerces.  It does not
exist
in 1.0.* .

It seems the XMLDTDScanner is relying upon the = SystemId property of
org.xml.sax.InputSource when an XML document = contains external unparsed
entities (example XML is below).  If the = SystemId is not set, you get a
NullPointerException at
org.apache.xerces.utils.StringPool.addSymbol(StringPool.java:34= 8). 

Constructing an InputSource from a Reader or = InputStream will create
this
behavior, i.e. getSystemId() returns null.  The = method
setSystemId(String)
can be called to manually set the systemid as a = workaround.

This requirement should be either fixed, or properly = handled with a
message (and documented).

Example XML:

<?xml version=3D"1.0" = encoding=3D"UTF-8"?>

<!DOCTYPE test [
<!ENTITY hello SYSTEM "hello.gif" NDATA = gif>
]>


<tag>hello world</tag>




Example program:

import org.xml.sax.*;
import org.xml.sax.helpers.*;
import java.io.*;

public class TestXerces {
        public = static void main(String [] argv) {
        =         String uri = =3D argv[0];

        =         try {
        =         =         XMLReader = reader =3D
XMLReaderFactory.createXMLReader("org.apache.xerces.parser= s.SAXParser");

        =         =         InputSource i = =3D new InputSource(new
FileReader(uri));

        =         =         // uncomment = this line to make it work
        =         =         //i.setSystemId(uri);

        =         =         reader.parse(i);

        =         }
        =         catch = (SAXException se) {
        =         =         if = (se.getException() !=3D
null) se.getException().printStackTrace();
        =         =         se.printStackTrace();
        =         }
        =         catch = (Exception e) {
        =         =         e.printStackTrace();
        =         }

        }
}

usage:

java TestXerces <filename>





---------------------------------------------------------------= ------
To unsubscribe, e-mail: = xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: = xerces-j-user-help@xml.apache.org

> -----Original Message-----
> From: aazz [mailto:aaz@leopard.com]
> Sent: Friday, February 16, 2001 10:52 AM
> To: general@xml.apache.org
> Subject: xerces 1.1.1 -> 1.3.0 probs
>
>
> Hi,
> We have an app that has been running fine on = Xerces 1.1.1 and we just
> replaed our jar with Xerces 1.3.0. Everything = compiles fine, but now
> when we parse any of our XML files like the = sample below, the
> parser throws a
> null pointer exception. It appears to be around = our use of
> ENTITY references.
> Note the file noted in the SYSTEM ref does = exist  and the XML
> in it is fine and
> can be parsed on its own a-ok. Any Ideas? This = works in 1.1.1
>
> <?xml version=3D"1.0" = encoding=3D"UTF-8"?>
>
> <!DOCTYPE  TEST_DOC [
>   <!ENTITY test_xml SYSTEM = "/tmp/test.xml">
>   <!ENTITY test2_xml SYSTEM = "/tmp/test2.xml">       =    
> ]>
>
>
> <TEST_DOC>
>  &test_xml;
>  &test2_xml;
> </TEST_DOC>
>
> = ---------------------------------------------------------------------
> In case of troubles, = e-mail:     webmaster@xml.apache.org
> To unsubscribe, e-mail:    &= nbsp;     general-unsubscribe@xml.apache.org
> For additional commands, e-mail: = general-help@xml.apache.org
>

------_=_NextPart_001_01C09842.38892770--