Bug #6370
closedXSD based validation finds a validation error but hits a NullPointerException when trying to generate a validation report
100%
Description
When I try to run Saxon Java 12.4 EE or SaxonCS 12.4 from the command line to validate the attached XML against the attached XSD schema, the validation error is found fine.
However, when I try to use -report:report.xml
to have Saxon generate a validation report, it fails with java.lang.NullPointerException for Saxon EE Java and System.NullReferenceException for SaxonCS.
Stack trace Saxon 12.4 Java EE:
java.lang.NullPointerException
at com.saxonica.ee.validate.InvalidityReportGeneratorEE.reportInvalidity(InvalidityReportGeneratorEE.java:168)
at com.saxonica.ee.validate.SelectorWatch.reportValidationError(SelectorWatch.java:601)
at com.saxonica.ee.validate.SelectorWatch.checkRow(SelectorWatch.java:269)
at com.saxonica.ee.validate.KeySelectorWatch.checkRow(KeySelectorWatch.java:49)
at com.saxonica.ee.validate.SelectorWatch.endSelectedParentNode(SelectorWatch.java:107)
at com.saxonica.ee.stream.watch.WatchManager.endElement(WatchManager.java:544)
at net.sf.saxon.event.TeeOutputter.endElement(TeeOutputter.java:145)
at net.sf.saxon.event.TeeOutputter.endElement(TeeOutputter.java:144)
at net.sf.saxon.event.ProxyReceiver.endElement(ProxyReceiver.java:149)
at com.saxonica.ee.validate.EmptyContentValidator.endElement(EmptyContentValidator.java:155)
at com.saxonica.ee.validate.ValidationStack.endElement(ValidationStack.java:490)
at net.sf.saxon.event.ProxyReceiver.endElement(ProxyReceiver.java:149)
at net.sf.saxon.event.ProxyReceiver.endElement(ProxyReceiver.java:149)
at com.saxonica.ee.validate.AttributeInheritor.endElement(AttributeInheritor.java:63)
at net.sf.saxon.event.PathMaintainer.endElement(PathMaintainer.java:60)
at net.sf.saxon.event.DocumentValidator.endElement(DocumentValidator.java:79)
at net.sf.saxon.event.ReceivingContentHandler.endElement(ReceivingContentHandler.java:578)
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:610)
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:184)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:351)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2710)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:534)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1216)
at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:635)
at net.sf.saxon.resource.ActiveSAXSource.deliver(ActiveSAXSource.java:192)
at net.sf.saxon.event.Sender.send(Sender.java:104)
at com.saxonica.ee.s9api.SchemaValidatorImpl.validate(SchemaValidatorImpl.java:624)
at com.saxonica.Validate.processFile(Validate.java:603)
at com.saxonica.Validate.doValidate(Validate.java:421)
at com.saxonica.Validate.main(Validate.java:56)
Stack trace SaxonCS 12.4:
System.NullReferenceException: Object reference not set to an instance of an object.
at Saxon.Eej.ee.validate.InvalidityReportGeneratorEE.reportInvalidity(Invalidity failure)
at Saxon.Eej.ee.validate.SelectorWatch.reportValidationError(ValidationFailure err, Location locator)
at Saxon.Eej.ee.validate.SelectorWatch.checkRow(AtomicSequence[] currentRow, Boolean isTarget, Location locationId)
at Saxon.Eej.ee.validate.KeySelectorWatch.checkRow(AtomicSequence[] currentRow, Boolean isTarget, Location locationId)
at Saxon.Eej.ee.validate.SelectorWatch.endSelectedParentNode(Location locationId)
at Saxon.Eej.ee.stream.watch.WatchManager.endElement()
at Saxon.Hej.event.TeeOutputter.endElement()
at Saxon.Hej.event.TeeOutputter.endElement()
at Saxon.Eej.ee.validate.EmptyContentValidator.endElement()
at Saxon.Eej.ee.validate.ValidationStack.endElement()
at Saxon.Hej.event.ProxyReceiver.endElement()
at Saxon.Eej.ee.validate.AttributeInheritor.endElement()
at Saxon.Hej.event.PathMaintainer.endElement()
at Saxon.Hej.event.DocumentValidator.endElement()
at Saxon.Hej.pull.PullPushTee.copyEvent(PullEvent event)
at Saxon.Hej.pull.PullPushTee.next()
at Saxon.Hej.pull.PullPushCopier.copy()
at Saxon.Hej.pull.PullSource.deliver(Receiver receiver, ParseOptions options)
at Saxon.Hej.event.Sender.send(Source source, Receiver receiver, ParseOptions options)
at Saxon.Eej.ee.s9api.SchemaValidatorImpl.validate(Source source)
at Saxon.Eej.Validate.processFile(Source source, SchemaValidator validator)
at Saxon.Eej.Validate.doValidate(String[] args)
Fatal error during validation: Object reference not set to an instance of an object.
I file that on category command line as the only schema related category "Schema conformance" doesn't seem adequate for the Saxon specific validation report. But the error seems to occur as well in C# code trying to use the SaxonCS API to generate a validation report.
Files
Updated by Martin Honnen 9 months ago
Saxon Java EE 11.6 also hits the NullPointerException:
java.lang.IllegalStateException: java.lang.NullPointerException
at net.sf.saxon.resource.ActiveSAXSource.deliver(ActiveSAXSource.java:233)
at net.sf.saxon.event.Sender.send(Sender.java:105)
at com.saxonica.ee.s9api.SchemaValidatorImpl.validate(SchemaValidatorImpl.java:707)
at com.saxonica.Validate.processFile(Validate.java:632)
at com.saxonica.Validate.doValidate(Validate.java:422)
at com.saxonica.Validate.main(Validate.java:55)
Caused by: java.lang.NullPointerException
at com.saxonica.ee.validate.InvalidityReportGeneratorEE.reportInvalidity(InvalidityReportGeneratorEE.java:175)
at com.saxonica.ee.validate.SelectorWatch.reportValidationError(SelectorWatch.java:601)
at com.saxonica.ee.validate.SelectorWatch.checkRow(SelectorWatch.java:269)
at com.saxonica.ee.validate.KeySelectorWatch.checkRow(KeySelectorWatch.java:49)
at com.saxonica.ee.validate.SelectorWatch.endSelectedParentNode(SelectorWatch.java:107)
at com.saxonica.ee.stream.watch.WatchManager.endElement(WatchManager.java:544)
at net.sf.saxon.event.TeeOutputter.endElement(TeeOutputter.java:145)
at net.sf.saxon.event.TeeOutputter.endElement(TeeOutputter.java:144)
at net.sf.saxon.event.ProxyReceiver.endElement(ProxyReceiver.java:149)
at com.saxonica.ee.validate.EmptyContentValidator.endElement(EmptyContentValidator.java:155)
at com.saxonica.ee.validate.ValidationStack.endElement(ValidationStack.java:514)
at net.sf.saxon.event.ProxyReceiver.endElement(ProxyReceiver.java:149)
at net.sf.saxon.event.ProxyReceiver.endElement(ProxyReceiver.java:149)
at com.saxonica.ee.validate.AttributeInheritor.endElement(AttributeInheritor.java:63)
at net.sf.saxon.event.PathMaintainer.endElement(PathMaintainer.java:61)
at net.sf.saxon.event.DocumentValidator.endElement(DocumentValidator.java:79)
at net.sf.saxon.event.ReceivingContentHandler.endElement(ReceivingContentHandler.java:572)
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:610)
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:184)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:351)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2710)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:534)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1216)
at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:635)
at net.sf.saxon.resource.ActiveSAXSource.deliver(ActiveSAXSource.java:190)
... 5 more
Fatal error during validation: java.lang.NullPointerException
Will try SaxonCS 11.6 next
Updated by Martin Honnen 9 months ago
SaxonCS 11.6 can't generate the validation report either:
System.NullReferenceException: Object reference not set to an instance of an object.
at Saxon.Eej.ee.validate.InvalidityReportGeneratorEE.reportInvalidity(Invalidity failure)
at Saxon.Eej.ee.validate.SelectorWatch.reportValidationError(ValidationFailure err, Location locator)
at Saxon.Eej.ee.validate.SelectorWatch.checkRow(AtomicSequence[] currentRow, Boolean isTarget, Location locationId)
at Saxon.Eej.ee.validate.KeySelectorWatch.checkRow(AtomicSequence[] currentRow, Boolean isTarget, Location locationId)
at Saxon.Eej.ee.validate.SelectorWatch.endSelectedParentNode(Location locationId)
at Saxon.Eej.ee.stream.watch.WatchManager.endElement()
at Saxon.Hej.event.TeeOutputter.endElement()
at Saxon.Hej.event.TeeOutputter.endElement()
at Saxon.Eej.ee.validate.EmptyContentValidator.endElement()
at Saxon.Eej.ee.validate.ValidationStack.endElement()
at Saxon.Hej.event.ProxyReceiver.endElement()
at Saxon.Eej.ee.validate.AttributeInheritor.endElement()
at Saxon.Hej.event.PathMaintainer.endElement()
at Saxon.Hej.event.DocumentValidator.endElement()
at Saxon.Hej.pull.PullPushTee.copyEvent(PullEvent event)
at Saxon.Hej.pull.PullPushTee.next()
at Saxon.Hej.pull.PullConsumer.consume()
at Saxon.Hej.pull.PullPushCopier.copy()
at Saxon.Hej.pull.PullSource.deliver(Receiver receiver, ParseOptions options)
at Saxon.Hej.event.Sender.send(Source source, Receiver receiver, ParseOptions options)
at Saxon.Eej.ee.s9api.SchemaValidatorImpl.validate(Source source)
at Saxon.Eej.Validate.processFile(Source source, SchemaValidator validator)
at Saxon.Eej.Validate.doValidate(String[] args)
Fatal error during validation: Object reference not set to an instance of an object.
Updated by Michael Kay 9 months ago
- Category changed from Command Line to Internals
- Status changed from New to In Progress
- Applies to branch trunk added
Thanks, problem reproduced.
It's failing because a uniqueness constraint violation doesn't have any associated path
property.
I should certainly change the invalidity reporting so it doesn't fail if there is no path
property on the invalidity. I should also look at whether it's possible to add this property to uniqueness violations.
Updated by Michael Kay 9 months ago
- Subject changed from Saxon 12.4 (tested with both Java EE and SaxonCS EE) with XSD based validation finds a validation error but hits a NullPointerException when trying to generate a validation report to XSD based validation finds a validation error but hits a NullPointerException when trying to generate a validation report
- Status changed from In Progress to Resolved
- Assignee set to Michael Kay
- Fix Committed on Branch 12, trunk added
I made both changes: the reporting no longer crashes if no path is available, but this particular error (and a few others similar to it) now include path information in the error details.
Updated by O'Neil Delpratt 5 months ago
- Status changed from Resolved to Closed
- % Done changed from 0 to 100
- Fixed in Maintenance Release 12.5 added
Bug fix applied in the Saxon 12.5 Maintenance release.
Please register to edit this issue