Actions
Bug #6560
closedjava.lang.ClassCastException in SaxonJ-HE 12.5
Start date:
2024-10-15
Due date:
% Done:
0%
Estimated time:
Legacy ID:
Applies to branch:
12, trunk
Fix Committed on Branch:
12, trunk
Fixed in Maintenance Release:
Platforms:
.NET, Java
Description
I have a ClassCastException in SaxonJ-HE 12.5 and have attached a stylesheet which demonstrates the problem.
The stylesheet is:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" />
<xsl:template name="xsl:initial-template">
<root>
<xsl:variable name="var01">abcdef</xsl:variable>
<xsl:analyze-string select="$var01/text()" regex="def">
<xsl:matching-substring>
<yes value="{.}" />
</xsl:matching-substring>
</xsl:analyze-string>
</root>
</xsl:template>
</xsl:stylesheet>
With 'miscellaneous' optimization disabled (-opt:-m) I get the following output:
<?xml version="1.0" encoding="UTF-8"?><root><yes value="def"/></root>
With 'miscellaneous' optimization enabled (-opt:m) I get the following crash output.
The trace below was produced with -t, -explain and -opt:m options (the explain output isn't included).
NOTE : if I remove the '/text()'
from the xsl:analyze-string select
attribute the crash no longer happens.
SaxonJ-HE 12.5 from Saxonica
Java version 11.0.23
OPT : At line 8 of file:/L:/Tests/Saxon/SaxonCrash/ClassCastExceptionCrash.xslt
OPT : Replaced variable var01 by its value
OPT : Expression after rewrite: abcdef
Stylesheet compilation time: 477.3962ms
Processing (no source document) initial template = xsl:initial-template
java.lang.ClassCastException: class net.sf.saxon.value.StringValue cannot be cast to class net.sf.saxon.om.NodeInfo (net.sf.saxon.value.StringValue and net.sf.saxon.om.NodeInfo are in unnamed module of loader 'app')
at net.sf.saxon.expr.SimpleStepExpression$SimpleStepExprElaborator.lambda$elaborateForPull$1(SimpleStepExpression.java:185)
at net.sf.saxon.expr.Atomizer$AtomizerElaborator.lambda$elaborateForPull$0(Atomizer.java:678)
at net.sf.saxon.expr.AtomicSequenceConverter$AtomicSequenceConverterElaborator.lambda$elaborateForPull$0(AtomicSequenceConverter.java:536)
at net.sf.saxon.expr.CardinalityChecker$CardinalityCheckerElaborator.lambda$elaborateForPull$0(CardinalityChecker.java:506)
at net.sf.saxon.expr.elab.PullElaborator.lambda$elaborateForItem$1(PullElaborator.java:54)
at net.sf.saxon.expr.elab.PullElaborator.lambda$elaborateForUnicodeString$3(PullElaborator.java:76)
at net.sf.saxon.expr.instruct.AnalyzeString$AnalyzeStringElaborator.lambda$elaborateForPush$2(AnalyzeString.java:473)
at net.sf.saxon.expr.LetExpression$LetExprElaborator.lambda$elaborateForPush$6(LetExpression.java:942)
at net.sf.saxon.expr.instruct.FixedElement$FixedElementElaborator.lambda$elaborateForPush$0(FixedElement.java:640)
at net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:247)
at net.sf.saxon.trans.XsltController.callTemplate(XsltController.java:872)
at net.sf.saxon.s9api.Xslt30Transformer.callTemplate(Xslt30Transformer.java:503)
at net.sf.saxon.Transform.processFile(Transform.java:1391)
at net.sf.saxon.Transform.doTransform(Transform.java:894)
at net.sf.saxon.Transform.main(Transform.java:84)
Fatal error during transformation: java.lang.ClassCastException: class net.sf.saxon.value.StringValue cannot be cast to class net.sf.saxon.om.NodeInfo (net.sf.saxon.value.StringValue and net.sf.saxon.om.NodeInfo are in unnamed module of loader 'app')
Adrian
Files
Please register to edit this issue
Actions