DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=35527>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=35527





------- Additional Comments From [EMAIL PROTECTED]  2005-06-28 23:23 -------
I confirmed the bug with latest on CVS. Here is relevant part of the stack trace
for reference:

<snipped/>
java.lang.ArrayIndexOutOfBoundsException: 33
        at org.apache.poi.util.LittleEndian.getNumber(LittleEndian.java:491)
        at org.apache.poi.util.LittleEndian.getShort(LittleEndian.java:52)
        at org.apache.poi.hssf.record.ObjRecord.fillFields(ObjRecord.java:99)
        at org.apache.poi.hssf.record.Record.fillFields(Record.java:90)
        at org.apache.poi.hssf.record.Record.<init>(Record.java:55)
        at org.apache.poi.hssf.record.ObjRecord.<init>(ObjRecord.java:61)
<snipped/>

Apparently, org.apache.poi.hssf.record.ObjRecord.fillFields runs out of data in
the loop:

        while (pos - offset < size)
        {
            short subRecordSid = LittleEndian.getShort(data, pos);
            short subRecordSize = LittleEndian.getShort(data, pos + 2);
            Record subRecord = SubRecord.createSubRecord(subRecordSid,
subRecordSize, data, pos + 4);
            subrecords.add(subRecord);
            pos += subRecord.getRecordSize();
        }

The following fix seemed to work, although the underlying cause is still not 
known:

file: org/apache/poi/hssf/record/ObjRecord.java

  // size-4: since at least the first two shorts have to be read
  while (pos - offset < size-4) 

I was able to read and save the file as a new xls with the above change and the
new file opened up fine.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/

Reply via email to