You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by lm...@apache.org on 2014/11/03 20:22:19 UTC
git commit: KNOX-459 - added null checks to the closing of
resultEnums to avoid NPEs
Repository: knox
Updated Branches:
refs/heads/master 868e5715e -> 197e9960d
KNOX-459 - added null checks to the closing of resultEnums to avoid NPEs
Project: http://git-wip-us.apache.org/repos/asf/knox/repo
Commit: http://git-wip-us.apache.org/repos/asf/knox/commit/197e9960
Tree: http://git-wip-us.apache.org/repos/asf/knox/tree/197e9960
Diff: http://git-wip-us.apache.org/repos/asf/knox/diff/197e9960
Branch: refs/heads/master
Commit: 197e9960d2724056f257ddb64980a62b40cf8d6a
Parents: 868e571
Author: Larry McCay <lm...@hortonworks.com>
Authored: Mon Nov 3 14:14:19 2014 -0500
Committer: Larry McCay <lm...@hortonworks.com>
Committed: Mon Nov 3 14:14:30 2014 -0500
----------------------------------------------------------------------
.../hadoop/gateway/shirorealm/KnoxLdapRealm.java | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/knox/blob/197e9960/gateway-provider-security-shiro/src/main/java/org/apache/hadoop/gateway/shirorealm/KnoxLdapRealm.java
----------------------------------------------------------------------
diff --git a/gateway-provider-security-shiro/src/main/java/org/apache/hadoop/gateway/shirorealm/KnoxLdapRealm.java b/gateway-provider-security-shiro/src/main/java/org/apache/hadoop/gateway/shirorealm/KnoxLdapRealm.java
index f9fc79c..1cf9fd8 100644
--- a/gateway-provider-security-shiro/src/main/java/org/apache/hadoop/gateway/shirorealm/KnoxLdapRealm.java
+++ b/gateway-provider-security-shiro/src/main/java/org/apache/hadoop/gateway/shirorealm/KnoxLdapRealm.java
@@ -274,10 +274,14 @@ public class KnoxLdapRealm extends JndiLdapRealm {
}
finally {
try {
- attributeEnum.close();
+ if (attributeEnum != null) {
+ attributeEnum.close();
+ }
}
finally {
- e.close();
+ if (e != null) {
+ e.close();
+ }
}
}
}
@@ -474,7 +478,9 @@ public class KnoxLdapRealm extends JndiLdapRealm {
finally {
if (searchResultEnum != null) {
try {
- searchResultEnum.close();
+ if (searchResultEnum != null) {
+ searchResultEnum.close();
+ }
}
finally {
LdapUtils.closeContext(systemLdapCtx);
@@ -534,7 +540,9 @@ public class KnoxLdapRealm extends JndiLdapRealm {
throw new IllegalArgumentException("Hit NamingException: " + e.getMessage());
} finally {
try {
- searchResultEnum.close();
+ if (searchResultEnum != null) {
+ searchResultEnum.close();
+ }
} catch (NamingException e) {
}
finally {