From ad74bf0a2cc09d0036a12793848b975e7b16eaa6 Mon Sep 17 00:00:00 2001
From: lutoff <lutoff@localhost>
Date: Fri, 27 Jul 2007 15:26:22 +0000
Subject: [PATCH]  modifications to fix issue #2022.

---
 opends/src/quicksetup/org/opends/quicksetup/util/ZipExtractor.java                    |    6 
 opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeIssueNotifier.java        |   13 
 opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java   |    6 
 opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java              |    7 
 opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java |   15 
 opends/src/quicksetup/org/opends/quicksetup/BuildInformation.java                     |   10 
 opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java                  |   70 +++--
 opends/src/quicksetup/org/opends/quicksetup/uninstaller/Uninstaller.java              |    7 
 opends/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java                        |   79 ------
 opends/src/quicksetup/org/opends/quicksetup/util/InProcessServerController.java       |    8 
 opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java                    |    4 
 opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java                |   29 +-
 opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java            |   22 +
 opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java                    |   10 
 opends/src/quicksetup/org/opends/quicksetup/util/ServerHealthChecker.java             |    7 
 opends/src/quicksetup/org/opends/quicksetup/ApplicationException.java                 |   88 +------
 opends/src/quicksetup/org/opends/quicksetup/Launcher.java                             |   18 +
 opends/src/quicksetup/org/opends/quicksetup/upgrader/MigrationManager.java            |   16 
 opends/src/quicksetup/org/opends/quicksetup/util/FileManager.java                     |   12 
 opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java          |   15 
 opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java                    |   28 +-
 opends/src/quicksetup/org/opends/quicksetup/ApplicationReturnCode.java                |  143 +++++++++++++
 22 files changed, 343 insertions(+), 270 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/ApplicationException.java b/opends/src/quicksetup/org/opends/quicksetup/ApplicationException.java
index 64f293e..cdae856 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ApplicationException.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ApplicationException.java
@@ -27,6 +27,8 @@
 
 package org.opends.quicksetup;
 
+import static org.opends.quicksetup.ApplicationReturnCode.ReturnCode;
+
 /**
  * This exception is used to encapsulate all the error that we might have
  * during the installation.
@@ -42,69 +44,7 @@
 
   private String formattedMsg = null;
 
-  private Type type;
-
-  /**
-   * This enum contains the different type of ApplicationException that we can
-   * have.
-   *
-   */
-  public enum Type
-  {
-    /**
-     * Error related to file system error: IOException writing files, permission
-     * errors, etc.
-     */
-    FILE_SYSTEM_ERROR,
-    /**
-     * Error downloading jar files from web start server.  This is specific
-     * to the web start installation.
-     */
-    DOWNLOAD_ERROR,
-    /**
-     * Error during the configuration of the Directory Server.
-     */
-    CONFIGURATION_ERROR,
-    /**
-     * Error during the import of data (base entry, from LDIF file or
-     * automatically generated data).
-     */
-    IMPORT_ERROR,
-    /**
-     * Error starting the Open DS server.
-     */
-    START_ERROR,
-
-    /**
-     * Error stopping the Open DS server.
-     */
-    STOP_ERROR,
-
-    /**
-     * Error enabling the Windows service.
-     */
-    WINDOWS_SERVICE_ERROR,
-
-    /**
-     * Application specific error.
-     */
-    APPLICATION,
-
-    /**
-     * Error invoking an OpenDS tool.
-     */
-    TOOL_ERROR,
-
-    /**
-     * User canceled operation.
-     */
-    CANCEL,
-
-    /**
-     * A bug (for instance when we throw an IllegalStateException).
-     */
-    BUG
-  }
+  private ReturnCode type;
 
   /**
    * Creates a new ApplicationException of type FILE_SYSTEM_ERROR.
@@ -113,17 +53,23 @@
    * @return ApplicationException with Type property being FILE_SYSTEM_ERROR
    */
   public static ApplicationException createFileSystemException(String msg,
-                                                               Exception e) {
-    return new ApplicationException(Type.FILE_SYSTEM_ERROR, msg, e);
+      Exception e)
+  {
+    return new ApplicationException(ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
+        msg, e);
   }
 
   /**
    * The constructor of the ApplicationException.
-   * @param type the type of error we have.
-   * @param localizedMsg a localized string describing the problem.
-   * @param rootCause the root cause of this exception.
+   *
+   * @param type
+   *          the type of error we have.
+   * @param localizedMsg
+   *          a localized string describing the problem.
+   * @param rootCause
+   *          the root cause of this exception.
    */
