Project

Profile

Help

Bug #4534

closed

NullPointerException with invalidly-initialized global variable

Added by Michael Kay almost 4 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Diagnostics
Sprint/Milestone:
-
Start date:
2020-04-30
Due date:
% Done:

100%

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

Description

This typo (note the spurious “)” inside the putative QName):

 <xsl:variable name="dbe:INVALID-INJECT"
               select="xs:QName('dbe:INVALID-INJECT)')"/>

Causes an NPE in Saxon EE 10.0:

java.lang.NullPointerException
	at net.sf.saxon.expr.Expression.getRetainedStaticContext(Expression.java:462)
	at net.sf.saxon.expr.parser.LoopLifter.process(LoopLifter.java:50)
	at net.sf.saxon.expr.parser.ExpressionTool.optimizeComponentBody(ExpressionTool.java:1075)
	at net.sf.saxon.style.XSLGlobalVariable.optimize(XSLGlobalVariable.java:370)

Saxon spots the invalid QName at compile time and generates an ErrorExpression, but fails to assign it a RetainedStaticContext, causing the NPE when loop-lifting optimization later visits the expression.

Please register to edit this issue

Also available in: Atom PDF