From 69bcc5da5dafd4e5c4af9478f8db2de0fd5af413 Mon Sep 17 00:00:00 2001
From: Violette Roche-Montane <violette.roche-montane@forgerock.com>
Date: Tue, 06 May 2014 09:17:27 +0000
Subject: [PATCH] OPENDJ-1303 "opendj-cli" - Removed && replaced StaticUtils.filterExitCode by com.forgerock.opendj.cli.Utils.filterExitCode; - Removed SetupUtils.getDefaultJMXPort and replaced it by CliConstants.DEFAULT_JMX_PORT. - Removed && replaced Utilities.OBFUSCATED_VALUE by com.forgerock.opendj.cli.Utils.OBFUSCATED_VALUE; - Removed && replaced Utils.getThrowableMsg by com.forgerock.opendj.cli.Utils.getThrowableMsg;

---
 opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/Utils.java |   60 ++----------------------------------------------------------
 1 files changed, 2 insertions(+), 58 deletions(-)

diff --git a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/Utils.java b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/Utils.java
index 7b2f69f..670f911 100644
--- a/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/Utils.java
+++ b/opendj3-server-dev/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -31,6 +31,8 @@
 import static org.opends.server.util.DynamicConstants.*;
 import static com.forgerock.opendj.util.OperatingSystem.isWindows;
 import static com.forgerock.opendj.util.OperatingSystem.isUnix;
+import static com.forgerock.opendj.cli.Utils.OBFUSCATED_VALUE;
+import static com.forgerock.opendj.cli.Utils.getThrowableMsg;
 
 import java.io.*;
 import java.net.InetAddress;
@@ -53,7 +55,6 @@
 import org.opends.admin.ads.util.ConnectionUtils;
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.i18n.LocalizableMessageBuilder;
-import org.forgerock.i18n.LocalizableMessageDescriptor;
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.quicksetup.*;
 import org.opends.quicksetup.installer.AuthenticationData;
@@ -601,33 +602,6 @@
   }
 
   /**
-   * Returns a localized message for a given properties key an throwable.
-   * @param message prefix
-   * @param t the throwable for which we want to get a message.
-   *
-   * @return a localized message for a given properties key and throwable.
-   */
-  public static LocalizableMessage getThrowableMsg(LocalizableMessage message, Throwable t)
-  {
-    LocalizableMessageBuilder mb = new LocalizableMessageBuilder(message);
-    LocalizableMessageDescriptor.Arg1<Object> tag;
-    if (isOutOfMemory(t))
-    {
-      tag = INFO_EXCEPTION_OUT_OF_MEMORY_DETAILS;
-    }
-    else
-    {
-      tag = INFO_EXCEPTION_DETAILS;
-    }
-    String detail = t.toString();
-    if (detail != null)
-    {
-      mb.append("  ").append(tag.get(detail));
-    }
-    return mb.toMessage();
-  }
-
-  /**
    * Gets a localized representation of the provide TopologyCacheException.
    * @param te the exception.
    * @return a localized representation of the provide TopologyCacheException.
@@ -1082,35 +1056,6 @@
   }
 
   /**
-    * Tells whether this throwable has been generated for an out of memory
-    * error or not.
-    * @param t the throwable to analyze.
-    * @return <CODE>true</CODE> if the throwable was generated by an out of
-    * memory error and false otherwise.
-    */
-  private static boolean isOutOfMemory(Throwable t)
-  {
-    boolean isOutOfMemory = false;
-    while (!isOutOfMemory && (t != null))
-    {
-      if (t instanceof OutOfMemoryError)
-      {
-        isOutOfMemory = true;
-      }
-      else if (t instanceof IOException)
-      {
-        String msg = t.toString();
-        if (msg != null)
-        {
-          isOutOfMemory = msg.contains("Not enough space");
-        }
-      }
-      t = t.getCause();
-    }
-    return isOutOfMemory;
-  }
-
-  /**
    * Returns the number of entries contained in the zip file.  This is used to
    * update properly the progress bar ratio.
    * @return the number of entries contained in the zip file.
@@ -1811,7 +1756,6 @@
   //Chars that require special treatment when passing them to command-line.
   private final static char[] charsToEscape = {' ', '\t', '\n', '|', ';', '<',
     '>', '(', ')', '$', '`', '\\', '"', '\''};
-  private static final String OBFUSCATED_VALUE = "******";
 
   /**
    * This method simply takes a value and tries to transform it (with escape or

--
Gitblit v1.10.0