openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgras...@apache.org
Subject svn commit: r1764316 - /openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java
Date Tue, 11 Oct 2016 18:30:19 GMT
Author: jgrassel
Date: Tue Oct 11 18:30:19 2016
New Revision: 1764316

URL: http://svn.apache.org/viewvc?rev=1764316&view=rev
Log:
OPENJPA-2672: ConfigurationImpl.loadGlobals() has java.util.ConcurrentModificationException
vulnerability

Modified:
    openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java

Modified: openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java?rev=1764316&r1=1764315&r2=1764316&view=diff
==============================================================================
--- openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java
(original)
+++ openjpa/trunk/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java
Tue Oct 11 18:30:19 2016
@@ -187,9 +187,14 @@ public class ConfigurationImpl
 
         // let system properties override other globals
         try {
-            fromProperties(new HashMap(
-                AccessController.doPrivileged(
-                    J2DoPrivHelper.getPropertiesAction())));
+            Properties systemProperties = AccessController.doPrivileged(
+                    J2DoPrivHelper.getPropertiesAction());
+            HashMap sysPropHM = null;
+            synchronized(systemProperties) {
+                // Prevent concurrent modification of systemProperties until HashMap ctor
is completed.
+                sysPropHM = new HashMap(systemProperties);
+            }
+            fromProperties(sysPropHM);
         } catch (SecurityException se) {
             // security manager might disallow
         }



Mime
View raw message