synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rod Burgett (JIRA)" <j...@apache.org>
Subject [jira] Created: (SYNAPSE-295) The clonePartially() method of org.apache.synapse.util.MessageHelper does not copy properties.
Date Wed, 07 May 2008 17:20:57 GMT
The clonePartially() method of org.apache.synapse.util.MessageHelper does not copy properties.
----------------------------------------------------------------------------------------------

                 Key: SYNAPSE-295
                 URL: https://issues.apache.org/jira/browse/SYNAPSE-295
             Project: Synapse
          Issue Type: Bug
          Components: Core
    Affects Versions: 1.1
         Environment: Windows XP
            Reporter: Rod Burgett


The clonePartially() method of org.apache.synapse.util.MessageHelper does not copy properties
to the new MessageContext.  The for-loop that walks through 'ori.getProperties().keySet()'
should be replaced with a while loop over the Iterator returned by 'ori.getPropertyNames()'.

You might expect these two iterations to be identical, especially when you see that 'getPropertyNames()'
returns 'properties.keySet().iterator()'.  But it's not that simple.  The Axis2 MessageContext
class extends AbstractContext and overrides 'getProperties()' with an implementation that
doesn't actually use the properties map.  So, 'getProperties()' and 'getPropertyNames()' work
from two different underlying maps.

The assertion in this code fragment will fail:

String key = "propKey";
MessageContext origMc = new MessageContext();
origMc.setProperty( key, "propValue" );
MessageContext newMc = MessageHelper.clonePartially( origMc );
Object result = newMc.getProperty( key );
assert( result != null );


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org


Mime
View raw message