Re: [mule-scm] [mule] [15903] branches/mule-2.2.x/core/src/main/java/org/mule: The return value for removeProperty() is misleading now that some of the properties are read-only

View: New views
2 Messages — Rating Filter:   Alert me  

Parent Message unknown Re: [mule-scm] [mule] [15903] branches/mule-2.2.x/core/src/main/java/org/mule: The return value for removeProperty() is misleading now that some of the properties are read-only

by Daniel Feist :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

We should avoid making internal API changes in a bug-fix release as much as possible and definitely not make external API changes . Does MessageAdaptor count as external API? My assumption is that it does..

Can we leave this for 3.x?

Dan


On Oct 28, 2009, at 9:18 AM, tcarlson@... wrote:

Diff

Modified: branches/mule-2.2.x/core/src/main/java/org/mule/DefaultMuleMessage.java (15902 => 15903)

--- branches/mule-2.2.x/core/src/main/java/org/mule/DefaultMuleMessage.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/core/src/main/java/org/mule/DefaultMuleMessage.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -293,15 +293,15 @@
     }
 
     /** {@inheritDoc} */
-    public Object removeProperty(String key)
+    public void removeProperty(String key)
     {
-        return adapter.removeProperty(key);
+        adapter.removeProperty(key);
     }
 
     /** {@inheritDoc} */
-    public Object removeProperty(String key, PropertyScope scope)
+    public void removeProperty(String key, PropertyScope scope)
     {
-        return adapter.removeProperty(key, scope);
+        adapter.removeProperty(key, scope);
     }
 
     /** {@inheritDoc} */

Modified: branches/mule-2.2.x/core/src/main/java/org/mule/MuleSessionHandler.java (15902 => 15903)

