mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

ludovicp
31.59.2010 8f8fa9a5bc51f0a11629031cb5bdc0753a839ade
Resolve an issue when uninstalling in CLI mode and tool.properties has some properties. When doing uninstall, always stop the local server.
3 files modified
40 ■■■■■ changed files
opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java 8 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/util/ServerController.java 27 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/tools/StopDS.java 5 ●●●●● patch | view | raw | blame | history
opends/src/guitools/org/opends/guitools/uninstaller/Uninstaller.java
@@ -828,7 +828,13 @@
          notifyListeners(getFormattedWithPoints(
              INFO_PROGRESS_STOPPING_NON_VERBOSE.get()));
        }
        new ServerController(this).stopServer(!isVerbose());
        // In case of uninstall, the server stop has to run locally.
        // In order to bypass the tools.properties mechanism, if any,
        // we systematically add the --noPropertiesFile flag
        // when we run the stop-ds command. This is done
        // by setting the parameter "noPropertiesFile" to 'true'
        // in the following call.
        new ServerController(this).stopServer(!isVerbose(),true);
        if (!isVerbose())
        {
          notifyListeners(getFormattedDoneWithLineBreak());
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"));
opends/src/server/org/opends/server/tools/StopDS.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 */
package org.opends.server.tools;
import org.opends.messages.Message;
@@ -827,7 +827,8 @@
          !"quiet".equals(arg.getName()) &&
          !"showusage".equals(arg.getName()) &&
          !"checkstoppability".equals(arg.getName()) &&
          !"windowsnetstop".equals(arg.getName()))
          !"windowsnetstop".equals(arg.getName()) &&
          ! OPTION_LONG_NO_PROP_FILE.equals(arg.getLongIdentifier()))
      {
        stopThroughProtocol |= arg.isPresent();
      }