You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/07/25 08:57:29 UTC
[1/2] git commit: CAMEL-7637 Avoid null throwable message when
creating the FailedToCreateRouteException
Repository: camel
Updated Branches:
refs/heads/camel-2.12.x 740021954 -> dd89d6b88
refs/heads/camel-2.13.x f39312fd0 -> 02a8e9cd5
CAMEL-7637 Avoid null throwable message when creating the FailedToCreateRouteException
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/02a8e9cd
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/02a8e9cd
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/02a8e9cd
Branch: refs/heads/camel-2.13.x
Commit: 02a8e9cd5c023a3a0937a0722f298e8a06cc605a
Parents: f39312f
Author: Willem Jiang <wi...@gmail.com>
Authored: Fri Jul 25 14:42:14 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Fri Jul 25 14:56:37 2014 +0800
----------------------------------------------------------------------
.../org/apache/camel/FailedToCreateRouteException.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/02a8e9cd/camel-core/src/main/java/org/apache/camel/FailedToCreateRouteException.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/FailedToCreateRouteException.java b/camel-core/src/main/java/org/apache/camel/FailedToCreateRouteException.java
index df63115..639384c 100644
--- a/camel-core/src/main/java/org/apache/camel/FailedToCreateRouteException.java
+++ b/camel-core/src/main/java/org/apache/camel/FailedToCreateRouteException.java
@@ -26,7 +26,7 @@ public class FailedToCreateRouteException extends CamelException {
private final String routeId;
public FailedToCreateRouteException(String routeId, String route, Throwable cause) {
- super("Failed to create route " + routeId + ": " + getRouteMessage(route) + " because of " + cause.getMessage(), cause);
+ super("Failed to create route " + routeId + ": " + getRouteMessage(route) + " because of " + getExceptionMessage(cause), cause);
this.routeId = routeId;
}
@@ -38,6 +38,14 @@ public class FailedToCreateRouteException extends CamelException {
public String getRouteId() {
return routeId;
}
+
+ protected static String getExceptionMessage(Throwable cause) {
+ if (cause.getMessage() != null) {
+ return cause.getMessage();
+ } else {
+ return cause.getClass().getSimpleName();
+ }
+ }
protected static String getRouteMessage(String route) {
// cut the route after 60 chars so it won't be too big in the message
[2/2] git commit: CAMEL-7637 Avoid null throwable message when
creating the FailedToCreateRouteException
Posted by ni...@apache.org.
CAMEL-7637 Avoid null throwable message when creating the FailedToCreateRouteException
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/dd89d6b8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/dd89d6b8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/dd89d6b8
Branch: refs/heads/camel-2.12.x
Commit: dd89d6b88072e6dba7e952728ea0a71db189ded0
Parents: 7400219
Author: Willem Jiang <wi...@gmail.com>
Authored: Fri Jul 25 14:42:14 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Fri Jul 25 14:57:04 2014 +0800
----------------------------------------------------------------------
.../org/apache/camel/FailedToCreateRouteException.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/dd89d6b8/camel-core/src/main/java/org/apache/camel/FailedToCreateRouteException.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/FailedToCreateRouteException.java b/camel-core/src/main/java/org/apache/camel/FailedToCreateRouteException.java
index df63115..639384c 100644
--- a/camel-core/src/main/java/org/apache/camel/FailedToCreateRouteException.java
+++ b/camel-core/src/main/java/org/apache/camel/FailedToCreateRouteException.java
@@ -26,7 +26,7 @@ public class FailedToCreateRouteException extends CamelException {
private final String routeId;
public FailedToCreateRouteException(String routeId, String route, Throwable cause) {
- super("Failed to create route " + routeId + ": " + getRouteMessage(route) + " because of " + cause.getMessage(), cause);
+ super("Failed to create route " + routeId + ": " + getRouteMessage(route) + " because of " + getExceptionMessage(cause), cause);
this.routeId = routeId;
}
@@ -38,6 +38,14 @@ public class FailedToCreateRouteException extends CamelException {
public String getRouteId() {
return routeId;
}
+
+ protected static String getExceptionMessage(Throwable cause) {
+ if (cause.getMessage() != null) {
+ return cause.getMessage();
+ } else {
+ return cause.getClass().getSimpleName();
+ }
+ }
protected static String getRouteMessage(String route) {
// cut the route after 60 chars so it won't be too big in the message