opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ConnectionUtils.java
@@ -188,39 +188,6 @@ } /** * Clones the provided InitialLdapContext and returns a connection using * the same parameters. * @param conn the connection to be cloned. * @param timeout the timeout to establish the connection in milliseconds. * Use {@code 0} to express no timeout. * @param trustManager the trust manager to be used to connect. * @param keyManager the key manager to be used to connect. * @return the new InitialLdapContext connected to the server. * @throws NamingException if there was an error creating the new connection. */ public static ConnectionWrapper cloneConnectionWrapper( final ConnectionWrapper conn, int timeout, final TrustManager trustManager, final KeyManager keyManager) throws NamingException { final Object[] pair = { null, null }; Thread t = new Thread(new Runnable() { @Override public void run() { try { if (conn.isLdaps() || conn.isStartTls()) { TrustedSocketFactory.setCurrentThreadTrustManager(trustManager, keyManager); } pair[0] = new ConnectionWrapper(conn); } catch (NamingException | RuntimeException ne) { pair[1] = ne; } } }); return ConnectionUtils.<ConnectionWrapper> getConnection(t, pair, timeout); } /** * Creates an LDAP+StartTLS connection and returns the corresponding * LdapContext. * This method first creates an LdapContext with anonymous bind. Then it @@ -392,11 +359,6 @@ private static InitialLdapContext getInitialLdapContext(Thread t, Object[] pair, int timeout) throws NamingException { return ConnectionUtils.<InitialLdapContext> getConnection(t, pair, timeout); } private static <T> T getConnection(Thread t, Object[] pair, int timeout) throws NamingException { try { if (timeout > 0) @@ -449,7 +411,7 @@ throw new IllegalStateException("Unexpected throwable occurred", (Throwable) ex); } } return (T) connection; return (InitialLdapContext) connection; } private static NamingException connectionTimedOut() opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/ControlPanelInfo.java
@@ -327,8 +327,7 @@ this.userDataConn = conn; if (conn != null) { ConnectionWrapper cloneConn = cloneConnectionWrapper(userDataConn, getConnectTimeout(), getTrustManager(), null); connectionPool.registerConnection(cloneConn); connectionPool.registerConnection(new ConnectionWrapper(userDataConn)); } } opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/task/DeleteEntryTask.java
@@ -18,7 +18,6 @@ import static org.forgerock.opendj.ldap.SearchScope.*; import static org.forgerock.opendj.ldap.requests.Requests.*; import static org.opends.admin.ads.util.ConnectionUtils.*; import static org.opends.messages.AdminToolMessages.*; import static org.opends.server.schema.SchemaConstants.*; @@ -41,11 +40,9 @@ import org.forgerock.opendj.ldap.Filter; import org.forgerock.opendj.ldap.LdapException; import org.forgerock.opendj.ldap.controls.SubtreeDeleteRequestControl; import org.forgerock.opendj.ldap.requests.DeleteRequest; import org.forgerock.opendj.ldap.requests.SearchRequest; import org.forgerock.opendj.ldap.responses.SearchResultEntry; import org.forgerock.opendj.ldif.ConnectionEntryReader; import org.opends.admin.ads.util.ConnectionWrapper; import org.opends.guitools.controlpanel.browser.BrowserController; import org.opends.guitools.controlpanel.browser.ConnectionWithControls; import org.opends.guitools.controlpanel.datamodel.BackendDescriptor; @@ -396,16 +393,9 @@ ColorAndFontConstants.defaultFont))); } }); // Use a copy of the connection since we are using a specific // control to delete the subtree and this can cause // synchronization problems when the tree is refreshed. ControlPanelInfo info = getInfo(); try (ConnectionWrapper conn1 = cloneConnectionWrapper(conn.getConnectionWrapper(), info.getConnectTimeout(), info.getTrustManager(), null)) { DeleteRequest request = newDeleteRequest(dn).addControl(SubtreeDeleteRequestControl.newControl(true)); conn1.getConnection().delete(request); } conn.delete(newDeleteRequest(dn).addControl(SubtreeDeleteRequestControl.newControl(true))); nDeleted ++; lastProgressTime = t; if (path != null)