You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2008/03/16 18:59:33 UTC

svn commit: r637619 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2: builder/BuilderUtil.java transport/TransportUtils.java

Author: dims
Date: Sun Mar 16 10:59:30 2008
New Revision: 637619

URL: http://svn.apache.org/viewvc?rev=637619&view=rev
Log:
Fix for AXIS2-3332 - java.lang.IllegalStateException on org.apache.axis2.transport.TransportUtils.deleteAttachments.

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

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java?rev=637619&r1=637618&r2=637619&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java Sun Mar 16 10:59:30 2008
@@ -457,26 +457,7 @@
     protected static Attachments createAttachmentsMap(MessageContext msgContext,
                                                       InputStream inStream,
                                                       String contentTypeString) {
-        Object cacheAttachmentProperty = msgContext
-                .getProperty(Constants.Configuration.CACHE_ATTACHMENTS);
-        String cacheAttachmentString = null;
-        boolean fileCacheForAttachments;
-
-        if (cacheAttachmentProperty != null
-                && cacheAttachmentProperty instanceof String) {
-            cacheAttachmentString = (String) cacheAttachmentProperty;
-            fileCacheForAttachments = (Constants.VALUE_TRUE
-                    .equals(cacheAttachmentString));
-        } else {
-            Parameter parameter_cache_attachment = msgContext
-                    .getParameter(Constants.Configuration.CACHE_ATTACHMENTS);
-            cacheAttachmentString =
-                    (parameter_cache_attachment != null) ? (String) parameter_cache_attachment
-                            .getValue()
-                            : null;
-        }
-        fileCacheForAttachments = (Constants.VALUE_TRUE
-                .equals(cacheAttachmentString));
+        boolean fileCacheForAttachments = isAttachmentsCacheEnabled(msgContext);
 
         String attachmentRepoDir = null;
         String attachmentSizeThreshold = null;
@@ -538,6 +519,30 @@
                 attachmentRepoDir,
                 attachmentSizeThreshold,
                 contentLength);
+    }
+
+    public static boolean isAttachmentsCacheEnabled(MessageContext msgContext) {
+        Object cacheAttachmentProperty = msgContext
+                .getProperty(Constants.Configuration.CACHE_ATTACHMENTS);
+        String cacheAttachmentString = null;
+        boolean fileCacheForAttachments;
+
+        if (cacheAttachmentProperty != null
+                && cacheAttachmentProperty instanceof String) {
+            cacheAttachmentString = (String) cacheAttachmentProperty;
+            fileCacheForAttachments = (Constants.VALUE_TRUE
+                    .equals(cacheAttachmentString));
+        } else {
+            Parameter parameter_cache_attachment = msgContext
+                    .getParameter(Constants.Configuration.CACHE_ATTACHMENTS);
+            cacheAttachmentString =
+                    (parameter_cache_attachment != null) ? (String) parameter_cache_attachment
+                            .getValue()
+                            : null;
+        }
+        fileCacheForAttachments = (Constants.VALUE_TRUE
+                .equals(cacheAttachmentString));
+        return fileCacheForAttachments;
     }
 
     public static Attachments createAttachments(MessageContext msgContext, 

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=637619&r1=637618&r2=637619&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 Sun Mar 16 10:59:30 2008
@@ -479,7 +479,7 @@
            }
            
        	Attachments attachments = msgContext.getAttachmentMap();
-           if (attachments != null) {
+           if (attachments != null && BuilderUtil.isAttachmentsCacheEnabled(msgContext)) {
                String [] keys = attachments.getAllContentIDs(); 
                if (keys != null) {
                	String key = null;



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org