From e0302537bd687bab02f6174e66fd1d9c2f13ba9d Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Wed, 26 Mar 2008 12:00:42 +0000
Subject: [PATCH] Fix for issue 3064 (The setup command should check the Java version)

---
 opends/src/quicksetup/org/opends/quicksetup/installer/SetupLauncher.java |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/installer/SetupLauncher.java b/opends/src/quicksetup/org/opends/quicksetup/installer/SetupLauncher.java
index 6ba1ca0..e6a7d7a 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/installer/SetupLauncher.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/installer/SetupLauncher.java
@@ -39,6 +39,7 @@
 import org.opends.quicksetup.Launcher;
 import org.opends.quicksetup.QuickSetupLog;
 import org.opends.quicksetup.installer.offline.OfflineInstaller;
+import org.opends.quicksetup.util.IncompatibleVersionException;
 import org.opends.quicksetup.util.Utils;
 import org.opends.messages.Message;
 import org.opends.server.tools.InstallDS;
@@ -128,7 +129,6 @@
    * {@inheritDoc}
    */
   public void launch() {
-    //  Validate user provided data
     try
     {
       argParser.parseArguments(args);
@@ -145,11 +145,15 @@
       }
       else if (isCli())
       {
+        Utils.checkJavaVersion();
         System.exit(InstallDS.mainCLI(args));
       }
       else
       {
         willLaunchGui();
+        // The java version is checked in the launchGui code to be sure
+        // that if there is a problem with the java version the message
+        // (if possible) is displayed graphically.
         int exitCode = launchGui(args);
         if (exitCode != 0) {
           File logFile = QuickSetupLog.getLogFile();
@@ -161,6 +165,7 @@
           {
             guiLaunchFailed(null);
           }
+          Utils.checkJavaVersion();
           System.exit(InstallDS.mainCLI(args));
         }
       }
@@ -174,6 +179,11 @@
 
       System.exit(ReturnCode.USER_DATA_ERROR.getReturnCode());
     }
+    catch (IncompatibleVersionException ive)
+    {
+      System.err.println(ive.getMessageObject());
+      System.exit(ReturnCode.JAVA_VERSION_INCOMPATIBLE.getReturnCode());
+    }
   }
 
   /**

--
Gitblit v1.10.0