Bug 39190 - protected worksheet
Summary: protected worksheet
Status: RESOLVED DUPLICATE of bug 27548
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.0-dev
Hardware: Other other
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
: 34727 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-04-03 20:31 UTC by Robert Nice
Modified: 2006-10-25 08:08 UTC (History)
1 user (show)



Attachments
Workbook that won't open (244.00 KB, application/vnd.ms-excel)
2006-04-03 20:32 UTC, Robert Nice
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Nice 2006-04-03 20:31:01 UTC
See attached xls sheet, won't open. Stack trace below. Checked 2.5.1-final and
3.0-alpha1-20050704

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:494)
        at
org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:237)
        at
org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:160)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:183)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:152)
        at test.main(test.java:10)
Caused by: java.lang.IllegalArgumentException: Illegal length
        at org.apache.poi.util.StringUtil.getFromUnicodeLE(StringUtil.java:70)
        at org.apache.poi.hssf.record.FontRecord.fillFields(FontRecord.java:135)
        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.FontRecord.<init>(FontRecord.java:88)
        ... 9 more
Exception in thread "main" org.apache.poi.hssf.record.RecordFormatException:
Unable to construct record instance, the following exception occured: null
        at
org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:250)
        at
org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:160)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:183)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:152)
        at test.main(test.java:10)
Comment 1 Robert Nice 2006-04-03 20:32:09 UTC
Created attachment 18021 [details]
Workbook that won't open

Thanks for your efforts.
Comment 2 Jason Height 2006-08-15 03:25:39 UTC
Can you confirm that this file was written by excel in the first instance.
Debugging it is Wierd, seems like the Font records are all screwed up.

Jason
Comment 3 Robert Nice 2006-08-15 14:44:22 UTC
(In reply to comment #2)
> Can you confirm that this file was written by excel in the first instance.
> Debugging it is Wierd, seems like the Font records are all screwed up.

No I can't. But it does open fine in Excel and OpenOffice.
Comment 4 Jason Height 2006-08-17 03:35:57 UTC
Agreed. And if i save in excel, the problem still exists. Wierd. Ill keep
looking into it but may be headed to the too hard basket.

Jason
Comment 5 Jason Height 2006-08-27 11:07:00 UTC
*** Bug 34727 has been marked as a duplicate of this bug. ***
Comment 6 Jason Height 2006-08-27 11:10:17 UTC
What seems to be happening is there there are some illegal font records, these
have whacked out values for all of the fields including the length of the font
name, so when we attempt to read the font name it barfs because it expects more
characters than what are remaining in the FontRecord.

As indicated above this does open in excel, so there much be some trickery going
on here that we are not aware of, or excel simply ignores these whacked out records.

Dont know what to do yet.

Jason
Comment 7 Jason Height 2006-08-27 11:55:12 UTC
Refer to Bug 27548, the reason for this is that the workbook is encrypted.

At this point in time HSSF does not support handling of encrypted workbooks see FAQ.

To prevent this confusion (in regards to this exception stacktrace) i will throw
a RecordFormatException when we hit a FILEPASS record.

Jason

*** This bug has been marked as a duplicate of 27548 ***
Comment 8 Robert Nice 2006-08-27 14:53:52 UTC
I don't understand. Are you saying that the workbook, or portions of it are
encrypted? I don't need a password to open it, so is it that just parts of it
are locked or something? Is there a suggested workaround to get it to skip any
parts it can't read? Help!