You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2008/03/05 11:12:03 UTC

DO NOT REPLY [Bug 44536] New: Error reading a 'read only 'recommended' XLS file

https://issues.apache.org/bugzilla/show_bug.cgi?id=44536

           Summary: Error reading a 'read only 'recommended' XLS file
           Product: POI
           Version: 3.0
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: richard.evans@datanomic.com


This is for version 3.0.2 FINAL.

If you open an XLS file and save with the 'read only recommended' option set,
POI fails to read the file:

Exception in thread "main" org.apache.poi.hssf.record.RecordFormatException:
Unable to construct record instance
        at
org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:199)
        at
org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:117)
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:207)
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:259)
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:240)
        at rde.tests.poi.XLTest.main(XLTest.java:30)
Caused by: 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:513)
        at
org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:187)
        ... 5 more
Caused by: java.lang.IllegalArgumentException: Illegal length
        at
org.apache.poi.hssf.record.RecordInputStream.readCompressedUnicode(RecordInputStream.java:270)
        at
org.apache.poi.hssf.record.FileSharingRecord.fillFields(FileSharingRecord.java:62)
        at org.apache.poi.hssf.record.Record.<init>(Record.java:55)
        at
org.apache.poi.hssf.record.FileSharingRecord.<init>(FileSharingRecord.java:48)
        ... 10 more

The code to parse the FILESHARING record does not seem to take account of
changes from BIFF5 to BIFF8.  Here is an extract from the openoffice xls file
format document:

0 2 1 = Recommend read-only state while loading the file
2 2 Hash value calculated from the read-only password (➜4.18.4)
4 var. User name of the file creator
BIFF2-BIFF5: Byte string, 8-bit string length (➜2.5.2)
BIFF8: Unicode string, 16-bit string length (➜2.5.3)
170

A trivial XLS file is attached


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 44536] Error reading a 'read only 'recommended' XLS file

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44536


Nick Burch <ni...@torchbox.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO




--- Comment #1 from Nick Burch <ni...@torchbox.com>  2008-03-06 07:44:29 PST ---
What version of excel did you generate your file with?

(I think all our supported versions of excel ought to be generating biff8
files)


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 44536] Error reading a 'read only 'recommended' XLS file

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44536





--- Comment #2 from Richard Evans <ri...@datanomic.com>  2008-03-06 07:47:55 PST ---
It was Excel 2003.  You are right in that POI supports BIFF8 only, I had not
realized that when I posted the original report.  

So it must be that the handling of the FILESHARING record is not quite right.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 44536] Error reading a 'read only 'recommended' XLS file

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44536


Richard Evans <ri...@datanomic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         OS/Version|Windows XP                  |All
           Platform|PC                          |DEC




-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 44536] Error reading a 'read only 'recommended' XLS file

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44536





--- Comment #3 from Nick Burch <ni...@torchbox.com>  2008-03-06 09:51:03 PST ---
Could you please upload the problem file, so we can see if it's possible to
detect this odd state in the filesharing record?


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 44536] Error reading a 'read only 'recommended' XLS file

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44536





--- Comment #4 from Richard Evans <ri...@datanomic.com>  2008-03-06 10:08:26 PST ---
Created an attachment (id=21641)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=21641)
trivial xls with 'read only recommended' flag set

Apologies.  Was convinced I had included an attachment with the original report


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 44536] Error reading a 'read only 'recommended' XLS file

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=44536


Nick Burch <ni...@torchbox.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|                            |FIXED




--- Comment #5 from Nick Burch <ni...@torchbox.com>  2008-03-07 03:35:55 PST ---
OK, looks like there was no username set, but there was a username length, so
was running off the end of the record

Fix in svn, along with tests, and a new HSSFWorkBook method to test for the
read-only flag


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org