You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2023/10/12 18:05:47 UTC

[camel] branch CAMEL-19982/camel-jbang-jvm-debug-as-last-parameter-4.1 created (now e3658c60340)

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

nfilotto pushed a change to branch CAMEL-19982/camel-jbang-jvm-debug-as-last-parameter-4.1
in repository https://gitbox.apache.org/repos/asf/camel.git


      at e3658c60340 CAMEL-19982: camel-jbang - Allow --jvm-debug as last parameter

This branch includes the following new commits:

     new e3658c60340 CAMEL-19982: camel-jbang - Allow --jvm-debug as last parameter

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[camel] 01/01: CAMEL-19982: camel-jbang - Allow --jvm-debug as last parameter

Posted by nf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

nfilotto pushed a commit to branch CAMEL-19982/camel-jbang-jvm-debug-as-last-parameter-4.1
in repository https://gitbox.apache.org/repos/asf/camel.git

commit e3658c603402c7b5472fa593d8dc0ca0d7eaba9f
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Thu Oct 12 19:45:24 2023 +0200

    CAMEL-19982: camel-jbang - Allow --jvm-debug as last parameter
---
 .../org/apache/camel/dsl/jbang/core/commands/CamelCommand.java     | 6 +++++-
 .../main/java/org/apache/camel/dsl/jbang/core/commands/Run.java    | 7 ++++++-
 2 files changed, 11 insertions(+), 2 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 66fc65bfb71..d520060113b 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
@@ -144,7 +144,7 @@ public abstract class CamelCommand implements Callable<Integer> {
 
         @Override
         public void consumeParameters(Stack<String> args, ArgSpec argSpec, CommandSpec cmdSpec) {
-            if (args.isEmpty()) {
+            if (failIfEmptyArgs() && args.isEmpty()) {
                 throw new ParameterException(cmdSpec.commandLine(), "Error: missing required parameter");
             }
             T cmd = (T) cmdSpec.userObject();
@@ -152,6 +152,10 @@ public abstract class CamelCommand implements Callable<Integer> {
         }
 
         protected abstract void doConsumeParameters(Stack<String> args, T cmd);
+
+        protected boolean failIfEmptyArgs() {
+            return true;
+        }
     }
 
 }
diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
index 5446fe8ee0c..d1a0ecacf73 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/Run.java
@@ -1407,7 +1407,7 @@ public class Run extends CamelCommand {
 
         @Override
         protected void doConsumeParameters(Stack<String> args, Run cmd) {
-            String arg = args.peek();
+            String arg = args.isEmpty() ? "" : args.peek();
             if (DEBUG_ARG_VALUE_PATTERN.asPredicate().test(arg)) {
                 // The value matches with the expected format so let's assume that it is a debug argument value
                 args.pop();
@@ -1417,5 +1417,10 @@ public class Run extends CamelCommand {
             }
             cmd.jvmDebugPort = parseJvmDebugPort(arg);
         }
+
+        @Override
+        protected boolean failIfEmptyArgs() {
+            return false;
+        }
     }
 }