Project

Profile

Help

Bug #5590

closed

ClassCastException (variable declaration with context item reference)

Added by Christian Grün almost 2 years ago. Updated almost 2 years ago.

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

0%

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

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

Is duplicate of Saxon - Bug #4508: ClassCastException on Saxon 10ClosedMichael Kay2020-03-30

Actions
Actions #1

Updated by Michael Kay almost 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?

Actions #2

Updated by Michael Kay almost 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.

Actions #3

Updated by Michael Kay almost 2 years ago

  • Status changed from New to AwaitingInfo
Actions #4

Updated by Christian Grün almost 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 ...
Actions #5

Updated by Michael Kay almost 2 years ago

  • Is duplicate of Bug #4508: ClassCastException on Saxon 10 added
Actions #6

Updated by Michael Kay almost 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

Also available in: Atom PDF