-  public ApplicationException(Type type, String localizedMsg,
+  public ApplicationException(ReturnCode type, String localizedMsg,
                               Throwable rootCause)
   {
     super(localizedMsg, rootCause);
@@ -137,7 +83,7 @@
    * @param formattedMsg a localized message with extra formatting
    * @param rootCause the root cause of this exception.
    */
-  public ApplicationException(Type type, String localizedMsg,
+  public ApplicationException(ReturnCode type, String localizedMsg,
                               String formattedMsg, Throwable rootCause)
   {
     super(localizedMsg, rootCause);
@@ -149,7 +95,7 @@
    * Returns the Type of this exception.
    * @return the Type of this exception.
    */
-  public Type getType()
+  public ReturnCode getType()
   {
     return type;
   }
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ApplicationReturnCode.java b/opends/src/quicksetup/org/opends/quicksetup/ApplicationReturnCode.java
new file mode 100644
index 0000000..10fe956
--- /dev/null
+++ b/opends/src/quicksetup/org/opends/quicksetup/ApplicationReturnCode.java
@@ -0,0 +1,143 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License, Version 1.0 only
+ * (the "License").  You may not use this file except in compliance
+ * with the License.
+ *
+ * You can obtain a copy of the license at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE
+ * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at
+ * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
+ * add the following below this CDDL HEADER, with the fields enclosed
+ * by brackets "[]" replaced with your own identifying information:
+ *      Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ *
+ *
+ *      Portions Copyright 2007 Sun Microsystems, Inc.
+ */
+
+package org.opends.quicksetup;
+
+/**
+ * This class defines enumeration of application return code.
+ */
+public final class ApplicationReturnCode
+{
+  /**
+   * Enumeration defining return code.
+   */
+  public enum ReturnCode
+  {
+    /**
+     * Return code: Application successful.
+     */
+    SUCCESSFUL(0),
+
+    /**
+     * Return code: User Cancelled uninstall.
+     */
+    CANCELLED(0),
+
+    /**
+     * Return code: User provided invalid data.
+     */
+    USER_DATA_ERROR(2),
+
+    /**
+     * Return code: Error accessing file system (reading/writing).
+     */
+    FILE_SYSTEM_ACCESS_ERROR(3),
+
+    /**
+     * Error downloading jar files from web start server.  This is specific
+     * to the web start installation.
+     */
+    DOWNLOAD_ERROR(4),
+    /**
+     * Error during the configuration of the Directory Server.
+     */
+    CONFIGURATION_ERROR(5),
+    /**
+     * Error during the import of data (base entry, from LDIF file or
+     * automatically generated data).
+     */
+    IMPORT_ERROR(6),
+    /**
+     * Error starting the Open DS server.
+     */
+    START_ERROR(7),
+
+    /**
+     * Error stopping the Open DS server.
+     */
+    STOP_ERROR(8),
+
+    /**
+     * Error enabling the Windows service.
+     */
+    WINDOWS_SERVICE_ERROR(9),
+
+    /**
+     * Application specific error.
+     */
+    APPLICATION_ERROR(10),
+
+    /**
+     * Error invoking an OpenDS tool.
+     */
+    TOOL_ERROR(11),
+
+    /**
+     * Return code: Bug.
+     */
+    BUG(12),
+    /**
+     * Return code: Bug.
+     */
+    PRINT_VERSION(50),
+
+    /**
+     * Return code for errors that are non-specified.
+     */
+    UNKNOWN(100);
+
+    private int returnCode;
+
+    /**
+     * Private constructor.
+     *
+     * @param returnCode
+     *          the return code.
+     */
+    private ReturnCode(int returnCode)
+    {
+      this.returnCode = returnCode;
+    }
+
+    /**
+     * Returns the return code.
+     *
+     * @return the return code.
+     */
+    public int getReturnCode()
+    {
+      return returnCode;
+    }
+  }
+
+  /**
+   * Private constructor.
+   */
+  private ApplicationReturnCode()
+  {
+  }
+}
diff --git a/opends/src/quicksetup/org/opends/quicksetup/BuildInformation.java b/opends/src/quicksetup/org/opends/quicksetup/BuildInformation.java
index ec3738c..8a819cf 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/BuildInformation.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/BuildInformation.java
@@ -107,8 +107,9 @@
         }
       }
     } catch (IOException e) {
-      throw new ApplicationException(ApplicationException.Type.START_ERROR,
-              getMsg("error-creating-build-info"), e);
+      throw new ApplicationException(
+          ApplicationReturnCode.ReturnCode.START_ERROR,
+          getMsg("error-creating-build-info"), e);
     } finally {
       if (is != null) {
         try {
@@ -381,8 +382,9 @@
           throws ApplicationException {
     for (String prop : props) {
       if (null == values.get(prop)) {
-        throw new ApplicationException(ApplicationException.Type.TOOL_ERROR,
-                getMsg("error-prop-value", prop), null);
+        throw new ApplicationException(
+            ApplicationReturnCode.ReturnCode.TOOL_ERROR, getMsg(
+                "error-prop-value", prop), null);
       }
     }
 
diff --git a/opends/src/quicksetup/org/opends/quicksetup/Launcher.java b/opends/src/quicksetup/org/opends/quicksetup/Launcher.java
index 59969ca..419a20d 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/Launcher.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/Launcher.java
@@ -269,15 +269,18 @@
    * @return 0 if everything worked fine, and an error code if something wrong
    *         occurred.
    */
-  protected int launchCli(CliApplication cliApp) {
+  protected int launchCli(CliApplication cliApp)
+  {
     System.setProperty("org.opends.quicksetup.cli", "true");
     QuickSetupCli cli = new QuickSetupCli(cliApp, this);
-    int returnValue = cli.run();
-    if (returnValue == QuickSetupCli.USER_DATA_ERROR) {
+    ApplicationReturnCode.ReturnCode returnValue = cli.run();
+    if (returnValue.equals(ApplicationReturnCode.ReturnCode.USER_DATA_ERROR))
+    {
       printUsage(true);
-      System.exit(QuickSetupCli.USER_DATA_ERROR);
+      System.exit(ApplicationReturnCode.ReturnCode.USER_DATA_ERROR
+          .getReturnCode());
     }
-    return returnValue;
+    return returnValue.getReturnCode();
   }
 
   /**
@@ -341,11 +344,12 @@
     if (shouldPrintVersion())
     {
       printVersion();
-      System.exit(QuickSetupCli.PRINT_VERSION);
+      System.exit(ApplicationReturnCode.ReturnCode.PRINT_VERSION
+          .getReturnCode());
     }
     else if (shouldPrintUsage()) {
       printUsage(false);
-      System.exit(QuickSetupCli.SUCCESSFUL);
+      System.exit(ApplicationReturnCode.ReturnCode.SUCCESSFUL.getReturnCode());
     } else if (isCli()) {
       CliApplication cliApp = createCliApplication();
       int exitCode = launchCli(cliApp);
diff --git a/opends/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java b/opends/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java
index e293495..d7caab3 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java
@@ -30,56 +30,19 @@
 import org.opends.quicksetup.util.ProgressMessageFormatter;
 import org.opends.quicksetup.util.PlainTextProgressMessageFormatter;
 import org.opends.quicksetup.util.Utils;
+import org.opends.quicksetup.ApplicationReturnCode.ReturnCode;
 import org.opends.quicksetup.event.ProgressUpdateListener;
 import org.opends.quicksetup.event.ProgressUpdateEvent;
 import org.opends.quicksetup.i18n.ResourceProvider;
 import org.opends.server.util.StaticUtils;
 
 /**
- * Controller for managing the execution of a CliApplication.
+ * This enum contains the different type of ApplicationException that we can
+ * have.
+ *
  */
 public class QuickSetupCli {
 
-  /**
-   * Return code: Application successful.
-   */
-  static public int SUCCESSFUL = 0;
-
-  /**
-   * Return code: User Cancelled uninstall.
-   */
-  static public int CANCELLED = 1;
-
-  /**
-   * Return code: User provided invalid data.
-   */
-  static public int USER_DATA_ERROR = 2;
-
-  /**
-   * Return code: Error accessing file system (reading/writing).
-   */
-  static public int ERROR_ACCESSING_FILE_SYSTEM = 3;
-
-  /**
-   * Return code: Error stopping server.
-   */
-  static public int ERROR_STOPPING_SERVER = 4;
-
-  /**
-   * Return code: Bug.
-   */
-  static public int BUG = 5;
-
-  /**
-   * Return code: Bug.
-   */
-  static public int PRINT_VERSION = 50;
-
-  /**
-   * Return code for errors that are non-specified.
-   */
-  static public int UNKNOWN = 100;
-
   /** Arguments passed in the command line. */
   protected Launcher launcher;
 
@@ -112,9 +75,9 @@
    * @return the return code (SUCCESSFUL, CANCELLED, USER_DATA_ERROR,
    * ERROR_ACCESSING_FILE_SYSTEM, ERROR_STOPPING_SERVER or BUG.
    */
-  public int run()
+  public ReturnCode run()
   {
-    int returnValue;
+    ReturnCode returnValue;
     // Parse the arguments
     try
     {
@@ -149,39 +112,17 @@
         ApplicationException ue = cliApp.getRunError();
         if (ue != null)
         {
-          ApplicationException.Type type = ue.getType();
-          if (type != null) {
-            switch (type)
-            {
-            case FILE_SYSTEM_ERROR:
-              returnValue = ERROR_ACCESSING_FILE_SYSTEM;
-              break;
-
-            case STOP_ERROR:
-              returnValue = ERROR_STOPPING_SERVER;
-              break;
-
-            case BUG:
-              returnValue = BUG;
-              break;
-
-            default:
-              returnValue = UNKNOWN;
-              break;
-            }
-          } else {
-            returnValue = UNKNOWN;
-          }
+          returnValue = ue.getType();
         }
         else
         {
-          returnValue = SUCCESSFUL;
+          returnValue = ApplicationReturnCode.ReturnCode.SUCCESSFUL;
         }
       }
       else
       {
         // User cancelled installation.
-        returnValue = CANCELLED;
+        returnValue = ApplicationReturnCode.ReturnCode.CANCELLED;
       }
     }
     catch (UserDataException uude)
@@ -190,7 +131,7 @@
       System.err.println(StaticUtils.wrapText(uude.getLocalizedMessage(),
               Utils.getCommandLineMaxLineWidth()));
       System.err.println();
-      returnValue = USER_DATA_ERROR;
+      returnValue = ReturnCode.USER_DATA_ERROR;
     }
     return returnValue;
   }
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java b/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
index 8be784f..726d8af 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/Installer.java
@@ -724,9 +724,11 @@
     }
     catch (IOException ioe)
     {
-      String failedMsg = getThrowableMsg("error-creating-temp-file", null, ioe);
+      String failedMsg = getThrowableMsg("error-creating-temp-file", null,
+          ioe);
       throw new ApplicationException(
-          ApplicationException.Type.FILE_SYSTEM_ERROR, failedMsg, ioe);
+          ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
+          failedMsg, ioe);
     }
   }
 
@@ -845,13 +847,13 @@
       if (result != 0)
       {
         throw new ApplicationException(
-            ApplicationException.Type.CONFIGURATION_ERROR,
+            ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR,
             getMsg("error-configuring"), null);
       }
     } catch (Throwable t)
     {
       throw new ApplicationException(
-          ApplicationException.Type.CONFIGURATION_ERROR,
+          ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR,
           getThrowableMsg("error-configuring", null, t), t);
     }
 
@@ -958,7 +960,7 @@
     catch (Throwable t)
     {
       throw new ApplicationException(
-          ApplicationException.Type.CONFIGURATION_ERROR,
+          ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR,
           getThrowableMsg("error-configuring-certificate", null, t), t);
     }
   }
@@ -1003,13 +1005,13 @@
       if (result != 0)
       {
         throw new ApplicationException(
-            ApplicationException.Type.CONFIGURATION_ERROR,
+            ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR,
             getMsg("error-creating-base-entry"), null);
       }
     } catch (Throwable t)
     {
       throw new ApplicationException(
-          ApplicationException.Type.CONFIGURATION_ERROR,
+          ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR,
           getThrowableMsg("error-creating-base-entry", null, t), t);
     }
 
@@ -1049,13 +1051,13 @@
       if (result != 0)
       {
         throw new ApplicationException(
-            ApplicationException.Type.CONFIGURATION_ERROR,
+            ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR,
             getMsg("error-importing-ldif"), null);
       }
     } catch (Throwable t)
     {
       throw new ApplicationException(
-          ApplicationException.Type.CONFIGURATION_ERROR,
+          ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR,
           getThrowableMsg("error-importing-ldif", null, t), t);
     }
   }
