Well, 
I left out mentioning that the changed code is a part
of ObjRecord.fillFields(..)

I believe writing out is handled as well. Actually,
since fillFields(..) is called by the constructor,
I think writing out is handled as a result.

I ran all unit tests and tried reading the file that 
caused the error and writing it out and it seemed
to work just fine (ie. no outofbounds exception and
files opened up just fine).

BTW, the unit tests all ran fine even before i made
the fix, so there was actually no failing test case
for the bugs. I have ensured that there are no
regression errors.

Regards,
~ amol


> -----Original Message-----
> From: Avik Sengupta [mailto:[EMAIL PROTECTED]
> Sent: Friday, July 08, 2005 11:11 AM
> To: POI Developers List
> Subject: Re: [Bug 35527] - ArrayIndexOutOfBoundsException when reading
> xls file
> 
> 
> 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/
> 

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