Actions
Bug #2451
closedExceptions from Saxon-EE optimization
Start date:
2015-08-31
Due date:
% Done:
100%
Estimated time:
Legacy ID:
Applies to branch:
9.6
Fix Committed on Branch:
9.6
Fixed in Maintenance Release:
Platforms:
Description
Some XQuery similar to this one was mistyped by omitting "or" before the quantified expression:
declare function local:f($x, $y)
{
let $a := $x
where empty($y) (every $i in $x satisfies $i = $y)
return $a
};
local:f("x", ())
The optimizer throws this exception:
java.lang.NullPointerException
at net.sf.saxon.expr.flwor.FLWORExpression.optimize(FLWORExpression.java:558)
at net.sf.saxon.expr.parser.ExpressionVisitor.optimize(ExpressionVisitor.java:244)
at net.sf.saxon.query.XQueryFunction.optimize(XQueryFunction.java:471)
at net.sf.saxon.query.XQueryFunctionLibrary.optimizeGlobalFunctions(XQueryFunctionLibrary.java:326)
at net.sf.saxon.query.QueryModule.optimizeGlobalFunctions(QueryModule.java:1208)
at net.sf.saxon.expr.instruct.Executable.fixupQueryModules(Executable.java:597)
at net.sf.saxon.query.XQueryParser.makeXQueryExpression(XQueryParser.java:159)
at net.sf.saxon.query.StaticQueryContext.compileQuery(StaticQueryContext.java:571)
at net.sf.saxon.query.StaticQueryContext.compileQuery(StaticQueryContext.java:634)
at net.sf.saxon.s9api.XQueryCompiler.compile(XQueryCompiler.java:592)
at net.sf.saxon.Query.compileQuery(Query.java:787)
at net.sf.saxon.Query.doQuery(Query.java:340)
at net.sf.saxon.Query.main(Query.java:111)
With the "or" in place, i.e.
declare function local:f($x, $y)
{
let $a := $x
where empty($y) or (every $i in $x satisfies $i = $y)
return $a
};
local:f("x", ())
there is an exception, too:
java.lang.ClassCastException: net.sf.saxon.expr.Literal cannot be cast to net.sf.saxon.expr.VariableReference
at com.saxonica.ee.optim.IndexedLookupExpression.replaceOperand(IndexedLookupExpression.java:204)
at net.sf.saxon.expr.parser.ExpressionTool.inlineVariableReferences(ExpressionTool.java:1300)
at net.sf.saxon.expr.parser.ExpressionTool.inlineVariableReferences(ExpressionTool.java:1303)
at net.sf.saxon.expr.Assignation.replaceVariable(Assignation.java:470)
at net.sf.saxon.expr.LetExpression.optimize(LetExpression.java:231)
at net.sf.saxon.expr.parser.ExpressionVisitor.optimize(ExpressionVisitor.java:244)
at net.sf.saxon.expr.BinaryExpression.optimize(BinaryExpression.java:90)
at net.sf.saxon.expr.BooleanExpression.optimize(BooleanExpression.java:105)
at net.sf.saxon.expr.OrExpression.optimize(OrExpression.java:55)
at net.sf.saxon.expr.parser.ExpressionVisitor.optimize(ExpressionVisitor.java:244)
at net.sf.saxon.expr.flwor.FLWORExpression$7.processExpression(FLWORExpression.java:490)
at net.sf.saxon.expr.flwor.WhereClause.processSubExpressions(WhereClause.java:111)
at net.sf.saxon.expr.flwor.FLWORExpression.optimize(FLWORExpression.java:488)
at net.sf.saxon.expr.parser.ExpressionVisitor.optimize(ExpressionVisitor.java:244)
at net.sf.saxon.expr.LetExpression.optimize(LetExpression.java:198)
at net.sf.saxon.expr.parser.ExpressionVisitor.optimize(ExpressionVisitor.java:244)
at net.sf.saxon.expr.LetExpression.optimize(LetExpression.java:198)
at net.sf.saxon.expr.parser.ExpressionVisitor.optimize(ExpressionVisitor.java:244)
at com.saxonica.ee.optim.OptimizerEE.tryInlineFunctionCall(OptimizerEE.java:1053)
at net.sf.saxon.expr.UserFunctionCall.optimize(UserFunctionCall.java:343)
at net.sf.saxon.query.XQueryExpression.<init>(XQueryExpression.java:81)
at com.saxonica.ee.optim.XQueryExpressionEE.<init>(XQueryExpressionEE.java:54)
at com.saxonica.config.EnterpriseConfiguration.makeXQueryExpression(EnterpriseConfiguration.java:1526)
at net.sf.saxon.query.XQueryParser.makeXQueryExpression(XQueryParser.java:173)
at net.sf.saxon.query.StaticQueryContext.compileQuery(StaticQueryContext.java:571)
at net.sf.saxon.query.StaticQueryContext.compileQuery(StaticQueryContext.java:634)
at net.sf.saxon.s9api.XQueryCompiler.compile(XQueryCompiler.java:592)
at net.sf.saxon.Query.compileQuery(Query.java:787)
at net.sf.saxon.Query.doQuery(Query.java:340)
at net.sf.saxon.Query.main(Query.java:111)
Tested from command line using Saxon-EE 9.6.0.7J.
Please register to edit this issue
Actions