Bug #2308
closedNullPointerException using xsl:choose when streaming
100%
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
Updated by Michael Kay almost 10 years ago
- File stylesheet.xsl stylesheet.xsl added
Updated by Michael Kay almost 10 years ago
Added the test case to W3C test suite as strm/si-apply-templates-005
Updated by Michael Kay almost 10 years ago
- Status changed from New to In Progress
Problem reproduced.
Updated by Michael Kay almost 10 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.
Updated by Michael Kay almost 10 years ago
- Subject changed from NullPointerException using tunnel parameters when streaming to NullPointerException using xsl:choose when streaming
Updated by Michael Kay over 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.
Updated by O'Neil Delpratt over 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.
Updated by O'Neil Delpratt about 9 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