[jdom-interest] ArrayIndexOutOfBoundsException with JDOMSource.

Eric Hartmann ehartmann at rhinfo.com
Fri Apr 12 05:36:55 PDT 2002


Hi Laurent,

Very sorry, I've made the test files too quickly (my first two files are
more complicated).
If you delete the wrong first line of dtd and change the creation of
org.jdom.Document with "REQUETE" instead of "ROOT" (to correct the two
errors), the exception is still thrown. 
To be more precise :
	* If I don't put a DocType to the org.jdom.Document, everything
works fine.
	* If I have a blank DTD, everything works fine too (I'm not
expecting Xerces to validate the document when I want Xalan to transform
it)
	* I've just tested it with Xerces 1.4.4 instead of 2.0.1 and
everything is fine too.

So I think it may be an bug in Xerces 2.0.1, I will report this to
Xerces team.

Thanks

Eric


-----Original Message-----
From: Laurent Bihanic [mailto:laurent.bihanic at atosorigin.com] 
Sent: Friday, April 12, 2002 2:00 PM
To: Eric Hartmann
Cc: jdom-interest at jdom.org
Subject: Re: [jdom-interest] ArrayIndexOutOfBoundsException with
JDOMSource.



Hi Eric,

There are two obvious problems with your code:
1. A DTD is not an XML file. So it should not include the XML header
"<?xml 
version="1.0" encoding="UTF-8"?>".
2. The document you are creating is not valid: Your root element is
named 
"ROOT" while your DTD defines it as "REQUETE".

Laurent


Eric Hartmann wrote:
> I've this exception using JDOMb8, Xerces 2.0.1 and Xalan 2.3.1 and 
> JAXP
> :
> 
> java.lang.ArrayIndexOutOfBoundsException
>         at 
> org.apache.xerces.impl.dtd.DTDGrammar.endParameterEntity(DTDGrammar.ja
> va
> :370)
>         at
>
org.apache.xerces.impl.dtd.XMLDTDValidator.endParameterEntity(XMLDTDVali
> dator.java:1283)
>         at
>
org.apache.xerces.impl.XMLDTDScannerImpl.endEntity(XMLDTDScannerImpl.jav
> a:521)
>         at
>
org.apache.xerces.impl.XMLEntityManager.endEntity(XMLEntityManager.java:
> 1159)
>         at
>
org.apache.xerces.impl.XMLEntityManager$EntityScanner.load(XMLEntityMana
> ger.java:3204)
>         at
>
org.apache.xerces.impl.XMLEntityManager$EntityScanner.load(XMLEntityMana
> ger.java:3210)
>         at
>
org.apache.xerces.impl.XMLEntityManager$EntityScanner.skipSpaces(XMLEnti
> tyManager.java:2905)
>         at
>
org.apache.xerces.impl.XMLDTDScannerImpl.skipSeparator(XMLDTDScannerImpl
> ..java:1892)
>         at
>
org.apache.xerces.impl.XMLDTDScannerImpl.scanDecls(XMLDTDScannerImpl.jav
> a:1867)
>         at
>
org.apache.xerces.impl.XMLDTDScannerImpl.scanDTDExternalSubset(XMLDTDSca
> nnerImpl.java:295)
>         at
>
org.apache.xerces.impl.XMLDocumentScannerImpl$DTDDispatcher.dispatch(XML
> DocumentScannerImpl.java:820)
>         at
>
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDo
> cumentFragmentScannerImpl.java:333)
>         at
>
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardPars
> erConfiguration.java:529)
>         at
>
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardPars
> erConfiguration.java:585)
>         at
org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)
>         at
>
org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java
> :1148)
>         at
org.jdom.output.SAXOutputter.dtdEvents(SAXOutputter.java:680)
>         at org.jdom.output.SAXOutputter.output(SAXOutputter.java:597)
>         at
>
org.jdom.transform.JDOMSource$DocumentReader.parse(JDOMSource.java:424)
>         at
>
org.apache.xml.dtm.ref.DTMManagerDefault.getDTM(DTMManagerDefault.java:3
> 49)
>         at
>
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.j
> ava:630)
>         at
>
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.j
> ava:1088)
>         at
>
org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.j
> ava:1066)
>         at testXML.main(testXML.java:40)
> 
> I've wrote a quite simple test program which raise this exception :
> 
> .....
> TransformerFactory tFactory = TransformerFactory.newInstance(); 
> Templates template = tFactory.newTemplates(new 
> StreamSource("/test.xsl")); Transformer processor = 
> template.newTransformer(); processor.transform(new JDOMSource(new 
> Document(new Element("ROOT"), new DocType("REQUETE", 
> "file:///test.dtd" ))), new StreamResult(System.out));
> .....
> 
> I've attached a zip file with the main class and the xsl and dtd file.
> 
> I saw a similar bug on Xerces that seems to be fixed since Xerces 
> 2.0.0b4 (http://nagoya.apache.org/bugzilla/show_bug.cgi?id=5122).
> I'm sorry if I post this to the wrong mailing list but I don't know 
> whether the bug is in Jdom, Xerces or Xalan (or if I do something 
> wrong).
> 
> Can anyone help me to solve this problem ?
> 
> Eric
> 




More information about the jdom-interest mailing list