You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sc...@apache.org on 2008/08/14 19:49:38 UTC

svn commit: r685976 - /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java

Author: scheu
Date: Thu Aug 14 10:49:38 2008
New Revision: 685976

URL: http://svn.apache.org/viewvc?rev=685976&view=rev
Log:
Quick Fix:
The deleteAttachments code should only delete the current attachments.  (Removed the call to getAllContentIDs...because
this will cause the code to try and read from the input stream...which is assumed closed at this point)

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java?rev=685976&r1=685975&r2=685976&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportUtils.java Thu Aug 14 10:49:38 2008
@@ -56,6 +56,7 @@
 import java.io.File;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.List;
 
 public class TransportUtils {
 
@@ -515,14 +516,16 @@
        	Attachments attachments = msgContext.getAttachmentMap();
        	LifecycleManager lcm = (LifecycleManager)msgContext.getRootContext().getAxisConfiguration().getParameterValue(DeploymentConstants.ATTACHMENTS_LIFECYCLE_MANAGER);
            if (attachments != null) {
-               String [] keys = attachments.getAllContentIDs(); 
+               // Get the list of Content IDs for the attachments...but does not try to pull the stream for new attachments.
+               // (Pulling the stream for new attachments will probably fail...the stream is probably closed)
+               List keys = attachments.getContentIDList();
                if (keys != null) {
                	String key = null;
                	File file = null;
                	DataSource dataSource = null;
-                   for (int i = 0; i < keys.length; i++) {
+                   for (int i = 0; i < keys.size(); i++) {
                        try {
-                           key = keys[i];
+                           key = (String) keys.get(i);
                            dataSource = attachments.getDataHandler(key).getDataSource();
                            if(dataSource instanceof CachedFileDataSource){
                            	file = ((CachedFileDataSource)dataSource).getFile();