Bug 49702

Summary: wb.getNumCellStyles() incorrect compared to wb.getCellStyleAt()
Product: POI Reporter: Antti Koskimäki <antti.koskimaki>
Component: XSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 3.7-dev   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: patch for StylesTable to return size of correct (?) list

Description Antti Koskimäki 2010-08-04 03:46:28 UTC
Created attachment 25840 [details]
patch for StylesTable to return size of correct (?) list

XSSFWorkbook implementation of wb.getNumCellStyles returns incorrect value, usually just "1", while wb.getCellStyleAt() still finds all the styles (...before IndexOutOfBounds hits :)

I inspected the code, and finally patched StylesTable to return size of different list, as shown in attached patch. Seems to work, although I would suggest that someone more familiar with XSSF internals checks through the code. I got quite confused about styleXfs vs. xfs...
Comment 1 Nick Burch 2010-08-04 10:43:29 UTC
Thanks for investigating this

Something similar applied in r982269, along with unit tests which show that we correct get the right number of styles as they're added, and that we can't read off the end of the list any more