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 2023/06/22 09:16:26 UTC

[camel] branch camel-3.20.x updated: CAMEL-19486: camel-jbang - Must use #name instead of for parameter placeholder substitution

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

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


The following commit(s) were added to refs/heads/camel-3.20.x by this push:
     new 877d576987e CAMEL-19486: camel-jbang - Must use #name instead of  for parameter placeholder substitution
877d576987e is described below

commit 877d576987e83bd87b96620d2584b393372f8328
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Jun 22 11:12:37 2023 +0200

    CAMEL-19486: camel-jbang - Must use #name instead of  for parameter placeholder substitution
---
 .../org/apache/camel/dsl/jbang/core/commands/CamelCommand.java   | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CamelCommand.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CamelCommand.java
index ccba4ccb621..8bb04280245 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CamelCommand.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/CamelCommand.java
@@ -82,10 +82,11 @@ public abstract class CamelCommand implements Callable<Integer> {
                         argSpec instanceof CommandLine.Model.OptionSpec) {
                     CommandLine.Model.OptionSpec optionSpec = (CommandLine.Model.OptionSpec) argSpec;
                     for (String name : optionSpec.names()) {
-                        String placeholder = "$" + StringHelper.after(name, "--");
-                        if (argSpec.getValue() != null &&
-                                argSpec.getValue().toString().contains(placeholder)) {
-                            argSpec.setValue(argSpec.getValue().toString().replace(placeholder, defaultValue));
+                        String placeholder = "#" + StringHelper.after(name, "--");
+                        Object v = argSpec.getValue();
+                        if (v != null &&
+                                v.toString().contains(placeholder)) {
+                            argSpec.setValue(v.toString().replace(placeholder, defaultValue));
                         }
                     }
                 }