Bug 29782

Summary: InvocationTargetException when using field validation
Product: POI Reporter: Dave Esmond <dave>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: major    
Priority: P3    
Version: 2.0-FINAL   
Target Milestone: ---   
Hardware: All   
OS: other   
Attachments: sample spreadsheet that crashes POI/HSSF

Description Dave Esmond 2004-06-24 08:20:29 UTC
Excel has a nifty feature called "validation" whereby it allows you to specify 
a list of possible values for a column and it will use the list to populate a 
drop-down list when a cell that uses that format has been highlighted (i.e. 
cursor is on it).  There is an incompatibility between the latest version of 
POI/HSSFS and this feature.  It fails every-time without fail.  Here are the 
exact steps to reproduce:

1. Create a spreadsheet using the validation feature I spoke about (or use the 
one that have/will uploaded to the bug).

2. Position your cursor overtop of the validation cell (highligh it) so as to 
cause the selector to appear.

3. SAVE the workbook! Its important to save the workbook with the cursor 
overtop of this cell.

4. Now read the workbook with POI/HSSF.  You will see a stacktrace comparable 
to the following:

java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance
(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance
(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
        at org.apache.poi.hssf.record.RecordFactory.createRecord
(RecordFactory.java:224)
        at org.apache.poi.hssf.record.RecordFactory.createRecords
(RecordFactory.java:160)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:165)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:132)
        at 
com.dorado.app.ppe.service.client.shell.lib.excel.PMExcelToDif.getBook
(PMExcelToDif.java:406)
        at 
com.dorado.app.ppe.service.client.shell.lib.excel.PMExcelToDif.parseBook
(PMExcelToDif.java:93)
        at com.dorado.app.ppe.service.client.shell.lib.excel.PMExcelToDif.main
(PMExcelToDif.java:429)
        at com.dorado.app.ppe.service.client.shell.PMShell.main(PMShell.java:79)
Caused by: java.lang.ArrayIndexOutOfBoundsException
        at java.lang.System.arraycopy(Native Method)
        at org.apache.poi.hssf.record.UnknownRecord.<init>
(UnknownRecord.java:62)
        at org.apache.poi.hssf.record.SubRecord.createSubRecord
(SubRecord.java:57)
        at org.apache.poi.hssf.record.ObjRecord.fillFields(ObjRecord.java:99)
        at org.apache.poi.hssf.record.Record.fillFields(Record.java:90)
        at org.apache.poi.hssf.record.Record.<init>(Record.java:55)
        at org.apache.poi.hssf.record.ObjRecord.<init>(ObjRecord.java:61)
        ... 16 more
com.dorado.app.ppe.service.client.shell.lib.excel.WorkbookNotFoundException: 
Fatal: Workbook "C:\dummy.xls" not found or invalid.
        at 
com.dorado.app.ppe.service.client.shell.lib.excel.PMExcelToDif.getBook
(PMExcelToDif.java:411)
        
...
etc.
Comment 1 Dave Esmond 2004-06-24 08:22:39 UTC
Created attachment 11940 [details]
sample spreadsheet that crashes POI/HSSF
Comment 2 Jason Height 2005-07-29 04:49:57 UTC
Works for me with latest CVS version.

Jason
Comment 3 Rob Cash 2006-09-07 21:13:30 UTC
(In reply to comment #2)
> Works for me with latest CVS version.
> 
> Jason
> 

Since the latest binary distribution (2.5.1-final) DOES have the problem, is
there a patch that can be applied to fix this problem? It's been a while since
there was an official release...

Rob