Bug 44483 - create workbook throws java.lang.IndexOutOfBoundsException with simple Excel file
Summary: create workbook throws java.lang.IndexOutOfBoundsException with simple Excel ...
Status: RESOLVED DUPLICATE of bug 42564
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.0-dev
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-25 04:42 UTC by David Webster
Modified: 2008-02-25 05:53 UTC (History)
0 users



Attachments
spreadsheet which throws Exception when opened by HSSF (77.00 KB, application/vnd.ms-excel)
2008-02-25 04:43 UTC, David Webster
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Webster 2008-02-25 04:42:11 UTC
Hello All,

Description
-----------

Creating a new HSSFWorkbook causes a Java Exception to be thrown and the
workbook not created.  The attached spreadsheet AVON.xls shows this behaviour -
it is a stripped down spreadsheet from a client ; I have stripped out almost all
data, worksheets, hidden worksheets, named ranges ... to leave this virtually
empty sheet.

Expected Behaviour
------------------

That the workbook is created correctly.

To replicate
------------
The following lines of code cause the exception to be thrown if the inFile is
the attached "AVON.xls"
 
  POIFSFileSystem fs = new POIFSFileSystem (new FileInputStream (inFile));
  wb = new HSSFWorkbook(fs);

The Exception is:

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        at java.util.ArrayList.RangeCheck(ArrayList.java:547)
        at java.util.ArrayList.get(ArrayList.java:322)
        at org.apache.poi.util.IntMapper.get(IntMapper.java:81)
        at org.apache.poi.hssf.record.SSTRecord.getString(SSTRecord.java:195)
        at org.apache.poi.hssf.model.Workbook.getSSTString(Workbook.java:729)
        at
org.apache.poi.hssf.usermodel.HSSFRichTextString.<init>(HSSFRichTextString.java:57)
        at org.apache.poi.hssf.usermodel.HSSFCell.<init>(HSSFCell.java:202)
        at
org.apache.poi.hssf.usermodel.HSSFRow.createCellFromRecord(HSSFRow.java:193)
        at
org.apache.poi.hssf.usermodel.HSSFSheet.setPropertiesFromSheet(HSSFSheet.java:177)
        at org.apache.poi.hssf.usermodel.HSSFSheet.<init>(HSSFSheet.java:131)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:226)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:148)
        at ExcelParser2.createWorkBook(ExcelParser2.java:47)
        at ExcelParser2.main(ExcelParser2.java:330)

Workaround
----------

None that I'm aware of ...

Any ideas?

Cheers,
Comment 1 David Webster 2008-02-25 04:43:06 UTC
Created attachment 21590 [details]
spreadsheet which throws Exception when opened by HSSF
Comment 2 David Webster 2008-02-25 05:53:15 UTC
Appologies, this is a duplicate of bug 42564, I forgot I modified the source to
work around this for one instance of a spreadsheet, obviously the workaround has
caused problems with other spreadsheets.

Any update re: 42564 and the updated Excel file formats?

Cheers


*** This bug has been marked as a duplicate of 42564 ***