DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15506>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=15506

ArrayIndexOutOfBoundsException (due to boundary condition)

           Summary: ArrayIndexOutOfBoundsException (due to boundary
                    condition)
           Product: Cocoon 2
           Version: Current CVS
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: core
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Very occasionally got an ArrayIndexOutOfBoundsException exception thrown by
org.apache.cocoon.util.BufferedOutputStream.write().

It is due to an off-by-one boundary condition and is easily fixed with the diff
below.

Index: src/java/org/apache/cocoon/util/BufferedOutputStream.java
===================================================================
RCS file:
/home/cvspublic/xml-cocoon2/src/java/org/apache/cocoon/util/BufferedOutputStream.java,v
retrieving revision 1.2
diff -u -r1.2 BufferedOutputStream.java
--- src/java/org/apache/cocoon/util/BufferedOutputStream.java   8 Nov 2002
11:09:39 -0000  1.2
+++ src/java/org/apache/cocoon/util/BufferedOutputStream.java   18 Dec 2002
21:00:46 -0000
@@ -127,7 +127,7 @@
      * @exception  IOException  if an I/O error occurs.
      */
     public void write(byte b[], int off, int len) throws IOException {
-        while (len > buf.length - count) {
+        while (len >= buf.length - count) {
             this.incBuffer();
         }
         System.arraycopy(b, off, buf, count, len);

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

Reply via email to