michael-o commented on a change in pull request #429:
URL: https://github.com/apache/maven/pull/429#discussion_r567249450



##########
File path: maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
##########
@@ -1507,41 +1506,41 @@ else if ( projectAction.startsWith( "+" ) )
     }
 
     // Visible for testing
-    static ProfileActivation determineProfileActivation( final CommandLine 
commandLine )
+    static void performProfileActivation( final CommandLine commandLine,
+                                          final ProfileActivation 
profileActivation )
     {
-        final ProfileActivation result = new ProfileActivation();
-
         if ( commandLine.hasOption( CLIManager.ACTIVATE_PROFILES ) )
         {
-            String[] profileOptionValues = commandLine.getOptionValues( 
CLIManager.ACTIVATE_PROFILES );
-            if ( profileOptionValues != null )
+            final String[] optionValues = commandLine.getOptionValues( 
CLIManager.ACTIVATE_PROFILES );
+
+            if ( optionValues == null )
             {
-                for ( String profileOptionValue : profileOptionValues )
-                {
-                    StringTokenizer profileTokens = new StringTokenizer( 
profileOptionValue, "," );
+                return;
+            }
 
-                    while ( profileTokens.hasMoreTokens() )
+            for ( final String optionValue : optionValues )
+            {
+                for ( String token : optionValue.split( "," ) )
+                {
+                    String profileId = token.trim();
+                    boolean active = true;
+                    if ( profileId.charAt( 0 ) == '-' || profileId.charAt( 0 ) 
== '!' )
                     {
-                        String profileAction = 
profileTokens.nextToken().trim();
-
-                        if ( profileAction.startsWith( "-" ) || 
profileAction.startsWith( "!" ) )
-                        {
-                            result.deactivate( profileAction.substring( 1 ) );
-                        }
-                        else if ( profileAction.startsWith( "+" ) )
-                        {
-                            result.activate( profileAction.substring( 1 ) );
-                        }
-                        else
-                        {
-                            result.activate( profileAction );
-                        }
+                        active = false;
+                        profileId = profileId.substring( 1 );
+                    }
+                    else if ( token.charAt( 0 ) == '+' )

Review comment:
       Agreed, documenting is another issue.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to