Project

Profile

Help

Bug #2387

closed

NPE when applying an XSLT transformation with schema based validation feature enabled

Added by Radu Pisoi almost 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Schema-Aware processing
Sprint/Milestone:
Start date:
2015-06-02
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
9.6
Fix Committed on Branch:
9.6
Fixed in Maintenance Release:
Platforms:

Description

I'm encountering the next NPE when running an XSLT transformation that has the schema based validation feature activated.


java.lang.NullPointerException
        at com.saxonica.ee.schema.sdoc.XSDAttributeGroup.checkImmediateRedefinition(XSDAttributeGroup.java:321)
        at com.saxonica.ee.schema.sdoc.XSDAttributeGroup.patchUpSelfReferences(XSDAttributeGroup.java:298)
        at com.saxonica.ee.schema.sdoc.XSDAttributeGroup.postValidate(XSDAttributeGroup.java:244)
        at com.saxonica.ee.schema.sdoc.SchemaElement.validateSubtree(SchemaElement.java:192)
        at com.saxonica.ee.schema.sdoc.SchemaElement.validateChildren(SchemaElement.java:229)
        at com.saxonica.ee.schema.sdoc.SchemaElement.validateSubtree(SchemaElement.java:191)
        at com.saxonica.ee.schema.sdoc.XSDSchema.validateChildren(XSDSchema.java:435)
        at com.saxonica.ee.schema.sdoc.SchemaElement.validateSubtree(SchemaElement.java:191)
        at com.saxonica.ee.schema.sdoc.SchemaReader.read(SchemaReader.java:158)
        at com.saxonica.ee.schema.SchemaCompiler.readSchema(SchemaCompiler.java:347)
        at com.saxonica.config.EnterpriseConfiguration.readSchema(EnterpriseConfiguration.java:447)
        at com.saxonica.ee.validate.XSIAttributeHandler.loadSchema(XSIAttributeHandler.java:363)
        at com.saxonica.ee.validate.XSIAttributeHandler.processXsiNoNamespaceSchemaLocation(XSIAttributeHandler.java:214)
        at com.saxonica.ee.validate.XSIAttributeHandler.startElement(XSIAttributeHandler.java:82)
        at net.sf.saxon.event.StartTagBuffer.startContent(StartTagBuffer.java:220)
        at net.sf.saxon.event.ProxyReceiver.startContent(ProxyReceiver.java:178)
        at net.sf.saxon.event.ProxyReceiver.startContent(ProxyReceiver.java:178)
        at net.sf.saxon.event.ReceivingContentHandler.startElement(ReceivingContentHandler.java:356)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3104)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:921)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
        at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:441)
        at net.sf.saxon.event.Sender.send(Sender.java:146)
        at net.sf.saxon.Controller.transform(Controller.java:1692)
        at net.sf.saxon.s9api.XsltTransformer.transform(XsltTransformer.java:547)
        at net.sf.saxon.Transform.processFile(Transform.java:1056)
        at net.sf.saxon.Transform.doTransform(Transform.java:659)
        at net.sf.saxon.Transform.main(Transform.java:80)
Fatal error during transformation: java.lang.NullPointerException:  (no message)

Unfortunately, I don't find an easy way to reproduce it, so I have attached all the resources that are needed to reproduce it.

From command line:

D:\workspace\eXml>java -Xmx60m -cp lib/saxon9ee.jar net.sf.saxon.Transform -xsl:final.xsl -s:dita_test.dita -val:lax

Files

saxon_issue.zip (121 KB) saxon_issue.zip Radu Pisoi, 2015-06-02 15:26
Actions #1

Updated by Michael Kay almost 9 years ago

I'm not sure I've got the full schema here. I'm getting errors like this:

Warning: at xs:include on line 53 column 77 of ditabase.xsd:

Included schema document ../../base/xsd/deliveryTargetAttDomain.xsd cannot be located:

java.io.FileNotFoundException

However, after a number of such warnings, it does eventually crash out with the NPE reported, so I'll look at that: it might simply be a question of replacing the NPE with an error message.

Actions #2

Updated by Michael Kay almost 9 years ago

  • Category set to Schema-Aware processing
  • Status changed from New to In Progress
  • Assignee set to Michael Kay

The processor has (I believe correctly) reported the error message

Error at xs:attributeGroup on line 167 column 60 of ditabase.xsd:

Attribute group {props-attribute-extensions} is not defined in the schema being redefined

but it then goes wrong on the recovery path; having established that the attribute group doesn't exist, it tries to look at its properties, causing an NPE.

Actions #3

Updated by Michael Kay almost 9 years ago

After patching this to avoid the NPE, it struggles on reporting more errors in similar vein, then eventually crashes with another NPE in XSIAttributeHandler.loadSchema(). This is the code where it has loaded a schema based on xsi:schemaLocation, has found that it's invalid, and tries to undo any changes that have been made to the global schema held by the configuration. This is a rather delicate area when redefines are involved... A second patch fixes this NPE and the transformation then runs to completion, with a warning that the schema used for validation was incomplete.

Actions #4

Updated by Michael Kay almost 9 years ago

  • Status changed from In Progress to Resolved
  • Priority changed from Low to Normal
  • Found in version changed from 9.6.0.5 to 9.6

Fix committed on the 9.6 and 9.7 branches; modules XSDAttributeGroup.java and XSIAttributeHandler.java.

Actions #5

Updated by O'Neil Delpratt almost 9 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in version set to 9.6.0.6

Bug fix applied in the Saxon 9.6.0.6 maintenance release.

Actions #6

Updated by O'Neil Delpratt over 8 years ago

  • Sprint/Milestone set to 9.6.0.6
  • Applies to branch 9.6 added
  • Fix Committed on Branch 9.6 added
  • Fixed in Maintenance Release 9.6.0.6 added

Please register to edit this issue

Also available in: Atom PDF