Project

Profile

Help

Bug #5051

ClassCastException: TinyElementImpl cannot be cast to class net.sf.saxon.value.NumericValue

Added by Christian Grün about 2 months ago. Updated about 2 months ago.

Status:
Duplicate
Priority:
Low
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
2021-07-29
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
10
Fix Committed on Branch:
Fixed in Maintenance Release:

Description

The query:

for $i in (<_>1</_>, 2)
return 'x'[$i]

The expected result: x x

The returned result:

java.lang.ClassCastException: class net.sf.saxon.tree.tiny.TinyElementImpl cannot be cast to class net.sf.saxon.value.NumericValue (net.sf.saxon.tree.tiny.TinyElementImpl and net.sf.saxon.value.NumericValue are in unnamed module of loader 'app')
        at net.sf.saxon.expr.SubscriptExpression.evaluateItem(SubscriptExpression.java:151)
        at net.sf.saxon.expr.Expression.process(Expression.java:940)
        at com.saxonica.ee.bytecode.ByteCodeCandidate.process(ByteCodeCandidate.java:146)
        at net.sf.saxon.expr.ForExpression.lambda$process$0(ForExpression.java:399)
        at net.sf.saxon.om.SequenceIterator.forEachOrFail(SequenceIterator.java:135)
        at net.sf.saxon.expr.ForExpression.process(ForExpression.java:397)
        at com.saxonica.ee.bytecode.ByteCodeCandidate.process(ByteCodeCandidate.java:146)
        at net.sf.saxon.query.XQueryExpression.run(XQueryExpression.java:453)
        at net.sf.saxon.s9api.XQueryEvaluator.run(XQueryEvaluator.java:369)
        at net.sf.saxon.Query.runQuery(Query.java:895)
        at net.sf.saxon.Query.doQuery(Query.java:423)
        at net.sf.saxon.Query.main(Query.java:97)
java.lang.RuntimeException: Internal error evaluating template rule  at line 2 in module file:/c:/Users/user/Desktop/x.xq
        at com.saxonica.ee.bytecode.ByteCodeCandidate.process(ByteCodeCandidate.java:159)
        at net.sf.saxon.expr.ForExpression.lambda$process$0(ForExpression.java:399)
        at net.sf.saxon.om.SequenceIterator.forEachOrFail(SequenceIterator.java:135)
        at net.sf.saxon.expr.ForExpression.process(ForExpression.java:397)
        at com.saxonica.ee.bytecode.ByteCodeCandidate.process(ByteCodeCandidate.java:146)
        at net.sf.saxon.query.XQueryExpression.run(XQueryExpression.java:453)
        at net.sf.saxon.s9api.XQueryEvaluator.run(XQueryEvaluator.java:369)
        at net.sf.saxon.Query.runQuery(Query.java:895)
        at net.sf.saxon.Query.doQuery(Query.java:423)
        at net.sf.saxon.Query.main(Query.java:97)

Hope this helps.

History

#1 Updated by Martin Honnen about 2 months ago

Why is the expected result x x? Isn't it x as 'x'[2] will give the empty sequence so only 'x'[<_>1</_>] produces an x?

#2 Updated by Martin Honnen about 2 months ago

Does this occur with the latest release, Saxon 10.5? It kind of looks like a duplicate of https://saxonica.plan.io/issues/4508, perhaps.

#3 Updated by Christian Grün about 2 months ago

Completely true; my "expected result" was a remnant of a previous bug description. Thanks.

I didn’t use the latest version for testing; if this has already been fixed, even better.

#4 Updated by Michael Kay about 2 months ago

  • Status changed from New to Duplicate

This does indeed look like a duplicate of #4508

Please register to edit this issue

Also available in: Atom PDF