camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [4/5] git commit: CAMEL-6946: Use ConnectException if netty producer cannot connect to remote server.
Date Fri, 08 Nov 2013 10:32:27 GMT
CAMEL-6946: Use ConnectException if netty producer cannot connect to remote server.


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

Branch: refs/heads/camel-2.12.x
Commit: d8238408c99be3998ac4f4a756dde509672636c0
Parents: 00668ee
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Fri Nov 8 11:32:41 2013 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Fri Nov 8 11:33:13 2013 +0100

----------------------------------------------------------------------
 .../java/org/apache/camel/component/netty/NettyProducer.java  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d8238408/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
index 0129c7d..2b5faba 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/NettyProducer.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.component.netty;
 
+import java.net.ConnectException;
 import java.net.InetSocketAddress;
 import java.util.Map;
 import java.util.concurrent.CountDownLatch;
@@ -433,7 +434,11 @@ public class NettyProducer extends DefaultAsyncProducer {
         
 
         if (!channelFuture.isDone() || !channelFuture.isSuccess()) {
-            throw new CamelException("Cannot connect to " + configuration.getAddress(), channelFuture.getCause());
+            ConnectException cause = new ConnectException("Cannot connect to " + configuration.getAddress());
+            if (channelFuture.getCause() != null) {
+                cause.initCause(channelFuture.getCause());
+            }
+            throw cause;
         }
         Channel answer = channelFuture.getChannel();
         // to keep track of all channels in use


Mime
View raw message