Bug 29262 - org.apache.poi.hssf.record.FormatRecord.field_1_index_code has value of -1.
Summary: org.apache.poi.hssf.record.FormatRecord.field_1_index_code has value of -1.
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 2.5-FINAL
Hardware: All Windows 2000
: P1 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
URL: http://tonto.eia.doe.gov/oog/ftparea/...
Depends on:
Reported: 2004-05-28 00:06 UTC by Lonny Bastien
Modified: 2007-11-30 23:54 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Lonny Bastien 2004-05-28 00:06:07 UTC
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

The format record is read in and is stored to the Workbook on line 192 of the 

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.
Comment 1 Avik Sengupta 2005-05-20 13:40:58 UTC
Could you tell us how this file was created? 
Comment 2 Jason Height 2006-07-24 12:52:18 UTC
When i open that file URL in excel is already complains about DataFormats being

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