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

jvergara
02.16.2008 84bb0e96722a3e49a3d01d1592bdb57fcfc99582
Fix for issue 2444 (Commands setup/start/etc... should check Java release and reject unsupported ones)

The script-util.sh test java functions now also handle the case where we have a non supported 1.5 version of the JDK.
3 files modified
41 ■■■■■ changed files
opendj-sdk/opends/resource/bin/_script-util.bat 11 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/resource/bin/_script-util.sh 18 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/tools/InstallDS.java 12 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/resource/bin/_script-util.bat
@@ -124,7 +124,9 @@
:testJava
"%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% org.opends.server.tools.InstallDS -t > NUL 2>&1
if not %errorlevel% == 0 goto noValidJavaHome
set RESULT_CODE=%errorlevel%
if %RESULT_CODE% == 13 goto notSupportedJavaHome
if not %RESULT_CODE% == 0 goto noValidJavaHome
goto end
:noValidJavaHome
@@ -146,6 +148,13 @@
pause
exit /B 1
:notSupportedJavaHome
rem We get here when the java version is 5 (or up) but not supported.  We run
rem InstallDS again to see a localized message.
"%OPENDS_JAVA_BIN%" %OPENDS_JAVA_ARGS% org.opends.server.tools.InstallDS -t
pause
exit /B 1
:noValidHomeWithArgs
echo ERROR:  The detected Java version could not be used with the set of java
echo arguments %OPENDS_JAVA_ARGS%.
opendj-sdk/opends/resource/bin/_script-util.sh
@@ -71,7 +71,14 @@
  if test -z "${OPENDS_JAVA_ARGS}"
  then
    "${OPENDS_JAVA_BIN}" org.opends.server.tools.InstallDS -t 2> /dev/null
    if test ${?} -ne 0
    RESULT_CODE=${?}
    if test ${RESULT_CODE} -eq 13
    then
      # This is a particular error code that means that the Java version is 5
      # but not supported.  Let InstallDS to display the localized error message
      "${OPENDS_JAVA_BIN}" org.opends.server.tools.InstallDS -t
      exit 1
    elif test ${RESULT_CODE} -ne 0
    then
      echo "ERROR:  The detected Java version could not be used.  The detected"
      echo "java binary is:"
@@ -91,7 +98,14 @@
    fi
  else
    "${OPENDS_JAVA_BIN}" ${OPENDS_JAVA_ARGS} org.opends.server.tools.InstallDS -t 2> /dev/null
    if test ${?} -ne 0
    RESULT_CODE=${?}
    if test ${RESULT_CODE} -eq 13
    then
      # This is a particular error code that means that the Java version is 5
      # but not supported.  Let InstallDS to display the localized error message
      "${OPENDS_JAVA_BIN}" org.opends.server.tools.InstallDS -t
      exit 1
    elif test ${RESULT_CODE} -ne 0
    then
      echo "ERROR:  The detected Java version could not be used with the set of java"
      echo "arguments ${OPENDS_JAVA_ARGS}."
opendj-sdk/opends/src/server/org/opends/server/tools/InstallDS.java
@@ -49,6 +49,7 @@
import org.opends.quicksetup.CurrentInstallStatus;
import org.opends.quicksetup.Installation;
import org.opends.quicksetup.QuickSetupLog;
import org.opends.quicksetup.ReturnCode;
import org.opends.quicksetup.SecurityOptions;
import org.opends.quicksetup.UserData;
import org.opends.quicksetup.UserDataException;
@@ -58,6 +59,7 @@
import org.opends.quicksetup.installer.offline.OfflineInstaller;
import org.opends.quicksetup.installer.ui.InstallReviewPanel;
import org.opends.quicksetup.ui.QuickSetupStepPanel;
import org.opends.quicksetup.util.IncompatibleVersionException;
import org.opends.quicksetup.util.PlainTextProgressMessageFormatter;
import org.opends.quicksetup.util.Utils;
import org.opends.server.core.DirectoryServer;
@@ -373,6 +375,16 @@
        LOG.log(Level.WARNING, "Error while trying to update the contents of "+
            "the set-java-home file in test only mode: "+t, t);
      }
      // Test that we are running a compatible java 1.5 version.
      try
      {
        Utils.checkJavaVersion();
      }
      catch (IncompatibleVersionException ive)
      {
        println(ive.getMessageObject());
        return ReturnCode.JAVA_VERSION_INCOMPATIBLE.getReturnCode();
      }
    }
    // If either the showUsage or testOnly or version arguments were provided,