Bug 57194 - org.apache.poi.hssf.record.RecordFormatException: Not enough data (1) to read requested (2) bytes
Summary: org.apache.poi.hssf.record.RecordFormatException: Not enough data (1) to read...
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2014-11-10 03:36 UTC by bearbalu
Modified: 2020-04-21 20:58 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description bearbalu 2014-11-10 03:36:21 UTC
I have an (xls) file with this issue. Unfortunately, it is not a public document so I can't post it. Happy to email it to someone who can look at it. If I open it using my Excel 10 and just re-save it, the issue goes away, so I can't edit out the confidential info and email it.

org.apache.poi.hssf.record.RecordFormatException: Not enough data (1) to read requested (2) bytes
	at org.apache.poi.hssf.record.RecordInputStream.checkRecordPosition(RecordInputStream.java:216)
	at org.apache.poi.hssf.record.RecordInputStream.readShort(RecordInputStream.java:233)
	at org.apache.poi.hssf.record.cont.ContinuableRecordInput.readShort(ContinuableRecordInput.java:70)
	at org.apache.poi.hssf.record.common.UnicodeString$ExtRst.<init>(UnicodeString.java:160)
	at org.apache.poi.hssf.record.common.UnicodeString.<init>(UnicodeString.java:437)
	at org.apache.poi.hssf.record.SSTDeserializer.manufactureStrings(SSTDeserializer.java:57)
	at org.apache.poi.hssf.record.SSTRecord.<init>(SSTRecord.java:247)
	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.readNextRecord(RecordFactoryInputStream.java:285)
	at org.apache.poi.hssf.record.RecordFactoryInputStream.nextRecord(RecordFactoryInputStream.java:251)
	at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:480)
	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)
	at org.apache.poi.ss.usermodel.WorkbookFactory.create(WorkbookFactory.java:76)
Comment 1 Nick Burch 2014-11-10 05:08:44 UTC
Without the problematic records, we're not going to be able to do very much here. If you can't find a file you can share showing the problem, you'll probably need to solve this one yourself...

As a start, try comparing the SST records from before and after saving in a new Excel, and see if you can spot what Excel does to fix things up?
Comment 2 bearbalu 2014-11-10 15:55:55 UTC
Hello Nick,

Thanks for your prompt feedback. Can I email it you? 
If so, please send a private note where I can email this to.
Comment 3 bearbalu 2015-01-02 05:30:01 UTC
Hello Nick,

As per my previous email, let me know if I can e-mail you a private copy since this is not a public file - if so, please send me an e-mail. 

Comment 4 Nick Burch 2015-01-02 05:47:41 UTC
In order to be sure we have fixed the bug, and that it remains fixed into the future, we need a public file that we can use in a unit test, sorry
Comment 5 neilli 2015-04-03 06:31:51 UTC
We got similar error.
Unfortunately, our Excel files also can't be publish.
But we solved this error with version up JRE 6 to 7.
For your reference.
Comment 6 Dominik Stadler 2015-04-03 11:53:39 UTC
@neili, can you share the document so we can reproduce the problem? The original reporter could not share it and thus it is hard to find what the actual problem is.
Comment 7 Andreas Beeker 2020-04-21 20:58:03 UTC
No file provided for a long time, so I'm closing this now.