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

Ludovic Poitou
23.17.2011 95798000b6af5e5805d7be753766e6d2fd5cb4aa
Fix OPENDJ-298 - Review screen content is wrong when using QuickSetup.
The issue was due to an exception being thrown while building the review screen. The exception was due to the computation of the path of Binaries, incorrect as the Java WebStart Install had not created the install location yet.
The fix is to use an alternate way to compute the command path, similar to what was done for setup.
2 files modified
52 ■■■■■ changed files
opends/src/quicksetup/org/opends/quicksetup/Installation.java 4 ●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/util/Utils.java 48 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/Installation.java
@@ -48,7 +48,7 @@
 * All the operations are dependent upon the root directory that is
 * specified in the constructor.
 */
public class Installation {
public final class Installation {
  /**
   * Relative path to OpenDJ jar files.
@@ -1151,6 +1151,8 @@
    if (buildInformation == null || !useCachedVersion) {
      FutureTask<BuildInformation> ft = new FutureTask<BuildInformation>(
              new Callable<BuildInformation>() {
                @Override
                public BuildInformation call() throws ApplicationException {
                  return BuildInformation.create(Installation.this);
                }
opends/src/quicksetup/org/opends/quicksetup/util/Utils.java
@@ -23,6 +23,7 @@
 *
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2011 ForgeRock AS
 */
package org.opends.quicksetup.util;
@@ -2485,7 +2486,7 @@
      UserData userData, Set<String> baseDNs, ServerDescriptor server)
  {
    ArrayList<String> cmdLine = new ArrayList<String>();
    String cmdName = getCommandLinePath("dsreplication");
    String cmdName = getCommandLinePath(userData, "dsreplication");
    cmdLine.add(cmdName);
    cmdLine.add("enable");
@@ -2560,50 +2561,31 @@
  /**
   * Returns the full path of the command-line for a given script name.
   * @param userData  the user data.
   * @param scriptBasicName the script basic name (with no extension).
   * @return the full path of the command-line for a given script name.
   */
  private static String getCommandLinePath(String scriptBasicName)
  private static String getCommandLinePath(UserData userData,
                                           String scriptBasicName)
  {
    String cmdLineName;
    if (isWindows())
    {
      cmdLineName = getBinaryDir()+scriptBasicName+".bat";
      cmdLineName = getInstallDir(userData)
          + Installation.WINDOWS_BINARIES_PATH_RELATIVE
          + File.separatorChar
          + scriptBasicName + ".bat";
    }
    else
    {
      cmdLineName = getBinaryDir()+scriptBasicName;
      cmdLineName = getInstallDir(userData)
          + Installation.UNIX_BINARIES_PATH_RELATIVE
          + File.separatorChar
          + scriptBasicName;
    }
    return cmdLineName;
  }
  private static String binDir;
  /**
   * Returns the binary/script directory.
   * @return the binary/script directory.
   */
  private static String getBinaryDir()
  {
    if (binDir == null)
    {
      File f = Installation.getLocal().getBinariesDirectory();
      try
      {
        binDir = f.getCanonicalPath();
      }
      catch (Throwable t)
      {
        binDir = f.getAbsolutePath();
      }
      if (binDir.lastIndexOf(File.separatorChar) != (binDir.length() - 1))
      {
        binDir += File.separatorChar;
      }
    }
    return binDir;
  }
  private static String installDir;
  /**
   * Returns the installation directory.
@@ -2645,7 +2627,7 @@
      UserData userData, Set<String> baseDNs, ServerDescriptor server)
  {
    ArrayList<String> cmdLine = new ArrayList<String>();
    String cmdName = getCommandLinePath("dsreplication");
    String cmdName = getCommandLinePath(userData, "dsreplication");
    cmdLine.add(cmdName);
    cmdLine.add("initialize");
@@ -2774,7 +2756,7 @@
  {
    ArrayList<ArrayList<String>> cmdLines = new ArrayList<ArrayList<String>>();
    String cmdName = getCommandLinePath("dsconfig");
    String cmdName = getCommandLinePath(userData, "dsconfig");
    ArrayList<String> connectionArgs = new ArrayList<String>();
    connectionArgs.add("--hostName");