maven-surefire-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject svn commit: r1058662 - /maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
Date Thu, 13 Jan 2011 17:01:20 GMT
Author: krosenvold
Date: Thu Jan 13 17:01:19 2011
New Revision: 1058662

URL: http://svn.apache.org/viewvc?rev=1058662&view=rev
Log:
[SUREFIRE-684] Avoid code duplication

Patch by Stefan Birkner. Applied unmodified

Modified:
    maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java

Modified: maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
URL: http://svn.apache.org/viewvc/maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java?rev=1058662&r1=1058661&r2=1058662&view=diff
==============================================================================
--- maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
(original)
+++ maven/surefire/trunk/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
Thu Jan 13 17:01:19 2011
@@ -712,15 +712,7 @@ public abstract class AbstractSurefireMo
 
     protected void processSystemProperties( boolean setInSystem )
     {
-        if ( this.getSystemProperties() != null )
-        {
-            for ( Iterator i = getSystemProperties().keySet().iterator(); i.hasNext(); )
-            {
-                String key = (String) i.next();
-                String value = (String) getSystemProperties().get( key );
-                getInternalSystemProperties().setProperty( key, value );
-            }
-        }
+    	copyPropertiesToInternalSystemProperties( getSystemProperties() );
 
         if ( this.getSystemPropertyVariables() != null )
         {
@@ -743,17 +735,10 @@ public abstract class AbstractSurefireMo
         // Not gonna do THAT any more... instead, we only propagate those system properties
         // that have been explicitly specified by the user via -Dkey=value on the CLI
 
-        Properties userProperties = getUserProperties();
-        for ( Iterator it = userProperties.keySet().iterator(); it.hasNext(); )
-        {
-            String key = (String) it.next();
-            String value = userProperties.getProperty( key );
-            getInternalSystemProperties().setProperty( key, value );
-        }
+    	copyPropertiesToInternalSystemProperties( getUserProperties() );
 
         getInternalSystemProperties().setProperty( "basedir", getBasedir().getAbsolutePath()
);
         getInternalSystemProperties().setProperty( "user.dir", getWorkingDirectory().getAbsolutePath()
);
-
         getInternalSystemProperties().setProperty( "localRepository", getLocalRepository().getBasedir()
);
 
         if ( setInSystem )
@@ -772,6 +757,19 @@ public abstract class AbstractSurefireMo
         }
     }
 
+    private void copyPropertiesToInternalSystemProperties( Properties properties )
+    {
+        if ( properties != null )
+        {
+            for ( Iterator i = properties.keySet().iterator(); i.hasNext(); )
+            {
+                String key = (String) i.next();
+                String value = properties.getProperty( key );
+                getInternalSystemProperties().setProperty( key, value );
+            }
+        }
+    }
+
     private Properties getUserProperties()
     {
         Properties props = null;



Mime
View raw message