Bug 41546 - because of "Unable to construct record instance" can not load a xls file
Summary: because of "Unable to construct record instance" can not load a xls file
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.0-FINAL
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2007-02-05 16:19 UTC by laoguo
Modified: 2008-03-19 04:55 UTC (History)
2 users (show)

only one sheet ,and nothing in the sheet.of cause no any macro. (18.00 KB, application/octet-stream)
2007-02-05 16:22 UTC, laoguo
Stacktrace of the issue (7.91 KB, text/plain)
2007-02-21 16:32 UTC, Ajay Gautam

Note You need to log in before you can comment on or make changes to this bug.
Description laoguo 2007-02-05 16:19:02 UTC
HI, dear POI dev team.

I'v got a VERY VERY SIMPLE AND EMPTY Excel file, ONLY ONE sheet and NOTHING in 
the sheet.(I do not known how the excel file was be created,It just come from 
my customer),
And when I use new HSSFWorkbook(fs) , it will threw a exception:
(but poi2.5 will WORK FINE with my poor excel files.)
org.apache.poi.hssf.record.RecordFactory.createRecord() RecordFactory.java:189

org.apache.poi.hssf.record.RecordFormatException: Unable to construct record 

And when I ues the newest poi-source-3.0-alpha3-20070205.zip try to finding the 
error point,I got the following infomation:

In method of Pta.createPtg(RecordInputStream in) 
   when switch (id), the id was -59 ,so it goto default :
   throw new java.lang.UnsupportedOperationException(" Unknown Ptg in Formula: 
0x"+Integer.toHexString(( int ) id) + " (" + ( int ) id + ")");

how can i upload my poor excel file?

your laoguo
Comment 1 laoguo 2007-02-05 16:22:02 UTC
Created attachment 19523 [details]
only one sheet ,and nothing in the sheet.of cause no any macro.
Comment 2 laoguo 2007-02-05 16:22:58 UTC
thanks first.
Comment 3 Ajay Gautam 2007-02-21 16:30:40 UTC
Same issue here!
MY xls file is not as simple as 1.xls. Its a real world xls file. (Let me know
if you would like me to attach it).

Just upgraded my java app to poi-3.0-alpha3-20061212
This file used to work in poi-final-2.5.1

I will attach the stacktrace.
Comment 4 Ajay Gautam 2007-02-21 16:32:46 UTC
Created attachment 19623 [details]
Stacktrace of the issue
Comment 5 mshoji 2007-06-15 07:55:25 UTC
the name definition (named range) causes this problem. 
Comment 6 Lucas Shaw 2008-03-18 12:56:36 UTC
Dear POI Team,

I also have this issue with a single sheet XLS file from a customer. I was using 3.0.2-FINAL release, but had to revert to 3.0.1-FINAL release for it to work again. I made a spreadsheet that is basically the same as the one that is causing the problem that I would be happy to provide if you need some test data. Since 3.0.1-FINAL works just fine, it's not a critical thing for me (though some of the new function evaluation code would come in handy). Thanks for your time. I love your product - great work!
Comment 7 Nick Burch 2008-03-19 04:55:59 UTC
I've just tried the attached spreadsheet, and it opens just fine with svn trunk

I've added a new test to the test suite, so we can ensure this doesn't get broken again in future