From a8192343ef279e3fe08b024e5a1e7a49f12862d5 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 18 Mar 2009 22:07:32 +0000
Subject: [PATCH] Fix for issue 3854 (Uninstall fails on Windows (due to log files))

---
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java
index 047e081..6ac830d 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java
@@ -22,11 +22,14 @@
  * CDDL HEADER END
  *
  *
- *      Copyright 2008 Sun Microsystems, Inc.
+ *      Copyright 2008-2009 Sun Microsystems, Inc.
  */
 
 package org.opends.quicksetup;
 
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
 import org.opends.quicksetup.util.ProgressMessageFormatter;
 import org.opends.quicksetup.util.PlainTextProgressMessageFormatter;
 import org.opends.quicksetup.util.Utils;
@@ -49,6 +52,9 @@
 
   private UserData userData;
 
+  static private final Logger LOG =
+    Logger.getLogger(QuickSetupCli.class.getName());
+
   /**
    * Creates a QuickSetupCli instance.
    * @param cliApp the application to be run
@@ -69,7 +75,7 @@
 
   /**
    * Parses the user data and prompts the user for data if required.  If the
-   * user provides all the required data it launches the Uninstaller.
+   * user provides all the required data it launches the application.
    *
    * @return the return code (SUCCESSFUL, CANCELLED, USER_DATA_ERROR,
    * ERROR_ACCESSING_FILE_SYSTEM, ERROR_STOPPING_SERVER or BUG.
@@ -102,6 +108,7 @@
                   });
         }
         Thread appThread = new Thread(cliApp, "CLI Application");
+        LOG.log(Level.INFO, "Launching application");
         appThread.start();
         while (!Thread.State.TERMINATED.equals(appThread.getState())) {
           try {
@@ -111,10 +118,12 @@
           }
         }
         returnValue = cliApp.getReturnCode();
+        LOG.log(Level.INFO, "Application returnValue: "+returnValue);
         if (returnValue == null) {
           ApplicationException ue = cliApp.getRunError();
           if (ue != null)
           {
+            LOG.log(Level.INFO, "Application run error: "+ue, ue);
             returnValue = ue.getType();
           }
           else
@@ -131,6 +140,7 @@
     }
     catch (UserDataException uude)
     {
+      LOG.log(Level.SEVERE, "UserDataException: "+uude, uude);
       System.err.println();
       System.err.println(StaticUtils.wrapText(uude.getLocalizedMessage(),
               Utils.getCommandLineMaxLineWidth()));
@@ -146,11 +156,18 @@
     }
     catch (ApplicationException ae)
     {
+      LOG.log(Level.SEVERE, "ApplicationException: "+ae, ae);
       System.err.println();
       System.err.println(ae.getLocalizedMessage());
       System.err.println();
       returnValue = ae.getType();
     }
+    catch (Throwable t)
+    {
+      LOG.log(Level.SEVERE, "Unexpected error: "+t, t);
+      returnValue = ReturnCode.UNKNOWN;
+    }
+    LOG.log(Level.INFO, "returnValue: "+returnValue.getReturnCode());
     return returnValue;
   }
 

--
Gitblit v1.10.0