@@ -1098,14 +1100,14 @@
       if (result != 0)
       {
         throw new ApplicationException(
-            ApplicationException.Type.CONFIGURATION_ERROR,
+            ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR,
             getMsg("error-import-ldif-tool-return-code",
                     Integer.toString(result)), null);
       }
     } catch (Throwable t)
     {
       throw new ApplicationException(
-          ApplicationException.Type.CONFIGURATION_ERROR,
+          ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR,
           getThrowableMsg("error-import-automatically-generated",
                   new String[] { Utils.listToString(argList, " "),
                           t.getLocalizedMessage()}, t), t);
@@ -1326,7 +1328,7 @@
     {
       String failedMsg = getThrowableMsg("error-connecting-to-local", null, ne);
       throw new ApplicationException(
-          ApplicationException.Type.CONFIGURATION_ERROR, failedMsg, ne);
+          ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, failedMsg, ne);
     }
     finally
     {
@@ -1515,7 +1517,7 @@
       setCurrentProgressStep(InstallProgressStep.CANCELING);
       notifyListeners(null);
       throw new ApplicationException(
-            ApplicationException.Type.CANCEL,
+          ApplicationReturnCode.ReturnCode.CANCELLED,
             getMsg("upgrade-canceled"), null);
     }
   }
@@ -1659,7 +1661,7 @@
       {
       }
       throw new ApplicationException(
-          ApplicationException.Type.CONFIGURATION_ERROR, failedMsg, t);
+          ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, failedMsg, t);
     }
 
     Set<SuffixDescriptor> suffixes =
@@ -1701,7 +1703,7 @@
           {
             String[] arg = {server.getHostPort(true)};
             throw new ApplicationException(
-                ApplicationException.Type.CONFIGURATION_ERROR,
+                ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR,
                 getMsg("cannot-connect-to-remote-generic", arg), ne);
           }
           finally
@@ -1735,7 +1737,7 @@
             if (nTries == 1)
             {
               throw new ApplicationException(
-                  ApplicationException.Type.APPLICATION,
+                  ApplicationReturnCode.ReturnCode.APPLICATION_ERROR,
                   pnfe.getLocalizedMessage(), null);
             }
             try
@@ -1871,7 +1873,8 @@
           String failedMsg = getThrowableMsg("error-connecting-to-local", null,
               t);
           throw new ApplicationException(
-              ApplicationException.Type.CONFIGURATION_ERROR, failedMsg, t);
+              ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR,
+              failedMsg, t);
         }
         createLocalAds(localCtx, false);
         notifyListeners(getFormattedDone());
@@ -2003,7 +2006,7 @@
                 if (nTries == 1)
                 {
                   throw new ApplicationException(
-                      ApplicationException.Type.APPLICATION,
+                      ApplicationReturnCode.ReturnCode.APPLICATION_ERROR,
                       pnfe.getLocalizedMessage(), null);
                 }
                 try
@@ -2027,14 +2030,14 @@
       {
         String[] arg = {getHostDisplay(auth)};
         throw new ApplicationException(
-            ApplicationException.Type.CONFIGURATION_ERROR,
+            ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR,
             getMsg("cannot-connect-to-remote-permissions", arg), x);
       }
       catch (NamingException ne)
       {
         String[] arg = {getHostDisplay(auth)};
         throw new ApplicationException(
-            ApplicationException.Type.CONFIGURATION_ERROR,
+            ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR,
             getMsg("cannot-connect-to-remote-generic", arg), ne);
       }
       catch (TopologyCacheException tpe)
