HADOOP-6570. RPC#stopProxy throws NPE if getProxyEngine(proxy) returns null. Contributed by Hairong Kuang.
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@911134 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
3a7841aeb8
commit
4b4e9d741e
@ -207,6 +207,9 @@ Trunk (unreleased changes)
|
||||
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
|
||||
|
@ -244,8 +244,9 @@ public static Object getProxy(Class protocol, long clientVersion,
|
||||
* @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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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";
|
||||
@ -393,6 +395,14 @@ public void testNoPings() throws Exception {
|
||||
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 {
|
||||
|
||||
new TestRPC("test").testCalls(conf);
|
||||
|
Loading…
Reference in New Issue
Block a user