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 2008/09/15 17:59:51 UTC

svn commit: r695516 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/impl/ camel-core/src/main/java/org/apache/camel/impl/converter/ camel-core/src/main/java/org/apache/camel/processor/ camel-core/src/main/java/org/apache/camel/uti...

Author: davsclaus
Date: Mon Sep 15 08:59:49 2008
New Revision: 695516

URL: http://svn.apache.org/viewvc?rev=695516&view=rev
Log:
CAMEL-899: Wrapping as RuntimeCamelException uses static wrapper method to avoid double wrapping. Polished javadoc. Fixed spelling.

Added:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/concurrent/package.html   (with props)
    activemq/camel/trunk/components/camel-hamcrest/src/test/resources/log4j.properties   (with props)
Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerTemplate.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/ObjectHelper.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/concurrent/CountingLatch.java
    activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/processor/BamProcessorSupport.java
    activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
    activemq/camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcComponent.java
    activemq/camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java
    activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/EndpointMessageListener.java
    activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/MessageListenerProcessor.java
    activemq/camel/trunk/components/camel-ldap/src/main/java/org/apache/camel/component/ldap/LdapEndpoint.java
    activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationConsumer.java
    activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/EventEndpoint.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java
    activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/TransactionInterceptor.java

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java?rev=695516&r1=695515&r2=695516&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java Mon Sep 15 08:59:49 2008
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.impl;
 
-import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
@@ -28,6 +27,7 @@
 import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.spi.UnitOfWork;
 import org.apache.camel.util.UuidGenerator;