@@ -2042,14 +2045,14 @@
         LOG.log(Level.WARNING, "Error reloading topology cache to "+
             "configure ADS replication.", tpe);
         throw new ApplicationException(
-            ApplicationException.Type.CONFIGURATION_ERROR,
+            ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR,
             getMsg("bug-msg"), tpe);
       }
       catch (ADSContextException ace)
       {
         String[] args = {getHostDisplay(auth), ace.toString()};
         throw new ApplicationException(
-            ApplicationException.Type.CONFIGURATION_ERROR,
+            ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR,
             getMsg("remote-ads-exception", args), ace);
       }
       finally
@@ -2092,7 +2095,8 @@
           String failedMsg = getThrowableMsg("error-connecting-to-local", null,
               t);
           throw new ApplicationException(
-              ApplicationException.Type.CONFIGURATION_ERROR, failedMsg, t);
+              ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR,
+              failedMsg, t);
         }
         createLocalAds(localCtx, true);
         int replicationPort =
@@ -2117,7 +2121,7 @@
       catch (ADSContextException ace)
       {
         throw new ApplicationException(
-            ApplicationException.Type.CONFIGURATION_ERROR,
+            ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR,
             getMsg("ads-exception", ace.toString()), ace);
       }
       finally
@@ -3807,7 +3811,7 @@
     {
       String failedMsg = getThrowableMsg("bug-msg", null, t);
       throw new ApplicationException(
-          ApplicationException.Type.CONFIGURATION_ERROR, failedMsg, t);
+          ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, failedMsg, t);
     }
   }
 
@@ -3861,7 +3865,8 @@
       String errorMessage = getMsg("cannot-connect-to-remote-generic",
           server.getHostPort(true), ne.toString(true));
       throw new ApplicationException(
-          ApplicationException.Type.CONFIGURATION_ERROR, errorMessage, ne);
+          ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, errorMessage,
+          ne);
     }
     return ctx;
   }
@@ -3903,8 +3908,9 @@
       {
         LOG.log(Level.SEVERE, "Error creating task "+attrs, ne);
         String[] arg = {sourceServerDisplay};
-        throw new ApplicationException(ApplicationException.Type.APPLICATION,
-            getThrowableMsg("error-launching-initialization", arg, ne), ne);
+        throw new ApplicationException(
+            ApplicationReturnCode.ReturnCode.APPLICATION_ERROR, getThrowableMsg(
+                "error-launching-initialization", arg, ne), ne);
       }
       i++;
     }
@@ -4054,7 +4060,8 @@
               helper.isStoppedByError(state))
           {
             ApplicationException ae = new ApplicationException(
-                ApplicationException.Type.APPLICATION, errorMsg, null);
+                ApplicationReturnCode.ReturnCode.APPLICATION_ERROR, errorMsg,
+                null);
             if ((lastLogMsg != null) &&
                 helper.isPeersNotFoundError(lastLogMsg))
             {
@@ -4081,8 +4088,9 @@
       catch (NamingException ne)
       {
         String[] arg = {sourceServerDisplay};
-        throw new ApplicationException(ApplicationException.Type.APPLICATION,
-            getThrowableMsg("error-pooling-initialization", arg, ne), ne);
+        throw new ApplicationException(
+            ApplicationReturnCode.ReturnCode.APPLICATION_ERROR, getThrowableMsg(
+                "error-pooling-initialization", arg, ne), ne);
       }
     }
   }
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java b/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
index b9de6dc..9385e73 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/InstallerHelper.java
@@ -43,6 +43,7 @@
 import javax.naming.ldap.InitialLdapContext;
 
 import org.opends.quicksetup.ApplicationException;
+import org.opends.quicksetup.ApplicationReturnCode;
 import org.opends.quicksetup.i18n.ResourceProvider;
 import org.opends.quicksetup.webstart.JnlpProperties;
 import org.opends.quicksetup.util.Utils;
@@ -141,7 +142,7 @@
         break;
       default:
         throw new ApplicationException(
-                ApplicationException.Type.WINDOWS_SERVICE_ERROR,
+            ApplicationReturnCode.ReturnCode.WINDOWS_SERVICE_ERROR,
                 errorMessage, null);
     }
   }
@@ -155,7 +156,7 @@
     int code = ConfigureWindowsService.disableService(System.out, System.err);
     if (code == ConfigureWindowsService.SERVICE_DISABLE_ERROR) {
       throw new ApplicationException(
-              ApplicationException.Type.WINDOWS_SERVICE_ERROR,
+          ApplicationReturnCode.ReturnCode.WINDOWS_SERVICE_ERROR,
               getMsg("error-disabling-windows-service"), null);
     }
   }
@@ -188,7 +189,8 @@
     {
       String failedMsg = getThrowableMsg("error-creating-temp-file", null, ioe);
       throw new ApplicationException(
-          ApplicationException.Type.FILE_SYSTEM_ERROR, failedMsg, ioe);
+          ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
+          failedMsg, ioe);
     }
 
     try
@@ -205,19 +207,19 @@
       writer.close();
     } catch (DirectoryException de) {
       throw new ApplicationException(
-              ApplicationException.Type.CONFIGURATION_ERROR,
+          ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR,
               getThrowableMsg("error-importing-ldif", null, de), de);
     } catch (LDIFException le) {
       throw new ApplicationException(
-              ApplicationException.Type.CONFIGURATION_ERROR,
+          ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR,
               getThrowableMsg("error-importing-ldif", null, le), le);
     } catch (IOException ioe) {
       throw new ApplicationException(
-              ApplicationException.Type.CONFIGURATION_ERROR,
+          ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR,
               getThrowableMsg("error-importing-ldif", null, ioe), ioe);
     } catch (Throwable t) {
       throw new ApplicationException(
-              ApplicationException.Type.BUG, getThrowableMsg(
+          ApplicationReturnCode.ReturnCode.BUG, getThrowableMsg(
               "bug-msg", t), t);
     }
     return ldifFile;
@@ -412,7 +414,8 @@
       String errorMessage = getMsg("error-configuring-remote-generic",
           serverDisplay, t.toString());
       throw new ApplicationException(
-          ApplicationException.Type.CONFIGURATION_ERROR, errorMessage, t);
+          ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, errorMessage,
+          t);
     }
   }
 
