Created attachment 1058869 [details] modified cli jar Description of problem: When using CLI if-else scripting that uses a string that contains parenthesis it fails with the following message: Failed to handle 'if (outcome == success && result.value != "a64180c0)e7187af86b435229de904104") of /system-property=test:read-resource': Unexpected operation at 49 in '(outcome == success && result.value != "a64180c0)e7187af86b435229de904104")' Where the position 49 is the ")". I think that this validation is done here: https://github.com/wildfly/wildfly-core/blob/61be46a71fc9499705b0a744b55bcdffa8721f3a/cli/src/main/java/org/jboss/as/cli/handlers/ifelse/ExpressionParser.java#L120 I added some outputs in the CLI: parsing: '(outcome == success && result.value != "a64180c0)e7187af86b435229de904104")' parsing: 'outcome == success && result.value != "a64180c0' Input: outcome == success && result.value != "a64180c0 parsed: (&& [(== [outcome, success]), (!= [result.value, "a64180c0])]) It stops exactly where ")" are. Version-Release number of selected component (if applicable): JBoss EAP 6.4.2. CLI: jboss-as-cli-7.5.2.Final-redhat-2.jar How reproducible: Create s CLI script like the following: if (outcome == success && result.value != "a64180c0)e7187af86b435229de904104") of /system-property=test:read-resource /system-property=test:write-attribute(name=value,value="a64180c0)e7187af86b435229de904104") end-if if (outcome != success) of /system-property=test:read-resource /system-property=test:add(value="a64180c0)e7187af86b435229de904104") end-if Steps to Reproduce: 1. Create a cli flie with the content above 2. Execute it: bin/jboss-cli.sh -c --file=test.cli Actual results: It fail with this message: Failed to handle 'if (outcome == success && result.value != "a64180c0)e7187af86b435229de904104") of /system-property=test:read-resource': Unexpected operation at 49 in '(outcome == success && result.value != "a64180c0)e7187af86b435229de904104")' Expected results: The property being executed and no errors should happen when we have a parenthesis in the middle of the if-else condition Additional info: To try to solve it I created the following method: private boolean inputIsInsideQuotes(String input){ int occurs = 0; for (int i = 0; i < input.length(); i++){ //System.out.println("Searching for quotes"); if (input.charAt(i) == '\"') { //System.out.println("quotes found at " + i); occurs++; } } if (occurs >= 1){ return true; } else { return false; } } And changed the parseOperand method to ignore everything that is inside quotes: protected Operand parseOperand() throws CommandLineException { skipWhitespaces(); if(pos == input.length()) { return null; } //System.out.println("have quotes? " + InputIsInsideQuotes(input)); if(input.charAt(pos) == '(') { if (inputIsInsideQuotes(input)){ //do nothing } else { int depthCount = 0; int endIndex = pos; ... After this I successfully executed the same CLI script [standalone@localhost:9999 /] /system-property=test:read-resource [fspolti@my-laptop main]$ bin/jboss-cli.sh -c --file=test.cli [user@my-laptop main]$ /bin/jboss-cli.sh -c [standalone@localhost:9999 /] /system-property=test:read-resource { "outcome" => "success", "result" => {"value" => "a64180c0)e7187af86b435229de904104"} } [standalone@localhost:9999 /] adding more parenthesis: [user@my-laptop main]$ bin/jboss-cli.sh -c --file=test.cli Input: (outcome == success && result.value != "a64180c0)e7187af86b435229()()()(de904104") [fspolti@my-laptop main]$ bin/jboss-cli.sh -c [standalone@localhost:9999 /] /system-property=lhs.gateway:read-resource { "outcome" => "success", "result" => {"value" => "a64180c0)e7187af86b435229()()()(de904104"} } I attached the script and the modified jar.
Created attachment 1058871 [details] modified jar
PR: https://github.com/jbossas/jboss-eap/pull/2515
Switching back to assigned before upstream is resolved.
Upstream rejected. See discussion in upstream PR: https://github.com/wildfly/wildfly-core/pull/938
PR: https://github.com/jbossas/jboss-eap/pull/2558
Verified with EAP 6.4.6.CP.CR2.
Retroactively bulk-closing issues from released EAP 6.4 cumulative patches.