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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to