relaxng / jing-trang

Schema validation and conversion based on RELAX NG
http://www.thaiopensource.com/relaxng/
Other
228 stars 69 forks source link

Null Pointer Exception in validation attempt with DocBook catalog #221

Closed gkholman closed 6 years ago

gkholman commented 7 years ago

jing-npe-gkholman-20170913-0030z.zip

Hello!

In the attached test shell script, I am invoking Saxon and Jing with the same resolver.jar and there are no reports from Saxon but there is a Null Pointer Exception from Jing. A transcript is below.

I hope this helps find and fix the problem. I'm stuck on my project until I can get around it.

BTW, I would like to know also where to download the latest JAR files for jing ... I cannot find them readily on this Git site. I'm not in a position to recompile the sources.

Thank you for any help you can be!

. . . . . . Ken

~/t/jing-npe-gkholman-20170913-0030z $ sh test.sh 
Running Saxon:
Running Jing:
Exception in thread "main" java.lang.NullPointerException
    at org.apache.xml.resolver.helpers.PublicId.normalize(PublicId.java:58)
    at org.apache.xml.resolver.Catalog.resolveLocalPublic(Catalog.java:1579)
    at org.apache.xml.resolver.Catalog.resolvePublic(Catalog.java:1509)
    at com.thaiopensource.resolver.catalog.CatalogResolver.resolve(CatalogResolver.java:79)
    at com.thaiopensource.resolver.SequenceResolver.resolve(SequenceResolver.java:18)
    at com.thaiopensource.resolver.xml.sax.SAX$EntityResolverImpl.resolveEntity(SAX.java:205)
    at com.sun.org.apache.xerces.internal.util.EntityResolver2Wrapper.resolveEntity(EntityResolver2Wrapper.java:177)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.resolveEntityAsPerStax(XMLEntityManager.java:997)
    at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.startEntity(XMLEntityManager.java:1213)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEntityReference(XMLDocumentFragmentScannerImpl.java:1902)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3058)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:118)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:504)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
    at com.thaiopensource.validate.ValidationDriver.validate(ValidationDriver.java:160)
    at com.thaiopensource.relaxng.util.Driver.doMain(Driver.java:154)
    at com.thaiopensource.relaxng.util.Driver.main(Driver.java:35)
~/t/jing-npe-gkholman-20170913-0030z $ 
gkholman commented 7 years ago

Further testing has revealed that if you remove from the XML the SYSTEM entity defining &summary; and remove the reference to that entity, there is no NPE. But, of course, there is also no content from the external entity.

Hopefully this will focus the direction towards where the problem is.

sideshowbarker commented 7 years ago

BTW, I would like to know also where to download the latest JAR files for jing ... I cannot find them readily on this Git site. I'm not in a position to recompile the sources.

We don’t have any release process in place—we have nobody building release jars. The jars are instead packaged by third-party distro packagers for different distros—e.g., there are packages for Debian and Ubuntu, and a brew package for MacOS, etc.

But I can build you a jar myself and get it to you however you want, if that helps.

In the mean time, I’m looking at the stack trace you posted and will try to see if I can figure out a fix.

gkholman commented 7 years ago

Thanks for explaining about the JAR files! I wouldn't want to impose on having you build custom JARs just for me.

I'm developing and testing my package on MacOS but testing and delivering the package for use on DOS, so I'm simply using the one set of JARs in both environments.

I'm guessing there aren't any platform specifics, so any set of JARs out there compiled with the latest should meet my needs. Perhaps have any of these packages simply been expanded somewhere and I can copy them.

Thanks, again, Michael!

sideshowbarker commented 7 years ago

Hi again Ken,

So I can reproduce this with the jing.jar from your zip file but not with a jar built from the latest sources in the master branch here, which I’ve posted to https://gist.githubusercontent.com/sideshowbarker/8284404/raw/0c626a9bb43ce5f85bb6f0ea79049da09cf34351/jing.jar

I hope that’s enough for now to unstick things so you can move ahead with your project.

gkholman commented 7 years ago

Thank you, very kindly, Michael! A delight to find this in my inbox this morning. My project is back on track far sooner than I had even hoped!

sideshowbarker commented 6 years ago

Closing per https://github.com/relaxng/jing-trang/issues/221#issuecomment-322036753