ARTEMIS-962 Fix CME when parsing system properties

Add synchronized block against the properties before iterating on them.

JIRA: https://issues.apache.org/jira/browse/ARTEMIS-926
(cherry picked from commit 5ae47e8c3c4cd17ca6abc75e72be0338b0ceaf96)

This closes #969
This commit is contained in:
Jeff Mesnil 2017-01-18 15:56:35 +01:00 committed by Clebert Suconic
parent 52d03c885c
commit 59f20d752a

View File

@ -302,22 +302,23 @@ public class ConfigurationImpl implements Configuration, Serializable {
@Override
public Configuration parseSystemProperties(Properties properties) throws Exception {
synchronized (properties) {
Map<String, Object> beanProperties = new HashMap<>();
Map<String, Object> beanProperties = new HashMap<>();
for (Map.Entry<Object, Object> entry : properties.entrySet()) {
if (entry.getKey().toString().startsWith(systemPropertyPrefix)) {
String key = entry.getKey().toString().substring(systemPropertyPrefix.length());
logger.debug("Setting up config, " + key + "=" + entry.getValue());
beanProperties.put(key, entry.getValue());
for (Map.Entry<Object, Object> entry : properties.entrySet()) {
if (entry.getKey().toString().startsWith(systemPropertyPrefix)) {
String key = entry.getKey().toString().substring(systemPropertyPrefix.length());
logger.debug("Setting up config, " + key + "=" + entry.getValue());
beanProperties.put(key, entry.getValue());
}
}
}
if (!beanProperties.isEmpty()) {
BeanSupport.setData(this, beanProperties);
}
if (!beanProperties.isEmpty()) {
BeanSupport.setData(this, beanProperties);
}
return this;
return this;
}
}
@Override