From 9e01bfedc057e6953c5c6953ca444326df5c4bea Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Mon, 31 May 2010 12:59:15 +0000
Subject: [PATCH] Resolve an issue when uninstalling in CLI mode and tool.properties has some properties. When doing uninstall, always stop the local server.

---
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
index 5a34245..57feb1b 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java
@@ -36,6 +36,7 @@
 
 import static org.opends.quicksetup.util.Utils.*;
 import org.opends.quicksetup.installer.InstallerHelper;
+import org.opends.server.tools.ToolConstants;
 import org.opends.server.util.SetupUtils;
 
 import javax.naming.NamingException;
@@ -112,6 +113,21 @@
    *          if something goes wrong.
    */
   public void stopServer(boolean suppressOutput) throws ApplicationException {
+    stopServer(suppressOutput,false);
+  }
+  /**
+   * This methods stops the server.
+   *
+   * @param suppressOutput boolean indicating that ouput to standard output
+   *                       streams from the server should be suppressed.
+   * @param noPropertiesFile boolean indicating if the stopServer should
+   *                       be called without taking into account the
+   *                       properties file.
+   * @throws org.opends.quicksetup.ApplicationException
+   *          if something goes wrong.
+   */
+  public void stopServer(boolean suppressOutput,boolean noPropertiesFile)
+  throws ApplicationException {
 
     if (suppressOutput && !StandardOutputSuppressor.isSuppressed()) {
       StandardOutputSuppressor.suppress();
@@ -135,8 +151,17 @@
       ArrayList<String> argList = new ArrayList<String>();
       argList.add(Utils.getScriptPath(
           Utils.getPath(installation.getServerStopCommandFile())));
-      String[] args = new String[argList.size()];
+      int size = argList.size();
+      if (noPropertiesFile)
+      {
+        size++;
+      }
+      String[] args = new String[size];
       argList.toArray(args);
+      if (noPropertiesFile)
+      {
+        args[argList.size()] = "--" + ToolConstants.OPTION_LONG_NO_PROP_FILE;
+      }
       ProcessBuilder pb = new ProcessBuilder(args);
       Map<String, String> env = pb.environment();
       env.put(SetupUtils.OPENDS_JAVA_HOME, System.getProperty("java.home"));

--
Gitblit v1.10.0