Description: It appears that the field_1_index_code field in the org.apache.poi.hssf.record.FormatRecord class can attain a value of -1. This causes the HSSFDataFormat to throw an ArrayIndexOutOfBoundsException on line 109 because the FormatRecord’s field_1_index_code field is used as an index into a Vector where all the FormatRecords for the workbook are stored. Steps to Reproduce: Open the file: http://tonto.eia.doe.gov/oog/ftparea/wogirs/xls/psw14.xls and an ArrayIndexOutOfBoundsException is thrown on line 109 of HSSFDataFormat. This error occurs for version 2.0 and 2.5 Notes: The format record is read in and is stored to the Workbook on line 192 of the org.apache.poi.hssf.model.Workbook.java. BackGround: After reading the OpenOffice document for FormatRecord, http://sc.openoffice.org/excelfileformat.pdf, it appears that -1 is an invalid index for a Format Record but I am not sure if the -1 is caused from HSSF incorrectly reading the Excel File or if the actual FormatRecord is stored with an index of -1.
Could you tell us how this file was created?
When i open that file URL in excel is already complains about DataFormats being lost. Sugest that whatever generated this file (probably an early version of POI who knows!!!) was not generating a correct file structure. When i resave in excel, no exception is raised (when calling HSSFWorkbook.createDataFormat()) Jason