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 2015/11/25 14:33:43 UTC
[1/2] camel git commit: CAMEL-9359: DefaultExchangeHolder should be
less noisty in logging. Also update javadoc about headers/properties are only
primitive/string/numbers.
Repository: camel
Updated Branches:
refs/heads/camel-2.16.x b371be6ca -> f1d821293
refs/heads/master 5091f938c -> 006b4594a
CAMEL-9359: DefaultExchangeHolder should be less noisty in logging. Also update javadoc about headers/properties are only primitive/string/numbers.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/006b4594
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/006b4594
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/006b4594
Branch: refs/heads/master
Commit: 006b4594a7f1a621e8f6b3090bbb64544e2596ab
Parents: 5091f93
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Nov 25 14:33:09 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Nov 25 14:33:09 2015 +0100
----------------------------------------------------------------------
.../camel/impl/DefaultExchangeHolder.java | 56 ++++++++++----------
1 file changed, 27 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/006b4594/camel-core/src/main/java/org/apache/camel/impl/DefaultExchangeHolder.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultExchangeHolder.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultExchangeHolder.java
index ea9713c..a066043 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultExchangeHolder.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultExchangeHolder.java
@@ -34,27 +34,31 @@ import org.slf4j.LoggerFactory;
/**
* Holder object for sending an exchange over a remote wire as a serialized object.
* This is usually configured using the <tt>transferExchange=true</tt> option on the endpoint.
- * <p/>
- * Note: Message body of type {@link File} or {@link WrappedFile} is <b>not</b> supported and
+ * <br/>
+ * <b>Note:</b> Message body of type {@link File} or {@link WrappedFile} is <b>not</b> supported and
* a {@link RuntimeExchangeException} is thrown.
- * <p/>
+ * <br/>
* As opposed to normal usage where only the body part of the exchange is transferred over the wire,
* this holder object serializes the following fields over the wire:
* <ul>
* <li>exchangeId</li>
* <li>in body</li>
* <li>out body</li>
- * <li>in headers</li>
- * <li>out headers</li>
* <li>fault body </li>
- * <li>fault headers</li>
* <li>exchange properties</li>
* <li>exception</li>
* </ul>
+ * And the following headers is transferred if their values are of primitive types, String or Number based.
+ * <ul>
+ * <li>in headers</li>
+ * <li>out headers</li>
+ * <li>fault headers</li>
+ * </ul>
* The body is serialized and stored as serialized bytes. The header and exchange properties only include
- * primitive, and String types (and Exception types for exchange properties). Any other type is skipped.
- * <p/>
- * Any object that is not serializable will be skipped and Camel will log this at WARN level.
+ * primitive, String, and Number types (and Exception types for exchange properties). Any other type is skipped.
+ * <br/>
+ * Any message body object that is not serializable will be skipped and Camel will log this at <tt>WARN</tt> level.
+ * And any message header values that is not a primitive value will be skipped and Camel will log this at <tt>DEBUG</tt> level.
*
* @version
*/
@@ -235,6 +239,10 @@ public class DefaultExchangeHolder implements Serializable {
for (Map.Entry<String, Object> entry : map.entrySet()) {
// silently skip any values which is null
+ if (entry.getValue() == null) {
+ continue;
+ }
+
Object value = getValidHeaderValue(entry.getKey(), entry.getValue());
if (value != null) {
Serializable converted = exchange.getContext().getTypeConverter().convertTo(Serializable.class, exchange, value);
@@ -260,6 +268,10 @@ public class DefaultExchangeHolder implements Serializable {
for (Map.Entry<String, Object> entry : map.entrySet()) {
// silently skip any values which is null
+ if (entry.getValue() == null) {
+ continue;
+ }
+
Object value = getValidExchangePropertyValue(entry.getKey(), entry.getValue());
if (value != null) {
Serializable converted = exchange.getContext().getTypeConverter().convertTo(Serializable.class, exchange, value);
@@ -347,30 +359,16 @@ public class DefaultExchangeHolder implements Serializable {
}
private static void logInvalidHeaderValue(String type, String key, Object value) {
- if (key.startsWith("Camel")) {
- // log Camel at DEBUG level
- if (LOG.isDebugEnabled()) {
- LOG.debug("Exchange {} containing key: {} with object: {} of type: {} is not valid header type, it will be excluded by the holder."
- , new Object[]{type, key, value, ObjectHelper.classCanonicalName(value)});
- }
- } else {
- // log regular at WARN level
- LOG.warn("Exchange {} containing key: {} with object: {} of type: {} is not valid header type, it will be excluded by the holder."
- , new Object[]{type, key, value, ObjectHelper.classCanonicalName(value)});
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Exchange {} containing key: {} with object: {} of type: {} is not valid header type, it will be excluded by the holder."
+ , new Object[]{type, key, value, ObjectHelper.classCanonicalName(value)});
}
}
private static void logInvalidExchangePropertyValue(String type, String key, Object value) {
- if (key.startsWith("Camel")) {
- // log Camel at DEBUG level
- if (LOG.isDebugEnabled()) {
- LOG.debug("Exchange {} containing key: {} with object: {} of type: {} is not valid exchange property type, it will be excluded by the holder."
- , new Object[]{type, key, value, ObjectHelper.classCanonicalName(value)});
- }
- } else {
- // log regular at WARN level
- LOG.warn("Exchange {} containing key: {} with object: {} of type: {} is not valid exchange property type, it will be excluded by the holder."
- , new Object[]{type, key, value, ObjectHelper.classCanonicalName(value)});
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Exchange {} containing key: {} with object: {} of type: {} is not valid exchange property type, it will be excluded by the holder."
+ , new Object[]{type, key, value, ObjectHelper.classCanonicalName(value)});
}
}
[2/2] camel git commit: CAMEL-9359: DefaultExchangeHolder should be
less noisty in logging. Also update javadoc about headers/properties are only
primitive/string/numbers.
Posted by da...@apache.org.
CAMEL-9359: DefaultExchangeHolder should be less noisty in logging. Also update javadoc about headers/properties are only primitive/string/numbers.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/f1d82129
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/f1d82129
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/f1d82129
Branch: refs/heads/camel-2.16.x
Commit: f1d82129301a9d7aa75a7f9771ddca8e3ad3336e
Parents: b371be6
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Nov 25 14:33:09 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Nov 25 14:33:34 2015 +0100
----------------------------------------------------------------------
.../camel/impl/DefaultExchangeHolder.java | 56 ++++++++++----------
1 file changed, 27 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/f1d82129/camel-core/src/main/java/org/apache/camel/impl/DefaultExchangeHolder.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/impl/DefaultExchangeHolder.java b/camel-core/src/main/java/org/apache/camel/impl/DefaultExchangeHolder.java
index ea9713c..a066043 100644
--- a/camel-core/src/main/java/org/apache/camel/impl/DefaultExchangeHolder.java
+++ b/camel-core/src/main/java/org/apache/camel/impl/DefaultExchangeHolder.java
@@ -34,27 +34,31 @@ import org.slf4j.LoggerFactory;
/**
* Holder object for sending an exchange over a remote wire as a serialized object.
* This is usually configured using the <tt>transferExchange=true</tt> option on the endpoint.
- * <p/>
- * Note: Message body of type {@link File} or {@link WrappedFile} is <b>not</b> supported and
+ * <br/>
+ * <b>Note:</b> Message body of type {@link File} or {@link WrappedFile} is <b>not</b> supported and
* a {@link RuntimeExchangeException} is thrown.
- * <p/>
+ * <br/>
* As opposed to normal usage where only the body part of the exchange is transferred over the wire,
* this holder object serializes the following fields over the wire:
* <ul>
* <li>exchangeId</li>
* <li>in body</li>
* <li>out body</li>
- * <li>in headers</li>
- * <li>out headers</li>
* <li>fault body </li>
- * <li>fault headers</li>
* <li>exchange properties</li>
* <li>exception</li>
* </ul>
+ * And the following headers is transferred if their values are of primitive types, String or Number based.
+ * <ul>
+ * <li>in headers</li>
+ * <li>out headers</li>
+ * <li>fault headers</li>
+ * </ul>
* The body is serialized and stored as serialized bytes. The header and exchange properties only include
- * primitive, and String types (and Exception types for exchange properties). Any other type is skipped.
- * <p/>
- * Any object that is not serializable will be skipped and Camel will log this at WARN level.
+ * primitive, String, and Number types (and Exception types for exchange properties). Any other type is skipped.
+ * <br/>
+ * Any message body object that is not serializable will be skipped and Camel will log this at <tt>WARN</tt> level.
+ * And any message header values that is not a primitive value will be skipped and Camel will log this at <tt>DEBUG</tt> level.
*
* @version
*/
@@ -235,6 +239,10 @@ public class DefaultExchangeHolder implements Serializable {
for (Map.Entry<String, Object> entry : map.entrySet()) {
// silently skip any values which is null
+ if (entry.getValue() == null) {
+ continue;
+ }
+
Object value = getValidHeaderValue(entry.getKey(), entry.getValue());
if (value != null) {
Serializable converted = exchange.getContext().getTypeConverter().convertTo(Serializable.class, exchange, value);
@@ -260,6 +268,10 @@ public class DefaultExchangeHolder implements Serializable {
for (Map.Entry<String, Object> entry : map.entrySet()) {
// silently skip any values which is null
+ if (entry.getValue() == null) {
+ continue;
+ }
+
Object value = getValidExchangePropertyValue(entry.getKey(), entry.getValue());
if (value != null) {
Serializable converted = exchange.getContext().getTypeConverter().convertTo(Serializable.class, exchange, value);
@@ -347,30 +359,16 @@ public class DefaultExchangeHolder implements Serializable {
}
private static void logInvalidHeaderValue(String type, String key, Object value) {
- if (key.startsWith("Camel")) {
- // log Camel at DEBUG level
- if (LOG.isDebugEnabled()) {
- LOG.debug("Exchange {} containing key: {} with object: {} of type: {} is not valid header type, it will be excluded by the holder."
- , new Object[]{type, key, value, ObjectHelper.classCanonicalName(value)});
- }
- } else {
- // log regular at WARN level
- LOG.warn("Exchange {} containing key: {} with object: {} of type: {} is not valid header type, it will be excluded by the holder."
- , new Object[]{type, key, value, ObjectHelper.classCanonicalName(value)});
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Exchange {} containing key: {} with object: {} of type: {} is not valid header type, it will be excluded by the holder."
+ , new Object[]{type, key, value, ObjectHelper.classCanonicalName(value)});
}
}
private static void logInvalidExchangePropertyValue(String type, String key, Object value) {
- if (key.startsWith("Camel")) {
- // log Camel at DEBUG level
- if (LOG.isDebugEnabled()) {
- LOG.debug("Exchange {} containing key: {} with object: {} of type: {} is not valid exchange property type, it will be excluded by the holder."
- , new Object[]{type, key, value, ObjectHelper.classCanonicalName(value)});
- }
- } else {
- // log regular at WARN level
- LOG.warn("Exchange {} containing key: {} with object: {} of type: {} is not valid exchange property type, it will be excluded by the holder."
- , new Object[]{type, key, value, ObjectHelper.classCanonicalName(value)});
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Exchange {} containing key: {} with object: {} of type: {} is not valid exchange property type, it will be excluded by the holder."
+ , new Object[]{type, key, value, ObjectHelper.classCanonicalName(value)});
}
}