Project

Profile

Help

Bug #6339

closed

saxon:transform() throws ArrayIndexOutOfBoundsException

Added by Johan Gheys 3 months ago. Updated 3 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Saxon extensions
Sprint/Milestone:
-
Start date:
2024-02-06
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

We have a transformation that splits one xml in several csv files, and this works fine when called with fn:transform(). In order to take advantage of the direct serialization of saxon:transform(), we switched to saxon:transform(), but this throws the following error:

java.lang.ArrayIndexOutOfBoundsException: -1
	at net.sf.saxon.tree.tiny.TinyBuilder.makeTextNode(TinyBuilder.java:516)
	at net.sf.saxon.tree.tiny.TinyBuilder.characters(TinyBuilder.java:483)
	at net.sf.saxon.event.TreeReceiver.characters(TreeReceiver.java:176)
	at net.sf.saxon.serialize.PrincipalOutputGatekeeper.characters(PrincipalOutputGatekeeper.java:83)
	at net.sf.saxon.event.ComplexContentOutputter.characters(ComplexContentOutputter.java:275)
	at net.sf.saxon.event.Outputter$1.close(Outputter.java:372)
	at net.sf.saxon.functions.StringJoin.process(StringJoin.java:140)
	at net.sf.saxon.expr.SystemFunctionCall$SystemFunctionCallElaborator.lambda$elaborateForPush$8(SystemFunctionCall.java:689)
	at net.sf.saxon.expr.instruct.ValueOf$ValueOfElaborator.lambda$elaborateForPush$1(ValueOf.java:420)
	at net.sf.saxon.expr.instruct.Block$BlockElaborator.lambda$elaborateForPush$1(Block.java:851)
	at net.sf.saxon.expr.LetExpression$LetExprElaborator.lambda$elaborateForPush$6(LetExpression.java:942)
	at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:376)
	at net.sf.saxon.trans.Mode.handleRuleNotNull(Mode.java:587)
	at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:521)
	at net.sf.saxon.trans.rules.TextOnlyCopyRuleSet.process(TextOnlyCopyRuleSet.java:72)
	at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:518)
	at net.sf.saxon.trans.XsltController.applyTemplates(XsltController.java:684)
	at com.saxonica.functions.extfn.TransformFn.call(TransformFn.java:103)
	at net.sf.saxon.expr.SystemFunctionCall$SystemFunctionCallElaborator.lambda$elaborateForPull$3(SystemFunctionCall.java:625)
	at net.sf.saxon.expr.elab.LazyPullEvaluator.evaluate(LazyPullEvaluator.java:39)
	at net.sf.saxon.expr.SystemFunctionCall$SystemFunctionCallElaborator.lambda$elaborateForPull$2(SystemFunctionCall.java:615)
	at net.sf.saxon.expr.elab.LazyPullEvaluator.evaluate(LazyPullEvaluator.java:39)
	at net.sf.saxon.expr.SystemFunctionCall$SystemFunctionCallElaborator.lambda$elaborateForPull$2(SystemFunctionCall.java:616)
	at net.sf.saxon.expr.LetExpression$LetExprElaborator.lambda$elaborateForPull$5(LetExpression.java:927)
	at net.sf.saxon.expr.instruct.Block$BlockElaborator$BlockIterator.getNthChildIterator(Block.java:832)
	at net.sf.saxon.expr.instruct.AbstractBlockIterator.next(AbstractBlockIterator.java:66)
	at net.sf.saxon.value.SingletonClosure.asItem(SingletonClosure.java:105)
	at net.sf.saxon.value.SingletonClosure.iterate(SingletonClosure.java:65)
	at net.sf.saxon.expr.UserFunctionCall$UserFunctionCallElaborator.lambda$elaborateForPull$0(UserFunctionCall.java:746)
	at net.sf.saxon.value.SingletonClosure.asItem(SingletonClosure.java:105)
	at net.sf.saxon.value.SingletonClosure.materialize(SingletonClosure.java:156)
	at net.sf.saxon.expr.elab.LocalVariableEvaluator.evaluate(LocalVariableEvaluator.java:31)
	at net.sf.saxon.expr.SystemFunctionCall$SystemFunctionCallElaborator.lambda$elaborateForPull$1(SystemFunctionCall.java:605)
	at net.sf.saxon.expr.sort.SortExpression$SortExprElaborator.lambda$elaborateForPull$0(SortExpression.java:511)
	at net.sf.saxon.expr.instruct.ForEach$ForEachElaborator.lambda$elaborateForPush$5(ForEach.java:809)
	at net.sf.saxon.expr.instruct.Block$BlockElaborator.lambda$elaborateForPush$1(Block.java:853)
	at net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:247)
	at net.sf.saxon.expr.instruct.CallTemplate$CallTemplateElaborator.lambda$elaborateForPush$1(CallTemplate.java:633)
	at net.sf.saxon.expr.instruct.Block$BlockElaborator.lambda$elaborateForPush$2(Block.java:864)
	at net.sf.saxon.expr.LetExpression$LetExprElaborator.lambda$elaborateForPush$6(LetExpression.java:942)
	at net.sf.saxon.expr.instruct.Block$BlockElaborator.lambda$elaborateForPush$1(Block.java:853)
	at net.sf.saxon.expr.LetExpression$LetExprElaborator.lambda$elaborateForPush$6(LetExpression.java:942)
	at net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:247)
	at net.sf.saxon.expr.instruct.CallTemplate$CallTemplatePackage.processLeavingTail(CallTemplate.java:515)
	at net.sf.saxon.expr.Expression.dispatchTailCall(Expression.java:976)
	at net.sf.saxon.expr.instruct.CallTemplate$CallTemplateElaborator.lambda$elaborateForPush$1(CallTemplate.java:634)
	at net.sf.saxon.expr.instruct.Block$BlockElaborator.lambda$elaborateForPush$4(Block.java:895)
	at net.sf.saxon.expr.LetExpression$LetExprElaborator.lambda$elaborateForPush$6(LetExpression.java:942)
	at net.sf.saxon.expr.TryCatch$TryCatchElaborator.lambda$elaborateForPush$1(TryCatch.java:335)
	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:1375)
	at net.sf.saxon.Transform.doTransform(Transform.java:879)
	at net.sf.saxon.Transform.main(Transform.java:83)
