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/server/org/opends/server/admin/client/cli/SecureConnectionCliArgs.java |   45 +++++++++++++--------------------------------
 1 files changed, 13 insertions(+), 32 deletions(-)

diff --git a/opendj3-server-dev/src/server/org/opends/server/admin/client/cli/SecureConnectionCliArgs.java b/opendj3-server-dev/src/server/org/opends/server/admin/client/cli/SecureConnectionCliArgs.java
index 4954532..82a1f23 100644
--- a/opendj3-server-dev/src/server/org/opends/server/admin/client/cli/SecureConnectionCliArgs.java
+++ b/opendj3-server-dev/src/server/org/opends/server/admin/client/cli/SecureConnectionCliArgs.java
@@ -28,8 +28,6 @@
 package org.opends.server.admin.client.cli;
 
 import static org.opends.server.admin.client.cli.DsFrameworkCliReturnCode.*;
-import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
-import static org.opends.server.loggers.debug.DebugLogger.getTracer;
 import static org.opends.messages.AdminToolMessages.*;
 import static org.opends.messages.ToolMessages.*;
 import org.forgerock.i18n.LocalizableMessage;
@@ -50,8 +48,8 @@
 import java.security.cert.CertificateException;
 import java.util.ArrayList;
 import java.util.LinkedHashSet;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+
+import org.forgerock.i18n.slf4j.LocalizedLogger;
 
 import javax.net.ssl.KeyManager;
 
@@ -67,8 +65,6 @@
 import org.opends.server.admin.std.server.TrustManagerProviderCfg;
 import org.opends.server.config.ConfigException;
 import org.opends.server.core.DirectoryServer;
-import org.opends.server.loggers.debug.DebugTracer;
-import org.opends.server.types.DebugLogLevel;
 import org.opends.server.util.PasswordReader;
 import org.opends.server.util.SelectableCertificateKeyManager;
 import org.opends.server.util.args.Argument;
@@ -186,22 +182,13 @@
   private ApplicationTrustManager trustManager;
 
   private boolean configurationInitialized = false;
-
-  /**
-   * The tracer object for the debug logger.
-   */
-  private static final DebugTracer TRACER = getTracer();
+  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
   /**
    * End Of Line.
    */
   public static String EOL = System.getProperty("line.separator");
 
-  /**
-   * The Logger.
-   */
-  static private final Logger LOG =
-    Logger.getLogger(SecureConnectionCliArgs.class.getName());
 
   // Defines if the CLI always use the SSL connection type.
   private boolean alwaysSSL = false;
@@ -321,10 +308,7 @@
           bindPasswordValue = new String(pwChars);
         } catch(Exception ex)
         {
-          if (debugEnabled())
-          {
-            TRACER.debugCaught(DebugLogLevel.ERROR, ex);
-          }
+          logger.traceException(ex);
           try
           {
             err.write(wrapText(ex.getMessage(), MAX_LINE_WIDTH).getBytes());
@@ -356,10 +340,7 @@
         }
         catch (Exception ex)
         {
-          if (debugEnabled())
-          {
-            TRACER.debugCaught(DebugLogLevel.ERROR, ex);
-          }
+          logger.traceException(ex);
           try
           {
             err.write(wrapText(ex.getMessage(), MAX_LINE_WIDTH).getBytes());
@@ -852,28 +833,28 @@
             // Nothing to do: if this occurs we will systematically refuse the
             // certificates.  Maybe we should avoid this and be strict, but we
             // are in a best effort mode.
-            LOG.log(Level.WARNING, "Error with the truststore", e);
+            logger.warn(LocalizableMessage.raw("Error with the truststore"), e);
           }
           catch (NoSuchAlgorithmException e)
           {
             // Nothing to do: if this occurs we will systematically refuse the
             // certificates.  Maybe we should avoid this and be strict, but we
             // are in a best effort mode.
-            LOG.log(Level.WARNING, "Error with the truststore", e);
+            logger.warn(LocalizableMessage.raw("Error with the truststore"), e);
           }
           catch (CertificateException e)
           {
             // Nothing to do: if this occurs we will systematically refuse the
             // certificates.  Maybe we should avoid this and be strict, but we
             // are in a best effort mode.
-            LOG.log(Level.WARNING, "Error with the truststore", e);
+            logger.warn(LocalizableMessage.raw("Error with the truststore"), e);
           }
           catch (IOException e)
           {
             // Nothing to do: if this occurs we will systematically refuse the
             // certificates.  Maybe we should avoid this and be strict, but we
             // are in a best effort mode.
-            LOG.log(Level.WARNING, "Error with the truststore", e);
+            logger.warn(LocalizableMessage.raw("Error with the truststore"), e);
           }
           finally
           {
@@ -930,7 +911,7 @@
         // the
         // certificates. Maybe we should avoid this and be strict, but
         // we are in a best effort mode.
-        LOG.log(Level.WARNING, "Error with the keystore", e);
+        logger.warn(LocalizableMessage.raw("Error with the keystore"), e);
       }
       catch (NoSuchAlgorithmException e)
       {
@@ -939,7 +920,7 @@
         // certificates. Maybe we should avoid this and be strict, but
         // we are
         // in a best effort mode.
-        LOG.log(Level.WARNING, "Error with the keystore", e);
+        logger.warn(LocalizableMessage.raw("Error with the keystore"), e);
       }
       catch (CertificateException e)
       {
@@ -948,7 +929,7 @@
         // certificates. Maybe we should avoid this and be strict, but
         // we are
         // in a best effort mode.
-        LOG.log(Level.WARNING, "Error with the keystore", e);
+        logger.warn(LocalizableMessage.raw("Error with the keystore"), e);
       }
       catch (IOException e)
       {
@@ -957,7 +938,7 @@
         // certificates. Maybe we should avoid this and be strict, but
         // we are
         // in a best effort mode.
-        LOG.log(Level.WARNING, "Error with the keystore", e);
+        logger.warn(LocalizableMessage.raw("Error with the keystore"), e);
       }
       finally
       {

--
Gitblit v1.10.0