--- branches/mule-2.2.x/core/src/main/java/org/mule/MuleSessionHandler.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/core/src/main/java/org/mule/MuleSessionHandler.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -39,7 +39,8 @@
     public MuleSession retrieveSessionInfoFromMessage(MuleMessage message) throws MuleException
     {
         MuleSession session = null;
-        byte[] serializedSession = (byte[]) message.removeProperty(MuleProperties.MULE_SESSION_PROPERTY);
+        byte[] serializedSession = (byte[]) message.getProperty(MuleProperties.MULE_SESSION_PROPERTY);
+        message.removeProperty(MuleProperties.MULE_SESSION_PROPERTY);
 
         if (serializedSession != null)
         {

Modified: branches/mule-2.2.x/core/src/main/java/org/mule/api/transport/MessageAdapter.java (15902 => 15903)

--- branches/mule-2.2.x/core/src/main/java/org/mule/api/transport/MessageAdapter.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/core/src/main/java/org/mule/api/transport/MessageAdapter.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -75,18 +75,16 @@
      * Removes a property on this message
      * 
      * @param key the property key to remove
-     * @return the removed property value or null if the property did not exist
      */
-    Object removeProperty(String key);
+    void removeProperty(String key);
 
     /**
      * Removes a property on this message from the specified scope only.
      * 
      * @param key the property key to remove
      * @param scope The scope at which to set the property at
-     * @return the removed property value or null if the property did not exist
      */
-    Object removeProperty(String key, PropertyScope scope);
+    void removeProperty(String key, PropertyScope scope);
 
     /**
      * @return all property keys on this message

Modified: branches/mule-2.2.x/core/src/main/java/org/mule/model/resolvers/MethodHeaderPropertyEntryPointResolver.java (15902 => 15903)

--- branches/mule-2.2.x/core/src/main/java/org/mule/model/resolvers/MethodHeaderPropertyEntryPointResolver.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/core/src/main/java/org/mule/model/resolvers/MethodHeaderPropertyEntryPointResolver.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -43,8 +43,9 @@
     {
         //TODO: RM* This is a hack that can be fixed by introducing property scoping on the message
         // Transports such as SOAP need to ignore the method property
-        boolean ignoreMethod = BooleanUtils.toBoolean((Boolean) context.getMessage().removeProperty(
-                MuleProperties.MULE_IGNORE_METHOD_PROPERTY));
+        boolean ignoreMethod = 
+            BooleanUtils.toBoolean((Boolean) context.getMessage().getProperty(MuleProperties.MULE_IGNORE_METHOD_PROPERTY));
+        context.getMessage().removeProperty(MuleProperties.MULE_IGNORE_METHOD_PROPERTY);
 
         if (ignoreMethod)
         {
@@ -55,9 +56,10 @@
         }
 
         //TODO: with scoped properties we wouldn't need to remove the property here
-        Object methodProp = context.getMessage().removeProperty(getMethodProperty());
+        Object methodProp = context.getMessage().getProperty(getMethodProperty());
         if (methodProp == null)
         {
+            context.getMessage().removeProperty(getMethodProperty());
             InvocationResult result = new InvocationResult(InvocationResult.STATE_INVOKED_FAILED);
             // no method for the explicit method header
             result.setErrorMessage(CoreMessages.propertyIsNotSetOnEvent(getMethodProperty()).toString());

Modified: branches/mule-2.2.x/core/src/main/java/org/mule/routing/outbound/StaticRecipientList.java (15902 => 15903)

--- branches/mule-2.2.x/core/src/main/java/org/mule/routing/outbound/StaticRecipientList.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/core/src/main/java/org/mule/routing/outbound/StaticRecipientList.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -35,7 +35,8 @@
 
     protected List getRecipients(MuleMessage message)
     {
-        Object msgRecipients = message.removeProperty(RECIPIENTS_PROPERTY);
+        Object msgRecipients = message.getProperty(RECIPIENTS_PROPERTY);
+        message.removeProperty(RECIPIENTS_PROPERTY);
 
         if (msgRecipients == null)
         {

Modified: branches/mule-2.2.x/core/src/main/java/org/mule/transport/AbstractMessageAdapter.java (15902 => 15903)

--- branches/mule-2.2.x/core/src/main/java/org/mule/transport/AbstractMessageAdapter.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/core/src/main/java/org/mule/transport/AbstractMessageAdapter.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -212,17 +212,17 @@
     }
 
     /** {@inheritDoc} */
-    public Object removeProperty(String key)
+    public void removeProperty(String key)
     {
         assertAccess(WRITE);
-        return properties.removeProperty(key);
+        properties.removeProperty(key);
     }
 
     /** {@inheritDoc} */
-    public Object removeProperty(String key, PropertyScope scope)
+    public void removeProperty(String key, PropertyScope scope)
     {
         assertAccess(WRITE);
-        return properties.removeProperty(key, scope);
+        properties.removeProperty(key, scope);
     }
 
     /** {@inheritDoc} */

Modified: branches/mule-2.2.x/core/src/main/java/org/mule/transport/MessagePropertiesContext.java (15902 => 15903)

--- branches/mule-2.2.x/core/src/main/java/org/mule/transport/MessagePropertiesContext.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/core/src/main/java/org/mule/transport/MessagePropertiesContext.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -245,18 +245,10 @@
      * You may explicitly remove a session property by calling removeProperty(key, PropertyScope.SESSION)
      *
      * @param key the property key to remove
-     * @return the removed property value or null if the property did not exist
      */
-    public Object removeProperty(String key)
+    public void removeProperty(String key)
     {
-        Object value = getScopedProperties(PropertyScope.OUTBOUND).remove(key);
-        Object inv = getScopedProperties(PropertyScope.INVOCATION).remove(key);
-    
-        keySet.remove(key);
-      
-        if (value == null) value = inv;
-        
-        return value;
+        removeProperty(key, null);
     }
 
     /**
@@ -265,25 +257,22 @@
      * @param key the property key to remove
      * @return the removed property value or null if the property did not exist
      */
-    public Object removeProperty(String key, PropertyScope scope)
+    public void removeProperty(String key, PropertyScope scope)
     {
         if (scope == null)
         {
-            return removeProperty(key);
+            // Remove from all read/write scopes
+            getScopedProperties(PropertyScope.OUTBOUND).remove(key);
+            getScopedProperties(PropertyScope.INVOCATION).remove(key);
         }
         
-        Object value = null;
-        if (PropertyScope.SESSION.equals(scope))
+        else if (PropertyScope.SESSION.equals(scope))
         {
             if (RequestContext.getEvent() != null)
             {
-                value = RequestContext.getEvent().getSession().removeProperty(key);
+                RequestContext.getEvent().getSession().removeProperty(key);
             }
         }
-        else
-        {
-            value = getScopedProperties(scope).remove(key);
-        }
 
         // Only remove the property from the keySet if it does not exist in any other scope besides this one.
         if (getProperty(key, PropertyScope.OUTBOUND) == null 
@@ -292,8 +281,6 @@
         {
             keySet.remove(key);
         }
-        
-        return value;
     }
 
     /**

Modified: branches/mule-2.2.x/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisMessageDispatcher.java (15902 => 15903)

--- branches/mule-2.2.x/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisMessageDispatcher.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisMessageDispatcher.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -524,15 +524,14 @@
             }
         }
 
-        SoapMethod soapMethod = (SoapMethod)event.getMessage()
-            .removeProperty(MuleProperties.MULE_SOAP_METHOD);
+        SoapMethod soapMethod = (SoapMethod)event.getMessage().getProperty(MuleProperties.MULE_SOAP_METHOD);
         if (soapMethod == null)
         {
             soapMethod = (SoapMethod)callParameters.get(method.getLocalPart());
         }
-
-        if (soapMethod != null)
+        else
         {
+	        event.getMessage().removeProperty(MuleProperties.MULE_SOAP_METHOD);
             for (Iterator iterator = soapMethod.getNamedParameters().iterator(); iterator.hasNext();)
             {
                 NamedParameter parameter = (NamedParameter)iterator.next();

Modified: branches/mule-2.2.x/transports/http/src/main/java/org/mule/transport/http/HttpClientMessageDispatcher.java (15902 => 15903)

--- branches/mule-2.2.x/transports/http/src/main/java/org/mule/transport/http/HttpClientMessageDispatcher.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/transports/http/src/main/java/org/mule/transport/http/HttpClientMessageDispatcher.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -142,8 +142,10 @@
     {
         MuleMessage msg = event.getMessage();
 
-        Object cookiesProperty = msg.removeProperty(HttpConnector.HTTP_COOKIES_PROPERTY);
-        String cookieSpecProperty = (String) msg.removeProperty(HttpConnector.HTTP_COOKIE_SPEC_PROPERTY);
+        Object cookiesProperty = msg.getProperty(HttpConnector.HTTP_COOKIES_PROPERTY);
+        msg.removeProperty(HttpConnector.HTTP_COOKIES_PROPERTY);
+        String cookieSpecProperty = (String) msg.getProperty(HttpConnector.HTTP_COOKIE_SPEC_PROPERTY);
+        msg.removeProperty(HttpConnector.HTTP_COOKIE_SPEC_PROPERTY);
         processCookies(cookiesProperty, cookieSpecProperty, event);
 
         cookiesProperty = endpoint.getProperty(HttpConnector.HTTP_COOKIES_PROPERTY);

Modified: branches/mule-2.2.x/transports/http/src/main/java/org/mule/transport/http/transformers/ObjectToHttpClientMethodRequest.java (15902 => 15903)

--- branches/mule-2.2.x/transports/http/src/main/java/org/mule/transport/http/transformers/ObjectToHttpClientMethodRequest.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/transports/http/src/main/java/org/mule/transport/http/transformers/ObjectToHttpClientMethodRequest.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -258,9 +258,10 @@
             }
 
             // Allow the user to set HttpMethodParams as an object on the message
-            HttpMethodParams params = (HttpMethodParams) msg.removeProperty(HttpConnector.HTTP_PARAMS_PROPERTY);
+            HttpMethodParams params = (HttpMethodParams) msg.getProperty(HttpConnector.HTTP_PARAMS_PROPERTY);
             if (params != null)
             {
+	            msg.removeProperty(HttpConnector.HTTP_PARAMS_PROPERTY);
                 httpMethod.setParams(params);
             }
             else

Modified: branches/mule-2.2.x/transports/jms/src/main/java/org/mule/transport/jms/JmsMessageDispatcher.java (15902 => 15903)

--- branches/mule-2.2.x/transports/jms/src/main/java/org/mule/transport/jms/JmsMessageDispatcher.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/transports/jms/src/main/java/org/mule/transport/jms/JmsMessageDispatcher.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -191,9 +191,12 @@
             processMessage(msg, event);
 
             // QoS support
-            String ttlString = (String) eventMsg.removeProperty(JmsConstants.TIME_TO_LIVE_PROPERTY);
-            String priorityString = (String) eventMsg.removeProperty(JmsConstants.PRIORITY_PROPERTY);
-            String persistentDeliveryString = (String) eventMsg.removeProperty(JmsConstants.PERSISTENT_DELIVERY_PROPERTY);
+            String ttlString = (String) eventMsg.getProperty(JmsConstants.TIME_TO_LIVE_PROPERTY);
+            eventMsg.removeProperty(JmsConstants.TIME_TO_LIVE_PROPERTY);
+            String priorityString = (String) eventMsg.getProperty(JmsConstants.PRIORITY_PROPERTY);
+            eventMsg.removeProperty(JmsConstants.PRIORITY_PROPERTY);
+            String persistentDeliveryString = (String) eventMsg.getProperty(JmsConstants.PERSISTENT_DELIVERY_PROPERTY);
+            eventMsg.removeProperty(JmsConstants.PERSISTENT_DELIVERY_PROPERTY);
 
             long ttl = StringUtils.isNotBlank(ttlString)
                     ? NumberUtils.toLong(ttlString)
@@ -441,13 +444,15 @@
         if (isHandleReplyTo(message, event))
         {
 
-            Object tempReplyTo = event.getMessage().removeProperty(JmsConstants.JMS_REPLY_TO);
+            Object tempReplyTo = event.getMessage().getProperty(JmsConstants.JMS_REPLY_TO);
+            event.getMessage().removeProperty(JmsConstants.JMS_REPLY_TO);
             if (tempReplyTo == null)
             {
                 //It may be a Mule URI or global endpoint Ref
-                tempReplyTo = event.getMessage().removeProperty(MuleProperties.MULE_REPLY_TO_PROPERTY);
+                tempReplyTo = event.getMessage().getProperty(MuleProperties.MULE_REPLY_TO_PROPERTY);
                 if (tempReplyTo != null)
                 {
+	                event.getMessage().removeProperty(MuleProperties.MULE_REPLY_TO_PROPERTY);
                     int i = tempReplyTo.toString().indexOf("://");
                     if(i > -1)
                     {

Modified: branches/mule-2.2.x/transports/jms/src/main/java/org/mule/transport/jms/JmsReplyToHandler.java (15902 => 15903)

--- branches/mule-2.2.x/transports/jms/src/main/java/org/mule/transport/jms/JmsReplyToHandler.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/transports/jms/src/main/java/org/mule/transport/jms/JmsReplyToHandler.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -114,9 +114,12 @@
 
             // QoS support
             MuleMessage eventMsg = event.getMessage();
-            String ttlString = (String)eventMsg.removeProperty(JmsConstants.TIME_TO_LIVE_PROPERTY);
-            String priorityString = (String)eventMsg.removeProperty(JmsConstants.PRIORITY_PROPERTY);
-            String persistentDeliveryString = (String)eventMsg.removeProperty(JmsConstants.PERSISTENT_DELIVERY_PROPERTY);
+            String ttlString = (String)eventMsg.getProperty(JmsConstants.TIME_TO_LIVE_PROPERTY);
+            eventMsg.removeProperty(JmsConstants.TIME_TO_LIVE_PROPERTY);
+            String priorityString = (String)eventMsg.getProperty(JmsConstants.PRIORITY_PROPERTY);
+            eventMsg.removeProperty(JmsConstants.PRIORITY_PROPERTY);
+            String persistentDeliveryString = (String)eventMsg.getProperty(JmsConstants.PERSISTENT_DELIVERY_PROPERTY);
+            eventMsg.removeProperty(JmsConstants.PERSISTENT_DELIVERY_PROPERTY);
 
             String correlationIDString = replyToMessage.getJMSCorrelationID();
             if (StringUtils.isBlank(correlationIDString))

Modified: branches/mule-2.2.x/transports/rmi/src/main/java/org/mule/transport/rmi/RmiConnector.java (15902 => 15903)

--- branches/mule-2.2.x/transports/rmi/src/main/java/org/mule/transport/rmi/RmiConnector.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/transports/rmi/src/main/java/org/mule/transport/rmi/RmiConnector.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -205,7 +205,8 @@
 
         if (null == methodName)
         {
-            methodName = (String)event.getMessage().removeProperty(MuleProperties.MULE_METHOD_PROPERTY);
+            methodName = (String)event.getMessage().getProperty(MuleProperties.MULE_METHOD_PROPERTY);
+            event.getMessage().removeProperty(MuleProperties.MULE_METHOD_PROPERTY);
 
             if (null == methodName)
             {


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email



Re: [mule-scm] [mule] [15903] branches/mule-2.2.x/core/src/main/java/org/mule: The return value for removeProperty() is misleading now that some of the properties are read-only

by Travis Carlson-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yeah, I'll roll it back, it caused regressions in CXF anyways.  
I wanted to make the method @deprecated, but since the only thing changed is the return type, I don't think there's a way to do that.  

Travis

On 28 Oct 2009, at 10:43, Daniel Feist wrote:

We should avoid making internal API changes in a bug-fix release as much as possible and definitely not make external API changes . Does MessageAdaptor count as external API? My assumption is that it does..

Can we leave this for 3.x?

Dan


On Oct 28, 2009, at 9:18 AM, tcarlson@... wrote:

Diff

Modified: branches/mule-2.2.x/core/src/main/java/org/mule/DefaultMuleMessage.java (15902 => 15903)

--- branches/mule-2.2.x/core/src/main/java/org/mule/DefaultMuleMessage.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/core/src/main/java/org/mule/DefaultMuleMessage.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -293,15 +293,15 @@
     }
 
     /** {@inheritDoc} */
-    public Object removeProperty(String key)
+    public void removeProperty(String key)
     {
-        return adapter.removeProperty(key);
+        adapter.removeProperty(key);
     }
 
     /** {@inheritDoc} */
-    public Object removeProperty(String key, PropertyScope scope)
+    public void removeProperty(String key, PropertyScope scope)
     {
-        return adapter.removeProperty(key, scope);
+        adapter.removeProperty(key, scope);
     }
 
     /** {@inheritDoc} */

Modified: branches/mule-2.2.x/core/src/main/java/org/mule/MuleSessionHandler.java (15902 => 15903)

--- branches/mule-2.2.x/core/src/main/java/org/mule/MuleSessionHandler.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/core/src/main/java/org/mule/MuleSessionHandler.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -39,7 +39,8 @@
     public MuleSession retrieveSessionInfoFromMessage(MuleMessage message) throws MuleException
     {
         MuleSession session = null;
-        byte[] serializedSession = (byte[]) message.removeProperty(MuleProperties.MULE_SESSION_PROPERTY);
+        byte[] serializedSession = (byte[]) message.getProperty(MuleProperties.MULE_SESSION_PROPERTY);
+        message.removeProperty(MuleProperties.MULE_SESSION_PROPERTY);
 
         if (serializedSession != null)
         {

Modified: branches/mule-2.2.x/core/src/main/java/org/mule/api/transport/MessageAdapter.java (15902 => 15903)

--- branches/mule-2.2.x/core/src/main/java/org/mule/api/transport/MessageAdapter.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/core/src/main/java/org/mule/api/transport/MessageAdapter.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -75,18 +75,16 @@
      * Removes a property on this message
      * 
      * @param key the property key to remove
-     * @return the removed property value or null if the property did not exist
      */
-    Object removeProperty(String key);
+    void removeProperty(String key);
 
     /**
      * Removes a property on this message from the specified scope only.
      * 
      * @param key the property key to remove
      * @param scope The scope at which to set the property at
-     * @return the removed property value or null if the property did not exist
      */
-    Object removeProperty(String key, PropertyScope scope);
+    void removeProperty(String key, PropertyScope scope);
 
     /**
      * @return all property keys on this message

Modified: branches/mule-2.2.x/core/src/main/java/org/mule/model/resolvers/MethodHeaderPropertyEntryPointResolver.java (15902 => 15903)

--- branches/mule-2.2.x/core/src/main/java/org/mule/model/resolvers/MethodHeaderPropertyEntryPointResolver.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/core/src/main/java/org/mule/model/resolvers/MethodHeaderPropertyEntryPointResolver.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -43,8 +43,9 @@
     {
         //TODO: RM* This is a hack that can be fixed by introducing property scoping on the message
         // Transports such as SOAP need to ignore the method property
-        boolean ignoreMethod = BooleanUtils.toBoolean((Boolean) context.getMessage().removeProperty(
-                MuleProperties.MULE_IGNORE_METHOD_PROPERTY));
+        boolean ignoreMethod = 
+            BooleanUtils.toBoolean((Boolean) context.getMessage().getProperty(MuleProperties.MULE_IGNORE_METHOD_PROPERTY));
+        context.getMessage().removeProperty(MuleProperties.MULE_IGNORE_METHOD_PROPERTY);
 
         if (ignoreMethod)
         {
@@ -55,9 +56,10 @@
         }
 
         //TODO: with scoped properties we wouldn't need to remove the property here
-        Object methodProp = context.getMessage().removeProperty(getMethodProperty());
+        Object methodProp = context.getMessage().getProperty(getMethodProperty());
         if (methodProp == null)
         {
+            context.getMessage().removeProperty(getMethodProperty());
             InvocationResult result = new InvocationResult(InvocationResult.STATE_INVOKED_FAILED);
             // no method for the explicit method header
             result.setErrorMessage(CoreMessages.propertyIsNotSetOnEvent(getMethodProperty()).toString());

Modified: branches/mule-2.2.x/core/src/main/java/org/mule/routing/outbound/StaticRecipientList.java (15902 => 15903)

--- branches/mule-2.2.x/core/src/main/java/org/mule/routing/outbound/StaticRecipientList.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/core/src/main/java/org/mule/routing/outbound/StaticRecipientList.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -35,7 +35,8 @@
 
     protected List getRecipients(MuleMessage message)
     {
-        Object msgRecipients = message.removeProperty(RECIPIENTS_PROPERTY);
+        Object msgRecipients = message.getProperty(RECIPIENTS_PROPERTY);
+        message.removeProperty(RECIPIENTS_PROPERTY);
 
         if (msgRecipients == null)
         {

Modified: branches/mule-2.2.x/core/src/main/java/org/mule/transport/AbstractMessageAdapter.java (15902 => 15903)

--- branches/mule-2.2.x/core/src/main/java/org/mule/transport/AbstractMessageAdapter.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/core/src/main/java/org/mule/transport/AbstractMessageAdapter.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -212,17 +212,17 @@
     }
 
     /** {@inheritDoc} */
-    public Object removeProperty(String key)
+    public void removeProperty(String key)
     {
         assertAccess(WRITE);
-        return properties.removeProperty(key);
+        properties.removeProperty(key);
     }
 
     /** {@inheritDoc} */
-    public Object removeProperty(String key, PropertyScope scope)
+    public void removeProperty(String key, PropertyScope scope)
     {
         assertAccess(WRITE);
-        return properties.removeProperty(key, scope);
+        properties.removeProperty(key, scope);
     }
 
     /** {@inheritDoc} */

Modified: branches/mule-2.2.x/core/src/main/java/org/mule/transport/MessagePropertiesContext.java (15902 => 15903)

--- branches/mule-2.2.x/core/src/main/java/org/mule/transport/MessagePropertiesContext.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/core/src/main/java/org/mule/transport/MessagePropertiesContext.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -245,18 +245,10 @@
      * You may explicitly remove a session property by calling removeProperty(key, PropertyScope.SESSION)
      *
      * @param key the property key to remove
-     * @return the removed property value or null if the property did not exist
      */
-    public Object removeProperty(String key)
+    public void removeProperty(String key)
     {
-        Object value = getScopedProperties(PropertyScope.OUTBOUND).remove(key);
-        Object inv = getScopedProperties(PropertyScope.INVOCATION).remove(key);
-    
-        keySet.remove(key);
-      
-        if (value == null) value = inv;
-        
-        return value;
+        removeProperty(key, null);
     }
 
     /**
@@ -265,25 +257,22 @@
      * @param key the property key to remove
      * @return the removed property value or null if the property did not exist
      */
-    public Object removeProperty(String key, PropertyScope scope)
+    public void removeProperty(String key, PropertyScope scope)
     {
         if (scope == null)
         {
-            return removeProperty(key);
+            // Remove from all read/write scopes
+            getScopedProperties(PropertyScope.OUTBOUND).remove(key);
+            getScopedProperties(PropertyScope.INVOCATION).remove(key);
         }
         
-        Object value = null;
-        if (PropertyScope.SESSION.equals(scope))
+        else if (PropertyScope.SESSION.equals(scope))
         {
             if (RequestContext.getEvent() != null)
             {
-                value = RequestContext.getEvent().getSession().removeProperty(key);
+                RequestContext.getEvent().getSession().removeProperty(key);
             }
         }
-        else
-        {
-            value = getScopedProperties(scope).remove(key);
-        }
 
         // Only remove the property from the keySet if it does not exist in any other scope besides this one.
         if (getProperty(key, PropertyScope.OUTBOUND) == null 
@@ -292,8 +281,6 @@
         {
             keySet.remove(key);
         }
-        
-        return value;
     }
 
     /**

Modified: branches/mule-2.2.x/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisMessageDispatcher.java (15902 => 15903)

--- branches/mule-2.2.x/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisMessageDispatcher.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/transports/axis/src/main/java/org/mule/transport/soap/axis/AxisMessageDispatcher.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -524,15 +524,14 @@
             }
         }
 
-        SoapMethod soapMethod = (SoapMethod)event.getMessage()
-            .removeProperty(MuleProperties.MULE_SOAP_METHOD);
+        SoapMethod soapMethod = (SoapMethod)event.getMessage().getProperty(MuleProperties.MULE_SOAP_METHOD);
         if (soapMethod == null)
         {
             soapMethod = (SoapMethod)callParameters.get(method.getLocalPart());
         }
-
-        if (soapMethod != null)
+        else
         {
+	        event.getMessage().removeProperty(MuleProperties.MULE_SOAP_METHOD);
             for (Iterator iterator = soapMethod.getNamedParameters().iterator(); iterator.hasNext();)
             {
                 NamedParameter parameter = (NamedParameter)iterator.next();

Modified: branches/mule-2.2.x/transports/http/src/main/java/org/mule/transport/http/HttpClientMessageDispatcher.java (15902 => 15903)

--- branches/mule-2.2.x/transports/http/src/main/java/org/mule/transport/http/HttpClientMessageDispatcher.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/transports/http/src/main/java/org/mule/transport/http/HttpClientMessageDispatcher.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -142,8 +142,10 @@
     {
         MuleMessage msg = event.getMessage();
 
-        Object cookiesProperty = msg.removeProperty(HttpConnector.HTTP_COOKIES_PROPERTY);
-        String cookieSpecProperty = (String) msg.removeProperty(HttpConnector.HTTP_COOKIE_SPEC_PROPERTY);
+        Object cookiesProperty = msg.getProperty(HttpConnector.HTTP_COOKIES_PROPERTY);
+        msg.removeProperty(HttpConnector.HTTP_COOKIES_PROPERTY);
+        String cookieSpecProperty = (String) msg.getProperty(HttpConnector.HTTP_COOKIE_SPEC_PROPERTY);
+        msg.removeProperty(HttpConnector.HTTP_COOKIE_SPEC_PROPERTY);
         processCookies(cookiesProperty, cookieSpecProperty, event);
 
         cookiesProperty = endpoint.getProperty(HttpConnector.HTTP_COOKIES_PROPERTY);

Modified: branches/mule-2.2.x/transports/http/src/main/java/org/mule/transport/http/transformers/ObjectToHttpClientMethodRequest.java (15902 => 15903)

--- branches/mule-2.2.x/transports/http/src/main/java/org/mule/transport/http/transformers/ObjectToHttpClientMethodRequest.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/transports/http/src/main/java/org/mule/transport/http/transformers/ObjectToHttpClientMethodRequest.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -258,9 +258,10 @@
             }
 
             // Allow the user to set HttpMethodParams as an object on the message
-            HttpMethodParams params = (HttpMethodParams) msg.removeProperty(HttpConnector.HTTP_PARAMS_PROPERTY);
+            HttpMethodParams params = (HttpMethodParams) msg.getProperty(HttpConnector.HTTP_PARAMS_PROPERTY);
             if (params != null)
             {
+	            msg.removeProperty(HttpConnector.HTTP_PARAMS_PROPERTY);
                 httpMethod.setParams(params);
             }
             else

Modified: branches/mule-2.2.x/transports/jms/src/main/java/org/mule/transport/jms/JmsMessageDispatcher.java (15902 => 15903)

--- branches/mule-2.2.x/transports/jms/src/main/java/org/mule/transport/jms/JmsMessageDispatcher.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/transports/jms/src/main/java/org/mule/transport/jms/JmsMessageDispatcher.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -191,9 +191,12 @@
             processMessage(msg, event);
 
             // QoS support
-            String ttlString = (String) eventMsg.removeProperty(JmsConstants.TIME_TO_LIVE_PROPERTY);
-            String priorityString = (String) eventMsg.removeProperty(JmsConstants.PRIORITY_PROPERTY);
-            String persistentDeliveryString = (String) eventMsg.removeProperty(JmsConstants.PERSISTENT_DELIVERY_PROPERTY);
+            String ttlString = (String) eventMsg.getProperty(JmsConstants.TIME_TO_LIVE_PROPERTY);
+            eventMsg.removeProperty(JmsConstants.TIME_TO_LIVE_PROPERTY);
+            String priorityString = (String) eventMsg.getProperty(JmsConstants.PRIORITY_PROPERTY);
+            eventMsg.removeProperty(JmsConstants.PRIORITY_PROPERTY);
+            String persistentDeliveryString = (String) eventMsg.getProperty(JmsConstants.PERSISTENT_DELIVERY_PROPERTY);
+            eventMsg.removeProperty(JmsConstants.PERSISTENT_DELIVERY_PROPERTY);
 
             long ttl = StringUtils.isNotBlank(ttlString)
                     ? NumberUtils.toLong(ttlString)
@@ -441,13 +444,15 @@
         if (isHandleReplyTo(message, event))
         {
 
-            Object tempReplyTo = event.getMessage().removeProperty(JmsConstants.JMS_REPLY_TO);
+            Object tempReplyTo = event.getMessage().getProperty(JmsConstants.JMS_REPLY_TO);
+            event.getMessage().removeProperty(JmsConstants.JMS_REPLY_TO);
             if (tempReplyTo == null)
             {
                 //It may be a Mule URI or global endpoint Ref
-                tempReplyTo = event.getMessage().removeProperty(MuleProperties.MULE_REPLY_TO_PROPERTY);
+                tempReplyTo = event.getMessage().getProperty(MuleProperties.MULE_REPLY_TO_PROPERTY);
                 if (tempReplyTo != null)
                 {
+	                event.getMessage().removeProperty(MuleProperties.MULE_REPLY_TO_PROPERTY);
                     int i = tempReplyTo.toString().indexOf("://");
                     if(i > -1)
                     {

Modified: branches/mule-2.2.x/transports/jms/src/main/java/org/mule/transport/jms/JmsReplyToHandler.java (15902 => 15903)

--- branches/mule-2.2.x/transports/jms/src/main/java/org/mule/transport/jms/JmsReplyToHandler.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/transports/jms/src/main/java/org/mule/transport/jms/JmsReplyToHandler.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -114,9 +114,12 @@
 
             // QoS support
             MuleMessage eventMsg = event.getMessage();
-            String ttlString = (String)eventMsg.removeProperty(JmsConstants.TIME_TO_LIVE_PROPERTY);
-            String priorityString = (String)eventMsg.removeProperty(JmsConstants.PRIORITY_PROPERTY);
-            String persistentDeliveryString = (String)eventMsg.removeProperty(JmsConstants.PERSISTENT_DELIVERY_PROPERTY);
+            String ttlString = (String)eventMsg.getProperty(JmsConstants.TIME_TO_LIVE_PROPERTY);
+            eventMsg.removeProperty(JmsConstants.TIME_TO_LIVE_PROPERTY);
+            String priorityString = (String)eventMsg.getProperty(JmsConstants.PRIORITY_PROPERTY);
+            eventMsg.removeProperty(JmsConstants.PRIORITY_PROPERTY);
+            String persistentDeliveryString = (String)eventMsg.getProperty(JmsConstants.PERSISTENT_DELIVERY_PROPERTY);
+            eventMsg.removeProperty(JmsConstants.PERSISTENT_DELIVERY_PROPERTY);
 
             String correlationIDString = replyToMessage.getJMSCorrelationID();
             if (StringUtils.isBlank(correlationIDString))

Modified: branches/mule-2.2.x/transports/rmi/src/main/java/org/mule/transport/rmi/RmiConnector.java (15902 => 15903)

--- branches/mule-2.2.x/transports/rmi/src/main/java/org/mule/transport/rmi/RmiConnector.java	2009-10-28 10:10:10 UTC (rev 15902)
+++ branches/mule-2.2.x/transports/rmi/src/main/java/org/mule/transport/rmi/RmiConnector.java	2009-10-28 11:18:06 UTC (rev 15903)
@@ -205,7 +205,8 @@
 
         if (null == methodName)
         {
-            methodName = (String)event.getMessage().removeProperty(MuleProperties.MULE_METHOD_PROPERTY);
+            methodName = (String)event.getMessage().getProperty(MuleProperties.MULE_METHOD_PROPERTY);
+            event.getMessage().removeProperty(MuleProperties.MULE_METHOD_PROPERTY);
 
             if (null == methodName)
             {


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email