HDFS-14962. RBF: ConnectionPool#newConnection() error log wrong protocol class (#1699). Contributed by Yuxuan Wang.
This commit is contained in:
parent
6663d6a5c2
commit
b25a37c322
|
@ -374,7 +374,7 @@ public class ConnectionPool {
|
|||
throws IOException {
|
||||
if (!PROTO_MAP.containsKey(proto)) {
|
||||
String msg = "Unsupported protocol for connection to NameNode: "
|
||||
+ ((proto != null) ? proto.getClass().getName() : "null");
|
||||
+ ((proto != null) ? proto.getName() : "null");
|
||||
LOG.error(msg);
|
||||
throw new IllegalStateException(msg);
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.apache.hadoop.hdfs.server.protocol.NamenodeProtocol;
|
|||
import org.apache.hadoop.net.NetUtils;
|
||||
import org.apache.hadoop.security.UserGroupInformation;
|
||||
import org.apache.hadoop.test.GenericTestUtils;
|
||||
import org.apache.hadoop.test.LambdaTestUtils;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
@ -301,4 +302,13 @@ public class TestConnectionManager {
|
|||
|
||||
tmpConnManager.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnsupportedProtoExceptionMsg() throws Exception {
|
||||
LambdaTestUtils.intercept(IllegalStateException.class,
|
||||
"Unsupported protocol for connection to NameNode: "
|
||||
+ TestConnectionManager.class.getName(),
|
||||
() -> ConnectionPool.newConnection(conf, TEST_NN_ADDRESS, TEST_USER1,
|
||||
TestConnectionManager.class));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue