You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by rm...@apache.org on 2018/03/23 05:31:09 UTC

ranger git commit: RANGER-2023: Hive test connection / lookup failed in kerberos cluster

Repository: ranger
Updated Branches:
  refs/heads/master d2073e774 -> 2925c07bf


RANGER-2023: Hive test connection / lookup failed in kerberos cluster

Signed-off-by: rmani <rm...@hortonworks.com>


Project: http://git-wip-us.apache.org/repos/asf/ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/2925c07b
Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/2925c07b
Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/2925c07b

Branch: refs/heads/master
Commit: 2925c07bf59c12be43f4a37b521f5f1b79e1125f
Parents: d2073e7
Author: rmani <rm...@hortonworks.com>
Authored: Thu Mar 15 12:11:51 2018 -0700
Committer: rmani <rm...@hortonworks.com>
Committed: Thu Mar 22 22:30:55 2018 -0700

----------------------------------------------------------------------
 .../ranger/services/hive/client/HiveClient.java | 22 ++++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ranger/blob/2925c07b/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveClient.java
----------------------------------------------------------------------
diff --git a/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveClient.java b/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveClient.java
index 265c015..bf1bc1d 100644
--- a/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveClient.java
+++ b/hive-agent/src/main/java/org/apache/ranger/services/hive/client/HiveClient.java
@@ -705,23 +705,23 @@ public class HiveClient extends BaseClient implements Closeable {
 				}
 			}
 
-			String decryptedPwd = null;
-			try {
-				decryptedPwd = PasswordUtils.decryptPassword(password);
-			} catch (Exception ex) {
-				LOG.info("Password decryption failed; trying Hive connection with received password string");
-				decryptedPwd = null;
-			} finally {
-				if (decryptedPwd == null) {
-					decryptedPwd = password;
-				}
-			}
 
 			try {
 
 				if (userName == null && password == null) {
 					con = DriverManager.getConnection(url);
 				} else {
+					String decryptedPwd = null;
+					try {
+						decryptedPwd = PasswordUtils.decryptPassword(password);
+					} catch (Exception ex) {
+						LOG.info("Password decryption failed; trying Hive connection with received password string");
+						decryptedPwd = null;
+					} finally {
+						if (decryptedPwd == null) {
+							decryptedPwd = password;
+						}
+					}
 					con = DriverManager.getConnection(url, userName, decryptedPwd);
 				}
 			} catch (SQLException e) {