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

lutoff
06.51.2007 778b1987a96a8591520f8b6e2c8225ccb5e73c69
fix for issue #1865 (upgrade -V error)

In case on -V option, BuildExtractor will exit with a pre-defined return
code defined in QuickSetupCli.java (let's say 50). Script will test this
specific return value to check if the non-null return code
is an error.
In case of none null return code, the upgradeLauncher will not be called.
8 files modified
76 ■■■■ changed files
opends/resource/upgrade 7 ●●●● patch | view | raw | blame | history
opends/resource/upgrade.bat 5 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/Launcher.java 19 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java 5 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installer/InstallLauncher.java 12 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/uninstaller/UninstallLauncher.java 12 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java 4 ●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeLauncher.java 12 ●●●●● patch | view | raw | blame | history
opends/resource/upgrade
@@ -136,7 +136,8 @@
done
export CLASSPATH
"${JAVA_BIN}" org.opends.quicksetup.upgrader.BuildExtractor "${@}"
if test $? -eq 0
RETURN_CODE=$?
if test ${RETURN_CODE} -eq 0
then
  # Configure the appropriate CLASSPATH.
  # Unlike BuildExtractor, the Upgrader uses
@@ -148,6 +149,10 @@
  done
  # Launch the upgrade process.
  "${JAVA_BIN}" org.opends.quicksetup.upgrader.UpgradeLauncher "${@}"
elif test ${RETURN_CODE} -eq 50
then
  # Version info was on requested
  exit 0
else
  exit 101
fi
opends/resource/upgrade.bat
@@ -70,6 +70,7 @@
FOR %%x in ("%INSTANCE_ROOT%\lib\*.jar") DO call "%INSTANCE_ROOT%\lib\setcp.bat" %%x
set CLASSPATH=%DIR_HOME%\classes;%CLASSPATH%
"%JAVA_BIN%" org.opends.quicksetup.upgrader.BuildExtractor %*
if %errorlevel% == 50 goto version
if not %errorlevel% == 0 goto end
goto upgrader
@@ -79,4 +80,8 @@
"%JAVA_BIN%" org.opends.quicksetup.upgrader.UpgradeLauncher %*
goto end
:version
rem version information was requested. Return code should be 0.
exit /B 0
:end
opends/src/quicksetup/org/opends/quicksetup/Launcher.java
@@ -305,21 +305,23 @@
  /**
   * The main method which is called by the command lines.
   *
   * @return the error return code.
   */
  public void launch() {
  public int launch() {
    if (shouldPrintVersion())
    {
      printVersion();
      System.exit(QuickSetupCli.SUCCESSFUL);
      return QuickSetupCli.VERSION_PRINT;
    }
    else if (shouldPrintUsage()) {
      printUsage(false);
      System.exit(QuickSetupCli.SUCCESSFUL);
      return QuickSetupCli.SUCCESSFUL;
    } else if (isCli()) {
      CliApplication cliApp = createCliApplication();
      int exitCode = launchCli(args, cliApp);
      preExit(cliApp);
      System.exit(exitCode);
      return exitCode;
    } else {
      willLaunchGui();
      int exitCode = launchGui(args);
@@ -337,10 +339,17 @@
        exitCode = launchCli(args, cliApp);
        if (exitCode != 0) {
          preExit(cliApp);
          System.exit(exitCode);
          return exitCode;
        }
      }
      else
      {
        return exitCode ;
      }
    }
    // We should never reach this code
    return QuickSetupCli.UNKNOWN;
  }
  private void preExit(CliApplication cliApp) {
opends/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java
@@ -70,6 +70,11 @@
  static public int BUG = 5;
  /**
   * Return code: It's not an error. Version info.
   */
  static public int VERSION_PRINT = 50;
  /**
   * Return code for errors that are non-specified.
   */
  static public int UNKNOWN = 100;
opends/src/quicksetup/org/opends/quicksetup/installer/InstallLauncher.java
@@ -36,6 +36,7 @@
import org.opends.quicksetup.Launcher;
import org.opends.quicksetup.CliApplication;
import org.opends.quicksetup.Installation;
import org.opends.quicksetup.QuickSetupCli;
import org.opends.quicksetup.QuickSetupLog;
import org.opends.quicksetup.util.Utils;
import org.opends.server.util.ServerConstants;
@@ -79,7 +80,16 @@
      System.err.println("Unable to initialize log");
      t.printStackTrace();
    }
    new InstallLauncher(args).launch();
    Launcher launcher = new InstallLauncher(args);
    int returnCode = launcher.launch();
    if (returnCode == QuickSetupCli.VERSION_PRINT)
    {
      System.exit(QuickSetupCli.SUCCESSFUL);
    }
    else
    {
      System.exit(returnCode);
    }
  }
  /**
opends/src/quicksetup/org/opends/quicksetup/uninstaller/UninstallLauncher.java
@@ -36,6 +36,7 @@
import org.opends.quicksetup.CliApplication;
import org.opends.quicksetup.Launcher;
import org.opends.quicksetup.Installation;
import org.opends.quicksetup.QuickSetupCli;
import org.opends.quicksetup.QuickSetupLog;
import org.opends.quicksetup.util.Utils;
import org.opends.server.util.ServerConstants;
@@ -74,7 +75,16 @@
      System.err.println("Unable to initialize log");
      t.printStackTrace();
    }
    new UninstallLauncher(args).launch();
    Launcher launcher = new UninstallLauncher(args);
    int returnCode = launcher.launch();
    if (returnCode == QuickSetupCli.VERSION_PRINT)
    {
      System.exit(QuickSetupCli.SUCCESSFUL);
    }
    else
    {
      System.exit(returnCode);
    }
  }
  /**
opends/src/quicksetup/org/opends/quicksetup/upgrader/BuildExtractor.java
@@ -72,7 +72,9 @@
              ResourceProvider.getInstance().getMsg("error-initializing-log"));
      t.printStackTrace();
    }
    new BuildExtractor(args).launch();
    Launcher launcher = new BuildExtractor(args);
    int returnCode = launcher.launch();
    System.exit(returnCode);
  }
  private BuildExtractorCliHelper helper = new BuildExtractorCliHelper();
opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeLauncher.java
@@ -33,6 +33,7 @@
import org.opends.quicksetup.Launcher;
import org.opends.quicksetup.CliApplication;
import org.opends.quicksetup.Installation;
import org.opends.quicksetup.QuickSetupCli;
import org.opends.quicksetup.QuickSetupLog;
import org.opends.quicksetup.i18n.ResourceProvider;
import org.opends.quicksetup.util.Utils;
@@ -73,7 +74,16 @@
              ResourceProvider.getInstance().getMsg("error-initializing-log"));
      t.printStackTrace();
    }
    new UpgradeLauncher(args).launch();
    Launcher launcher = new UpgradeLauncher(args);
    int returnCode = launcher.launch();
    if (returnCode == QuickSetupCli.VERSION_PRINT)
    {
      System.exit(QuickSetupCli.SUCCESSFUL);
    }
    else
    {
      System.exit(returnCode);
    }
  }
  /**