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 19:29:29 UTC
svn commit: r1152494 -
/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/attachments/Attachments.java
Author: veithen
Date: Sat Jul 30 17:29:28 2011
New Revision: 1152494
URL: http://svn.apache.org/viewvc?rev=1152494&view=rev
Log:
Use a LinkedHashMap (instead of two separate collections) to store the attachments in the order in which they occur in the message.
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=1152494&r1=1152493&r2=1152494&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 17:29:28 2011
@@ -39,9 +39,9 @@ import java.io.InputStream;
import java.io.PushbackInputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Set;
-import java.util.TreeMap;
import java.util.Map;
import java.util.Collections;
@@ -70,16 +70,10 @@ public class Attachments implements OMAt
private final DetachableInputStream filterIS;
/**
- * <code>attachmentsMap</code> stores the Data Handlers of the already parsed Mime Body Parts.
- * This ordered Map is keyed using the content-ID's.
+ * Stores the Data Handlers of the already parsed Mime Body Parts in the order that the attachments
+ * occur in the message. This map is keyed using the content-ID's.
*/
- private final TreeMap attachmentsMap = new TreeMap();
-
- /**
- * <code>cids</code> stores the content ids in the order that the attachments
- * occur in the message
- */
- private final ArrayList cids = new ArrayList();
+ private final Map attachmentsMap = new LinkedHashMap();
/** <code>partIndex</code>- Number of Mime parts parsed */
private int partIndex = 0;
@@ -378,9 +372,6 @@ public class Attachments implements OMAt
*/
public void addDataHandler(String contentID, DataHandler dataHandler) {
attachmentsMap.put(contentID, dataHandler);
- if (!cids.contains(contentID)) {
- cids.add(contentID);
- }
}
/**
@@ -401,9 +392,6 @@ public class Attachments implements OMAt
}
}
}
- if (cids.contains(blobContentID)) {
- cids.remove(blobContentID);
- }
}
/**
@@ -549,6 +537,7 @@ public class Attachments implements OMAt
*/
public String[] getAllContentIDs() {
fetchAllParts();
+ Set cids = attachmentsMap.keySet();
return (String[]) cids.toArray(new String[cids.size()]);
}
@@ -589,7 +578,7 @@ public class Attachments implements OMAt
* @return List of content IDs in order of appearance in message
*/
public List getContentIDList() {
- return cids;
+ return new ArrayList(attachmentsMap.keySet());
}
/**