+import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException;
 
 /**
  * A default implementation of {@link Exchange}
@@ -246,7 +246,7 @@
         if (exception instanceof Exception) {
             throw (Exception)exception;
         }
-        throw new RuntimeCamelException(exception);
+        throw wrapRuntimeCamelException(exception);
     }
 
     public Message getFault() {

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerTemplate.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerTemplate.java?rev=695516&r1=695515&r2=695516&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerTemplate.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultProducerTemplate.java Mon Sep 15 08:59:49 2008
@@ -29,8 +29,8 @@
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
 import org.apache.camel.ProducerTemplate;
-import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.util.ObjectHelper;
+import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException;
 
 /**
  * A client helper object (named like Spring's TransactionTemplate & JmsTemplate
@@ -331,13 +331,7 @@
         if (result != null) {
             // rethrow if there was an exception
             if (result.getException() != null) {
-                if (result.getException() instanceof RuntimeCamelException) {
-                    // already a RuntimeCamelException so throw it as is
-                    throw (RuntimeCamelException) result.getException();
-                } else {
-                    // wrap checked exception in runtime
-                    throw new RuntimeCamelException(result.getException());
-                }
+                throw wrapRuntimeCamelException(result.getException());
             }
 
             // result could have a fault message

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java?rev=695516&r1=695515&r2=695516&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java Mon Sep 15 08:59:49 2008
@@ -26,8 +26,8 @@
 import org.apache.camel.FailedToCreateProducerException;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
-import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.impl.converter.AsyncProcessorTypeConverter;
+import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException;
 import org.apache.camel.util.ServiceHelper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -68,7 +68,7 @@
             Producer<E> producer = getProducer(endpoint);
             producer.process(exchange);
         } catch (Exception e) {
-            throw new RuntimeCamelException(e);
+            throw wrapRuntimeCamelException(e);
         }
     }
 
@@ -85,7 +85,7 @@
             E exchange = producer.createExchange();
             return sendExchange(endpoint, producer, processor, exchange);
         } catch (Exception e) {
-            throw new RuntimeCamelException(e);
+            throw wrapRuntimeCamelException(e);
         }
     }
 
@@ -105,7 +105,7 @@
             setProcessedSync(exchange, sync);
             return exchange;
         } catch (Exception e) {
-            throw new RuntimeCamelException(e);
+            throw wrapRuntimeCamelException(e);
         }
     }
 
@@ -133,7 +133,7 @@
             E exchange = producer.createExchange(pattern);
             return sendExchange(endpoint, producer, processor, exchange);
         } catch (Exception e) {
-            throw new RuntimeCamelException(e);
+            throw wrapRuntimeCamelException(e);
         }
     }
 

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java?rev=695516&r1=695515&r2=695516&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/converter/DefaultTypeConverter.java Mon Sep 15 08:59:49 2008
@@ -24,13 +24,13 @@
 import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.camel.Exchange;
-import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.TypeConverter;
 import org.apache.camel.spi.Injector;
 import org.apache.camel.spi.TypeConverterAware;
 import org.apache.camel.util.FactoryFinder;
 import org.apache.camel.util.NoFactoryAvailableException;
 import org.apache.camel.util.ObjectHelper;
+import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -250,7 +250,7 @@
                     // ignore its fine to have none
                 }
             } catch (Exception e) {
-                throw new RuntimeCamelException(e);
+                throw wrapRuntimeCamelException(e);
             }
         }
     }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java?rev=695516&r1=695515&r2=695516&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/TryProcessor.java Mon Sep 15 08:59:49 2008
@@ -20,10 +20,10 @@
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
-import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.impl.ServiceSupport;
 import org.apache.camel.util.ExchangeHelper;
 import org.apache.camel.util.ServiceHelper;
+import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -74,14 +74,14 @@
         } catch (Exception ex) {
             unexpected = ex;
         } catch (Throwable ex) {
-            unexpected = new RuntimeCamelException(ex);
+            unexpected = wrapRuntimeCamelException(ex);
         } finally {
             try {
                 processFinally(exchange);
             } catch (Exception ex) {
                 unexpected = ex;
             } catch (Throwable ex) {
-                unexpected = new RuntimeCamelException(ex);
+                unexpected = wrapRuntimeCamelException(ex);
             }
             if (unexpected != null) {
                 LOG.warn("Caught exception inside processFinally clause.", unexpected);

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=695516&r1=695515&r2=695516&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 Mon Sep 15 08:59:49 2008
@@ -664,4 +664,20 @@
         }
         return value != null;
     }
+
+    /**
+     * Wraps the caused exception in a {@link RuntimeCamelException} if its not already such an exception.
+     *
+     * @param e  the caused exception
+     * @return  the wrapper exception
+     */
+    public static RuntimeCamelException wrapRuntimeCamelException(Throwable e) {
+        if (e instanceof RuntimeCamelException) {
+            // don't double wrap if already a RuntimeCamelException
+            return (RuntimeCamelException) e;
+        } else {
+            return new RuntimeCamelException(e);
+        }
+    }
+
 }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/concurrent/CountingLatch.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/concurrent/CountingLatch.java?rev=695516&r1=695515&r2=695516&view=diff
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/concurrent/CountingLatch.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/concurrent/CountingLatch.java Mon Sep 15 08:59:49 2008
@@ -65,7 +65,7 @@
     /**
      * Get the current count
      */
-    public int getCount()  {
+    public int getCount() {
         return sync.getCount();
     }
     
@@ -97,7 +97,7 @@
      * 
      * @param timeout the value of the timeout
      * @param unit the unit in which the timeout is expressed
-     * @return <code>trAwue</code> if the latch has reached the count of 0 in the given time
+     * @return <code>true</code> if the latch has reached the count of 0 in the given time
      * @throws InterruptedException if the thread gets interrupted while waiting
      */
     public boolean await(long timeout, TimeUnit unit) throws InterruptedException {

Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/concurrent/package.html
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/concurrent/package.html?rev=695516&view=auto
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/concurrent/package.html (added)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/concurrent/package.html Mon Sep 15 08:59:49 2008
@@ -0,0 +1,25 @@
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<html>
+<head>
+</head>
+<body>
+
+Concurrent utility classes
+
+</body>
+</html>

Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/concurrent/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/concurrent/package.html
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/util/concurrent/package.html
------------------------------------------------------------------------------
    svn:mime-type = text/html

Modified: activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/processor/BamProcessorSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/processor/BamProcessorSupport.java?rev=695516&r1=695515&r2=695516&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/processor/BamProcessorSupport.java (original)
+++ activemq/camel/trunk/components/camel-bam/src/main/java/org/apache/camel/bam/processor/BamProcessorSupport.java Mon Sep 15 08:59:49 2008
@@ -22,8 +22,8 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.Expression;
 import org.apache.camel.Processor;
-import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.util.ExchangeHelper;
+import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.springframework.transaction.TransactionStatus;
@@ -145,7 +145,7 @@
     protected Object onError(TransactionStatus status, Exception e) {
         status.setRollbackOnly();
         LOG.error("Caught: " + e, e);
-        throw new RuntimeCamelException(e);
+        throw wrapRuntimeCamelException(e);
     }
 
 }

Modified: activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java?rev=695516&r1=695515&r2=695516&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java (original)
+++ activemq/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfProducer.java Mon Sep 15 08:59:49 2008
@@ -36,6 +36,7 @@
 import org.apache.camel.component.cxf.util.CxfEndpointUtils;
 import org.apache.camel.impl.DefaultProducer;
 import org.apache.camel.util.ObjectHelper;
+import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException;
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.bus.spring.SpringBusFactory;
@@ -255,7 +256,7 @@
             }
         } catch (Exception e) {
             // TODO add the fault message handling work
-            throw new RuntimeCamelException(e);
+            throw wrapRuntimeCamelException(e);
         }
 
     }