java.lang.RuntimeException: Internal error evaluating template rule  in module file:/C:/Data/MyProjects/int-batch/src/test/resources/saxon/saxon-transform-xxxx/xslt/convert-xml-report-to-csv.xslt
	at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:386)
	at net.sf.saxon.trans.Mode.handleRuleNotNull(Mode.java:587)
	at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:521)
	at net.sf.saxon.trans.rules.TextOnlyCopyRuleSet.process(TextOnlyCopyRuleSet.java:72)
	at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:518)
	at net.sf.saxon.trans.XsltController.applyTemplates(XsltController.java:684)
	at com.saxonica.functions.extfn.TransformFn.call(TransformFn.java:103)
	at net.sf.saxon.expr.SystemFunctionCall$SystemFunctionCallElaborator.lambda$elaborateForPull$3(SystemFunctionCall.java:625)
	at net.sf.saxon.expr.elab.LazyPullEvaluator.evaluate(LazyPullEvaluator.java:39)
	at net.sf.saxon.expr.SystemFunctionCall$SystemFunctionCallElaborator.lambda$elaborateForPull$2(SystemFunctionCall.java:615)
	at net.sf.saxon.expr.elab.LazyPullEvaluator.evaluate(LazyPullEvaluator.java:39)
	at net.sf.saxon.expr.SystemFunctionCall$SystemFunctionCallElaborator.lambda$elaborateForPull$2(SystemFunctionCall.java:616)
	at net.sf.saxon.expr.LetExpression$LetExprElaborator.lambda$elaborateForPull$5(LetExpression.java:927)
	at net.sf.saxon.expr.instruct.Block$BlockElaborator$BlockIterator.getNthChildIterator(Block.java:832)
	at net.sf.saxon.expr.instruct.AbstractBlockIterator.next(AbstractBlockIterator.java:66)
	at net.sf.saxon.value.SingletonClosure.asItem(SingletonClosure.java:105)
	at net.sf.saxon.value.SingletonClosure.iterate(SingletonClosure.java:65)
	at net.sf.saxon.expr.UserFunctionCall$UserFunctionCallElaborator.lambda$elaborateForPull$0(UserFunctionCall.java:746)
	at net.sf.saxon.value.SingletonClosure.asItem(SingletonClosure.java:105)
	at net.sf.saxon.value.SingletonClosure.materialize(SingletonClosure.java:156)
	at net.sf.saxon.expr.elab.LocalVariableEvaluator.evaluate(LocalVariableEvaluator.java:31)
	at net.sf.saxon.expr.SystemFunctionCall$SystemFunctionCallElaborator.lambda$elaborateForPull$1(SystemFunctionCall.java:605)
	at net.sf.saxon.expr.sort.SortExpression$SortExprElaborator.lambda$elaborateForPull$0(SortExpression.java:511)
	at net.sf.saxon.expr.instruct.ForEach$ForEachElaborator.lambda$elaborateForPush$5(ForEach.java:809)
	at net.sf.saxon.expr.instruct.Block$BlockElaborator.lambda$elaborateForPush$1(Block.java:853)
	at net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:247)
	at net.sf.saxon.expr.instruct.CallTemplate$CallTemplateElaborator.lambda$elaborateForPush$1(CallTemplate.java:633)
	at net.sf.saxon.expr.instruct.Block$BlockElaborator.lambda$elaborateForPush$2(Block.java:864)
	at net.sf.saxon.expr.LetExpression$LetExprElaborator.lambda$elaborateForPush$6(LetExpression.java:942)
	at net.sf.saxon.expr.instruct.Block$BlockElaborator.lambda$elaborateForPush$1(Block.java:853)
	at net.sf.saxon.expr.LetExpression$LetExprElaborator.lambda$elaborateForPush$6(LetExpression.java:942)
	at net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:247)
	at net.sf.saxon.expr.instruct.CallTemplate$CallTemplatePackage.processLeavingTail(CallTemplate.java:515)
	at net.sf.saxon.expr.Expression.dispatchTailCall(Expression.java:976)
	at net.sf.saxon.expr.instruct.CallTemplate$CallTemplateElaborator.lambda$elaborateForPush$1(CallTemplate.java:634)
	at net.sf.saxon.expr.instruct.Block$BlockElaborator.lambda$elaborateForPush$4(Block.java:895)
	at net.sf.saxon.expr.LetExpression$LetExprElaborator.lambda$elaborateForPush$6(LetExpression.java:942)
	at net.sf.saxon.expr.TryCatch$TryCatchElaborator.lambda$elaborateForPush$1(TryCatch.java:335)
	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:1375)
	at net.sf.saxon.Transform.doTransform(Transform.java:879)
	at net.sf.saxon.Transform.main(Transform.java:83)
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
	at net.sf.saxon.tree.tiny.TinyBuilder.makeTextNode(TinyBuilder.java:516)
	at net.sf.saxon.tree.tiny.TinyBuilder.characters(TinyBuilder.java:483)
	at net.sf.saxon.event.TreeReceiver.characters(TreeReceiver.java:176)
	at net.sf.saxon.serialize.PrincipalOutputGatekeeper.characters(PrincipalOutputGatekeeper.java:83)
	at net.sf.saxon.event.ComplexContentOutputter.characters(ComplexContentOutputter.java:275)
	at net.sf.saxon.event.Outputter$1.close(Outputter.java:372)
	at net.sf.saxon.functions.StringJoin.process(StringJoin.java:140)
	at net.sf.saxon.expr.SystemFunctionCall$SystemFunctionCallElaborator.lambda$elaborateForPush$8(SystemFunctionCall.java:689)
	at net.sf.saxon.expr.instruct.ValueOf$ValueOfElaborator.lambda$elaborateForPush$1(ValueOf.java:420)
	at net.sf.saxon.expr.instruct.Block$BlockElaborator.lambda$elaborateForPush$1(Block.java:851)
	at net.sf.saxon.expr.LetExpression$LetExprElaborator.lambda$elaborateForPush$6(LetExpression.java:942)
	at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:376)
	... 43 more
Fatal error during transformation: java.lang.RuntimeException: Internal error evaluating template rule  in module file:/C:/Data/MyProjects/int-batch/src/test/resources/saxon/saxon-transform-xxxx/xslt/convert-xml-report-to-csv.xslt

Files

saxon-transform-6339.zip (6.47 KB) saxon-transform-6339.zip Johan Gheys, 2024-02-06 14:33

Please register to edit this issue

Also available in: Atom PDF