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 2022/01/17 11:09:31 UTC

[camel] branch main updated: CAMEL-17501: FailedToCreateRouteException should cut the route toString before sanitizing in case the uri is very long.

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 28d88e5  CAMEL-17501: FailedToCreateRouteException should cut the route toString before sanitizing in case the uri is very long.
28d88e5 is described below

commit 28d88e52a13ba09fc68c871ad199647b5762dc94
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Jan 17 12:07:49 2022 +0100

    CAMEL-17501: FailedToCreateRouteException should cut the route toString before sanitizing in case the uri is very long.
---
 .../org/apache/camel/FailedToCreateRouteException.java   | 15 +++++++--------
 .../org/apache/camel/model/RouteDefinitionHelper.java    | 16 +++++++---------
 2 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/core/camel-api/src/main/java/org/apache/camel/FailedToCreateRouteException.java b/core/camel-api/src/main/java/org/apache/camel/FailedToCreateRouteException.java
index 745b4c7..c0c7d8f 100644
--- a/core/camel-api/src/main/java/org/apache/camel/FailedToCreateRouteException.java
+++ b/core/camel-api/src/main/java/org/apache/camel/FailedToCreateRouteException.java
@@ -46,16 +46,15 @@ public class FailedToCreateRouteException extends RuntimeCamelException {
     }
 
     protected static String getRouteMessage(String route) {
-        // ensure to sanitize uri's in the route so we do not show sensitive information such as passwords
-        route = URISupport.sanitizeUri(route);
-
-        // cut the route after 60 chars so it won't be too big in the message
-        // users just need to be able to identify the route so they know where to look
+        // cut the route after 60 chars, so it won't be too big in the message
+        // users just need to be able to identify the route, so they know where to look
         if (route.length() > 60) {
-            return route.substring(0, 60) + "...";
-        } else {
-            return route;
+            route = route.substring(0, 60) + "...";
         }
+
+        // ensure to sanitize uri's in the route, so we do not show sensitive information such as passwords
+        route = URISupport.sanitizeUri(route);
+        return route;
     }
 
 }
diff --git a/core/camel-core-model/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java b/core/camel-core-model/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
index c61d997..1194d2c 100644
--- a/core/camel-core-model/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
+++ b/core/camel-core-model/src/main/java/org/apache/camel/model/RouteDefinitionHelper.java
@@ -745,16 +745,14 @@ public final class RouteDefinitionHelper {
     }
 
     public static String getRouteMessage(String route) {
-        // ensure to sanitize uri's in the route so we do not show sensitive
-        // information such as passwords
-        route = URISupport.sanitizeUri(route);
-        // cut the route after 60 chars so it won't be too big in the message
-        // users just need to be able to identify the route so they know where
-        // to look
+        // cut the route after 60 chars, so it won't be too big in the message
+        // users just need to be able to identify the route, so they know where to look
         if (route.length() > 60) {
-            return route.substring(0, 60) + "...";
-        } else {
-            return route;
+            route = route.substring(0, 60) + "...";
         }
+
+        // ensure to sanitize uri's in the route, so we do not show sensitive information such as passwords
+        route = URISupport.sanitizeUri(route);
+        return route;
     }
 }