Thanks for the responses. I also got pointed to http://issues.apache.org/jira/browse/XMLBEANS-115. And they all look related but actually they're both slightly different from my patch.
The patch for XMLBEAN-115 has been checked in and should work (let us know if not). I think the other one has been addressed as well - if not please raise a JIRA and let us know. The problem there was that a single char was being replaced by multiple ones (e.g. '<' to "<") and the pointers into the circular buffer weren't allowing for that to cause you to need to go back to the beginning of the buffer. This bug is about what happens in entitizeComment() which solely replaces "--" with "- " (note: no change in length - the 2nd char is a space). Nonetheless there was a logic error that if the underlying circular buffer was utilizing its "circularity" (i.e. the pointers to start and length of the active part of the buffer were such that (start + len) > real_buffer_length) when you attempted to entitize the comment then you tried to refer to a character beyond the end of the buffer. The fix is simply to refer to ((start + len) % buffer_len) instead. This bug still exists despite the fixes above. Cheers, Lawrence > -----Original Message----- > From: Jason Calabrese [mailto:[EMAIL PROTECTED] > Sent: Tuesday, May 31, 2005 3:29 PM > To: dev@xmlbeans.apache.org > Subject: Re: Suggested patch for ArrayIndexOutOfBoundException - > committers please commit for me > > 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] or > g&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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]