poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 26916] New: - ArrayIndexOutOfBoundsException in HSSFDataFormat.getBuiltinFormat
Date Fri, 13 Feb 2004 15:53:35 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26916>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26916

ArrayIndexOutOfBoundsException in HSSFDataFormat.getBuiltinFormat

           Summary: ArrayIndexOutOfBoundsException in
                    HSSFDataFormat.getBuiltinFormat
           Product: POI
           Version: 2.0-dev
          Platform: PC
        OS/Version: Windows XP
            Status: UNCONFIRMED
          Severity: Major
          Priority: Other
         Component: HSSF
        AssignedTo: poi-dev@jakarta.apache.org
        ReportedBy: bsayatovic@amig.com


While attempting to read a workbook with skeletal test program, I encountered 
the following exception:

java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 191
	at java.util.Vector.get(Vector.java:716)
	at org.apache.poi.hssf.usermodel.HSSFDataFormat.getBuiltinFormat
(HSSFDataFormat.java:320)
	...

The portion of my code which lead up to this was inside a double loop over each 
row, and each cell in the row:

	HSSFCellStyle style = cell.getCellStyle();
	short format = style.getDataFormat();
	String formatString = HSSFDataFormat.getBuiltinFormat(format);

The way I read the documentation, the HSSFDataFormat.getBuiltinFormat call 
should return a format String if one exists, or null.  In this case, however, 
neither happened.  Instead, I got an ArrayIndexOutOfBoundsException.

Unless I've missed something, I suspect either the documentation should be 
updated or the code altered.  For now, I'm going to attempt to work around this 
by checking the format index against 
HSSFDataFormat.getNumberOfBuiltinBuiltinFormats.

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: poi-dev-help@jakarta.apache.org


Mime
View raw message