From ee7ae5ef9a6ee6c26f0fd1311af89f61f0e94de5 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Tue, 20 Jan 2009 11:33:46 +0000
Subject: [PATCH] Fix for issue 3131 (Windows: upgrade using the webinstaller should not hang) Detect that the java arguments used in the installation are not compatible with the JVM of the web start installer and display an error message accordingly.
---
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java | 42 ++++++++++++++++++--
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/ui/WelcomePanel.java | 8 ++++
opendj-sdk/opends/src/messages/messages/quicksetup.properties | 9 +++-
opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Installation.java | 29 ++++++++++++++
4 files changed, 81 insertions(+), 7 deletions(-)
diff --git a/opendj-sdk/opends/src/messages/messages/quicksetup.properties b/opendj-sdk/opends/src/messages/messages/quicksetup.properties
index ea60c2f..6f74034 100644
--- a/opendj-sdk/opends/src/messages/messages/quicksetup.properties
+++ b/opendj-sdk/opends/src/messages/messages/quicksetup.properties
@@ -1330,14 +1330,14 @@
documentation wiki</a>.
INFO_WELCOME_STEP=Welcome
INFO_LICENSE_PANEL_OFFLINE_INSTRUCTIONS=Please read the following important \
- information before continuing.
+ information before continuing.
INFO_LICENSE_PANEL_TITLE=License
INFO_LICENSE_PANEL_WEBSTART_INSTRUCTIONS=bla bla
INFO_LICENSE_STEP=License
INFO_LICENSE_DETAILS_LABEL=Please read the following License Agreement.\n\
You must accept the terms of the agreement before continuing with the installation.
INFO_LICENSE_CLICK_LABEL=Click to accept
-INFO_LICENSE_CLI_ACCEPT_QUESTION=Accept the license (%s/%s) [%s]:
+INFO_LICENSE_CLI_ACCEPT_QUESTION=Accept the license (%s/%s) [%s]:
INFO_LICENSE_CLI_ACCEPT_YES=Yes
INFO_LICENSE_CLI_ACCEPT_NO=No
INFO_LICENSE_CLI_ACCEPT_INVALID_RESPONSE=Invalid response
@@ -1355,3 +1355,8 @@
OPENDS_JAVA_HOME to the root of a compatible Java installation or edit the \
java.properties file and then run the dsjavaproperties script to specify the \
java version to be used.
+SEVERE_ERR_INVALID_JAVA_ARGS=The java arguments used in the OpenDS \
+ installation in '%s' do not seem to be compatible with the JVM used to run \
+ the upgrader (%s).%n%nTo fix this problem delete the file %s and click on \
+ 'Next' again.%nOnce the upgrader finishes you will have to set again the \
+ java arguments by running the command-line %s.
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Installation.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Installation.java
index 92a6237..2cbe0d6 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Installation.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/Installation.java
@@ -251,6 +251,18 @@
"control-panel.bat";
/**
+ * The UNIX dsjavaproperties script file name.
+ */
+ public static final String UNIX_DSJAVAPROPERTIES_FILE_NAME =
+ "dsjavaproperties";
+
+ /**
+ * The Windows dsjavaproperties batch file name.
+ */
+ public static final String WINDOWS_DSJAVAPROPERTIES_FILE_NAME =
+ "dsjavaproperties.bat";
+
+ /**
* The MacOS X Java application stub name.
*/
public static final String MAC_JAVA_APP_STUB_NAME = "JavaApplicationStub";
@@ -1045,6 +1057,23 @@
}
/**
+ * Gets the dsjavaproperties file appropriate for the current operating
+ * system.
+ * @return File object representing the dsjavaproperties command
+ */
+ public File getJavaPropertiesCommandFile() {
+ File javaPropertiesCommandFile;
+ if (Utils.isWindows()) {
+ javaPropertiesCommandFile = new File(getBinariesDirectory(),
+ WINDOWS_DSJAVAPROPERTIES_FILE_NAME);
+ } else {
+ javaPropertiesCommandFile = new File(getBinariesDirectory(),
+ UNIX_DSJAVAPROPERTIES_FILE_NAME);
+ }
+ return javaPropertiesCommandFile;
+ }
+
+ /**
* Gets information about the build that was used to produce the bits
* for this installation.
* @return BuildInformation object describing this installation
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/ui/WelcomePanel.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/ui/WelcomePanel.java
index d7b79cf..09aae42 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/ui/WelcomePanel.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/installandupgrader/ui/WelcomePanel.java
@@ -94,6 +94,14 @@
/**
* {@inheritDoc}
*/
+ protected boolean hasCheckingLabel()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public Object getFieldValue(FieldName fieldName) {
Object v = null;
if (FieldName.SERVER_TO_UPGRADE_LOCATION.equals(fieldName)) {
diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
index 30d55f0..875a6b4 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java
@@ -215,11 +215,6 @@
private BuildInformation stagedVersion = null;
/**
- * Information on the staged instance.
- */
- private BuildInformation stagedInstanceVersion = null;
-
- /**
* New OpenDS bits.
*/
private Installation stagedInstallation = null;
@@ -661,6 +656,43 @@
Installation installation = new Installation(serverLocation,
serverLocation);
setInstallation(installation);
+ try
+ {
+ // Try to see if there is a problem with the build information,
+ // we might be trying to do the upgrade with a JVM that is not
+ // compatible with the java arguments used by the server
+ // scripts (see issue ).
+ installation.getBuildInformation(true);
+ }
+ catch (ApplicationException ae)
+ {
+ if (ae.getMessageObject().getDescriptor().equals(
+ INFO_ERROR_CREATING_BUILD_INFO_MSG))
+ {
+ // This is the message thrown when there was a problem with
+ // the binary. The details content is on the scripts and not
+ // localized, we can assume that if there is a mention to
+ // OPENDS_JAVA_HOME in the message there is an error with the
+ // script.
+ if (ae.getMessageObject().toString().indexOf(
+ "OPENDS_JAVA_HOME") != -1)
+ {
+ String javaBin = System.getProperty("java.home")+
+ File.separator+
+ "bin"+File.separator+"java";
+ String setJavaHome =
+ installation.getSetJavaHomeFile().getAbsolutePath();
+ String dsJavaProperties =
+ installation.getJavaPropertiesCommandFile().
+ getAbsolutePath();
+ errorMsgs.add(ERR_INVALID_JAVA_ARGS.get(
+ serverLocationString,
+ javaBin,
+ setJavaHome,
+ dsJavaProperties));
+ }
+ }
+ }
}
uud.setServerLocation(serverLocationString);
--
Gitblit v1.10.0