From 7b11fcf138a9310aa14d26fea3249d6073c38828 Mon Sep 17 00:00:00 2001
From: Gaetan Boismal <gaetan.boismal@forgerock.com>
Date: Mon, 11 Apr 2016 17:22:17 +0000
Subject: [PATCH] Code cleanup

---
 opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/UninstallLauncher.java |   33 +++++++--------------------------
 1 files changed, 7 insertions(+), 26 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/UninstallLauncher.java b/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/UninstallLauncher.java
index 3375210..e450acf 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/UninstallLauncher.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/UninstallLauncher.java
@@ -12,7 +12,7 @@
  * information: "Portions Copyright [year] [name of copyright owner]".
  *
  * Copyright 2006-2010 Sun Microsystems, Inc.
- * Portions Copyright 2011-2015 ForgeRock AS.
+ * Portions Copyright 2011-2016 ForgeRock AS.
  */
 
 package org.opends.guitools.uninstaller;
@@ -25,11 +25,9 @@
 import org.forgerock.i18n.LocalizableMessage;
 import org.opends.messages.ToolMessages;
 
-import java.io.File;
 import org.opends.quicksetup.CliApplication;
 import org.opends.quicksetup.Launcher;
 import org.opends.quicksetup.Installation;
-import org.opends.quicksetup.QuickSetupLog;
 import org.opends.quicksetup.ReturnCode;
 import org.opends.quicksetup.util.Utils;
 import org.opends.server.util.DynamicConstants;
@@ -48,9 +46,6 @@
   /** Prefix for log files. */
   public static final String LOG_FILE_PREFIX = "opendj-uninstall-";
 
-  /** Suffix for log files. */
-  public static final String LOG_FILE_SUFFIX = ".log";
-
   /**
    * The main method which is called by the uninstall command lines.
    *
@@ -59,14 +54,6 @@
    * will pass to the org.opends.server.tools.InstallDS class.
    */
   public static void main(String[] args) {
-    try {
-      QuickSetupLog.initLogFileHandler(
-              File.createTempFile(LOG_FILE_PREFIX, LOG_FILE_SUFFIX));
-
-    } catch (Throwable t) {
-      System.err.println("Unable to initialize log");
-      t.printStackTrace();
-    }
     new UninstallLauncher(args).launch();
   }
 
@@ -78,7 +65,7 @@
    * @param args the arguments passed by the command lines.
    */
   public UninstallLauncher(String[] args) {
-    super(args);
+    super(args, LOG_FILE_PREFIX);
 
     String scriptName;
     if (isWindows()) {
@@ -142,17 +129,11 @@
     }
   }
 
-  /** {@inheritDoc} */
-  protected void guiLaunchFailed(String logFilePath) {
-    if (logFilePath != null)
-    {
-      System.err.println(ERR_UNINSTALL_LAUNCHER_GUI_LAUNCHED_FAILED_DETAILS
-              .get(logFilePath));
-    }
-    else
-    {
-      System.err.println(ERR_UNINSTALL_LAUNCHER_GUI_LAUNCHED_FAILED.get());
-    }
+  @Override
+  protected void guiLaunchFailed() {
+      System.err.println(
+          tempLogFile.isEnabled() ? ERR_UNINSTALL_LAUNCHER_GUI_LAUNCHED_FAILED_DETAILS.get(tempLogFile.getPath())
+                                  : ERR_UNINSTALL_LAUNCHER_GUI_LAUNCHED_FAILED.get());
   }
 
   /** {@inheritDoc} */

--
Gitblit v1.10.0