On Wed, 9 Feb 2011, Taro App wrote:
Caused by: 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.readUShort(RecordInputStream.java:267)
        at org.apache.poi.util.StringUtil.readUnicodeLE(StringUtil.java:277)
        at 
org.apache.poi.hssf.record.common.UnicodeString$ExtRst.<init>(UnicodeString.java:172)
        at 
org.apache.poi.hssf.record.common.UnicodeString.<init>(UnicodeString.java:438)
        at 
org.apache.poi.hssf.record.SSTDeserializer.manufactureStrings(SSTDeserializer.java:55)
        at org.apache.poi.hssf.record.SSTRecord.<init>(SSTRecord.java:250)

This is the key bit of the stack trace. You have a SST Record which contains a string that claims to be a 1 character unicode string (2 bytes). However, the record only had 1 byte left, which is never a valid size for a unicode string (they must have even lengths)

I've no idea if excel has written something invalid, or if POI is confused about the string being unicode vs ascii.

The file is saved with Excel 2003. It's a confidential file, so I
can't provide the file here.

I'd suggest you use a debugger to step into the SSTRecord code, and see if you can spot what's going wrong. Is this the only string in the record? If not, do the strings before it make sense or is there garbage in them?

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to