[jdom-interest] String index out of range in Beta 7

Alex Rosen arosen at silverstream.com
Mon Jul 16 07:59:51 PDT 2001


That line in Xerces 1.2.0 is just a re-throw of the real underlying
exception in a SAXException. Unfortunately our JDOMException doesn't
dive more than one level deep when printing out stack traces, so the
*real* cause is lost.

I'll submit a patch so that JDOMException will also print out the root
stack trace for SAXExceptions. Should I check for other common nested
exceptions too? The comment in this bug
http://developer.java.sun.com/developer/bugParade/bugs/4209652.html
mentions:

    java.sql.SQLException
    java.lang.reflect.InvocationTargetException
    java.lang.ExceptionInInitializerError
    java.rmi.RemoteException
    javax.naming.NamingException

I can check for all of these, but if we still need to maintain JDK 1.1
compatibility, I need to figure out if any of these are new for 1.2 and
skip them.

In the mean time, when you print out the stack trace, you should be able
to do this yourself: call JDOMException.getCause(), and if that's a
SAXException, call SAXException.getException(), and print out that stack
trace. Or, can you try using the latest Xerces? 1.2.0 is pretty old.

Alex

> -----Original Message-----
> From: jdom-interest-admin at jdom.org
> [mailto:jdom-interest-admin at jdom.org]On Behalf Of Cyrus Kalbrener
> Sent: Monday, July 16, 2001 9:49 AM
> To: jdom-interest at jdom.org
> Subject: [jdom-interest] String index out of range in Beta 7
>
>
> JDOM: Beta 7
> Xerces: 1.2.0
>
> We are building a high-volume transactional system using JDOM
> and Xerces.
> When parsing XML documents, we are frequently seeing the following:
>
> org.jdom.JDOMException: Error in building: String index out
> of range: -37
>         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:306)
>         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:650)
>         ...
> Root cause: org.xml.sax.SAXException: String index out of range: -37
>         at
> org.apache.xerces.framework.XMLParser.parse(XMLParser.java:917)
>         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:287)
>         at org.jdom.input.SAXBuilder.build(SAXBuilder.java:650)
>         ...
>
> This particular exception occurs when there is no PUBLIC id
> in the DOCTYPE
> element, however it also occurs at what seems to be random
> intervals and in
> unpredictable ways. Looking through the e-mail archives I
> have seen this
> brought up a couple of times, but never resolved.  It is
> becoming a serious
> problem.  How can we avoid this?
>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/yo
uraddr at yourhost.com




More information about the jdom-interest mailing list