浏览代码

HADOOP-12178. NPE during handling of SASL setup if problem with SASL resolver class. Contributed by Steve Loughran

(cherry picked from commit ed9806ea40b945df0637c21b68964d1d2bd204f3)
Zhihai Xu 9 年之前
父节点
当前提交
73612294bd

+ 3 - 0
hadoop-common-project/hadoop-common/CHANGES.txt

@@ -680,6 +680,9 @@ Release 2.8.0 - UNRELEASED
     HADOOP-12457. [JDK8] Fix a failure of compiling common by javadoc.
     (Akira AJISAKA via ozawa)
 
+    HADOOP-12178. NPE during handling of SASL setup if problem with SASL
+    resolver class. (Steve Loughran via zxu)
+
   OPTIMIZATIONS
 
     HADOOP-12051. ProtobufRpcEngine.invoke() should use Exception.toString()

+ 7 - 2
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java

@@ -749,7 +749,12 @@ public class Client {
                       return setupSaslConnection(in2, out2);
                     }
                   });
-            } catch (Exception ex) {
+            } catch (IOException ex) {
+              if (saslRpcClient == null) {
+                // whatever happened -it can't be handled, so rethrow
+                throw ex;
+              }
+              // otherwise, assume a connection problem
               authMethod = saslRpcClient.getAuthMethod();
               if (rand == null) {
                 rand = new Random();
@@ -811,7 +816,7 @@ public class Client {
         if (t instanceof IOException) {
           markClosed((IOException)t);
         } else {
-          markClosed(new IOException("Couldn't set up IO streams", t));
+          markClosed(new IOException("Couldn't set up IO streams: " + t, t));
         }
         close();
       }