This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch fix/MNG-6069
in repository https://gitbox.apache.org/repos/asf/maven.git

commit 194abed8b4079877122bedcde6ef65ef83e5d887
Author: Sylwester Lachiewicz <slachiew...@gmail.com>
AuthorDate: Sat Mar 18 18:18:27 2017 +0100

    [MNG-6069] Migrate to non deprecated parts of Commons CLI
---
 .../main/java/org/apache/maven/cli/MavenCli.java   | 49 +++++-----------------
 1 file changed, 11 insertions(+), 38 deletions(-)

diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java 
b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
index ca8e040..9486697 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
@@ -1648,14 +1648,18 @@ public class MavenCli
 
         if ( commandLine.hasOption( CLIManager.SET_SYSTEM_PROPERTY ) )
         {
-            String[] defStrs = commandLine.getOptionValues( 
CLIManager.SET_SYSTEM_PROPERTY );
-            
-            if ( defStrs != null )
+            Properties lineOptionProperties = commandLine.getOptionProperties( 
CLIManager.SET_SYSTEM_PROPERTY );
+
+            for ( String defStr : lineOptionProperties.stringPropertyNames( ) )
             {
-                for ( String defStr : defStrs )
-                {
-                    setCliProperty( defStr, userProperties );
-                }
+                String optValue = lineOptionProperties.getProperty( defStr );
+                userProperties.setProperty( defStr, optValue );
+
+                // 
----------------------------------------------------------------------
+                // I'm leaving the setting of system properties here as not to 
break
+                // the SystemPropertyProfileActivator. This won't harm 
embedding. jvz.
+                // 
----------------------------------------------------------------------
+               System.setProperty( defStr, optValue );
             }
         }
 
@@ -1675,37 +1679,6 @@ public class MavenCli
         systemProperties.setProperty( "maven.build.version", mavenBuildVersion 
);
     }
 
-    private static void setCliProperty( String property, Properties properties 
)
-    {
-        String name;
-
-        String value;
-
-        int i = property.indexOf( '=' );
-
-        if ( i <= 0 )
-        {
-            name = property.trim();
-
-            value = "true";
-        }
-        else
-        {
-            name = property.substring( 0, i ).trim();
-
-            value = property.substring( i + 1 );
-        }
-
-        properties.setProperty( name, value );
-
-        // 
----------------------------------------------------------------------
-        // I'm leaving the setting of system properties here as not to break
-        // the SystemPropertyProfileActivator. This won't harm embedding. jvz.
-        // 
----------------------------------------------------------------------
-
-        System.setProperty( name, value );
-    }
-
     static class ExitException
         extends Exception
     {

Reply via email to