You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/01/17 04:03:23 UTC

[2/2] git commit: CAMEL-6921 Find another way to fix the NPE issue

CAMEL-6921 Find another way to fix the NPE issue


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

Branch: refs/heads/camel-2.11.x
Commit: 525fd0cc354821c57234239866dbf8895418aa21
Parents: 365a40c
Author: Willem Jiang <wi...@gmail.com>
Authored: Fri Jan 17 10:57:43 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Fri Jan 17 11:02:38 2014 +0800

----------------------------------------------------------------------
 .../java/org/apache/camel/component/netty/NettyProducer.java     | 3 ++-
 .../camel/component/netty/handlers/ClientChannelHandler.java     | 4 ++++
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/525fd0cc/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 65b1800..2a36440 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
@@ -484,7 +484,8 @@ public class NettyProducer extends DefaultAsyncProducer {
         @Override
         public void destroyObject(Channel channel) throws Exception {
             LOG.trace("Destroying channel: {}", channel);
-            // noop
+            NettyHelper.close(channel);
+            ALL_CHANNELS.remove(channel);
         }
 
         @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/525fd0cc/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
----------------------------------------------------------------------
diff --git a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
index 449fb22..cb380fc 100644
--- a/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
+++ b/components/camel-netty/src/main/java/org/apache/camel/component/netty/handlers/ClientChannelHandler.java
@@ -136,6 +136,10 @@ public class ClientChannelHandler extends SimpleChannelUpstreamHandler {
         }
 
         Exchange exchange = getExchange(ctx);
+        if (exchange == null) {
+            // we just ignore the received message as the channel is closed
+            return;
+        }
         AsyncCallback callback = getAsyncCallback(ctx);
 
         Object body = messageEvent.getMessage();