Project

Profile

Help

Bug #6340

closed

using `saxon:capture="yes"` in an accumlator rule with streamable="yes" can throw java.util.EmptyStackException

Added by Matt Patterson 10 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
-
Sprint/Milestone:
-
Start date:
2024-02-06
Due date:
% Done:

100%

Estimated time:
Legacy ID:
Applies to branch:
12, trunk
Fix Committed on Branch:
12, trunk
Fixed in Maintenance Release:
Platforms:
.NET, Java

Description

I managed to create a use of <xsl:accumulator> that causes exceptions if streaming is enabled and not otherwise.

It seems to be triggered when the accumulator rules selects a text node: if the accumulator rule is changed to use the pattern tag instead of tag/text() the exception does not occur.

Stylesheet was executed with java -cp /opt/saxon/current/saxon-ee-12.4.jar:/Users/matt/.saxon:'/opt/saxon/current/lib/*' com.saxonica.Transform -xsl:bug.xsl -s:input.xml

With the /opt/saxon/current directory containing the contents of the 12.4 .zip downloaded from https://downloads.saxonica.com/SaxonJ/EE/12/SaxonEE12-4J.zip

java.util.EmptyStackException
	at java.base/java.util.Stack.peek(Stack.java:101)
	at java.base/java.util.Stack.pop(Stack.java:83)
	at com.saxonica.ee.stream.watch.AccumulatorWatch.applyRule(AccumulatorWatch.java:194)
	at com.saxonica.ee.stream.watch.AccumulatorWatch.processItem(AccumulatorWatch.java:264)
	at com.saxonica.ee.stream.watch.MultiAccumulatorWatch.processItem(MultiAccumulatorWatch.java:95)
	at com.saxonica.ee.stream.watch.WatchManager.characters(WatchManager.java:464)
	at com.saxonica.ee.stream.ContentDetector.characters(ContentDetector.java:58)
	at net.sf.saxon.event.ReceivingContentHandler.flush(ReceivingContentHandler.java:701)
	at net.sf.saxon.event.ReceivingContentHandler.endElement(ReceivingContentHandler.java:576)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:618)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1728)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2899)
	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:542)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:889)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825)
	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:1224)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:637)
	at net.sf.saxon.resource.ActiveSAXSource.deliver(ActiveSAXSource.java:192)
	at net.sf.saxon.resource.ActiveStreamSource.deliver(ActiveStreamSource.java:73)
	at net.sf.saxon.event.Sender.send(Sender.java:104)
	at net.sf.saxon.trans.XsltController.applyStreamingTemplates(XsltController.java:969)
	at net.sf.saxon.s9api.AbstractXsltTransformer.applyTemplatesToSource(AbstractXsltTransformer.java:422)
	at net.sf.saxon.s9api.Xslt30Transformer.applyTemplates(Xslt30Transformer.java:306)
	at net.sf.saxon.Transform.processFile(Transform.java:1389)
	at net.sf.saxon.Transform.doTransform(Transform.java:879)
	at net.sf.saxon.Transform.main(Transform.java:83)
Fatal error during transformation: java.util.EmptyStackException:  (no message)

A simple repro XSL and input XML are attached.


Files

bug.xsl (1.24 KB) bug.xsl Matt Patterson, 2024-02-06 15:11
input.xml (215 Bytes) input.xml Matt Patterson, 2024-02-06 15:11

Please register to edit this issue

Also available in: Atom PDF