@@ -514,7 +517,8 @@
       String errorMessage = getMsg("error-configuring-remote-generic",
           serverDisplay, t.toString());
       throw new ApplicationException(
-          ApplicationException.Type.CONFIGURATION_ERROR, errorMessage, t);
+          ApplicationReturnCode.ReturnCode.CONFIGURATION_ERROR, errorMessage,
+          t);
     }
   }
 
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java b/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
index 6ed5ca0..27c4d1f 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/offline/OfflineInstaller.java
@@ -36,6 +36,7 @@
 import java.security.KeyStoreException;
 
 import org.opends.quicksetup.ApplicationException;
+import org.opends.quicksetup.ApplicationReturnCode;
 import org.opends.quicksetup.ProgressStep;
 import org.opends.quicksetup.Installation;
 import org.opends.quicksetup.SecurityOptions;
@@ -158,7 +159,7 @@
 
     } catch (ApplicationException ex)
     {
-      if (ApplicationException.Type.CANCEL.equals(ex.getType())) {
+      if (ApplicationReturnCode.ReturnCode.CANCELLED.equals(ex.getType())) {
         uninstall();
         setCurrentProgressStep(InstallProgressStep.FINISHED_CANCELED);
         notifyListeners(null);
@@ -197,7 +198,8 @@
       updateSummaryWithServerState(hmSummary);
       setCurrentProgressStep(InstallProgressStep.FINISHED_WITH_ERROR);
       ApplicationException ex = new ApplicationException(
-          ApplicationException.Type.BUG, getThrowableMsg("bug-msg", t), t);
+          ApplicationReturnCode.ReturnCode.BUG,
+          getThrowableMsg("bug-msg", t), t);
       String msg = getFormattedError(ex, true);
       notifyListeners(msg);
       LOG.log(Level.SEVERE, "Error installing.", t);
diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java b/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
index 35b7b81..a26e9d6 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/webstart/WebStartInstaller.java
@@ -37,6 +37,7 @@
 import java.util.logging.Logger;
 
 import org.opends.quicksetup.ApplicationException;
+import org.opends.quicksetup.ApplicationReturnCode;
 import org.opends.quicksetup.ProgressStep;
 import org.opends.quicksetup.Installation;
 import org.opends.quicksetup.webstart.JnlpProperties;
@@ -215,7 +216,7 @@
 
     } catch (ApplicationException ex)
     {
-      if (ApplicationException.Type.CANCEL.equals(ex.getType())) {
+      if (ApplicationReturnCode.ReturnCode.CANCELLED.equals(ex.getType())) {
         uninstall();
         setCurrentProgressStep(InstallProgressStep.FINISHED_CANCELED);
         notifyListeners(null);
@@ -254,7 +255,8 @@
       updateSummaryWithServerState(hmSummary);
       setCurrentProgressStep(InstallProgressStep.FINISHED_WITH_ERROR);
       ApplicationException ex = new ApplicationException(
-          ApplicationException.Type.BUG, getThrowableMsg("bug-msg", t), t);
+          ApplicationReturnCode.ReturnCode.BUG,
+          getThrowableMsg("bug-msg", t), t);
       String msg = getFormattedError(ex, true);
       notifyListeners(msg);
       LOG.log(Level.SEVERE, "Error installing.", t);
@@ -409,8 +411,9 @@
 
     if (in == null)
     {
-      throw new ApplicationException(ApplicationException.Type.DOWNLOAD_ERROR,
-          getMsg("error-zipinputstreamnull", new String[] {zipName}), null);
+      throw new ApplicationException(
+          ApplicationReturnCode.ReturnCode.DOWNLOAD_ERROR, getMsg(
+              "error-zipinputstreamnull", new String[] { zipName }), null);
     }
 
     notifyListeners(getFormattedDone());
@@ -433,7 +436,7 @@
         if (!Utils.createDirectory(parent))
         {
           throw new ApplicationException(
-              ApplicationException.Type.FILE_SYSTEM_ERROR,
+              ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
               getMsg("error-could-not-create-parent-dir",
                   new String[] {parent}), null);
         }
@@ -441,7 +444,7 @@
       catch (IOException ioe)
       {
         throw new ApplicationException(
-            ApplicationException.Type.FILE_SYSTEM_ERROR,
+            ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
             getMsg("error-could-not-create-parent-dir", new String[] {parent}),
             ioe);
       }
diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java b/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java
index f5a026c..f899157 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java
@@ -572,8 +572,8 @@
       String msg = getMsg("error-starting-server-with-no-connection-handlers",
           (t.getMessage() == null) ? t.toString() : t.getMessage());
       LOG.log(Level.INFO, msg, t);
-      throw new ApplicationException(ApplicationException.Type.IMPORT_ERROR,
-          msg, t);
+      throw new ApplicationException(
+          ApplicationReturnCode.ReturnCode.IMPORT_ERROR, msg, t);
     }
   }
 
diff --git a/opends/src/quicksetup/org/opends/quicksetup/uninstaller/Uninstaller.java b/opends/src/quicksetup/org/opends/quicksetup/uninstaller/Uninstaller.java
index 77667c7..7ca05df 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/uninstaller/Uninstaller.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/uninstaller/Uninstaller.java
@@ -604,7 +604,7 @@
     }
     catch (Throwable t) {
       ue = new ApplicationException(
-              ApplicationException.Type.BUG,
+              ApplicationReturnCode.ReturnCode.BUG,
               getThrowableMsg("bug-msg", t), t);
       status = UninstallProgressStep.FINISHED_WITH_ERROR;
       String msg = getFormattedError(ue, true);
@@ -917,7 +917,8 @@
         errMsg = getMsg("error-deleting-directory", arg);
       }
       throw new ApplicationException(
-              ApplicationException.Type.FILE_SYSTEM_ERROR, errMsg, null);
+          ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
+          errMsg, null);
     }
 
     notifyListeners(getFormattedDone() + getLineBreak());
@@ -1021,7 +1022,7 @@
         break;
       default:
         throw new ApplicationException(
-                ApplicationException.Type.WINDOWS_SERVICE_ERROR,
+            ApplicationReturnCode.ReturnCode.WINDOWS_SERVICE_ERROR,
                 errorMessage, null);
     }
   }
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java
index cc00d6e..f11e1e1 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java
@@ -115,7 +115,7 @@
                   Utils.getPath(buildFile),
                   installation.getInvalidityReason());
           error = new ApplicationException(
-                ApplicationException.Type.APPLICATION,
+              ApplicationReturnCode.ReturnCode.APPLICATION_ERROR,
                   invalidMsg, null);
           System.err.println(invalidMsg);
         }
