hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hair...@apache.org
Subject svn commit: r911134 - in /hadoop/common/trunk: CHANGES.txt src/java/org/apache/hadoop/ipc/RPC.java src/test/core/org/apache/hadoop/ipc/TestRPC.java
Date Wed, 17 Feb 2010 18:22:41 GMT
Author: hairong
Date: Wed Feb 17 18:22:40 2010
New Revision: 911134

URL: http://svn.apache.org/viewvc?rev=911134&view=rev
Log:
HADOOP-6570. RPC#stopProxy throws NPE if getProxyEngine(proxy) returns null. Contributed by
Hairong Kuang.

Modified:
    hadoop/common/trunk/CHANGES.txt
    hadoop/common/trunk/src/java/org/apache/hadoop/ipc/RPC.java
    hadoop/common/trunk/src/test/core/org/apache/hadoop/ipc/TestRPC.java

Modified: hadoop/common/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/CHANGES.txt?rev=911134&r1=911133&r2=911134&view=diff
==============================================================================
--- hadoop/common/trunk/CHANGES.txt (original)
+++ hadoop/common/trunk/CHANGES.txt Wed Feb 17 18:22:40 2010
@@ -207,6 +207,9 @@
     HADOOP-6549. TestDoAsEffectiveUser should use ip address of the host
      for superuser ip check(jnp via boryas)
 
+    HADOOP-6570. RPC#stopProxy throws NPE if getProxyEngine(proxy) returns
+    null. (hairong)
+
 Release 0.21.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/common/trunk/src/java/org/apache/hadoop/ipc/RPC.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/java/org/apache/hadoop/ipc/RPC.java?rev=911134&r1=911133&r2=911134&view=diff
==============================================================================
--- hadoop/common/trunk/src/java/org/apache/hadoop/ipc/RPC.java (original)
+++ hadoop/common/trunk/src/java/org/apache/hadoop/ipc/RPC.java Wed Feb 17 18:22:40 2010
@@ -244,8 +244,9 @@
    * @param proxy the proxy to be stopped
    */
   public static void stopProxy(Object proxy) {
-    if (proxy!=null) {
-      getProxyEngine(proxy).stopProxy(proxy);
+    RpcEngine rpcEngine;
+    if (proxy!=null && (rpcEngine = getProxyEngine(proxy)) != null) {
+      rpcEngine.stopProxy(proxy);
     }
   }
 

Modified: hadoop/common/trunk/src/test/core/org/apache/hadoop/ipc/TestRPC.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/src/test/core/org/apache/hadoop/ipc/TestRPC.java?rev=911134&r1=911133&r2=911134&view=diff
==============================================================================
--- hadoop/common/trunk/src/test/core/org/apache/hadoop/ipc/TestRPC.java (original)
+++ hadoop/common/trunk/src/test/core/org/apache/hadoop/ipc/TestRPC.java Wed Feb 17 18:22:40
2010
@@ -39,6 +39,8 @@
 import org.apache.hadoop.security.authorize.Service;
 import org.apache.hadoop.security.authorize.ServiceAuthorizationManager;
 
+import static org.mockito.Mockito.*;
+
 /** Unit tests for RPC. */
 public class TestRPC extends TestCase {
   private static final String ADDRESS = "0.0.0.0";
@@ -392,6 +394,14 @@
     conf.setBoolean("ipc.client.ping", false);
     new TestRPC("testnoPings").testCalls(conf);
   }
+
+  /**
+   * Test stopping a non-registered proxy
+   * @throws Exception
+   */
+  public void testStopNonRegisteredProxy() throws Exception {
+    RPC.stopProxy(mock(TestProtocol.class));
+  }
   
   public static void main(String[] args) throws Exception {
 



Mime
View raw message