Alon Bar-Lev has posted comments on this change. Change subject: aaa: fix coverity issues ......................................................................
Patch Set 4: Code-Review+1 (3 comments) I still think that the try/finally of the context can be simpler... http://gerrit.ovirt.org/#/c/27397/4/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/ldap/RootDSEData.java File backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/ldap/RootDSEData.java: Line 56: Hashtable<String, String> env = new Hashtable<>(); Line 57: env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); Line 58: env.put(Context.PROVIDER_URL, url.toString()); Line 59: try { Line 60: dirContext = new InitialDirContext(env); I still think these should be moved above the try and remove the != null condition... not sure why you need the condition. DirContext dirContext = new InitialDirContext(env); try { .... } finally { dirContext.close(); } Line 61: SearchControls controls = RootDSEQueryInfo.createSearchControls(); Line 62: String query = RootDSEQueryInfo.ROOT_DSE_LDAP_QUERY; Line 63: NamingEnumeration<SearchResult> searchResults = dirContext.search("", query, controls); Line 64: http://gerrit.ovirt.org/#/c/27397/4/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/kerberos/JndiAction.java File backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/kerberos/JndiAction.java: Line 104: currentLdapServer = ldapQueryPath.toString(); Line 105: env.put(Context.PROVIDER_URL, currentLdapServer); Line 106: Line 107: // Run the LDAP query to get the user Line 108: ctx = new InitialDirContext(env); why don't you start the try here? Line 109: NamingEnumeration<SearchResult> answer = executeQuery(ctx, controls, prepareQuery()); Line 110: Line 111: if (answer.hasMoreElements()) { Line 112: // Print the objectGUID for the user as well as URI and query path Line 105: env.put(Context.PROVIDER_URL, currentLdapServer); Line 106: Line 107: // Run the LDAP query to get the user Line 108: ctx = new InitialDirContext(env); Line 109: NamingEnumeration<SearchResult> answer = executeQuery(ctx, controls, prepareQuery()); and close it here? Line 110: Line 111: if (answer.hasMoreElements()) { Line 112: // Print the objectGUID for the user as well as URI and query path Line 113: String guid = guidFromResults(answer.next()); -- To view, visit http://gerrit.ovirt.org/27397 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I057929e0f2dc7672bc5d06457d14c548f4726112 Gerrit-PatchSet: 4 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yair Zaslavsky <[email protected]> Gerrit-Reviewer: Alon Bar-Lev <[email protected]> Gerrit-Reviewer: Yair Zaslavsky <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
