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 2014/09/12 07:28:14 UTC
[1/2] git commit: CAMEL-7804: MessageHelper - dump message for
logging should catch throwable
Repository: camel
Updated Branches:
refs/heads/camel-2.12.x 767cca8ea -> 909788c8e
refs/heads/camel-2.13.x 5805379c0 -> e5d9899ff
CAMEL-7804: MessageHelper - dump message for logging should catch throwable
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/e5d9899f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/e5d9899f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/e5d9899f
Branch: refs/heads/camel-2.13.x
Commit: e5d9899ff90ee495e759ddc66194964ce9ea86d8
Parents: 5805379
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Sep 11 18:59:44 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Sep 12 07:27:53 2014 +0200
----------------------------------------------------------------------
.../org/apache/camel/util/MessageHelper.java | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/e5d9899f/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java b/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java
index 0182594..ec088f3 100644
--- a/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java
@@ -251,13 +251,17 @@ public final class MessageHelper {
String body = null;
if (message.getExchange() != null) {
try {
- body = message.getExchange().getContext().getTypeConverter().convertTo(String.class, message.getExchange(), obj);
- } catch (Exception e) {
+ body = message.getExchange().getContext().getTypeConverter().tryConvertTo(String.class, message.getExchange(), obj);
+ } catch (Throwable e) {
// ignore as the body is for logging purpose
}
}
if (body == null) {
- body = obj.toString();
+ try {
+ body = obj.toString();
+ } catch (Throwable e) {
+ // ignore as the body is for logging purpose
+ }
}
// reset stream cache after use
@@ -359,13 +363,13 @@ public final class MessageHelper {
// to String
if (value != null) {
try {
- String xml = message.getExchange().getContext().getTypeConverter().convertTo(String.class,
+ String xml = message.getExchange().getContext().getTypeConverter().tryConvertTo(String.class,
message.getExchange(), value);
if (xml != null) {
// must always xml encode
sb.append(StringHelper.xmlEncode(xml));
}
- } catch (Exception e) {
+ } catch (Throwable e) {
// ignore as the body is for logging purpose
}
}
@@ -433,7 +437,8 @@ public final class MessageHelper {
// must not cause new exceptions so run this in a try catch block
try {
return doDumpMessageHistoryStacktrace(exchange, exchangeFormatter, logStackTrace);
- } catch (Exception e) {
+ } catch (Throwable e) {
+ // ignore as the body is for logging purpose
return "";
}
}
@@ -472,7 +477,7 @@ public final class MessageHelper {
for (MessageHistory history : list) {
routeId = history.getRouteId() != null ? history.getRouteId() : "";
id = history.getNode().getId();
- // we need to avoid leak the sensibale information here
+ // we need to avoid leak the sensible information here
label = URISupport.sanitizeUri(history.getNode().getLabel());
elapsed = history.getElapsed();
[2/2] git commit: CAMEL-7804: MessageHelper - dump message for
logging should catch throwable
Posted by da...@apache.org.
CAMEL-7804: MessageHelper - dump message for logging should catch throwable
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/909788c8
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/909788c8
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/909788c8
Branch: refs/heads/camel-2.12.x
Commit: 909788c8eaf577a5414c25b5a0094ed1de2cb394
Parents: 767cca8
Author: Claus Ibsen <da...@apache.org>
Authored: Thu Sep 11 18:59:44 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Sep 12 07:28:02 2014 +0200
----------------------------------------------------------------------
.../org/apache/camel/util/MessageHelper.java | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/909788c8/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java b/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java
index 0182594..ec088f3 100644
--- a/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/MessageHelper.java
@@ -251,13 +251,17 @@ public final class MessageHelper {
String body = null;
if (message.getExchange() != null) {
try {
- body = message.getExchange().getContext().getTypeConverter().convertTo(String.class, message.getExchange(), obj);
- } catch (Exception e) {
+ body = message.getExchange().getContext().getTypeConverter().tryConvertTo(String.class, message.getExchange(), obj);
+ } catch (Throwable e) {
// ignore as the body is for logging purpose
}
}
if (body == null) {
- body = obj.toString();
+ try {
+ body = obj.toString();
+ } catch (Throwable e) {
+ // ignore as the body is for logging purpose
+ }
}
// reset stream cache after use
@@ -359,13 +363,13 @@ public final class MessageHelper {
// to String
if (value != null) {
try {
- String xml = message.getExchange().getContext().getTypeConverter().convertTo(String.class,
+ String xml = message.getExchange().getContext().getTypeConverter().tryConvertTo(String.class,
message.getExchange(), value);
if (xml != null) {
// must always xml encode
sb.append(StringHelper.xmlEncode(xml));
}
- } catch (Exception e) {
+ } catch (Throwable e) {
// ignore as the body is for logging purpose
}
}
@@ -433,7 +437,8 @@ public final class MessageHelper {
// must not cause new exceptions so run this in a try catch block
try {
return doDumpMessageHistoryStacktrace(exchange, exchangeFormatter, logStackTrace);
- } catch (Exception e) {
+ } catch (Throwable e) {
+ // ignore as the body is for logging purpose
return "";
}
}
@@ -472,7 +477,7 @@ public final class MessageHelper {
for (MessageHistory history : list) {
routeId = history.getRouteId() != null ? history.getRouteId() : "";
id = history.getNode().getId();
- // we need to avoid leak the sensibale information here
+ // we need to avoid leak the sensible information here
label = URISupport.sanitizeUri(history.getNode().getLabel());
elapsed = history.getElapsed();