Project

Profile

Help

Bug #2594

closed

NullPointerException when compiling an XPath expression

Added by Alin Balasa over 8 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
High
Category:
Internals
Sprint/Milestone:
-
Start date:
2016-01-21
Due date:
% Done:

100%

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

Description

I have obtained a NPE when trying to compile the next XPath expression:

ancestor-or-self::*[@conref] | .[ancestor-or-self::p][@conref]
Exception in thread "main" java.lang.NullPointerException: Internal error: expression .[exists(...)][exists(...)] has no retained static context
	at net.sf.saxon.expr.Expression.getConfiguration(Expression.java:1089)
	at net.sf.saxon.expr.FilterExpression.optimize(FilterExpression.java:296)
	at net.sf.saxon.expr.FilterExpression.optimize(FilterExpression.java:457)
	at net.sf.saxon.expr.Operand.optimize(Operand.java:200)
	at net.sf.saxon.expr.Expression.optimizeChildren(Expression.java:496)
	at net.sf.saxon.expr.UnaryExpression.optimize(UnaryExpression.java:112)
	at net.sf.saxon.expr.Operand.optimize(Operand.java:200)
	at net.sf.saxon.expr.sort.DocumentSorter.optimize(DocumentSorter.java:99)
	at net.sf.saxon.expr.Operand.optimize(Operand.java:200)
	at net.sf.saxon.expr.Expression.optimizeChildren(Expression.java:496)
	at net.sf.saxon.expr.BinaryExpression.optimize(BinaryExpression.java:171)
	at net.sf.saxon.expr.VennExpression.optimize(VennExpression.java:312)
	at net.sf.saxon.sxpath.XPathEvaluator.createExpression(XPathEvaluator.java:150)
	at net.sf.saxon.s9api.XPathCompiler.internalCompile(XPathCompiler.java:506)
	at net.sf.saxon.s9api.XPathCompiler.compile(XPathCompiler.java:481)
	at Sample.main(Sample.java:12)

The problem can be reproduced running this code:

public static void main(String[] args) throws Exception {
		net.sf.saxon.s9api.Processor processor = new net.sf.saxon.s9api.Processor(true);
		XPathCompiler newXPathCompiler = processor.newXPathCompiler();
		newXPathCompiler.compile("ancestor-or-self::*[@conref] | .[ancestor-or-self::p][@conref]");
}

Please register to edit this issue

Also available in: Atom PDF