poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jatin Puri <purija...@gmail.com>
Subject Not enough data (1) to read requested (2) bytes - File succeeds on saving using excel
Date Fri, 12 Feb 2016 13:30:14 GMT
Hello.

We are currently using poi 3.13. We get over a 1000 excels a day which we
parse using poi. But since last few days, for a new set of `.xls` files, it
fails with the below exception:

Exception in thread "main"
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:226)
    at
org.apache.poi.hssf.record.RecordInputStream.readShort(RecordInputStream.java:243)
    at
org.apache.poi.hssf.record.ExtSSTRecord$InfoSubRecord.<init>(ExtSSTRecord.java:62)
    at org.apache.poi.hssf.record.ExtSSTRecord.<init>(ExtSSTRecord.java:97)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at
org.apache.poi.hssf.record.RecordFactory$ReflectionConstructorRecordCreator.create(RecordFactory.java:84)
    at
org.apache.poi.hssf.record.RecordFactory.createSingleRecord(RecordFactory.java:334)
    at
org.apache.poi.hssf.record.RecordFactoryInputStream.readNextRecord(RecordFactoryInputStream.java:308)
    at
org.apache.poi.hssf.record.RecordFactoryInputStream.nextRecord(RecordFactoryInputStream.java:274)
    at
org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:478)
    at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:344)
    at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:401)


*Important Note*:

   1. If I open the `.xls` file with Microsoft Excel 2010. And simply save
   it. i.e. make no change but just save it and then run the saved file. *It
   succeeds.*
   2. I am not sure if it is useful, but sharing it this case: While
   debugging, I have realized, that the error comes towards reading records at
   end of the file. i.e. it has read all the visible contents and only towards
   almost end of file, it fails.

Sadly, I cannot share the excel as it is confidential. Removing contents
and sharing wont help as on saving, it works perfectly fine. Any help?

Thanks!
Jatin


-- 
Jatin Puri
http://jatinpuri.com <http://www.jatinpuri.com>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message