You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2024/01/24 18:20:14 UTC

(camel) branch main updated: CAMEL-20359: simple language - Using exchangeProperty should also support colon so its the same as for header.

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 c768989a562 CAMEL-20359: simple language - Using exchangeProperty should also support colon so its the same as for header.
c768989a562 is described below

commit c768989a562cbdb7f32620963f1072c5b29e4bcb
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Jan 24 19:14:55 2024 +0100

    CAMEL-20359: simple language - Using exchangeProperty should also support colon so its the same as for header.
---
 .../apache/camel/language/simple/ast/SimpleFunctionExpression.java    | 4 ++--
 .../src/test/java/org/apache/camel/language/simple/SimpleTest.java    | 1 +
 2 files changed, 3 insertions(+), 2 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 fb04db0eefa..20b07a3d12b 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
@@ -122,8 +122,8 @@ public class SimpleFunctionExpression extends LiteralExpression {
         // exchange property
         remainder = ifStartsWithReturnRemainder("exchangeProperty", function);
         if (remainder != null) {
-            // remove leading character (dot or ?)
-            if (remainder.startsWith(".") || remainder.startsWith("?")) {
+            // remove leading character (dot, colon or ?)
+            if (remainder.startsWith(".") || remainder.startsWith(":") || remainder.startsWith("?")) {
                 remainder = remainder.substring(1);
             }
             // remove starting and ending brackets
diff --git a/core/camel-core/src/test/java/org/apache/camel/language/simple/SimpleTest.java b/core/camel-core/src/test/java/org/apache/camel/language/simple/SimpleTest.java
index 7550edc2ca4..7d3dd1f7bb3 100644
--- a/core/camel-core/src/test/java/org/apache/camel/language/simple/SimpleTest.java
+++ b/core/camel-core/src/test/java/org/apache/camel/language/simple/SimpleTest.java
@@ -280,6 +280,7 @@ public class SimpleTest extends LanguageTestSupport {
     public void testSimpleExchangePropertyExpressions() throws Exception {
         exchange.setProperty("medal", "gold");
         assertExpression("${exchangeProperty.medal}", "gold");
+        assertExpression("${exchangeProperty:medal}", "gold");
     }
 
     @Test