davsclaus commented on code in PR #26764:
URL: https://github.com/apache/camel/pull/26764#discussion_r4080976830


##########
core/camel-core-languages/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionStart.java:
##########
@@ -333,6 +333,49 @@ private String wrapFunctionsInCondition(String 
conditionText) {
             return conditionText;
         }
 
+        // the condition may be several comparisons joined by a logical 
operator, and each of them needs its
+        // functions wrapped, not only the first (CAMEL-24920)
+        StringBuilder answer = new StringBuilder();
+        int from = 0;
+        for (int at = logicalOperator(conditionText, 0); at >= 0; at = 
logicalOperator(conditionText, from)) {
+            int end = conditionText.indexOf(' ', at + 1);
+            if (end < 0) {
+                break; // the operator has nothing after it: leave it to the 
predicate parser to say so
+            }

Review Comment:
   Right, it cannot be reached: `logicalOperator` only returns a position when 
`&& ` or `|| ` matched *with* its trailing space, so `indexOf(' ', at + 1)` 
finds that space at `at + 2` at the latest. Removed, and left a line saying why 
the index is safe.
   
   Worth noting for CAMEL-24921, which moves this code into `SimpleSyntaxHints` 
so the ternary and a bare predicate share it: there the text can end at an 
operator (`${body == }`), and that case is handled in the comparison wrapping 
instead, where it produces a message about the missing right hand side rather 
than a silent pass.



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