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 2013/10/22 18:31:30 UTC

[2/2] git commit: CAMEL-6871: Added option to log component to control if message body should skip LS or not. Favor using StringHelper.replaceAll that doesnt compile regexp, for this simple replace task.

CAMEL-6871: Added option to log component to control if message body should skip LS or not. Favor using StringHelper.replaceAll that doesnt compile regexp, for this simple replace task.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/5d6c303f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/5d6c303f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/5d6c303f

Branch: refs/heads/camel-2.12.x
Commit: 5d6c303f5580dd35270eda1a875791d0133a2130
Parents: 09a1d75
Author: Claus Ibsen <da...@apache.org>
Authored: Tue Oct 22 18:31:30 2013 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Tue Oct 22 18:31:50 2013 +0200

----------------------------------------------------------------------
 .../org/apache/camel/processor/DefaultExchangeFormatter.java    | 5 +++--
 .../src/main/java/org/apache/camel/util/StringHelper.java       | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/5d6c303f/camel-core/src/main/java/org/apache/camel/processor/DefaultExchangeFormatter.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/processor/DefaultExchangeFormatter.java b/camel-core/src/main/java/org/apache/camel/processor/DefaultExchangeFormatter.java
index 0eb6e80..19ee87a 100644
--- a/camel-core/src/main/java/org/apache/camel/processor/DefaultExchangeFormatter.java
+++ b/camel-core/src/main/java/org/apache/camel/processor/DefaultExchangeFormatter.java
@@ -27,6 +27,7 @@ import org.apache.camel.Message;
 import org.apache.camel.spi.ExchangeFormatter;
 import org.apache.camel.util.MessageHelper;
 import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.StringHelper;
 
 /**
  * Default {@link ExchangeFormatter} that have fine grained options to configure what to include in the output.
@@ -109,7 +110,7 @@ public class DefaultExchangeFormatter implements ExchangeFormatter {
             }
             String body = getBodyAsString(in);
             if (skipBodyLineSeparator) {
-                body = body.replaceAll(LS, "");
+                body = StringHelper.replaceAll(body, LS, "");
             }
             sb.append(style("Body")).append(body);
         }
@@ -165,7 +166,7 @@ public class DefaultExchangeFormatter implements ExchangeFormatter {
                     }
                     String body = getBodyAsString(out);
                     if (skipBodyLineSeparator) {
-                        body = body.replaceAll(LS, "");
+                        body = StringHelper.replaceAll(body, LS, "");
                     }
                     sb.append(style("OutBody")).append(body);
                 }

http://git-wip-us.apache.org/repos/asf/camel/blob/5d6c303f/camel-core/src/main/java/org/apache/camel/util/StringHelper.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/util/StringHelper.java b/camel-core/src/main/java/org/apache/camel/util/StringHelper.java
index 408fb16..54579af 100644
--- a/camel-core/src/main/java/org/apache/camel/util/StringHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/StringHelper.java
@@ -180,8 +180,8 @@ public final class StringHelper {
         if (ObjectHelper.isEmpty(input)) {
             return input;
         }
-        if (ObjectHelper.isEmpty(from)) {
-            throw new IllegalArgumentException("From cannot be empty");
+        if (from == null) {
+            throw new IllegalArgumentException("from cannot be null");
         }
         if (to == null) {
             // to can be empty, so only check for null