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/08/03 08:21:55 UTC

[camel] branch main updated: CAMEL-19702: camel-jbang - Fix version list from/to version with just single digit.

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 eba6928ef64 CAMEL-19702: camel-jbang - Fix version list from/to version with just single digit.
eba6928ef64 is described below

commit eba6928ef642d70d1c45dafef147d145d9441f97
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Aug 3 10:21:36 2023 +0200

    CAMEL-19702: camel-jbang - Fix version list from/to version with just single digit.
---
 .../camel/dsl/jbang/core/commands/version/VersionList.java  | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/version/VersionList.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/version/VersionList.java
index 5e37d02ae7f..157bc2517ed 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/version/VersionList.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/version/VersionList.java
@@ -114,11 +114,24 @@ public class VersionList extends CamelCommand {
                 repo = rr.resolveRepository(repo);
             }
 
+            // ensure from and to-version have major.minor
+            if (fromVersion != null) {
+                if (!(fromVersion.contains(".") || fromVersion.contains(","))) {
+                    fromVersion = fromVersion + ".0";
+                }
+            }
+            if (toVersion != null) {
+                if (!(toVersion.contains(".") || toVersion.contains(","))) {
+                    toVersion = toVersion + ".0";
+                }
+            }
+
             versions = downloader.resolveAvailableVersions(g, a, fromVersion, repo);
             versions = versions.stream().filter(v -> acceptVersion(v[0])).collect(Collectors.toList());
 
             main.stop();
         } catch (Exception e) {
+            e.printStackTrace();
             System.out.println("Error downloading available Camel versions");
             return 1;
         }