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/10 09:30:04 UTC

[camel] branch main updated: CAMEL-19729: camel-jbang - camel get route-dump should handle 2+ routes in the source files

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 2715a8accb7 CAMEL-19729: camel-jbang - camel get route-dump should handle 2+ routes in the source files
2715a8accb7 is described below

commit 2715a8accb7580165f8daea221f5bf8e45efb4bf
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Thu Aug 10 11:29:50 2023 +0200

    CAMEL-19729: camel-jbang - camel get route-dump should handle 2+ routes in the source files
---
 .../jbang/core/commands/action/CamelRouteDumpAction.java   | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelRouteDumpAction.java b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelRouteDumpAction.java
index 18f3e7ec476..097779c3549 100644
--- a/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelRouteDumpAction.java
+++ b/dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/action/CamelRouteDumpAction.java
@@ -21,6 +21,7 @@ import java.io.FileInputStream;
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Objects;
 
 import org.apache.camel.dsl.jbang.core.commands.CamelJBangMain;
 import org.apache.camel.support.PatternHelper;
@@ -118,7 +119,6 @@ public class CamelRouteDumpAction extends ActionBaseCommand {
                 Row row = new Row();
                 row.location = extractSourceName(o.getString("source"));
                 row.routeId = o.getString("routeId");
-                // if there are 2+ routes in the same source then we would have duplicates
                 if (!rows.contains(row)) {
                     List<JsonObject> lines = o.getCollection("code");
                     if (lines != null) {
@@ -249,21 +249,21 @@ public class CamelRouteDumpAction extends ActionBaseCommand {
 
         @Override
         public boolean equals(Object o) {
-            if (this == o) {
+            if (this == o)
                 return true;
-            }
-            if (o == null || getClass() != o.getClass()) {
+            if (o == null || getClass() != o.getClass())
                 return false;
-            }
 
             Row row = (Row) o;
 
-            return location.equals(row.location);
+            if (!Objects.equals(location, row.location))
+                return false;
+            return routeId.equals(row.routeId);
         }
 
         @Override
         public int hashCode() {
-            return location.hashCode();
+            return routeId.hashCode();
         }
     }