Actions
Bug #6470
open![Author: Martin Honnen](https://www.gravatar.com/avatar/3ea75023c3c487f36257090d420b7c50?rating=PG&size=50&default=https%3A%2F%2Fassets.plan.io%2Fimages%2Fdefault_avatar.png)
XQuery net.sf.saxon.Query command line runner and SaxonCS query command line tool give stack trace instead of simple error message/error code
Status:
New
Priority:
Normal
Assignee:
-
Category:
Command Line
Sprint/Milestone:
-
Start date:
2024-07-05
Due date:
% Done:
0%
Estimated time:
Legacy ID:
Applies to branch:
12
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:
.NET, Java
Description
The following XQuery code incorrectly tries to use an xs:string
as an xs:token
and Saxon raises an error but somehow the Java net.sf.saxon.Query
command line tool doesn't just report it but generates a stack trace.
let $s := ' abc ',
$t := $s cast as xs:token,
$t2 as xs:token := $s
return ($s, $t, $t2) ! ('|' || . || '|')
Stack trace:
java -cp 'C:\Program Files\Saxonica\SaxonHE12-5J\saxon-he-12.5.jar' net.sf.saxon.Query .\token-test2.xq
<?xml version="1.0" encoding="UTF-8"?>| abc | |abc|net.sf.saxon.trans.UncheckedXPathException: The required item type of the value of variable $t2 is xs:token; the supplied value " abc " does not match. The supplied value is of type xs:string
at net.sf.saxon.expr.ItemChecker.lambda$checkSequence$0(ItemChecker.java:252)
at net.sf.saxon.expr.ItemCheckingIterator.next(ItemCheckingIterator.java:63)
at net.sf.saxon.expr.instruct.AbstractBlockIterator.next(AbstractBlockIterator.java:71)
at net.sf.saxon.om.FocusTrackingIterator.next(FocusTrackingIterator.java:72)
at net.sf.saxon.expr.instruct.ForEach$ForEachElaborator.lambda$elaborateForPush$5(ForEach.java:811)
at net.sf.saxon.query.XQueryExpression.processQuery(XQueryExpression.java:499)
at net.sf.saxon.query.XQueryExpression.run(XQueryExpression.java:473)
at net.sf.saxon.s9api.XQueryEvaluator.run(XQueryEvaluator.java:466)
at net.sf.saxon.Query.runQuery(Query.java:1006)
at net.sf.saxon.Query.doQuery(Query.java:457)
at net.sf.saxon.Query.doQuery(Query.java:516)
at net.sf.saxon.Query.main(Query.java:107)
Caused by: net.sf.saxon.trans.XPathException: The required item type of the value of variable $t2 is xs:token; the supplied value " abc " does not match. The supplied value is of type xs:string
at net.sf.saxon.expr.ItemChecker.lambda$checkSequence$0(ItemChecker.java:248)
... 11 more
Fatal error during query: net.sf.saxon.trans.UncheckedXPathException: The required item type of the value of variable $t2 is xs:token; the supplied value " abc " does not match. The supplied value is of type xs:string
SaxonCS (tested with 12.5) also gives a similar stack trace:
& 'C:\Program Files\Saxonica\SaxonCS-12.5\SaxonCS.exe' query .\token-test2.xq
<?xml version="1.0" encoding="UTF-8"?>| abc | |abc|Saxon.Hej.trans.UncheckedXPathException
---> Saxon.Hej.trans.XPathException: The required item type of the value of variable $t2 is xs:token; the supplied value " abc " does not match.
--- End of inner exception stack trace ---
at Saxon.Hej.expr.ItemChecker.<>c__DisplayClass13_0.<checkSequence>b__0(Item item)
at Saxon.Hej.expr.ItemCheckingIterator.next()
at Saxon.Hej.expr.instruct.AbstractBlockIterator.next()
at Saxon.Hej.om.FocusTrackingIterator.next()
at Saxon.Hej.expr.instruct.ForEach.ForEachElaborator.<>c__DisplayClass2_0.<elaborateForPush>b__1(Outputter out, XPathContext context)
at Saxon.Eej.ee.optim.XQueryExpressionEE.processQuery(Outputter dest, XPathContext context)
at Saxon.Hej.query.XQueryExpression.run(DynamicQueryContext env, Result result, Properties outputProperties)
at Saxon.Hej.s9api.XQueryEvaluator.run(Destination destination)
at Saxon.Hej.Query.runQuery(XQueryExecutable exp, XQueryEvaluator evaluator, Source input, Destination destination)
at Saxon.Hej.Query.doQuery(String[] args)
Fatal error during query: UncheckedXPathException:
Exiting with code 2
I
No data to display
Please register to edit this issue
Actions