Bug 56564 - RecordFormatException: Unknown encryption info 4
Summary: RecordFormatException: Unknown encryption info 4
Status: RESOLVED DUPLICATE of bug 35897
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.10-FINAL
Hardware: PC All
: P2 blocker (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-26 08:00 UTC by almas.kristoffer
Modified: 2014-05-26 09:04 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description almas.kristoffer 2014-05-26 08:00:17 UTC
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)
Comment 1 Nick Burch 2014-05-26 09:04:11 UTC

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