Thanks Amol, this was a long standing bug. 

Does you fix handle writing out as well? Sorry, too lazy to read the
code! :)

On Fri, 2005-07-08 at 16:59 +0200, [EMAIL PROTECTED] wrote:
> 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
> 
> 
> [EMAIL PROTECTED] changed:
> 
>            What    |Removed                     |Added
> ----------------------------------------------------------------------------
>              Status|NEW                         |RESOLVED
>          Resolution|                            |FIXED
> 
> 
> 
> 
> ------- Additional Comments From [EMAIL PROTECTED]  2005-07-08 16:59 -------
> *** I thought i had resolved this issue as fixed  *** 
> *** couple of days back, but my fix comments dont *** 
> *** appear, so I'm adding these comments again    ***
> 
> 
> Further "investigation" revealed that the byte array
> was falling short 2 bytes when the sid of the SubRecord
> indicated an EndSubRecord.
> 
> Hence,
> I made a slight modification in the change I proposed
> earlier in the file I committed. Here is the changed part:
> 
> <code>
> 
> while (pos - offset <= size-2) // atleast one "short" must be present
> {
>   short subRecordSid = LittleEndian.getShort(data, pos);
>   short subRecordSize = -1; // set default to "< 0"
>   if (pos-offset <= size-4) { // see if size info is present, else default to 
> -1
>     subRecordSize = LittleEndian.getShort(data, pos + 2);
>   }
> 
> </code>
> 
> 
> 
> Now, when the byte array falls short two bytes when dealing with
> EndSubRecord, the length is implicitly set to 0 since the change
> in ObjRecord now sets the length to default value of -1 if the 
> short value for the SubRecord size is not found.
> 
> 
-- 


---------------------------------------------------------------------
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