Bug 44732 - ClassCastException with new HSSFWorkbook(is)
Summary: ClassCastException with new HSSFWorkbook(is)
Status: RESOLVED WORKSFORME
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.0-FINAL
Hardware: Other Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-01 14:21 UTC by Tuure Laurinolli
Modified: 2008-04-02 01:42 UTC (History)
0 users



Attachments
Test program (340 bytes, text/x-java)
2008-04-01 14:21 UTC, Tuure Laurinolli
Details
Test data (91.00 KB, application/msexcel)
2008-04-01 14:22 UTC, Tuure Laurinolli
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tuure Laurinolli 2008-04-01 14:21:50 UTC
Created attachment 21756 [details]
Test program

The attached test program when run against the attached test file throws ClassCastException.

Steps to reproduce:
- Run attached test program with attached test file

Actual result:
- Program crashes with the following stack trace:
Stack trace:
java -cp lib/poi-3.0.2-FINAL-20080204.jar:. MinimalTest
Exception in thread "main" java.lang.ClassCastException: org.apache.poi.hpsf.PropertySet cannot be cast to org.apache.poi.hpsf.DocumentSummaryInformation
        at org.apache.poi.POIDocument.readProperties(POIDocument.java:74)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:171)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:259)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:240)
        at MinimalTest.main(MinimalTest.java:7)

Expected result:
- The program should exit succesfully

Exact POI version:
poi-3.0.2-FINAL-20080204.jar
Comment 1 Tuure Laurinolli 2008-04-01 14:22:58 UTC
Created attachment 21757 [details]
Test data
Comment 2 Tuure Laurinolli 2008-04-01 14:26:44 UTC
Additional information:
- The test data is saved with a Debian OpenOffice.org 2.0.4.9 from Debian 
- If the test data is opened with OO.o 2.2.1 for Windows and resaved, POI can open it

Is it just a broken file that OO.o can cope with for some reason? Even in that case ClassCastException is a bit rough :)
Comment 3 Josh Micich 2008-04-01 18:36:15 UTC
The sample code + spreadsheet work OK in the latest svn trunk.

POIDocument.java must have changed since 3.0.2.  Line 74 does not seem to correspond to the supplied stack trace.

If you find the same problem on the latest trunk, please re-open this bug.
Comment 4 Tuure Laurinolli 2008-04-02 01:42:04 UTC
Hm yes, appparently some kind of fix for this was applied to trunk in r620582.