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

jvergara
20.33.2009 c5f88120ad601b099ab51a451b8bc4bf24d5391f
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.
4 files modified
88 ■■■■■ changed files
opends/src/messages/messages/quicksetup.properties 9 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/Installation.java 29 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/installandupgrader/ui/WelcomePanel.java 8 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/upgrader/Upgrader.java 42 ●●●● patch | view | raw | blame | history
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.
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
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)) {
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);