You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by ve...@apache.org on 2011/07/30 21:21:24 UTC

svn commit: r1152501 - /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java

Author: veithen
Date: Sat Jul 30 19:21:23 2011
New Revision: 1152501

URL: http://svn.apache.org/viewvc?rev=1152501&view=rev
Log:
Removed some dead code:
* noStreams is final => using it in a loop expression doesn't make sense
* getPart() never returns null

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

Modified: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java?rev=1152501&r1=1152500&r2=1152501&view=diff
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java (original)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java Sat Jul 30 19:21:23 2011
@@ -518,11 +518,9 @@ public class Attachments implements OMAt
      * Force reading of all attachments.
      */
     private void fetchAllParts() {
-        DataHandler dataHandler;
-        while (!noStreams) {
-            dataHandler = this.getNextPartDataHandler();
-            if (dataHandler == null) {
-                break;
+        if (!noStreams) {
+            while (getNextPartDataHandler() != null) {
+                // Just loop until getNextPartDataHandler returns null
             }
         }
     }
@@ -639,12 +637,8 @@ public class Attachments implements OMAt
     private DataHandler getNextPartDataHandler() throws OMException {
         if (endOfStreamReached) {
             return null;
-        }
-        Part nextPart;
-        nextPart = getPart();
-        if (nextPart == null) {
-            return null;
-        } else
+        } else {
+            Part nextPart = getPart();
             try {
                 long size = nextPart.getSize();
                 String partContentID;
@@ -698,6 +692,7 @@ public class Attachments implements OMAt
             } catch (MessagingException e) {
                 throw new OMException(e);
             }
+        }
     }
 
     /**