Bug #5590
closedClassCastException (variable declaration with context item reference)
0%
Description
declare context item := 'x';
declare variable $a := .;
1[$a]
… ends up in a Java exception:
java.lang.ClassCastException: class net.sf.saxon.value.StringValue cannot be cast to class net.sf.saxon.value.NumericValue (net.sf.saxon.value.StringValue 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)
...
Related issues
Updated by Michael Kay over 2 years ago
- Assignee set to Michael Kay
I've added this to QT3 as test case -s:prod-ContextItemDecl -t:contextDecl-061
.
So far it appears to be working correctly on the 10.x, 11.x, and 12.x branches. Further investigation needed. Could you elaborate on how you are running the query?
Updated by Michael Kay over 2 years ago
Also tried from the command line under 10.x and 11.x.
The fact that it's generated a SubscriptExpression means it must have decided that the filter predicate is numeric, but I can't see why it would do that and it's not doing so in my tests.
I'll mark this as awaiting further info.
Updated by Christian Grün over 2 years ago
Even better, so I assume the bug is already fixed. I tried Saxon-EE 10.0J:
java -cp saxon-ee-10.0.jar net.sf.saxon.Query query.xq
<?xml version="1.0" encoding="UTF-8"?>java.lang.ClassCastException:
class net.sf.saxon.value.StringValue cannot be cast to class net.sf.saxon.value.NumericValue ...
Updated by Michael Kay over 2 years ago
- Is duplicate of Bug #4508: ClassCastException on Saxon 10 added
Updated by Michael Kay over 2 years ago
- Status changed from AwaitingInfo to Duplicate
Closing as a duplicate of #4508. I'm not absolutely certain of this but it seems very likely.
Please register to edit this issue