camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r679284 - in /activemq/camel/trunk/camel-core/src: main/java/org/apache/camel/component/log/ main/java/org/apache/camel/processor/interceptor/ main/java/org/apache/camel/util/ test/java/org/apache/camel/component/log/
Date Thu, 24 Jul 2008 06:10:54 GMT
Author: davsclaus
Date: Wed Jul 23 23:10:53 2008
New Revision: 679284

URL: http://svn.apache.org/viewvc?rev=679284&view=rev
Log:
CAMEL-740: Use canoical classname for log/tracer so we can see byte[] etc

Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/log/LogFormatter.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceFormatter.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/log/LogFormatterTest.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/log/LogFormatter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/log/LogFormatter.java?rev=679284&r1=679283&r2=679284&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/log/LogFormatter.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/component/log/LogFormatter.java
Wed Jul 23 23:10:53 2008
@@ -181,7 +181,7 @@
     }
 
     protected Object getBodyTypeAsString(Message message) {
-        String answer = ObjectHelper.className(message.getBody());
+        String answer = ObjectHelper.classCanoicalName(message.getBody());
         if (answer != null && answer.startsWith("java.lang.")) {
             return answer.substring(10);
         }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceFormatter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceFormatter.java?rev=679284&r1=679283&r2=679284&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceFormatter.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/interceptor/TraceFormatter.java
Wed Jul 23 23:10:53 2008
@@ -120,7 +120,7 @@
     }
 
     protected Object getBodyTypeAsString(Message message) {
-        String answer = ObjectHelper.className(message.getBody());
+        String answer = ObjectHelper.classCanoicalName(message.getBody());
         if (answer != null && answer.startsWith("java.lang.")) {
             return answer.substring(10);
         }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java?rev=679284&r1=679283&r2=679284&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
Wed Jul 23 23:10:53 2008
@@ -337,6 +337,17 @@
     }
 
     /**
+     * Returns the canoical type name of the given value
+     */
+    public static String classCanoicalName(Object value) {
+        if (value != null) {
+            return value.getClass().getCanonicalName();
+        } else {
+            return null;
+        }
+    }
+
+    /**
      * Attempts to load the given class name using the thread context class
      * loader or the class loader used to load this class
      *

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/log/LogFormatterTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/log/LogFormatterTest.java?rev=679284&r1=679283&r2=679284&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/log/LogFormatterTest.java
(original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/component/log/LogFormatterTest.java
Wed Jul 23 23:10:53 2008
@@ -53,6 +53,10 @@
         template.sendBody("log:org.apache.camel.TEST?multiline=true", "Hello World");
     }
 
+    public void testSendByteArrayMessageToLogDefault() throws Exception {
+        template.sendBody("log:org.apache.camel.TEST", "Hello World".getBytes());
+    }
+
     public void testSendExchangeWithOut() throws Exception {
         Endpoint endpoint = resolveMandatoryEndpoint("log:org.apache.camel.TEST?showAll=true&multiline=true");
         Exchange exchange = endpoint.createExchange();



Mime
View raw message