Bug 64350 - Sonar fix - "Iterator.next()" methods should throw "NoSuchElementException"
Summary: Sonar fix - "Iterator.next()" methods should throw "NoSuchElementException"
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: 4.1.x-dev
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2020-04-14 19:05 UTC by Andreas Beeker
Modified: 2020-04-14 19:07 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Beeker 2020-04-14 19:05:38 UTC
Currently there are few Iterators used which don't behave correctly in the case of an depleted Iterator.next()

see also https://sonarcloud.io/organizations/apache/rules?open=java%3AS2272&rule_key=java%3AS2272

The reason for opening a bug report are the side-effects on low-level usercode using the POIFSStream or POIFSMiniStore and expecting an IndexOutOfBoundsException in such a case.

Although one could argue, that this is an API-break, this only occurs, if .next() is called when .hasNext() == false, which itself is an erroneous handling. Therefore I regard it as fix within 4.x.
Comment 1 Andreas Beeker 2020-04-14 19:07:52 UTC
Applied via r1876525