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/11/08 11:32:25 UTC
[2/5] git commit: CAMEL-6946: Use ConnectException if netty producer
cannot connect to remote server.
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/3813c745
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3813c745
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3813c745
Branch: refs/heads/master
Commit: 3813c7453e62494c68f88358b90c23edbf2d2728
Parents: 0372752
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Nov 8 11:32:41 2013 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Nov 8 11:32:41 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/3813c745/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