@@ -123,8 +123,9 @@
     } catch (Throwable t) {
       LOG.log(Level.INFO, "unexpected error extracting build", t);
       String reason = t.getLocalizedMessage();
-      error = new ApplicationException(ApplicationException.Type.APPLICATION,
-                getMsg("build-extractor-error", reason), t);
+      error = new ApplicationException(
+          ApplicationReturnCode.ReturnCode.APPLICATION_ERROR, getMsg(
+              "build-extractor-error", reason), t);
       System.err.println(reason);
     } finally   {
       finished = true;
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/MigrationManager.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/MigrationManager.java
index e3c3410..c99b1df 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/MigrationManager.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/MigrationManager.java
@@ -28,6 +28,7 @@
 package org.opends.quicksetup.upgrader;
 
 import org.opends.quicksetup.ApplicationException;
+import org.opends.quicksetup.ApplicationReturnCode;
 import org.opends.quicksetup.Installation;
 import org.opends.quicksetup.UserInteraction;
 import org.opends.quicksetup.Constants;
@@ -173,8 +174,8 @@
     } catch (Exception e) {
       String msg = getMsg("error-applying-custom-config");
       LOG.log(Level.INFO, msg, e);
-      throw new ApplicationException(ApplicationException.Type.IMPORT_ERROR,
-              msg, e);
+      throw new ApplicationException(
+          ApplicationReturnCode.ReturnCode.IMPORT_ERROR, msg, e);
     }
   }
 
@@ -195,8 +196,8 @@
     } catch (Exception e) {
       String msg = getMsg("error-applying-custom-schema");
       LOG.log(Level.INFO, msg, e);
-      throw new ApplicationException(ApplicationException.Type.IMPORT_ERROR,
-              msg, e);
+      throw new ApplicationException(
+          ApplicationReturnCode.ReturnCode.IMPORT_ERROR, msg, e);
     }
   }
 
@@ -268,8 +269,9 @@
           } else if (retry.equals(r)) {
             // do nothing; will retry;
           } else {
-            throw new ApplicationException(ApplicationException.Type.CANCEL,
-                    getMsg("upgrade-canceled"), e);
+            throw new ApplicationException(
+                ApplicationReturnCode.ReturnCode.CANCELLED,
+                getMsg("upgrade-canceled"), e);
           }
         } else {
           throw e;
@@ -336,7 +338,7 @@
     int ret = oo.getReturnCode();
     if (ret != 0) {
       throw new ApplicationException(
-              ApplicationException.Type.TOOL_ERROR,
+          ApplicationReturnCode.ReturnCode.TOOL_ERROR,
               getMsg("error-ldif-diff-tool-return-code",
                       Integer.toString(ret)),
               null);
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java
index 9bddfb3..ab37a2f 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java
@@ -27,6 +27,7 @@
 
 package org.opends.quicksetup.upgrader;
 
+import org.opends.quicksetup.ApplicationReturnCode;
 import org.opends.quicksetup.CliApplication;
 import org.opends.quicksetup.UserData;
 import org.opends.quicksetup.UserDataException;
@@ -341,8 +342,9 @@
                 UserInteraction.MessageType.WARNING,
                 new String[] { cont, cancel },
                 cont))) {
-          throw new ApplicationException(ApplicationException.Type.CANCEL,
-                  getMsg("reversion-canceled"), null);
+          throw new ApplicationException(
+              ApplicationReturnCode.ReturnCode.CANCELLED,
+              getMsg("reversion-canceled"), null);
         }
       }
 
@@ -351,7 +353,7 @@
     } catch (Throwable e) {
       if (!(e instanceof ApplicationException)) {
         runError = new ApplicationException(
-                ApplicationException.Type.BUG,
+            ApplicationReturnCode.ReturnCode.BUG,
                 e.getLocalizedMessage(), e);
       } else {
         runError = (ApplicationException)e;
@@ -405,7 +407,7 @@
       throw ae;
     } catch (Exception e) {
       throw new ApplicationException(
-              ApplicationException.Type.FILE_SYSTEM_ERROR,
+          ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
               getMsg("error-backup-filesystem"),
               e);
     }
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeIssueNotifier.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeIssueNotifier.java
index 1f2f43e..bcc7434 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeIssueNotifier.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeIssueNotifier.java
@@ -27,6 +27,7 @@
 
 package org.opends.quicksetup.upgrader;
 
+import org.opends.quicksetup.ApplicationReturnCode;
 import org.opends.quicksetup.BuildInformation;
 import org.opends.quicksetup.UserInteraction;
 import org.opends.quicksetup.ApplicationException;
@@ -77,8 +78,9 @@
                     directive.getMessage());
           }
         }
-        throw new ApplicationException(ApplicationException.Type.APPLICATION,
-                getMsg("upgrade-oracle-unsupported", args), null);
+        throw new ApplicationException(
+            ApplicationReturnCode.ReturnCode.APPLICATION_ERROR, getMsg(
+                "upgrade-oracle-unsupported", args), null);
       } else {
         if (ui != null) {
           for (VersionIssueNotifier.Directive directive : issues) {
@@ -135,13 +137,14 @@
                     new String[]{cont, cancel},
                     defaultAction))) {
               throw new ApplicationException(
-                      ApplicationException.Type.CANCEL,
+                  ApplicationReturnCode.ReturnCode.CANCELLED,
                       getMsg("upgrade-canceled"), null);
             }
           }
         } else {
-          throw new ApplicationException(ApplicationException.Type.APPLICATION,
-                  getMsg("oracle-no-silent"), null);
+          throw new ApplicationException(
+              ApplicationReturnCode.ReturnCode.APPLICATION_ERROR,
+              getMsg("oracle-no-silent"), null);
         }
       }
     }
diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
index 9d1616d..9f69adb 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
@@ -30,6 +30,7 @@
 import org.opends.quicksetup.CliApplication;
 import static org.opends.quicksetup.Installation.*;
 
+import org.opends.quicksetup.ApplicationReturnCode;
 import org.opends.quicksetup.WizardStep;
 import org.opends.quicksetup.ProgressStep;
 import org.opends.quicksetup.ApplicationException;
@@ -793,8 +794,9 @@
           LOG.log(Level.INFO,
                   "Error starting server in order to apply custom" +
                           "schema and/or configuration", e);
-          throw new ApplicationException(ApplicationException.Type.APPLICATION,
-                  getMsg("error-starting-server"), e);
+          throw new ApplicationException(
+              ApplicationReturnCode.ReturnCode.APPLICATION_ERROR,
+              getMsg("error-starting-server"), e);
         }
 
         checkAbort();
@@ -848,7 +850,7 @@
           LOG.log(Level.INFO, "server stopped");
         } catch (Throwable t) {
           LOG.log(Level.INFO, "Error stopping server", t);
-          throw new ApplicationException(ApplicationException.Type.BUG,
+          throw new ApplicationException(ApplicationReturnCode.ReturnCode.BUG,
                   getMsg("error-stopping-server"), t);
         }
       }
@@ -889,7 +891,7 @@
                 Utils.listToString(errors,
                         Constants.LINE_SEPARATOR, /*bullet=*/"\u2022 ", "");
         ApplicationException ae = new ApplicationException(
-                ApplicationException.Type.APPLICATION,
+                ApplicationReturnCode.ReturnCode.APPLICATION_ERROR,
                 getMsg("error-upgraded-server-starts-with-errors",
                         Constants.LINE_SEPARATOR + formattedDetails), null);
         UserInteraction ui = userInteraction();
