From f45aad28ca76ce859bfae6aa9cff650b9a34b85e Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 07 Feb 2014 15:41:31 +0000
Subject: [PATCH] Used StaticUtils.close().

---
 opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/LoginPanel.java |   25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/LoginPanel.java b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/LoginPanel.java
index 98969ea..7c804d6 100644
--- a/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/LoginPanel.java
+++ b/opendj3-server-dev/src/guitools/org/opends/guitools/controlpanel/ui/LoginPanel.java
@@ -37,9 +37,6 @@
 import java.util.Iterator;
 import java.util.LinkedHashSet;
 
-import org.forgerock.i18n.LocalizableMessage;
-import org.forgerock.i18n.slf4j.LocalizedLogger;
-
 import javax.naming.NamingException;
 import javax.naming.ldap.InitialLdapContext;
 import javax.swing.JLabel;
@@ -47,6 +44,8 @@
 import javax.swing.JTextField;
 import javax.swing.SwingUtilities;
 
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.admin.ads.util.ApplicationTrustManager;
 import org.opends.guitools.controlpanel.datamodel.ConfigReadException;
 import org.opends.guitools.controlpanel.event.ConfigurationChangeEvent;
@@ -57,6 +56,7 @@
 import org.opends.quicksetup.util.UIKeyStore;
 import org.opends.quicksetup.util.Utils;
 import org.opends.server.types.DN;
+import org.opends.server.util.StaticUtils;
 
 /**
  * The panel that appears when the user is asked to provide authentication.
@@ -86,6 +86,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public LocalizableMessage getTitle()
   {
     return INFO_CTRL_PANEL_LOGIN_PANEL_TITLE.get();
@@ -136,6 +137,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public Component getPreferredFocusComponent()
   {
     return pwd;
@@ -144,6 +146,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void configurationChanged(ConfigurationChangeEvent ev)
   {
   }
@@ -164,6 +167,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public void okClicked()
   {
     setPrimaryValid(dnLabel);
@@ -211,6 +215,7 @@
         /**
          * {@inheritDoc}
          */
+        @Override
         public InitialLdapContext processBackgroundTask() throws Throwable
         {
           InitialLdapContext ctx = null;
@@ -249,6 +254,7 @@
             }
             SwingUtilities.invokeLater(new Runnable()
             {
+              @Override
               public void run()
               {
                 displayMessage(
@@ -261,16 +267,7 @@
             return ctx;
           } catch (Throwable t)
           {
-            if (ctx != null)
-            {
-              try
-              {
-                ctx.close();
-              }
-              catch (Throwable t1)
-              {
-              }
-            }
+            StaticUtils.close(ctx);
             throw t;
           }
         }
@@ -278,6 +275,7 @@
         /**
          * {@inheritDoc}
          */
+        @Override
         public void backgroundTaskCompleted(InitialLdapContext ctx,
             Throwable throwable)
         {
@@ -447,6 +445,7 @@
         /* Simulate a click on the OK by calling in the okClicked method. */
         SwingUtilities.invokeLater(new Runnable()
         {
+          @Override
           public void run()
           {
             okClicked();

--
Gitblit v1.10.0