gnodet-bot commented on code in PR #13996:
URL: https://github.com/apache/maven/pull/13996#discussion_r4573023169


##########
impl/maven-support/src/main/java/org/apache/maven/settings/v4/ArgumentTokenizer.java:
##########
@@ -59,28 +58,34 @@ public static List<String> tokenize(String input) {
         StringBuilder current = new StringBuilder();
         boolean inDoubleQuotes = false;
         boolean inSingleQuotes = false;
+        boolean tokenStarted = false;
 
         for (int i = 0; i < input.length(); i++) {
             char c = input.charAt(i);
 
             if (c == '\\' && !inSingleQuotes && i + 1 < input.length()) {
                 // Backslash escape: outside single-quotes, \X is always a 
literal X.
                 current.append(input.charAt(++i));
+                tokenStarted = true;
             } else if (c == '"' && !inSingleQuotes) {
                 inDoubleQuotes = !inDoubleQuotes;
+                tokenStarted = true;
             } else if (c == '\'' && !inDoubleQuotes) {
                 inSingleQuotes = !inSingleQuotes;
+                tokenStarted = true;
             } else if (Character.isWhitespace(c) && !inDoubleQuotes && 
!inSingleQuotes) {
-                if (current.length() > 0) {
+                if (tokenStarted) {
                     args.add(current.toString());
                     current.setLength(0);
+                    tokenStarted = false;
                 }
             } else {
                 current.append(c);
+                tokenStarted = true;

Review Comment:
   Test inline comment.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to