cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r1104243 - in /cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment: AttachmentUtil.java MimeBodyPartInputStream.java
Date Tue, 17 May 2011 13:38:13 GMT
Author: ffang
Date: Tue May 17 13:38:13 2011
New Revision: 1104243

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

Modified:
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/MimeBodyPartInputStream.java

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java?rev=1104243&r1=1104242&r2=1104243&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/AttachmentUtil.java Tue May
17 13:38:13 2011
@@ -285,9 +285,13 @@ public final class AttachmentUtil {
             } catch (UnsupportedEncodingException ue) {
                 contentId = contentId.substring(4);
             }
-            return new LazyDataSource(contentId, atts);
+            LazyDataSource lazyDS =  new LazyDataSource(contentId, atts);
+            lazyDS.getContentType();
+            return lazyDS;
         } else if (contentId.indexOf("://") == -1) {
-            return new LazyDataSource(contentId, atts);
+            LazyDataSource lazyDS =  new LazyDataSource(contentId, atts);
+            lazyDS.getContentType();
+            return lazyDS;
         } else {
             try {
                 return new URLDataSource(new URL(contentId));

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/MimeBodyPartInputStream.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/MimeBodyPartInputStream.java?rev=1104243&r1=1104242&r2=1104243&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/MimeBodyPartInputStream.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/attachment/MimeBodyPartInputStream.java
Tue May 17 13:38:13 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;
+    }
 }



Mime
View raw message