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/09 13:32:29 UTC

[camel] branch camel-3.20.x updated: CAMEL-19381: camel-jbang - Fix endless loop with run different camel version from configuation

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 7a36ffa4d7c CAMEL-19381: camel-jbang - Fix endless loop with run different camel version from configuation
7a36ffa4d7c is described below

commit 7a36ffa4d7c60e4e7e4d9f14f9ed1e84b92fffbc
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Jun 9 15:31:42 2023 +0200

    CAMEL-19381: camel-jbang - Fix endless loop with run different camel version from configuation
---
 .../java/org/apache/camel/dsl/jbang/core/commands/Run.java    | 11 +++++++++++
 1 file changed, 11 insertions(+)

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 b44bbd1b756..4a544c358a8 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
@@ -49,6 +49,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import io.apicurio.datamodels.Library;
 import io.apicurio.datamodels.openapi.models.OasDocument;
 import org.apache.camel.CamelContext;
+import org.apache.camel.catalog.CamelCatalog;
 import org.apache.camel.catalog.DefaultCamelCatalog;
 import org.apache.camel.dsl.jbang.core.common.RuntimeUtil;
 import org.apache.camel.dsl.jbang.core.common.VersionHelper;
@@ -562,6 +563,16 @@ public class Run extends CamelCommand {
             writeSettings("camel.component.properties.location", loc);
         }
 
+        // if we have a specific camel version then make sure we really need to switch
+        if (camelVersion != null) {
+            CamelCatalog catalog = new DefaultCamelCatalog();
+            String v = catalog.getCatalogVersion();
+            if (camelVersion.equals(v)) {
+                // same version, so we use current
+                camelVersion = null;
+            }
+        }
+
         // okay we have validated all input and are ready to run
         if (camelVersion != null) {
             // run in another JVM with different camel version (foreground or background)