You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2021/03/03 20:48:58 UTC
[maven-surefire] branch master updated: refactoring in
SurefireProperties.java
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
The following commit(s) were added to refs/heads/master by this push:
new 34dd786 refactoring in SurefireProperties.java
34dd786 is described below
commit 34dd7861fcacaf1cc78c4e7d0526c3561aa84bf3
Author: tibordigana <ti...@gmail.com>
AuthorDate: Wed Mar 3 21:48:46 2021 +0100
refactoring in SurefireProperties.java
---
.../apache/maven/plugin/surefire/SurefireProperties.java | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java
index cd2f91f..8762c31 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java
@@ -38,6 +38,7 @@ import org.apache.maven.surefire.booter.KeyValueSource;
import org.apache.maven.surefire.shared.utils.StringUtils;
import static java.util.Arrays.asList;
+import static java.util.Map.Entry;
/**
* A properties implementation that preserves insertion order.
@@ -74,7 +75,7 @@ public class SurefireProperties
@Override
public synchronized void putAll( Map<?, ?> t )
{
- for ( Map.Entry<?, ?> entry : t.entrySet() )
+ for ( Entry<?, ?> entry : t.entrySet() )
{
put( entry.getKey(), entry.getValue() );
}
@@ -117,7 +118,6 @@ public class SurefireProperties
public Iterable<Object> getStringKeySet()
{
- //noinspection unchecked
return keySet();
}
@@ -126,6 +126,7 @@ public class SurefireProperties
Set<Object> result = new HashSet<>();
for ( Object key : getStringKeySet() )
{
+ //noinspection SuspiciousMethodCalls
if ( KEYS_THAT_CANNOT_BE_USED_AS_SYSTEM_PROPERTIES.contains( key ) )
{
result.add( key );
@@ -136,13 +137,10 @@ public class SurefireProperties
public void copyToSystemProperties()
{
-
- //noinspection unchecked
for ( Object o : items )
{
String key = (String) o;
String value = getProperty( key );
-
System.setProperty( key, value );
}
}
@@ -167,15 +165,11 @@ public class SurefireProperties
return result;
}
- public static void copyProperties( Properties target, Map<String, String> source )
+ private static void copyProperties( Properties target, Map<String, String> source )
{
if ( source != null )
{
- for ( String key : source.keySet() )
- {
- String value = source.get( key );
- target.setProperty( key, value == null ? "" : value );
- }
+ target.putAll( source );
}
}