You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by om...@apache.org on 2011/03/04 05:11:05 UTC
svn commit: r1077399 -
/hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/ipc/Client.java
Author: omalley
Date: Fri Mar 4 04:11:05 2011
New Revision: 1077399
URL: http://svn.apache.org/viewvc?rev=1077399&view=rev
Log:
commit 98f3aed1678f1c7bcd1f7a42f14837eb39433a53
Author: Devaraj Das <dd...@yahoo-inc.com>
Date: Fri Apr 16 12:45:26 2010 -0700
HADOOP:6706 from https://issues.apache.org/jira/secure/attachment/12441782/6706.bp20.patch
+++ b/YAHOO-CHANGES.txt
+ HADOOP-6706. Fixes exception handling for saslConnect. The ideal
+ solution is to the Refreshable interface but as Owen noted in
+ HADOOP-6656, it doesn't seem to work as expected. (ddas)
+
Modified:
hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/ipc/Client.java
Modified: hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/ipc/Client.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/ipc/Client.java?rev=1077399&r1=1077398&r2=1077399&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/ipc/Client.java (original)
+++ hadoop/common/branches/branch-0.20-security-patches/src/core/org/apache/hadoop/ipc/Client.java Fri Mar 4 04:11:05 2011
@@ -358,7 +358,14 @@ public class Client {
saslRpcClient = new SaslRpcClient(authMethod, token,
serverPrincipal);
return saslRpcClient.saslConnect(in2, out2);
- } catch (javax.security.sasl.SaslException je) {
+ } catch (Exception e) {
+ LOG.warn("Exception encountered while connecting to the server : " +
+ e.getMessage() + ". Will attempt a relogin");
+ /*
+ * Catch all exceptions here. Most likely we would have hit one of
+ * the kerberos exceptions. Just attempt to relogin and try to
+ * connect to the server
+ */
UserGroupInformation loginUser = UserGroupInformation.getLoginUser();
UserGroupInformation currentUser =
UserGroupInformation.getCurrentUser();
@@ -379,17 +386,16 @@ public class Client {
saslRpcClient = new SaslRpcClient(authMethod, token,
serverPrincipal);
return saslRpcClient.saslConnect(in2, out2);
- } catch (javax.security.sasl.SaslException jee) {
- LOG.warn("Couldn't setup connection for " +
- loginUser.getUserName() +
- " to " + serverPrincipal + " even after relogin.");
- throw jee;
- } catch (IOException ie) {
- ie.initCause(je);
- throw ie;
+ } catch (Exception ex) {
+ String msg = "Couldn't setup connection for " +
+ loginUser.getUserName() +
+ " to " + serverPrincipal + " even after relogin.";
+ LOG.warn(msg);
+ throw (IOException) new IOException(msg).initCause(ex);
}
}
- throw je;
+ throw (IOException)new IOException("Failed to connect to the server"
+ ).initCause(e);
}
}
/** Connect to the server and set up the I/O streams. It then sends