Bug 49702 - wb.getNumCellStyles() incorrect compared to wb.getCellStyleAt()
Summary: wb.getNumCellStyles() incorrect compared to wb.getCellStyleAt()
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.7-dev
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-04 03:46 UTC by Antti Koskimäki
Modified: 2010-08-04 10:43 UTC (History)
0 users



Attachments
patch for StylesTable to return size of correct (?) list (436 bytes, application/octet-stream)
2010-08-04 03:46 UTC, Antti Koskimäki
Details

Note You need to log in before you can comment on or make changes to this bug.
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