@@ -945,7 +947,7 @@
             int port = getInstallation().getCurrentConfiguration().getPort();
             if (port != -1 && !Utils.canUseAsPort(port)) {
               throw new ApplicationException(
-                      ApplicationException.Type.APPLICATION,
+                  ApplicationReturnCode.ReturnCode.APPLICATION_ERROR,
                       getMsg("error-port-in-use", Integer.toString(port)),
                       null);
             }
@@ -975,7 +977,7 @@
       } catch (IOException ioe) {
         LOG.log(Level.INFO, "error determining if server running");
         this.runWarning = new ApplicationException(
-                ApplicationException.Type.TOOL_ERROR,
+            ApplicationReturnCode.ReturnCode.TOOL_ERROR,
                 getMsg("error-server-status"), ioe);
       }
 
@@ -983,7 +985,7 @@
 
       // We don't consider a  user cancelation exception
       // to be an error.
-      if (ae.getType() != ApplicationException.Type.CANCEL) {
+      if (ae.getType() != ApplicationReturnCode.ReturnCode.CANCELLED) {
         this.runError = ae;
       } else {
         this.abort = true;
@@ -991,7 +993,7 @@
 
     } catch (Throwable t) {
       this.runError =
-              new ApplicationException(ApplicationException.Type.BUG,
+              new ApplicationException(ApplicationReturnCode.ReturnCode.BUG,
                       getMsg("bug-msg"), t);
     } finally {
       try {
@@ -1111,7 +1113,7 @@
 
   private void checkAbort() throws ApplicationException {
     if (abort) throw new ApplicationException(
-            ApplicationException.Type.CANCEL,
+        ApplicationReturnCode.ReturnCode.CANCELLED,
             getMsg("upgrade-canceled"), null);
   }
 
@@ -1247,7 +1249,7 @@
       throw ae;
     } catch (Exception e) {
       throw new ApplicationException(
-              ApplicationException.Type.FILE_SYSTEM_ERROR,
+          ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
               getMsg("error-backup-filesystem"),
               e);
     }
@@ -1260,7 +1262,7 @@
       int ret = output.getReturnCode();
       if (ret != 0) {
         throw new ApplicationException(
-                ApplicationException.Type.TOOL_ERROR,
+            ApplicationReturnCode.ReturnCode.TOOL_ERROR,
                 getMsg("error-backup-db-tool-return-code",
                         Integer.toString(ret)),
                 null);
@@ -1270,7 +1272,7 @@
       throw ae;
     } catch (Exception e) {
       throw new ApplicationException(
-              ApplicationException.Type.TOOL_ERROR,
+          ApplicationReturnCode.ReturnCode.TOOL_ERROR,
               getMsg("error-backup-db"), e);
     }
   }
@@ -1317,7 +1319,7 @@
       throw ae;
     } catch (Exception e) {
       throw new ApplicationException(
-              ApplicationException.Type.FILE_SYSTEM_ERROR,
+          ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
               getMsg("error-initializing-upgrade"), e);
     }
   }
diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/FileManager.java b/opends/src/quicksetup/org/opends/quicksetup/util/FileManager.java
index f3a9181..4a9dfba 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/FileManager.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/util/FileManager.java
@@ -158,7 +158,7 @@
         if (target.exists()) {
           if (!target.delete()) {
             throw new ApplicationException(
-                    ApplicationException.Type.FILE_SYSTEM_ERROR,
+                ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
                     getMsg("error-deleting-file",
                             Utils.getPath(target)), null);
           }
@@ -166,7 +166,7 @@
       }
       if (!fileToRename.renameTo(target)) {
         throw new ApplicationException(
-                ApplicationException.Type.FILE_SYSTEM_ERROR,
+            ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
                 getMsg("error-renaming-file",
                         Utils.getPath(fileToRename),
                         Utils.getPath(target)), null);
@@ -525,7 +525,7 @@
             } catch (Exception e) {
               String errMsg = getMsg("error-copying-file", args);
               throw new ApplicationException(
-                      ApplicationException.Type.FILE_SYSTEM_ERROR,
+                  ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
                       errMsg, null);
             } finally {
               if (fis != null) {
@@ -546,7 +546,8 @@
           } else {
             String errMsg = getMsg("error-copying-file", args);
             throw new ApplicationException(
-                    ApplicationException.Type.FILE_SYSTEM_ERROR, errMsg, null);
+                ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
+                errMsg, null);
           }
         } else {
           LOG.log(Level.INFO, "Ignoring file '" +
@@ -646,7 +647,8 @@
           errMsg = getMsg("error-deleting-directory", arg);
         }
         throw new ApplicationException(
-                ApplicationException.Type.FILE_SYSTEM_ERROR, errMsg, null);
+            ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
+            errMsg, null);
       }
 
       if (application != null) {
diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/InProcessServerController.java b/opends/src/quicksetup/org/opends/quicksetup/util/InProcessServerController.java
index eb6dd0c..8ccbf70 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/InProcessServerController.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/util/InProcessServerController.java
@@ -401,7 +401,7 @@
           // report the error to the user
           StringBuilder error = op.getErrorMessage();
           throw new ApplicationException(
-                  ApplicationException.Type.IMPORT_ERROR,
+              ApplicationReturnCode.ReturnCode.IMPORT_ERROR,
                   getMsg("error-apply-ldif-modify", dnByteString.toString(),
                           error != null ? error.toString() : ""),
                   null);
@@ -424,7 +424,7 @@
           // report the error to the user
           StringBuilder error = addOp.getErrorMessage();
           throw new ApplicationException(
-                  ApplicationException.Type.IMPORT_ERROR,
+              ApplicationReturnCode.ReturnCode.IMPORT_ERROR,
                   getMsg("error-apply-ldif-add", dnByteString.toString(),
                           error != null ? error.toString() : ""),
                   null);
@@ -441,7 +441,7 @@
           // report the error to the user
           StringBuilder error = delOp.getErrorMessage();
           throw new ApplicationException(
-                  ApplicationException.Type.IMPORT_ERROR,
+              ApplicationReturnCode.ReturnCode.IMPORT_ERROR,
                   getMsg("error-apply-ldif-delete", dnByteString.toString(),
                           error != null ? error.toString() : ""),
                   null);
@@ -449,7 +449,7 @@
         break;
       default:
         LOG.log(Level.SEVERE, "Unexpected record type " + cre.getClass());
-        throw new ApplicationException(ApplicationException.Type.BUG,
+        throw new ApplicationException(ApplicationReturnCode.ReturnCode.BUG,
                 getMsg("bug-msg"),
                 null);
     }
diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java b/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
index bd00412..7b71e2a 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
@@ -204,10 +204,10 @@
           * The return code is not the one expected, assume the server could
           * not be stopped.
           */
-          throw new ApplicationException(ApplicationException.Type.STOP_ERROR,
-                  ResourceProvider.getInstance().getMsg(
-                          "error-stopping-server-code",
-                          String.valueOf(returnValue)),
+          throw new ApplicationException(
+              ApplicationReturnCode.ReturnCode.STOP_ERROR, ResourceProvider
+                  .getInstance().getMsg("error-stopping-server-code",
+                      String.valueOf(returnValue)),
                   null);
         } else {
           if (application != null) {
@@ -219,8 +219,9 @@
         }
 
       } catch (Exception e) {
-        throw new ApplicationException(ApplicationException.Type.STOP_ERROR,
-                getThrowableMsg("error-stopping-server", e), e);
+        throw new ApplicationException(
+            ApplicationReturnCode.ReturnCode.STOP_ERROR, getThrowableMsg(
+                "error-stopping-server", e), e);
       }
     } finally {
       if (suppressOutput && StandardOutputSuppressor.isSuppressed()) {
@@ -437,7 +438,7 @@
           if (Utils.isWindows())
           {
             throw new ApplicationException(
-                ApplicationException.Type.START_ERROR,
+                ApplicationReturnCode.ReturnCode.START_ERROR,
                     getMsg("error-starting-server-in-windows",
                             String.valueOf(port)),
                     null);
@@ -445,7 +446,7 @@
           else
           {
             throw new ApplicationException(
-                ApplicationException.Type.START_ERROR,
+                ApplicationReturnCode.ReturnCode.START_ERROR,
                     getMsg("error-starting-server-in-unix",
                             String.valueOf(port)),
                     null);
@@ -455,9 +456,9 @@
 
     } catch (IOException ioe)
     {
-      throw new ApplicationException(ApplicationException.Type.START_ERROR,
-              getThrowableMsg("error-starting-server", ioe),
-              ioe);
+      throw new ApplicationException(
+            ApplicationReturnCode.ReturnCode.START_ERROR, getThrowableMsg(
+                "error-starting-server", ioe), ioe);
     }
   } finally {
       if (suppressOuput && StandardOutputSuppressor.isSuppressed()) {
@@ -611,9 +612,9 @@
             }
           } catch (Throwable t)
           {
-            ex =
-                new ApplicationException(ApplicationException.Type.START_ERROR,
-                    getThrowableMsg(errorTag, t), t);
+            ex = new ApplicationException(
+                ApplicationReturnCode.ReturnCode.START_ERROR,
+                getThrowableMsg(errorTag, t), t);
 
           }
           isFinished = true;
diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/ServerHealthChecker.java b/opends/src/quicksetup/org/opends/quicksetup/util/ServerHealthChecker.java
index e676791..0e61774 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/ServerHealthChecker.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/util/ServerHealthChecker.java
@@ -27,6 +27,7 @@
 
 package org.opends.quicksetup.util;
 
+import org.opends.quicksetup.ApplicationReturnCode;
 import org.opends.quicksetup.Installation;
 import org.opends.quicksetup.ApplicationException;
 import org.opends.quicksetup.i18n.ResourceProvider;
@@ -85,9 +86,9 @@
       if (e instanceof ApplicationException) {
         throw (ApplicationException)e;
       } else {
-        throw new ApplicationException(ApplicationException.Type.APPLICATION,
-                ResourceProvider.getInstance().getMsg(
-                        "error-server-health-check-failure"), e);
+        throw new ApplicationException(
+            ApplicationReturnCode.ReturnCode.APPLICATION_ERROR, ResourceProvider
+                .getInstance().getMsg("error-server-health-check-failure"), e);
       }
     } finally {
       if (control != null) {
diff --git a/opends/src/quicksetup/org/opends/quicksetup/util/ZipExtractor.java b/opends/src/quicksetup/org/opends/quicksetup/util/ZipExtractor.java
index 7ea35fd..81d0865 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/util/ZipExtractor.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/util/ZipExtractor.java
@@ -29,6 +29,7 @@
 
 import org.opends.quicksetup.ApplicationException;
 import org.opends.quicksetup.Application;
+import org.opends.quicksetup.ApplicationReturnCode;
 import org.opends.quicksetup.i18n.ResourceProvider;
 
 import java.io.*;
@@ -209,7 +210,7 @@
                             "error-copying", arg, ioe);
 
             throw new ApplicationException(
-                    ApplicationException.Type.FILE_SYSTEM_ERROR,
+                ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
                     errorMsg, ioe);
           }
         }
@@ -247,7 +248,8 @@
               Utils.getThrowableMsg(ResourceProvider.getInstance(),
                       "error-zip-stream", arg, ioe);
       throw new ApplicationException(
-              ApplicationException.Type.FILE_SYSTEM_ERROR, errorMsg, ioe);
+          ApplicationReturnCode.ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
+          errorMsg, ioe);
     }
   }
 
diff --git a/opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java b/opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java
index 5059335..27cbe84 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/webstart/WebStartDownloader.java
@@ -38,6 +38,7 @@
 
 import org.opends.quicksetup.i18n.ResourceProvider;
 import org.opends.quicksetup.ApplicationException;
+import org.opends.quicksetup.ApplicationReturnCode;
 import org.opends.quicksetup.util.Utils;
 
 /**
@@ -134,7 +135,7 @@
         {
           // This is a bug
           ex =
-              new ApplicationException(ApplicationException.Type.BUG,
+              new ApplicationException(ApplicationReturnCode.ReturnCode.BUG,
                       getExceptionMsg(
                   "bug-msg", mfe), mfe);
         } catch (IOException ioe)
@@ -152,13 +153,14 @@
           String[] arg =
             { buf.toString() };
           ex =
-              new ApplicationException(ApplicationException.Type.DOWNLOAD_ERROR,
-                  getExceptionMsg("downloading-error", arg, ioe), ioe);
+              new ApplicationException(
+              ApplicationReturnCode.ReturnCode.DOWNLOAD_ERROR,
+              getExceptionMsg("downloading-error", arg, ioe), ioe);
         } catch (Throwable t)
         {
           // This is a bug
           ex =
-              new ApplicationException(ApplicationException.Type.BUG,
+              new ApplicationException(ApplicationReturnCode.ReturnCode.BUG,
                       getExceptionMsg(
                   "bug-msg", t), t);
         }
@@ -363,8 +365,9 @@
   public void downloadFailed(URL url, String version)
   {
     ex =
-        new ApplicationException(ApplicationException.Type.DOWNLOAD_ERROR,
-            getMsg("downloading-error", new String[] { url.toString() }), null);
+        new ApplicationException(
+        ApplicationReturnCode.ReturnCode.DOWNLOAD_ERROR, getMsg(
+            "downloading-error", new String[] { url.toString() }), null);
   }
 
   /**

--
Gitblit v1.10.0