Added: activemq/camel/trunk/components/camel-hamcrest/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-hamcrest/src/test/resources/log4j.properties?rev=695516&view=auto
==============================================================================
--- activemq/camel/trunk/components/camel-hamcrest/src/test/resources/log4j.properties (added)
+++ activemq/camel/trunk/components/camel-hamcrest/src/test/resources/log4j.properties Mon Sep 15 08:59:49 2008
@@ -0,0 +1,35 @@
+## ---------------------------------------------------------------------------
+## Licensed to the Apache Software Foundation (ASF) under one or more
+## contributor license agreements.  See the NOTICE file distributed with
+## this work for additional information regarding copyright ownership.
+## The ASF licenses this file to You under the Apache License, Version 2.0
+## (the "License"); you may not use this file except in compliance with
+## the License.  You may obtain a copy of the License at
+## 
+## http://www.apache.org/licenses/LICENSE-2.0
+## 
+## Unless required by applicable law or agreed to in writing, software
+## distributed under the License is distributed on an "AS IS" BASIS,
+## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+## See the License for the specific language governing permissions and
+## limitations under the License.
+## ---------------------------------------------------------------------------
+
+#
+# The logging properties used during tests..
+#
+log4j.rootLogger=INFO, out
+
+# CONSOLE appender not used by default
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+
+# File appender
+log4j.appender.out=org.apache.log4j.FileAppender
+log4j.appender.out.layout=org.apache.log4j.PatternLayout
+log4j.appender.out.layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
+log4j.appender.out.file=target/camel-hamcrest-test.log
+log4j.appender.out.append=true
+
+#log4j.logger.org.apache.camel=DEBUG
\ No newline at end of file

Propchange: activemq/camel/trunk/components/camel-hamcrest/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-hamcrest/src/test/resources/log4j.properties
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: activemq/camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcComponent.java?rev=695516&r1=695515&r2=695516&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcComponent.java (original)
+++ activemq/camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcComponent.java Mon Sep 15 08:59:49 2008
@@ -103,8 +103,6 @@
             conn.connect();
         } catch (Exception e) {
             LOG.error("Failed to connect: " + e, e);
-
-            // TODO use checked exceptions?
             throw new RuntimeCamelException(e);
         }
         return conn;
@@ -115,7 +113,7 @@
             connection.doQuit();
             connection.close();
         } catch (Exception e) {
-            e.printStackTrace();
+            LOG.warn("Error closing connection.", e);
         }
     }
 

