I've seen other ArrayIndexOutOfBoundException's in Saver.

One of the guys that worked here in the past made a simple fix, but to my 
knowledge his patch was never applied to the code base.

Here's his post/patch:
http://nagoya.apache.org/eyebrowse/[EMAIL PROTECTED]&msgId=1854066

We we're never able to find the time to create a test case, but we have been 
running with this patch for a long time and it hasn't caused any problems.

On Tuesday 31 May 2005 02:37 pm, Lawrence Jones wrote:
> With attached patch this time ;-)
>
>
>
> Cheers,
>
>
>
> Lawrence
>
>
>
>   _____
>
> From: Lawrence Jones
> Sent: Tuesday, May 31, 2005 2:34 PM
> To: 'dev@xmlbeans.apache.org'
> Subject: Suggested patch for ArrayIndexOutOfBoundException - committers
> please commit for me
>
>
>
> Hi all
>
>
>
> In Saver.java.entitizeCommment() the last 2 lines read:
>
>
>
>     if (_buf[ _lastEmitIn + _lastEmitCch - 1 ] == '-')
>         i = replace( _lastEmitIn + _lastEmitCch - 1, " " );
>
>
>
> but _buf is a circular buffer and it is possible for (_lastEmitIn +
> _lastEmitCch - 1) to be > the length of the _buf buffer. Instead the
> code should be:
>
>
>
>     int offset = (_lastEmitIn + _lastEmitCch - 1) % _buf.length;
>
>     if (_buf[ offset ] == '-')
>
>         i = replace( offset, " " );
>
>
>
> otherwise you can get an ArrayIndexOutOfBoundException.
>
>
>
> I am attaching a patch which fixes this. I'd be grateful if one of the
> committers would check it in.
>
>
>
> Thanks,
>
>
>
> Lawrence Jones

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to