You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by ff...@apache.org on 2011/05/17 15:53:47 UTC

svn commit: r1104252 - /cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/MimeBodyPartInputStream.java

Author: ffang
Date: Tue May 17 13:53:47 2011
New Revision: 1104252

URL: http://svn.apache.org/viewvc?rev=1104252&view=rev
Log:
[CXF-3504]ensure can't read MimeBodyPartInputStream after close it

Modified:
    cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/MimeBodyPartInputStream.java

Modified: cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/MimeBodyPartInputStream.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/MimeBodyPartInputStream.java?rev=1104252&r1=1104251&r2=1104252&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/MimeBodyPartInputStream.java (original)
+++ cxf/branches/2.3.x-fixes/rt/core/src/main/java/org/apache/cxf/attachment/MimeBodyPartInputStream.java Tue May 17 13:53:47 2011
@@ -32,6 +32,8 @@ public class MimeBodyPartInputStream ext
     byte[] boundary;
     byte[] boundaryBuffer;
 
+    private boolean closed;
+
     public MimeBodyPartInputStream(PushbackInputStream inStreamParam, 
                                    byte[] boundaryParam,
                                    int pbsize) {
@@ -45,7 +47,7 @@ public class MimeBodyPartInputStream ext
         byte b[] = buf;
         int off = origOff;
         int len = origLen;
-        if (boundaryFound) {
+        if (boundaryFound || closed) {
             return -1;
         }
         if ((off < 0) || (off > b.length) || (len < 0) 
@@ -268,4 +270,8 @@ public class MimeBodyPartInputStream ext
         }
         return value;
     }
+    
+    public void close() throws IOException {
+        this.closed = true;
+    }
 }