Project

Profile

Help

Bug #2177

closed

NullPointerException with literal FilterExpression

Added by Michael Kay about 10 years ago. Updated almost 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
XPath conformance
Sprint/Milestone:
Start date:
2014-10-13
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

If a filter expression after optimization reduces to something like (1 to 20)[89], where both operands are literals and the index is out of range for the length of the sequence, a NullPointerException occurs rather than returning the empty sequence.

Problem code is at line 1121 in FilterExpression.iterate()

return ((Literal)base).getValue().itemAt(pos - 1).iterate();

where itemAt() can return null.

There is also another instance a few lines earlier where the base expression is a variable reference.

Actions #1

Updated by Michael Kay about 10 years ago

Both cases fixed on the 9.7 branch.

Actions #2

Updated by Michael Kay about 10 years ago

Reproduced, and fix tested, using the above query with -opt:0. The problem probably occurs only if optimisation is disabled. Also as far as I can see the problem does not occur on the bytecode path, only when interpreted.

A patch has been committed on the 9.6 branch (in addition to the earlier 9.7 fix).

Actions #3

Updated by Michael Kay about 10 years ago

  • Status changed from New to Resolved
Actions #4

Updated by O'Neil Delpratt about 10 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in version set to 9.6.0.2

Bug fix applied to the maintenance release Saxon 9.6.0.2

Actions #5

Updated by O'Neil Delpratt almost 9 years ago

  • Sprint/Milestone set to 9.6.0.2
  • Applies to branch 9.6 added
  • Fix Committed on Branch 9.6 added
  • Fixed in Maintenance Release 9.6.0.2 added

Please register to edit this issue

Also available in: Atom PDF