Modified: activemq/camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java?rev=695516&r1=695515&r2=695516&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java (original)
+++ activemq/camel/trunk/components/camel-irc/src/main/java/org/apache/camel/component/irc/IrcConfiguration.java Mon Sep 15 08:59:49 2008
@@ -21,23 +21,23 @@
 import org.apache.camel.RuntimeCamelException;
 
 public class IrcConfiguration implements Cloneable {
-    String target;
-    String hostname;
-    String password;
-    String nickname;
-    String realname;
-    String username;
-    boolean persistent = true;
-    boolean colors = true;
-    boolean onNick = true;
-    boolean onQuit = true;
-    boolean onJoin = true;
-    boolean onKick = true;
-    boolean onMode = true;
-    boolean onPart = true;
-    boolean onTopic = true;
-    boolean onPrivmsg = true;
-    int[] ports = {6667, 6668, 6669};
+    private String target;
+    private String hostname;
+    private String password;
+    private String nickname;
+    private String realname;
+    private String username;
+    private boolean persistent = true;
+    private boolean colors = true;
+    private boolean onNick = true;
+    private boolean onQuit = true;
+    private boolean onJoin = true;
+    private boolean onKick = true;
+    private boolean onMode = true;
+    private boolean onPart = true;
+    private boolean onTopic = true;
+    private boolean onPrivmsg = true;
+    private int[] ports = {6667, 6668, 6669};
 
     public IrcConfiguration() {
     }

Modified: activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/EndpointMessageListener.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/EndpointMessageListener.java?rev=695516&r1=695515&r2=695516&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/EndpointMessageListener.java (original)
+++ activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/EndpointMessageListener.java Mon Sep 15 08:59:49 2008
@@ -25,6 +25,7 @@
 import org.apache.camel.ExchangePattern;
 import org.apache.camel.Processor;
 import org.apache.camel.RuntimeCamelException;
+import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.springframework.jms.core.JmsOperations;
@@ -36,7 +37,7 @@
  *
  * Note that instance of this object has to be thread safe (reentrant)
  * 
- * @version $Revision$    ;';;;
+ * @version $Revision$
  */
 public class EndpointMessageListener implements MessageListener {
     private static final transient Log LOG = LogFactory.getLog(EndpointMessageListener.class);
@@ -75,7 +76,7 @@
                 if (exchange.getException() != null) {
                     // an exception occured while processing
                     // TODO: Camel-585 somekind of flag to determine if we should send the exchange back to the client
-                    // or do as new wrap as runtime exception to be thrown back to spring so it can do rollback
+                    // or do as now where we wrap as runtime exception to be thrown back to spring so it can do rollback
                     rce = wrapRuntimeCamelException(exchange.getException());
                 } else if (exchange.getFault().getBody() != null) {
                     // a fault occured while processing
@@ -175,19 +176,6 @@
     // Implementation methods
     //-------------------------------------------------------------------------
 
-    /**
-     * Wraps the caused exception in a RuntimeCamelException if its not already such an exception
-     */
-    private static RuntimeCamelException wrapRuntimeCamelException(Throwable e) {
-        // TODO: Move to camel-core
-        if (e instanceof RuntimeCamelException) {
-            // dont double wrap if already a RuntimeCamelException
-            return (RuntimeCamelException) e;
-        } else {
-            return new RuntimeCamelException(e);
-        }
-    }
-
     protected void sendReply(Destination replyDestination, final Message message, final JmsExchange exchange, final JmsMessage out) {
         if (replyDestination == null) {
             if (LOG.isDebugEnabled()) {

Modified: activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/MessageListenerProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/MessageListenerProcessor.java?rev=695516&r1=695515&r2=695516&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/MessageListenerProcessor.java (original)
+++ activemq/camel/trunk/components/camel-jms/src/main/java/org/apache/camel/component/jms/MessageListenerProcessor.java Mon Sep 15 08:59:49 2008
@@ -21,7 +21,7 @@
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
-import org.apache.camel.RuntimeCamelException;
+import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException;
 
 /**
  * Represents a JMS {@link MessageListener} which can be used directly with any
@@ -44,7 +44,7 @@
             Exchange exchange = endpoint.createExchange(message);
             processor.process(exchange);
         } catch (Exception e) {
-            throw new RuntimeCamelException(e);
+            throw wrapRuntimeCamelException(e);
         }
     }
 }

Modified: activemq/camel/trunk/components/camel-ldap/src/main/java/org/apache/camel/component/ldap/LdapEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ldap/src/main/java/org/apache/camel/component/ldap/LdapEndpoint.java?rev=695516&r1=695515&r2=695516&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ldap/src/main/java/org/apache/camel/component/ldap/LdapEndpoint.java (original)
+++ activemq/camel/trunk/components/camel-ldap/src/main/java/org/apache/camel/component/ldap/LdapEndpoint.java Mon Sep 15 08:59:49 2008
@@ -20,7 +20,6 @@
 
 import javax.naming.directory.SearchControls;
 
-import org.apache.camel.CamelException;
 import org.apache.camel.Consumer;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
@@ -81,7 +80,7 @@
         this.scope = scope;
     }
 
-    private int toSearchControlScope(String scope) throws CamelException {
+    private int toSearchControlScope(String scope) {
         if (scope.equalsIgnoreCase(OBJECT_SCOPE)) {
             return SearchControls.OBJECT_SCOPE;
         } else if (scope.equalsIgnoreCase(ONELEVEL_SCOPE)) {
@@ -89,7 +88,7 @@
         } else if (scope.equalsIgnoreCase(SUBTREE_SCOPE)) {
             return SearchControls.SUBTREE_SCOPE;
         } else {
-            throw new CamelException("Invalid search scope \"" + scope
+            throw new IllegalArgumentException("Invalid search scope \"" + scope
                 + "\" for LdapEndpoint: " + getEndpointUri());
         }
     }

Modified: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationConsumer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationConsumer.java?rev=695516&r1=695515&r2=695516&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationConsumer.java (original)
+++ activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationConsumer.java Mon Sep 15 08:59:49 2008
@@ -57,7 +57,7 @@
                 inputChannel = (AbstractPollableChannel) channelRegistry.lookupChannel(inputChannelName);
                 ObjectHelper.notNull(inputChannel, "The inputChannel with the name [" + inputChannelName + "]");
             } else {
-                throw new RuntimeCamelException("Can't find the right inputChannelName, , please check your configuration.");
+                throw new RuntimeCamelException("Can't find the right inputChannelName, please check your configuration.");
             }
         } else {
             if (endpoint.getMessageChannel() != null) {

Modified: activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java?rev=695516&r1=695515&r2=695516&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java (original)
+++ activemq/camel/trunk/components/camel-spring-integration/src/main/java/org/apache/camel/component/spring/integration/SpringIntegrationProducer.java Mon Sep 15 08:59:49 2008
@@ -60,7 +60,7 @@
                 outputChannelName = endpoint.getInputChannel();
             }
             if (ObjectHelper.isNullOrBlank(outputChannelName)) {
-                throw new RuntimeCamelException("Can't find the right outputChannelName,"
+                throw new RuntimeCamelException("Can't find the right outputChannelName, "
                                                 + "please check the endpoint uri outputChannel part!");
             } else {
                 outputChannel = (AbstractPollableChannel) channelRegistry.lookupChannel(outputChannelName);

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/EventEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/EventEndpoint.java?rev=695516&r1=695515&r2=695516&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/EventEndpoint.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/event/EventEndpoint.java Mon Sep 15 08:59:49 2008
@@ -19,11 +19,11 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
-import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.impl.DefaultProducer;
 import org.apache.camel.processor.loadbalancer.LoadBalancer;
 import org.apache.camel.processor.loadbalancer.TopicLoadBalancer;
+import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException;
 import org.springframework.beans.BeansException;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
@@ -79,7 +79,7 @@
         try {
             getLoadBalancer().process(exchange);
         } catch (Exception e) {
-            throw new RuntimeCamelException(e);
+            throw wrapRuntimeCamelException(e);
         }
     }
 

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java?rev=695516&r1=695515&r2=695516&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelBeanPostProcessor.java Mon Sep 15 08:59:49 2008
@@ -34,7 +34,6 @@
 import org.apache.camel.Processor;
 import org.apache.camel.Produce;
 import org.apache.camel.Producer;
-import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.Service;
 import org.apache.camel.component.bean.BeanProcessor;
 import org.apache.camel.component.bean.ProxyHelper;
@@ -52,6 +51,7 @@
 
 import static org.apache.camel.util.ObjectHelper.isNotNullAndNonEmpty;
 import static org.apache.camel.util.ObjectHelper.isNullOrBlank;
+import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException;
 
 /**
  * A post processor to perform injection of {@link Endpoint} and
@@ -218,7 +218,7 @@
                 startService(consumer);
             } catch (Exception e) {
                 LOG.warn(e);
-                throw new RuntimeCamelException(e);
+                throw wrapRuntimeCamelException(e);
             }
         }
     }
@@ -276,7 +276,7 @@
             startService(pollingConsumer);
             return pollingConsumer;
         } catch (Exception e) {
-            throw new RuntimeCamelException(e);
+            throw wrapRuntimeCamelException(e);
         }
     }
 
@@ -290,7 +290,7 @@
             startService(producer);
             return producer;
         } catch (Exception e) {
-            throw new RuntimeCamelException(e);
+            throw wrapRuntimeCamelException(e);
         }
     }
 

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java?rev=695516&r1=695515&r2=695516&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java Mon Sep 15 08:59:49 2008
@@ -29,13 +29,11 @@
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 
-import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.builder.ErrorHandlerBuilder;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.DefaultLifecycleStrategy;
 import org.apache.camel.management.DefaultInstrumentationAgent;
 import org.apache.camel.management.InstrumentationLifecycleStrategy;
-import org.apache.camel.management.InstrumentationProcessor;
 import org.apache.camel.model.ExceptionType;
 import org.apache.camel.model.IdentifiedType;
 import org.apache.camel.model.InterceptType;
@@ -50,6 +48,7 @@
 import org.apache.camel.processor.interceptor.Tracer;
 import org.apache.camel.spi.LifecycleStrategy;
 import org.apache.camel.spi.Registry;
+import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.springframework.beans.factory.DisposableBean;
@@ -275,7 +274,7 @@
                 LOG.debug("Starting the context now!");
                 getContext().start();
             } catch (Exception e) {
-                throw new RuntimeCamelException(e);
+                throw wrapRuntimeCamelException(e);
             }
         }
         /*

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java?rev=695516&r1=695515&r2=695516&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/SpringCamelContext.java Mon Sep 15 08:59:49 2008
@@ -18,7 +18,6 @@
 
 import org.apache.camel.Endpoint;
 import org.apache.camel.Processor;
-import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.component.bean.BeanProcessor;
 import org.apache.camel.component.event.EventComponent;
 import org.apache.camel.component.event.EventEndpoint;
@@ -29,6 +28,7 @@
 import org.apache.camel.spring.spi.ApplicationContextRegistry;
 import org.apache.camel.spring.spi.SpringInjector;
 import org.apache.camel.util.ObjectHelper;
+import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.springframework.beans.BeansException;
@@ -115,7 +115,7 @@
             } catch (RuntimeException e) {
                 throw e;
             } catch (Exception e) {
-                throw new RuntimeCamelException(e);
+                throw wrapRuntimeCamelException(e);
             }
             if (eventEndpoint != null) {
                 eventEndpoint.onApplicationEvent(event);

Modified: activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/TransactionInterceptor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/TransactionInterceptor.java?rev=695516&r1=695515&r2=695516&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/TransactionInterceptor.java (original)
+++ activemq/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/spi/TransactionInterceptor.java Mon Sep 15 08:59:49 2008
@@ -23,6 +23,7 @@
 import org.apache.camel.processor.DelayPolicy;
 import org.apache.camel.processor.DelegateProcessor;
 import org.apache.camel.processor.RedeliveryPolicy;
+import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.springframework.transaction.TransactionDefinition;
@@ -134,19 +135,6 @@
     }
 
     /**
-     * Wraps the caused exception in a RuntimeCamelException if its not already such an exception
-     */
-    private static RuntimeCamelException wrapRuntimeCamelException(Throwable e) {
-        if (e instanceof RuntimeCamelException) {
-            // dont double wrap if already a RuntimeCamelException
-            return (RuntimeCamelException) e;
-        } else {
-             // wrap if the exchange threw an exception
-            return new RuntimeCamelException(e);
-        }
-    }
-
-    /**
      * Sleeps before the transaction is set as rollback and the caused exception is rethrown to let the
      * Spring TransactionManager handle the rollback.
      */