Project

Profile

Help

Bug #4530

closed

NullPointerException with `<xsl:copy-of select="/"/>`

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

Status:
Closed
Priority:
Normal
Assignee:
Category:
XSLT conformance
Sprint/Milestone:
-
Start date:
2020-04-28
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

Norm Tovey-Walsh reports on the saxon-help mailing list:

In the course of debugging, I wanted to make sure the input actually contained something. I decided the least disruptive way to simply copy the input to the output was:

<xsl:template match="/"> <xsl:sequence select="/"/> </xsl:template>

It goes bang in 9.9.1-7 EE:

java.lang.NullPointerException
	at net.sf.saxon.expr.Expression.getRetainedStaticContext(Expression.java:461)
	at net.sf.saxon.expr.parser.LoopLifter.process(LoopLifter.java:50)
	at net.sf.saxon.expr.parser.ExpressionTool.optimizeComponentBody(ExpressionTool.java:1213)
	at com.saxonica.ee.trans.TemplateRuleInitializer.init(TemplateRuleInitializer.java:63)
	at com.saxonica.ee.trans.TemplateRuleEE.initialize(TemplateRuleEE.java:85)
	at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:509)
Actions #1

Updated by Michael Kay almost 4 years ago

RootExpression.typeCheck() rewrites "/" as "." if the context item type is document-node() (for streamability reasons, primarily). The rewrite is failing to copy static context and location information to the new expression, and this isn't defaulting to the information from the parent expression because the expression has no parent.

Actions #2

Updated by Michael Kay almost 4 years ago

  • Status changed from New to Resolved
  • Applies to branch 10 added
  • Fix Committed on Branch 10, 9.9 added
Actions #3

Updated by O'Neil Delpratt almost 4 years ago

  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 10.1 added

Bug fix committed in the Saxon 10.1 maintenance release.

Actions #4

Updated by O'Neil Delpratt over 3 years ago

  • Status changed from Resolved to Closed
  • Fixed in Maintenance Release 10.2, 9.9.1.8 added
  • Fixed in Maintenance Release deleted (10.1)

Bug fix applied on the Saxon 9.9.1.8 maintenance release.

Please register to edit this issue

Also available in: Atom PDF