From 18dc6866af53fb06efb0879f9c9c369e698d7379 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 18 Apr 2016 06:57:37 +0000
Subject: [PATCH] Remove ConnectionWrapper constructor accepting an InitialLdapContext

---
 opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/ui/LoginDialog.java |   37 +++++++++----------------------------
 1 files changed, 9 insertions(+), 28 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/ui/LoginDialog.java b/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/ui/LoginDialog.java
index d94336f..4e095b3 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/ui/LoginDialog.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/ui/LoginDialog.java
@@ -27,7 +27,6 @@
 import java.util.ArrayList;
 
 import javax.naming.NamingException;
-import javax.naming.ldap.InitialLdapContext;
 import javax.swing.Box;
 import javax.swing.JButton;
 import javax.swing.JDialog;
@@ -74,7 +73,7 @@
 {
   private static final long serialVersionUID = 9049409381101152000L;
 
-  private JFrame parent;
+  private final JFrame parent;
 
   private JLabel lHostName;
   private JLabel lUid;
@@ -89,10 +88,8 @@
 
   private boolean isCanceled = true;
 
-  private ApplicationTrustManager trustManager;
-  private int timeout;
-
-  private InitialLdapContext ctx;
+  private final ApplicationTrustManager trustManager;
+  private final int timeout;
 
   private ConnectionWrapper connWrapper;
 
@@ -191,15 +188,6 @@
 
   /**
    * Returns the connection we got with the provided authentication.
-   * @return the connection we got with the provided authentication.
-   */
-  public InitialLdapContext getContext()
-  {
-    return ctx;
-  }
-
-  /**
-   * Returns the connection we got with the provided authentication.
    *
    * @return the connection
    */
@@ -378,20 +366,15 @@
     dispose();
   }
 
-  /**
-   * Method called when user clicks on OK.
-   *
-   */
+  /** Method called when user clicks on OK. */
   private void okClicked()
   {
     BackgroundTask<Boolean> worker = new BackgroundTask<Boolean>()
     {
       @Override
-      public Boolean processBackgroundTask() throws NamingException,
-      ApplicationException
+      public Boolean processBackgroundTask() throws NamingException, ApplicationException
       {
-        Boolean isServerRunning = Boolean.TRUE;
-        ctx = null;
+        connWrapper = null;
         try
         {
           ControlPanelInfo info = ControlPanelInfo.getInstance();
@@ -409,16 +392,15 @@
             throw new ApplicationException(ReturnCode.APPLICATION_ERROR,
                 ERR_COULD_NOT_FIND_VALID_LDAPURL.get(), null);
           }
-          ctx = org.opends.guitools.controlpanel.util.Utilities.getAdminDirContext(info, dn, pwd);
-          connWrapper = new ConnectionWrapper(ctx, info.getConnectTimeout(), info.getTrustManager());
-
+          connWrapper = org.opends.guitools.controlpanel.util.Utilities.getAdminDirContext(info, dn, pwd);
+          return true; // server is running
         } catch (NamingException ne)
         {
           if (isServerRunning())
           {
             throw ne;
           }
-          isServerRunning = Boolean.FALSE;
+          return false;
         } catch (ApplicationException | IllegalStateException e)
         {
           throw e;
@@ -426,7 +408,6 @@
         {
           throw new IllegalStateException("Unexpected throwable.", t);
         }
-        return isServerRunning;
       }
 
       @Override

--
Gitblit v1.10.0