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

            Bug ID: 57456
           Summary: RecordFormatExpection (Not enough data) with External
                    Data Source
           Product: POI
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
          Assignee: [email protected]
          Reporter: [email protected]

I know there have been resolved cases of RecordFormatException involving
SSTRecord in the past, but I think I found a new case. The stack trace looks
like this:

org.apache.poi.hssf.record.RecordFormatException: Not enough data (0) 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.common.UnicodeString.<init>(UnicodeString.java:405)
    at
org.apache.poi.hssf.record.SSTDeserializer.manufactureStrings(SSTDeserializer.java:57)
    at org.apache.poi.hssf.record.SSTRecord.<init>(SSTRecord.java:247)

SSTDeserializer.manufactureStrings(..) is told there are strings, but the
RecordInputStream has 0 bytes remaining (although there are more records that
follow). I find it interesting that the code attempts to read a Unicode string
when there are no bytes remaining ... it will always fail, no? 

General Steps to Reproduce:

* Create blank workbook in Excel 2010 (or later).
* Add a web query (or any other data source) and insert into the sheet. This
creates an external sheet ref.
* In the "Usage" tab of the connection properties, specify "Remove data from
external data range before saving the workbook".
* Save workbook as XLS file.
* Open XLS file in POI. *Boom*.

Upon saving, Excel is writing the SSTRecord that claims to have strings, but it
is actually empty. Odd, but it is what it is. I know POI cannot handle external
data sources, but I expect to be able to open the file with POI without blowing
up. There may be other sheets with useful data that I want to scrape.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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

Reply via email to