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 2014/05/26 10:00:17 UTC

[Bug 56564] New: RecordFormatException: Unknown encryption info 4

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

            Bug ID: 56564
           Summary: RecordFormatException: Unknown encryption info 4
           Product: POI
           Version: 3.10
          Hardware: PC
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: HSSF
          Assignee: dev@poi.apache.org
          Reporter: almas.kristoffer@gmail.com

Using poi-3.10-FINAL

When trying to create an instance of HSSFWorkbook, either from a
POIFSFileSystem or FileInputStream I get this error sometimes.

In my experience this has only occured for .xls files which is encrypted with
the option "Protect Workbook Structure".

I've experience that this happens all the time when doing following:

 1 ) Open an existing .xls file, or create a new one, either encrypted with
"Protect Workbook Structure".
 2 ) Save the file as a new file with different name.
 3 ) Save the file again as new file with different name. (For every file you
does this with, will cause an error as shown below)

Be aware if you reopen the file from step 3, and saves as a new file with
different name, this file will not cause an error.

Hope it is understandable.

Stacktrace:
org.apache.poi.hssf.record.RecordFormatException: Unknown encryption info 4
    at org.apache.poi.hssf.record.FilePassRecord.<init>(FilePassRecord.java:70)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
    at
org.apache.poi.hssf.record.RecordFactory$ReflectionConstructorRecordCreator.create(RecordFactory.java:87)
    at
org.apache.poi.hssf.record.RecordFactory.createSingleRecord(RecordFactory.java:338)
    at
org.apache.poi.hssf.record.RecordFactoryInputStream$StreamEncryptionInfo.<init>(RecordFactoryInputStream.java:65)
    at
org.apache.poi.hssf.record.RecordFactoryInputStream.<init>(RecordFactoryInputStream.java:182)
    at
org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:477)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:301)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:264)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:199)
    at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:181)

-- 
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


[Bug 56564] RecordFormatException: Unknown encryption info 4

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

Nick Burch <ap...@gagravarr.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |DUPLICATE
                 OS|                            |All

--- Comment #1 from Nick Burch <ap...@gagravarr.org> ---


*** This bug has been marked as a duplicate of bug 35897 ***

-- 
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


Re: [Bug 56564] New: RecordFormatException: Unknown encryption info 4

Posted by vishal_sinha <vi...@adeptia.com>.
data.xls <http://apache-poi.1045710.n5.nabble.com/file/n5716740/data.xls>  

Hello, 
I am creating a password protected file of format Excel 97-2003 Workbook
(.xls) using Microsoft Office 2013. 
I have written a java program to read password protected excel file using
POI API. I am able to read .xlsx file using this API, but I am not able to
read .xls file. It throws error : 
org.apache.poi.hssf.record.RecordFormatException: Unknown encryption info 4 
        at
org.apache.poi.hssf.record.FilePassRecord.<init>(FilePassRecord.java:70) 
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method) 
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
Source) 
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source) 
        at java.lang.reflect.Constructor.newInstance(Unknown Source) 
        at
org.apache.poi.hssf.record.RecordFactory$ReflectionConstructorRecordCreator.create(RecordFactory.java:87) 
        at
org.apache.poi.hssf.record.RecordFactory.createSingleRecord(RecordFactory.java:338) 
        at
org.apache.poi.hssf.record.RecordFactoryInputStream$StreamEncryptionInfo.<init>(RecordFactoryInputStream.java:73) 
        at
org.apache.poi.hssf.record.RecordFactoryInputStream.<init>(RecordFactoryInputStream.java:182) 
        at
org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:477) 
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:301) 
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:264) 
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:199) 
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:342) 
        at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:323) 

Using same java code I am able to read .xls file if I use Microsoft Office
2010 to create this password protected file. 
My OS is Windows 8(64-bit). 
I am using latest Apache POI API i.e. “poi-3.10.1-20140818.jar”. 
Can you please let me know how I can solve this issue. I have attached XLS
file for reference. 
Please ASAP.
Thanks 
Vishal 



--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Bug-56564-New-RecordFormatException-Unknown-encryption-info-4-tp5715713p5716740.html
Sent from the POI - Dev mailing list archive at Nabble.com.

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