Bug 48079 - POI reportSheet.autoSizeColumn java.lang.ArrayIndexOutOfBoundsException: -1
Summary: POI reportSheet.autoSizeColumn java.lang.ArrayIndexOutOfBoundsException: -1
Status: RESOLVED LATER
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.5-FINAL
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-28 11:32 UTC by michael.ramirez
Modified: 2011-02-18 13:03 UTC (History)
0 users



Attachments
XLSServlet.java generates spreadsheet data. (16.97 KB, text/plain)
2009-10-28 12:18 UTC, michael.ramirez
Details

Note You need to log in before you can comment on or make changes to this bug.
Description michael.ramirez 2009-10-28 11:32:10 UTC
This seems to be a repeat of Bug 45322, which was fixed for POI 3.2.  This is now happening in 3.5-FINAL.

I'm getting the same outofboundsexception when performing an autoSizeColumn on columns whose data format returns -1.
Comment 1 Yegor Kozlov 2009-10-28 12:01:58 UTC
Can you attach a file and sample code to reproduce the problem? 3.5-FINAL works fine for the file attached to Bug 45322. 

Yegor
Comment 2 michael.ramirez 2009-10-28 12:18:53 UTC
Created attachment 24439 [details]
XLSServlet.java generates spreadsheet data.
Comment 3 michael.ramirez 2009-10-28 12:19:32 UTC
Attached code.  Unable to generate a file because it fails on autoSizeColumn.
Comment 4 michael.ramirez 2009-10-28 12:26:17 UTC
FYI: The following line of code was added to bypass the exception:

if ( null != row.getCell(i) && null != row.getCell(i).getCellStyle() && row.getCell(i).getCellStyle().getDataFormat() > -1 )

With that line removed, the exception occurs at:

sheet.autoSizeColumn((short)i);
Comment 5 neil.pugh 2010-11-01 12:30:39 UTC
If you attempt to use org.apache.poi.hssf.usermodel.HSSFSheet and method autosizecolumn(int) on a column after setting more than 32767 cells then ArrayOutOfBoundsException is thrown.

I found this while accessing java via ColdFusion, i doubt you'll want my source code! 

This major bug is still present in version 3.7.
Comment 6 Nick Burch 2011-02-18 13:03:50 UTC
In r1072093 I have added a test which shows we can size columns with very large (>32767) numbers of rows without error. So, looks like this bug is no longer present.