activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject activemq-artemis git commit: ARTEMIS-962 Fix CME when parsing system properties
Date Wed, 18 Jan 2017 15:24:46 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/1.x 52d03c885 -> 59f20d752


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


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/59f20d75
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/59f20d75
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/59f20d75

Branch: refs/heads/1.x
Commit: 59f20d752a23fb8422f4305b999b994cc10afaff
Parents: 52d03c8
Author: Jeff Mesnil <jmesnil@gmail.com>
Authored: Wed Jan 18 15:56:35 2017 +0100
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Wed Jan 18 10:24:06 2017 -0500

----------------------------------------------------------------------
 .../core/config/impl/ConfigurationImpl.java     | 25 ++++++++++----------
 1 file changed, 13 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/59f20d75/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java
b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java
index e318874..a59d1a2 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java
@@ -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<>();
+
+         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());
+            }
+         }
 
-      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());
+         if (!beanProperties.isEmpty()) {
+            BeanSupport.setData(this, beanProperties);
          }
-      }
 
-      if (!beanProperties.isEmpty()) {
-         BeanSupport.setData(this, beanProperties);
+         return this;
       }
-
-      return this;
    }
 
    @Override


Mime
View raw message