Project

Profile

Help

Bug #4750

XdmSequenceIterator may return duplicate nodes

Added by Norm Tovey-Walsh 12 months ago. Updated 11 months 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:

Description

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

History

#1 Updated by Norm Tovey-Walsh 12 months ago

  • Status changed from New to In Progress

#2 Updated by Norm Tovey-Walsh 12 months ago

  • Fix Committed on Branch 10, trunk added

Fixed.

#3 Updated by Norm Tovey-Walsh 12 months ago

  • Status changed from In Progress to Resolved

#4 Updated by Norm Tovey-Walsh 12 months ago

Updated the fix to use LookaheadIterator

#5 Updated by Michael Kay 12 months 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.

#6 Updated by Michael Kay 12 months ago

  • Status changed from In Progress to Resolved

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

#8 Updated by Michael Kay 11 months 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.

#11 Updated by O'Neil Delpratt 11 months ago

Bug fix applied in the Saxon 10.3 maintenance release

#12 Updated by O'Neil Delpratt 11 months 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