Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] Possible bug in build(String systemID) where systemID points to a resource within a jar file

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Daniel Lowe <dl387 AT cam.ac.uk>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: [XOM-interest] Possible bug in build(String systemID) where systemID points to a resource within a jar file
  • Date: Mon, 26 Oct 2009 13:42:33 +0000

The problem I am encountering is introduced somewhere between revision 1.82 of Builder.java (this corresponds to XOM-1.1) and 1.86 (this corresponds to XOM-1.2b1) with my hunch being that the cause of the problem in the change to canonicalizeURL in 1.86.

The error is below:
C:\My Documents\workspace\xomTest\target>java -jar xomTest-0.0.1-SNAPSHOT-jar-with-dependencies.jar
Exception in thread "main" java.net.MalformedURLException: invalid url: //file:/C:/My%20Documents/workspace/xomTest/target/xomTest-0.0.1-SNAPSHOT-jar-with-dependencies.jar!/foo/foo.xml (java.net.MalformedURLException: no protocol: //file:/C:/My%20Documents/workspace/xomTest/target/xomTest-0.0.1-SNAPSHOT-jar-with-dependencies.jar)
encies.jar)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at java.net.URL.<init>(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrent
Entity(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(
Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startDocumen
tEntity(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.setInp
utSource(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.DTDConfiguration.parse(Unk
nown Source)
at com.sun.org.apache.xerces.internal.parsers.DTDConfiguration.parse(Unk
nown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown So
urce)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Un
known Source)
at nu.xom.Builder.build(Unknown Source)
at nu.xom.Builder.build(Unknown Source)
at foo.App.openFile(App.java:27)
at foo.App.main(App.java:20)

This occurs when doing new Builder().build(u.toString()); where u is a URL pointing to a file within the jar that the program is running from.
The exact same code works from within my IDE, when the resource has not yet been placed in a jar.

If you would like to see my test code you can download it from:
http://senduit.com/8f7faf

To reiterate this error only occurs on Xom1.2beta and later; the code works fine on Xom-1.1.

Thanks for your help,

Daniel




Archive powered by MHonArc 2.6.24.

Top of Page