ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dillido...@apache.org
Subject git commit: ARGUS-157: defensively handle potential connection leaks in LdapUserGroupBuilder
Date Wed, 05 Nov 2014 23:08:34 GMT
Repository: incubator-argus
Updated Branches:
  refs/heads/master 7b287b7a5 -> b61836fae


ARGUS-157: defensively handle potential connection leaks in LdapUserGroupBuilder


Project: http://git-wip-us.apache.org/repos/asf/incubator-argus/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-argus/commit/b61836fa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-argus/tree/b61836fa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-argus/diff/b61836fa

Branch: refs/heads/master
Commit: b61836fae9f8a5bfeed37bff18afb036e2ce1ab3
Parents: 7b287b7
Author: Dilli Dorai Arumugam <darumugam@hortonworks.com>
Authored: Wed Nov 5 14:42:57 2014 -0800
Committer: Dilli Dorai Arumugam <darumugam@hortonworks.com>
Committed: Wed Nov 5 14:42:57 2014 -0800

----------------------------------------------------------------------
 .../xasecure/ldapusersync/process/LdapUserGroupBuilder.java    | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-argus/blob/b61836fa/ugsync/src/main/java/com/xasecure/ldapusersync/process/LdapUserGroupBuilder.java
----------------------------------------------------------------------
diff --git a/ugsync/src/main/java/com/xasecure/ldapusersync/process/LdapUserGroupBuilder.java
b/ugsync/src/main/java/com/xasecure/ldapusersync/process/LdapUserGroupBuilder.java
index c8d3204..e0a3fa3 100644
--- a/ugsync/src/main/java/com/xasecure/ldapusersync/process/LdapUserGroupBuilder.java
+++ b/ugsync/src/main/java/com/xasecure/ldapusersync/process/LdapUserGroupBuilder.java
@@ -180,6 +180,7 @@ public class LdapUserGroupBuilder implements UserGroupSource {
 	@Override
 	public void updateSink(UserGroupSink sink) throws Throwable {
 		LOG.info("LDAPUserGroupBuilder updateSink started");
+    NamingEnumeration<SearchResult> searchResultEnum = null;
 		try {
 			createLdapContext();
 			
@@ -191,7 +192,7 @@ public class LdapUserGroupBuilder implements UserGroupSource {
 		    
 			int counter = 0;
 			do {
-				NamingEnumeration<SearchResult> searchResultEnum = ldapContext
+				searchResultEnum = ldapContext
 					.search(userSearchBase, extendedSearchFilter,
 							searchControls);
 				while (searchResultEnum.hasMore()) { 
@@ -281,6 +282,9 @@ public class LdapUserGroupBuilder implements UserGroupSource {
 			LOG.info("LDAPUserGroupBuilder.updateSink() completed with user count: "
 					+ counter);
 		} finally {
+      if (searchResultEnum != null) {
+        searchResultEnum.close();
+      }
 			closeLdapContext();
 		}
 	}


Mime
View raw message