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 15f3d574236d fix(test-infra): handle both old and new CLI version 
output (#24033)
15f3d574236d is described below

commit 15f3d574236dc17a76ba37417c563efce5762195
Author: Marco Carletti <[email protected]>
AuthorDate: Mon Jun 15 16:23:34 2026 +0200

    fix(test-infra): handle both old and new CLI version output (#24033)
    
    The version() method in CliLocalContainerService looks for "Camel CLI
    version:" in the launcher output, but older launcher JARs still output
    "Camel JBang version:" (pre-rebrand). This causes a NPE when
    StringHelper.between() returns null and .trim() is called on it.
    
    Accept both "Camel CLI version:" and "Camel JBang version:" strings,
    and guard against null before calling trim().
---
 .../camel/test/infra/cli/services/CliLocalContainerService.java    | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/test-infra/camel-test-infra-cli/src/main/java/org/apache/camel/test/infra/cli/services/CliLocalContainerService.java
 
b/test-infra/camel-test-infra-cli/src/main/java/org/apache/camel/test/infra/cli/services/CliLocalContainerService.java
index ef3918fae8bb..1fc0dfe19f7d 100644
--- 
a/test-infra/camel-test-infra-cli/src/main/java/org/apache/camel/test/infra/cli/services/CliLocalContainerService.java
+++ 
b/test-infra/camel-test-infra-cli/src/main/java/org/apache/camel/test/infra/cli/services/CliLocalContainerService.java
@@ -21,6 +21,8 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -241,7 +243,10 @@ public class CliLocalContainerService implements 
CliService, ContainerService<Cl
                         version = StringHelper.between(versionSummary, 
"camel-version = ", "\n").trim();
                     }
                     if (version == null) {
-                        version = StringHelper.between(versionSummary, "Camel 
CLI version:", "\n").trim();
+                        Matcher m = Pattern.compile("Camel (?:CLI|JBang) 
version:\\s*(.+)").matcher(versionSummary);
+                        if (m.find()) {
+                            version = m.group(1).trim();
+                        }
                     }
                     return version;
                 });

Reply via email to