You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlbeans.apache.org by ra...@apache.org on 2005/06/02 00:13:17 UTC

svn commit: r179432 - /xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Saver.java

Author: radup
Date: Wed Jun  1 15:13:16 2005
New Revision: 179432

URL: http://svn.apache.org/viewcvs?rev=179432&view=rev
Log:
Fix for a bug such that if the internal state of the circular buffer utilized in Saver.entitizeComment() was such that the working part of the buffer went over the end of the circular buffer and back to the beginning and, in that state, entitizeComment() was called then you could get a reference to an index past the end of the buffer and hence an ArrayIndexOutOfBoundsException.

Modified:
    xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Saver.java

Modified: xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Saver.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Saver.java?rev=179432&r1=179431&r2=179432&view=diff
==============================================================================
--- xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Saver.java (original)
+++ xmlbeans/trunk/src/store/org/apache/xmlbeans/impl/store/Saver.java Wed Jun  1 15:13:16 2005
@@ -1347,8 +1347,9 @@
             // Because I have only replaced chars with single chars,
             // _lastEmitIn will still be ok
 
-            if (_buf[ _lastEmitIn + _lastEmitCch - 1 ] == '-')
-                i = replace( _lastEmitIn + _lastEmitCch - 1, " " );
+            int offset = (_lastEmitIn + _lastEmitCch - 1) % _buf.length;
+            if (_buf[ offset ] == '-')
+                i = replace( offset, " " );
         }
 
         private void entitizeProcinst ( )



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org