camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject svn commit: r1165246 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/builder/ main/java/org/apache/camel/component/log/ main/java/org/apache/camel/util/ test/java/org/apache/camel/processor/
Date Mon, 05 Sep 2011 11:47:16 GMT
Author: cschneider
Date: Mon Sep  5 11:47:15 2011
New Revision: 1165246

URL: http://svn.apache.org/viewvc?rev=1165246&view=rev
Log:
CAMEL-4414 Fixes

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DefaultErrorHandlerBuilder.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/log/LogProducer.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/util/CamelLogger.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThroughPutLoggerTest.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DefaultErrorHandlerBuilder.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DefaultErrorHandlerBuilder.java?rev=1165246&r1=1165245&r2=1165246&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DefaultErrorHandlerBuilder.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/builder/DefaultErrorHandlerBuilder.java
Mon Sep  5 11:47:15 2011
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.builder;
 
-import static org.apache.camel.builder.PredicateBuilder.toPredicate;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Expression;
@@ -30,6 +29,8 @@ import org.apache.camel.spi.RouteContext
 import org.apache.camel.util.CamelLogger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.camel.builder.PredicateBuilder.toPredicate;
+
 /**
  * The default error handler builder.
  *

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/log/LogProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/log/LogProducer.java?rev=1165246&r1=1165245&r2=1165246&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/log/LogProducer.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/log/LogProducer.java Mon
Sep  5 11:47:15 2011
@@ -20,7 +20,6 @@ import org.apache.camel.AsyncCallback;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
-import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.impl.DefaultAsyncProducer;
 
 /**
@@ -39,9 +38,10 @@ public class LogProducer extends Default
         try {
             logger.process(exchange);
         } catch (Exception e) {
-            throw new RuntimeCamelException(e);
+            exchange.setException(e);
+        } finally {
+            callback.done(true);
         }
-        callback.done(true);
         return true;
     }
 }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/CamelLogger.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/CamelLogger.java?rev=1165246&r1=1165245&r2=1165246&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/util/CamelLogger.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/CamelLogger.java Mon Sep  5
11:47:15 2011
@@ -45,7 +45,7 @@ public class CamelLogger {
 
     public CamelLogger(Logger log, LoggingLevel level) {
         this.log = log;
-        this.level = level;
+        setLevel(level);
     }
 
     public CamelLogger(String logName) {
@@ -70,7 +70,7 @@ public class CamelLogger {
     
     public void log(String message) {
         if (shouldLog(log, level)) {
-            log(log, level,message);
+            log(log, level, message);
         }
     }
 
@@ -97,6 +97,10 @@ public class CamelLogger {
     }
 
     public void setLevel(LoggingLevel level) {
+        if (level == null) {
+            throw new IllegalArgumentException("Log level may not be null");
+        }
+
         this.level = level;
     }
 
@@ -105,9 +109,6 @@ public class CamelLogger {
     }
 
     public static boolean shouldLog(Logger log, LoggingLevel level) {
-        if (level == null) {
-            throw new NullPointerException("Log level may not be null");
-        }
         return level == LoggingLevel.DEBUG && log.isDebugEnabled() 
             || level == LoggingLevel.ERROR && log.isErrorEnabled()
             || level == LoggingLevel.INFO && log.isInfoEnabled()
@@ -116,9 +117,6 @@ public class CamelLogger {
     }
 
     public static void log(Logger log, LoggingLevel level, String message) {
-        if (level == null) {
-            throw new NullPointerException("Log level may not be null");
-        }
         switch (level) {
         case DEBUG:
             log.debug(message);
@@ -135,13 +133,11 @@ public class CamelLogger {
         case WARN:
             log.warn(message);
             break;
+        default:
         }
     }
     
     public static void log(Logger log, LoggingLevel level, String message, Throwable th)
{
-        if (level == null) {
-            throw new NullPointerException("Log level may not be null");
-        }
         switch (level) {
         case DEBUG:
             log.debug(message, th);
@@ -158,6 +154,7 @@ public class CamelLogger {
         case WARN:
             log.warn(message, th);
             break;
+        default:
         }
     }
 

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThroughPutLoggerTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThroughPutLoggerTest.java?rev=1165246&r1=1165245&r2=1165246&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThroughPutLoggerTest.java
(original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/ThroughPutLoggerTest.java
Mon Sep  5 11:47:15 2011
@@ -16,10 +16,10 @@
  */
 package org.apache.camel.processor;
 
+import junit.framework.TestCase;
 import org.apache.camel.util.CamelLogger;
 import org.easymock.EasyMock;
 import org.slf4j.Logger;
-import junit.framework.TestCase;
 
 public class ThroughPutLoggerTest extends TestCase {
 



Mime
View raw message