Repository: maven Updated Branches: refs/heads/master 8fe10c341 -> d8e3585e0
[MNG-6105] properties.internal.SystemProperties.addSystemProperties() is not really thread-safe If a property is concurrently removed from System.getProperties(), we shouldn't try to insert 'null' since this is not allowed by Properties: adding a null-check. Project: http://git-wip-us.apache.org/repos/asf/maven/repo Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/d8e3585e Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/d8e3585e Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/d8e3585e Branch: refs/heads/master Commit: d8e3585e051db0293ddd41c781b39e0bf9ce350b Parents: 8fe10c3 Author: Guillaume Boué <gb...@apache.org> Authored: Thu Oct 13 23:28:16 2016 +0200 Committer: Guillaume Boué <gb...@apache.org> Committed: Thu Oct 13 23:28:16 2016 +0200 ---------------------------------------------------------------------- .../apache/maven/properties/internal/SystemProperties.java | 7 ++++++- .../settings/building/DefaultSettingsBuildingRequest.java | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven/blob/d8e3585e/maven-core/src/main/java/org/apache/maven/properties/internal/SystemProperties.java ---------------------------------------------------------------------- diff --git a/maven-core/src/main/java/org/apache/maven/properties/internal/SystemProperties.java b/maven-core/src/main/java/org/apache/maven/properties/internal/SystemProperties.java index 0372558..0a77376 100644 --- a/maven-core/src/main/java/org/apache/maven/properties/internal/SystemProperties.java +++ b/maven-core/src/main/java/org/apache/maven/properties/internal/SystemProperties.java @@ -35,7 +35,12 @@ public class SystemProperties { for ( String key : System.getProperties().stringPropertyNames() ) { - props.put( key, System.getProperty( key ) ); + String value = System.getProperty( key ); + // could be null if another thread concurrently removed this key (MNG-6105) + if ( value != null ) + { + props.put( key, value ); + } } } http://git-wip-us.apache.org/repos/asf/maven/blob/d8e3585e/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingRequest.java ---------------------------------------------------------------------- diff --git a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingRequest.java b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingRequest.java index 5a4824e..d917a9c 100644 --- a/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingRequest.java +++ b/maven-settings-builder/src/main/java/org/apache/maven/settings/building/DefaultSettingsBuildingRequest.java @@ -119,7 +119,12 @@ public class DefaultSettingsBuildingRequest // MNG-5670 guard against ConcurrentModificationException for ( String key : System.getProperties().stringPropertyNames() ) { - this.systemProperties.put( key, System.getProperty( key ) ); + String value = System.getProperty( key ); + // could be null if another thread concurrently removed this key (MNG-6105) + if ( value != null ) + { + this.systemProperties.put( key, value ); + } } } else