You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by "Ruwan Linton (JIRA)" <ji...@apache.org> on 2008/05/08 06:46:55 UTC

[jira] Commented: (SYNAPSE-295) The clonePartially() method of org.apache.synapse.util.MessageHelper does not copy properties.

    [ https://issues.apache.org/jira/browse/SYNAPSE-295?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12595117#action_12595117 ] 

Ruwan Linton commented on SYNAPSE-295:
--------------------------------------

Good catch Rod, Your explanation is correct and I think this is a issue in axis2 because the getProperties should return the whole hierarchy (must include the message context properties as well). Any way getProperties is now deprecated.

Also what my intention was just to copy the message context properties in here. So getPropertyNames seems to be right function to use.

Thanks, for pointing this. Will add your reproduction code as a test case in to synapse as well.

> 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
>            Assignee: Ruwan Linton
>             Fix For: 1.2
>
>
> 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