Project

Profile

Help

Bug #4750

closed

XdmSequenceIterator may return duplicate nodes

Added by Norm Tovey-Walsh over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Category:
-
Sprint/Milestone:
-
Start date:
2020-09-24
Due date:
% Done:

100%

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

Description

If the next() method on XdmSequenceIterator is called repeatedly without calling hasNext(), XdmSequenceIterator may incorrectly return duplicate items.

Actions #1

Updated by Norm Tovey-Walsh over 3 years ago

  • Status changed from New to In Progress
Actions #2

Updated by Norm Tovey-Walsh over 3 years ago

  • Fix Committed on Branch 10, trunk added

Fixed.

Actions #3

Updated by Norm Tovey-Walsh over 3 years ago

  • Status changed from In Progress to Resolved
Actions #4

Updated by Norm Tovey-Walsh over 3 years ago

Updated the fix to use LookaheadIterator

Actions #5

Updated by Michael Kay over 3 years ago

  • Status changed from Resolved to In Progress

Reviewed the changes.

I think the contract for Iterator (and the behaviour of the current XdmSequenceIterator) is that after hasNext() returns false, a further call on next() should throw NoSuchElementException rather than return null.

Also, I think the comment in next() that the exception cannot occur is wrong. I will try and construct an example.

Actions #6

Updated by Michael Kay over 3 years ago

  • Status changed from In Progress to Resolved

I've made further changes to the code and the tests to reflect these comments.

Actions #8

Updated by Michael Kay over 3 years ago

Applied a further patch: one of the JUnit tests in StreamTest was failing because XdmSequenceIterator.close() was no longer causing the next call on hasNext() to return false.

Actions #11

Updated by O'Neil Delpratt over 3 years ago

Bug fix applied in the Saxon 10.3 maintenance release

Actions #12

Updated by O'Neil Delpratt over 3 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 0 to 100
  • Fixed in Maintenance Release 10.3 added

Please register to edit this issue

Also available in: Atom PDF