Summary: | Sheet and Row iterators expose remove method which does not correctly remove the row or cell | ||
---|---|---|---|
Product: | POI | Reporter: | Javen O'Neal <onealj> |
Component: | SS Common | Assignee: | POI Developers List <dev> |
Status: | NEW --- | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Linux | ||
Attachments: |
failing unit tests
unit test results |
Description
Javen O'Neal
2015-09-20 21:46:08 UTC
Created attachment 33121 [details]
failing unit tests
I've written unit tests for Workbook, Sheet, and Row which should test the sheetIterator, rowIterator, and cellIterator, respectively for the following scenarios:
1) iterator.remove() either is unsupported or behaves the same as the removeSheetAt, removeRow, or removeCell method
2) if removeSheetAt, removeRow, or removeCell are called after an iterator has been created, the iterator should throw a ConcurrentModificationException the next time a method is called on it.
The Workbook sheetIterator passes, but the rowIterator and cellIterator fail for HSSF, XSSF, and SXSSF variants.
Summary of test results
HSSF XSSF SXSSF
BaseTestWorkbook pass pass pass
BaseTestSheet 1fail 1fail 1fail
BaseTestRow 2fails 1fail 1fail
I needed to modify HSSFRow.hashCode in order to have assertNull(HSSFRow) give a more meaningful error.
Created attachment 33122 [details]
unit test results
Additional unit tests are necessary to verify that the side-effects of iterator.remove are identical to removeSheetAt, removeRow, and removeCell. I propose making iterator.remove() an UnsupportedOperationException for now until someone can find a solution that doesn't duplicate code and works correctly. |