From 1d5d1a6a4a0a58d6bb4803527dacb6641c027816 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Tue, 28 Jan 2014 13:34:12 +0000
Subject: [PATCH] Checkpoint commit for OPENDJ-1288 :    Migrate I18n and logging support to i18n framework and SLF4J

---
 opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/ui/LoginDialog.java |   37 ++++++++++++++++++-------------------
 1 files changed, 18 insertions(+), 19 deletions(-)

diff --git a/opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/ui/LoginDialog.java b/opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/ui/LoginDialog.java
index e2be57e..748c966 100644
--- a/opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/ui/LoginDialog.java
+++ b/opendj3-server-dev/src/guitools/org/opends/guitools/uninstaller/ui/LoginDialog.java
@@ -35,8 +35,9 @@
 import java.net.URI;
 import java.security.cert.X509Certificate;
 import java.util.ArrayList;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+
+import org.forgerock.i18n.LocalizableMessage;
+import org.forgerock.i18n.slf4j.LocalizedLogger;
 
 import javax.naming.NamingException;
 import javax.naming.ldap.InitialLdapContext;
@@ -70,7 +71,6 @@
 import org.opends.quicksetup.util.UIKeyStore;
 import org.opends.quicksetup.util.Utils;
 
-import org.forgerock.i18n.LocalizableMessage;
 import static org.opends.messages.AdminToolMessages.*;
 import static org.opends.messages.QuickSetupMessages.*;
 
@@ -105,8 +105,7 @@
 
   private String usedUrl;
 
-  private static final Logger LOG =
-    Logger.getLogger(LoginDialog.class.getName());
+  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
   /**
    * Constructor of the LoginDialog.
@@ -437,13 +436,13 @@
       {
         if (throwable != null)
         {
-          LOG.log(Level.INFO, "Error connecting: " + throwable, throwable);
+          logger.debug(LocalizableMessage.raw("Error connecting: " + throwable, throwable));
           if (Utils.isCertificateException(throwable))
           {
             ApplicationTrustManager.Cause cause =
               trustManager.getLastRefusedCause();
 
-            LOG.log(Level.INFO, "Certificate exception cause: "+cause);
+            logger.debug(LocalizableMessage.raw("Certificate exception cause: "+cause));
             UserDataCertificateException.Type excType = null;
             if (cause == ApplicationTrustManager.Cause.NOT_TRUSTED)
             {
@@ -473,8 +472,8 @@
               }
               catch (Throwable t)
               {
-                LOG.log(Level.WARNING,
-                    "Error parsing ldap url of ldap url.", t);
+                logger.warn(LocalizableMessage.raw(
+                    "Error parsing ldap url of ldap url.", t));
                 h = INFO_NOT_AVAILABLE_LABEL.get().toString();
                 p = -1;
               }
@@ -551,8 +550,8 @@
           else
           {
             // This is a bug
-            LOG.log(Level.SEVERE, "Unexpected throwable: "+throwable,
-                throwable);
+            logger.error(LocalizableMessage.raw("Unexpected throwable: "+throwable,
+                throwable));
             displayError(
                 Utils.getThrowableMsg(INFO_BUG_MSG.get(), throwable),
                 INFO_ERROR_TITLE.get());
@@ -667,7 +666,7 @@
 
       if ((chain != null) && (authType != null) && (host != null))
       {
-        LOG.log(Level.INFO, "Accepting certificate presented by host "+host);
+        logger.debug(LocalizableMessage.raw("Accepting certificate presented by host "+host));
         getTrustManager().acceptCertificate(chain, authType, host);
         /* Simulate a click on the OK by calling in the okClicked method. */
         SwingUtilities.invokeLater(new Runnable()
@@ -682,18 +681,18 @@
       {
         if (chain == null)
         {
-          LOG.log(Level.WARNING,
-              "The chain is null for the UserDataCertificateException");
+          logger.warn(LocalizableMessage.raw(
+              "The chain is null for the UserDataCertificateException"));
         }
         if (authType == null)
         {
-          LOG.log(Level.WARNING,
-              "The auth type is null for the UserDataCertificateException");
+          logger.warn(LocalizableMessage.raw(
+              "The auth type is null for the UserDataCertificateException"));
         }
         if (host == null)
         {
-          LOG.log(Level.WARNING,
-              "The host is null for the UserDataCertificateException");
+          logger.warn(LocalizableMessage.raw(
+              "The host is null for the UserDataCertificateException"));
         }
       }
     }
@@ -709,7 +708,7 @@
         }
         catch (Throwable t)
         {
-          LOG.log(Level.WARNING, "Error accepting certificate: "+t, t);
+          logger.warn(LocalizableMessage.raw("Error accepting certificate: "+t, t));
         }
       }
     }

--
Gitblit v1.10.0