Project

Profile

Help

Bug #2308

closed

NullPointerException using xsl:choose when streaming

Added by Michael Kay about 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Streaming
Sprint/Milestone:
Start date:
2015-02-04
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

Originally raised here: http://sourceforge.net/p/saxon/support-requests/71/

Saxon-EE 9.6.0.4J

In XSLT 3.0 streaming mode, evaluating a tunnelled parameter in a boolean context (xsl:if) causes a null pointer exception. See attached stylesheet, which references 'test.xml' consisting of:

java -jar saxon9ee.jar -it:main -xsl:stylesheet.xsl -o:/dev/null

stack trace:

java.lang.NullPointerException

at net.sf.saxon.expr.VariableReference.iterate(VariableReference.java:449)

at net.sf.saxon.expr.Expression.effectiveBooleanValue(Expression.java:511)

at com.saxonica.ee.stream.adjunct.ChooseAdjunct$1.makeWatch(ChooseAdjunct.java:87)

at com.saxonica.ee.stream.Inversion.getWatch(Inversion.java:340)

at com.saxonica.ee.stream.TemplateInversion.getWatch(TemplateInversion.java:55)

at com.saxonica.ee.stream.watch.ApplyTemplatesAction.startSelectedParentNode(ApplyTemplatesAction.java:270)

at com.saxonica.ee.stream.watch.Trigger.startSelectedParentNode(Trigger.java:70)

at com.saxonica.ee.stream.watch.WatchManager.startElement(WatchManager.java:215)

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.ReceivingContentHandler.startElement(ReceivingContentHandler.java:356)

at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)

at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)

at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:356)

at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:605)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3138)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:880)

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:117)

at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)

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:648)

at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:441)

at net.sf.saxon.event.Sender.send(Sender.java:146)

at net.sf.saxon.functions.DocumentFn.sendDoc(DocumentFn.java:821)

at net.sf.saxon.functions.Doc.sendDocument(Doc.java:271)

at com.saxonica.ee.stream.StreamingApplyTemplates.apply(StreamingApplyTemplates.java:82)

at net.sf.saxon.expr.instruct.ApplyTemplates.processLeavingTail(ApplyTemplates.java:247)

at net.sf.saxon.expr.instruct.Template.expand(Template.java:371)

at net.sf.saxon.Controller.transformDocument(Controller.java:2118)

at net.sf.saxon.Controller.transform(Controller.java:1704)

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)


Files

stylesheet.xsl (529 Bytes) stylesheet.xsl Problem stylesheet Michael Kay, 2015-02-04 12:34
Actions #2

Updated by Michael Kay about 9 years ago

Added the test case to W3C test suite as strm/si-apply-templates-005

Actions #3

Updated by Michael Kay about 9 years ago

  • Status changed from New to In Progress

Problem reproduced.

Actions #4

Updated by Michael Kay about 9 years ago

Tricky one. When a streamable template contains a consuming xsl:choose, the test condition of the xsl:choose (which determines the active branch of the xsl:choose) is being evaluated before the preceding sibling instructions of the xsl:choose, which include the LocalParamSetter (effectively the xsl:param) which picks up the tunnel parameters and sets their values in the appropriate stack frame slots. So the slot is empty at the time it is referenced.

Actions #5

Updated by Michael Kay about 9 years ago

  • Subject changed from NullPointerException using tunnel parameters when streaming to NullPointerException using xsl:choose when streaming
Actions #6

Updated by Michael Kay almost 9 years ago

  • Status changed from In Progress to Resolved

I have fixed this (9.6 and 9.7) to ensure that any instructions preceding an xsl:choose are executed before evaluating the xsl:choose condition. The area remains rather poorly tested.

Actions #7

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 #8

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