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 "Rich Scheuerle (JIRA)" <ji...@apache.org> on 2007/09/06 19:36:33 UTC

[jira] Created: (AXIS2-3177) JAXWS: Concurrent Modification in Property Migrator

JAXWS: Concurrent Modification in Property Migrator
---------------------------------------------------

                 Key: AXIS2-3177
                 URL: https://issues.apache.org/jira/browse/AXIS2-3177
             Project: Axis 2.0 (Axis2)
          Issue Type: Bug
            Reporter: Rich Scheuerle
            Assignee: Rich Scheuerle


Problem: 
The code that iterates over the property keys in the JAXWS PropertyMigrator can result in a concurrent modification exception.

Solution:
Dustin Amrhein provided a simple solution to avoid the property key iterator.

The new code is:

public void migratePropertiesToMessageContext(Map<String, Object> userContext,
                                                  MessageContext messageContext) {

        // Avoid using putAll as this causes copies of the propery set
        if (userContext != null) {
            // should not use iterator here because this map may be modified
            // on different threads by the user or other JAX-WS code
            String[] keys = new String[userContext.keySet().size()];
            keys = userContext.keySet().toArray(keys);
            for(int i=0; i < keys.length; i++) {
                String key = keys[i];
                Object value = userContext.get(key);
                // Make sure mtom state in the user context, the message context, 
                // the MEP context are the same.
                if(key.equalsIgnoreCase(Constants.Configuration.ENABLE_MTOM)){
                    value = messageContext.getMessage().isMTOMEnabled();
                    messageContext.getMEPContext().put(key, value);
                }
                messageContext.setProperty(key, value);
            }
        }
    }

I will commit this change after I complete testing.

-- 
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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Resolved: (AXIS2-3177) JAXWS: Concurrent Modification in Property Migrator

Posted by "Rich Scheuerle (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rich Scheuerle resolved AXIS2-3177.
-----------------------------------

    Resolution: Fixed

Committed 573327

> JAXWS: Concurrent Modification in Property Migrator
> ---------------------------------------------------
>
>                 Key: AXIS2-3177
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3177
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>            Reporter: Rich Scheuerle
>            Assignee: Rich Scheuerle
>
> Problem: 
> The code that iterates over the property keys in the JAXWS PropertyMigrator can result in a concurrent modification exception.
> Solution:
> Dustin Amrhein provided a simple solution to avoid the property key iterator.
> The new code is:
> public void migratePropertiesToMessageContext(Map<String, Object> userContext,
>                                                   MessageContext messageContext) {
>         // Avoid using putAll as this causes copies of the propery set
>         if (userContext != null) {
>             // should not use iterator here because this map may be modified
>             // on different threads by the user or other JAX-WS code
>             String[] keys = new String[userContext.keySet().size()];
>             keys = userContext.keySet().toArray(keys);
>             for(int i=0; i < keys.length; i++) {
>                 String key = keys[i];
>                 Object value = userContext.get(key);
>                 // Make sure mtom state in the user context, the message context, 
>                 // the MEP context are the same.
>                 if(key.equalsIgnoreCase(Constants.Configuration.ENABLE_MTOM)){
>                     value = messageContext.getMessage().isMTOMEnabled();
>                     messageContext.getMEPContext().put(key, value);
>                 }
>                 messageContext.setProperty(key, value);
>             }
>         }
>     }
> I will commit this change after I complete testing.

-- 
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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


[jira] Updated: (AXIS2-3177) JAXWS: Concurrent Modification in Property Migrator

Posted by "Rich Scheuerle (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/AXIS2-3177?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rich Scheuerle updated AXIS2-3177:
----------------------------------

    Component/s: jaxws

> JAXWS: Concurrent Modification in Property Migrator
> ---------------------------------------------------
>
>                 Key: AXIS2-3177
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3177
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: jaxws
>            Reporter: Rich Scheuerle
>            Assignee: Rich Scheuerle
>
> Problem: 
> The code that iterates over the property keys in the JAXWS PropertyMigrator can result in a concurrent modification exception.
> Solution:
> Dustin Amrhein provided a simple solution to avoid the property key iterator.
> The new code is:
> public void migratePropertiesToMessageContext(Map<String, Object> userContext,
>                                                   MessageContext messageContext) {
>         // Avoid using putAll as this causes copies of the propery set
>         if (userContext != null) {
>             // should not use iterator here because this map may be modified
>             // on different threads by the user or other JAX-WS code
>             String[] keys = new String[userContext.keySet().size()];
>             keys = userContext.keySet().toArray(keys);
>             for(int i=0; i < keys.length; i++) {
>                 String key = keys[i];
>                 Object value = userContext.get(key);
>                 // Make sure mtom state in the user context, the message context, 
>                 // the MEP context are the same.
>                 if(key.equalsIgnoreCase(Constants.Configuration.ENABLE_MTOM)){
>                     value = messageContext.getMessage().isMTOMEnabled();
>                     messageContext.getMEPContext().put(key, value);
>                 }
>                 messageContext.setProperty(key, value);
>             }
>         }
>     }
> I will commit this change after I complete testing.

-- 
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: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org