ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1159970 - /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/MIMEMessage.java
Date Sun, 21 Aug 2011 12:04:11 GMT
Author: veithen
Date: Sun Aug 21 12:04:11 2011
New Revision: 1159970

URL: http://svn.apache.org/viewvc?rev=1159970&view=rev
Log:
Avoid the call to Part#getSize() because this requires buffering of the part, which prevents
us from implementing streaming (AXIOM-377) properly.

The code was introduced by AXIOM-383 but is actually unnecessary:
* The buffering logic works well with with empty attachments.
* The case where "the stream end[s] without having a MIME message terminator" is irrelevant
because such a message should generate an exception.

Modified:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/MIMEMessage.java

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/MIMEMessage.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/MIMEMessage.java?rev=1159970&r1=1159969&r2=1159970&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/MIMEMessage.java
(original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/MIMEMessage.java
Sun Aug 21 12:04:11 2011
@@ -289,19 +289,11 @@ class MIMEMessage extends AttachmentsImp
             return null;
         } else {
             Part nextPart = getPart();
-            long size = nextPart.getSize();
             String partContentID = nextPart.getContentID();
-            DataHandler dataHandler;
             if (partContentID == null & partIndex == 1) {
                 String id = "firstPart_" + UIDGenerator.generateContentId();
                 firstPartId = id;
-                if (size > 0) {
-                    dataHandler = nextPart.getDataHandler();
-                } else {
-                    // Either the mime part is empty or the stream ended without having 
-                    // a MIME message terminator
-                    dataHandler = new DataHandler(new ByteArrayDataSource(new byte[]{}));
-                }
+                DataHandler dataHandler = nextPart.getDataHandler();
                 addDataHandler(id, dataHandler);
                 return dataHandler;
             }
@@ -322,13 +314,7 @@ class MIMEMessage extends AttachmentsImp
                 throw new OMException(
                         "Two MIME parts with the same Content-ID not allowed.");
             }
-            if (size > 0) {
-                dataHandler = nextPart.getDataHandler();
-            } else {
-                // Either the mime part is empty or the stream ended without having 
-                // a MIME message terminator
-                dataHandler = new DataHandler(new ByteArrayDataSource(new byte[]{}));
-            }
+            DataHandler dataHandler = nextPart.getDataHandler();
             addDataHandler(partContentID, dataHandler);
             return dataHandler;
         }



Mime
View raw message