MNG-5670 guard against ConcurrentModificationException iterating over System properties

Signed-off-by: Igor Fedorenko <ifedorenko@apache.org>
This commit is contained in:
Igor Fedorenko 2014-07-30 07:28:12 +04:00
parent 61c3740425
commit e3000a09c9
1 changed files with 6 additions and 1 deletions

View File

@ -126,7 +126,12 @@ public final class MavenRepositorySystemUtils
session.setArtifactDescriptorPolicy( new SimpleArtifactDescriptorPolicy( true, true ) );
Properties sysProps = System.getProperties();
// MNG-5670 guard against ConcurrentModificationException
Properties sysProps = new Properties();
for ( String key : System.getProperties().stringPropertyNames() )
{
sysProps.put( key, System.getProperty( key ) );
}
session.setSystemProperties( sysProps );
session.setConfigProperties( sysProps );