You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2020/06/09 16:03:40 UTC

[GitHub] [geode] jinmeiliao commented on a change in pull request #5187: GEODE-8179: gfsh query cmd returns incorrect results if '=' sign is missing

jinmeiliao commented on a change in pull request #5187:
URL: https://github.com/apache/geode/pull/5187#discussion_r436991385



##########
File path: geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/GfshParser.java
##########
@@ -122,21 +122,30 @@ else if (insideQuoteOf == c) {
     List<String> splitWithWhiteSpaces = splitWithWhiteSpace(userInput);
 
     List<String> furtherSplitWithEquals = new ArrayList<>();
+    boolean doNotRemoveEqualsInNextToken = false;
     for (String token : splitWithWhiteSpaces) {
-      // if this token has equal sign, split around the first occurrence of it
-      int indexOfFirstEqual = token.indexOf('=');
-      if (indexOfFirstEqual < 0) {
+      if (doNotRemoveEqualsInNextToken) {
         furtherSplitWithEquals.add(token);
+        doNotRemoveEqualsInNextToken = false;
       } else {
-        String left = token.substring(0, indexOfFirstEqual);
-        String right = token.substring(indexOfFirstEqual + 1);
-        if (left.length() > 0) {
-          furtherSplitWithEquals.add(left);
-        }
-        if (right.length() > 0) {
-          furtherSplitWithEquals.add(right);
+        // if this token has equal sign, split around the first occurrence of it
+        int indexOfFirstEqual = token.indexOf('=');
+        if (indexOfFirstEqual < 0) {
+          furtherSplitWithEquals.add(token);
+        } else {
+          String left = token.substring(0, indexOfFirstEqual);
+          String right = token.substring(indexOfFirstEqual + 1);
+          if (left.length() > 0) {
+            furtherSplitWithEquals.add(left);
+          }
+          if (right.length() > 0) {
+            furtherSplitWithEquals.add(right);
+          }
         }
       }
+      if (token.equals("--query") || token.equals("--J")) {

Review comment:
       anyway to not hardcode these two conditions? maybe based the decision on "do not remove = sign if it's in the quotes"?




----------------------------------------------------------------
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:
users@infra.apache.org