This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new d6d5a4672c6 CAMEL-22204: Fix iif expression parsing for Strings
d6d5a4672c6 is described below

commit d6d5a4672c60d5aa1ee441637c78c5450c633e40
Author: Claus Ibsen <[email protected]>
AuthorDate: Sat Jun 28 12:17:25 2025 +0200

    CAMEL-22204: Fix iif expression parsing for Strings
---
 .../simple/ast/SimpleFunctionExpression.java         | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git 
a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java
 
b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java
index d67b2472f02..040db8bc383 100644
--- 
a/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java
+++ 
b/core/camel-core-languages/src/main/java/org/apache/camel/language/simple/ast/SimpleFunctionExpression.java
@@ -916,7 +916,7 @@ public class SimpleFunctionExpression extends 
LiteralExpression {
             String values = StringHelper.beforeLast(remainder, ")");
             String[] tokens = null;
             if (ObjectHelper.isNotEmpty(values)) {
-                tokens = StringQuoteHelper.splitSafeQuote(values, ',', true, 
true);
+                tokens = StringQuoteHelper.splitSafeQuote(values, ',', true, 
false);
             }
             return SimpleExpressionBuilder.listExpression(tokens);
         }
@@ -926,7 +926,7 @@ public class SimpleFunctionExpression extends 
LiteralExpression {
             String values = StringHelper.beforeLast(remainder, ")");
             String[] tokens = null;
             if (ObjectHelper.isNotEmpty(values)) {
-                tokens = StringQuoteHelper.splitSafeQuote(values, ',');
+                tokens = StringQuoteHelper.splitSafeQuote(values, ',', true, 
false);
             }
             // there must be an even number of tokens as each map element is a 
pair
             if (tokens != null && tokens.length % 2 == 1) {
@@ -1969,7 +1969,13 @@ public class SimpleFunctionExpression extends 
LiteralExpression {
             }
             StringJoiner sj = new StringJoiner(", ");
             for (int i = 0; tokens != null && i < tokens.length; i++) {
-                sj.add(tokens[i]);
+                String s = tokens[i];
+                // single quotes should be double quotes
+                if (StringHelper.isSingleQuoted(s)) {
+                    s = StringHelper.removeLeadingAndEndingQuotes(s);
+                    s = StringQuoteHelper.doubleQuote(s);
+                }
+                sj.add(s);
             }
             String p = sj.length() > 0 ? sj.toString() : "null";
             return "list(exchange, " + p + ")";
@@ -1985,7 +1991,13 @@ public class SimpleFunctionExpression extends 
LiteralExpression {
             }
             StringJoiner sj = new StringJoiner(", ");
             for (int i = 0; tokens != null && i < tokens.length; i++) {
-                sj.add(tokens[i]);
+                String s = tokens[i];
+                // single quotes should be double quotes
+                if (StringHelper.isSingleQuoted(s)) {
+                    s = StringHelper.removeLeadingAndEndingQuotes(s);
+                    s = StringQuoteHelper.doubleQuote(s);
+                }
+                sj.add(s);
             }
             String p = sj.length() > 0 ? sj.toString() : "null";
             return "map(exchange, " + p + ")";

Reply via email to