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

lutoff
04.46.2009 e0dcbe0d17e7fccc9741dd4bdb1252c2c885aad8
 Fix for issue #3965 (revert should not be supported from 2.0 to a previous version)

With this modification, we introduce a Flag of the day for the reversion.
This modification also fixes a NPE when the upgrade tool is called in
non-interactive mode.
7 files modified
110 ■■■■ changed files
opends/src/messages/messages/quicksetup.properties 2 ●●● patch | view | raw | blame | history
opends/src/messages/messages/version.properties 2 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/upgrader/ReversionIssueNotifier.java 21 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java 9 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeIssueNotifier.java 23 ●●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/upgrader/VersionIssueNotifier.java 41 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/util/VersionCompatibilityIssue.java 12 ●●●●● patch | view | raw | blame | history
opends/src/messages/messages/quicksetup.properties
@@ -1223,7 +1223,7 @@
INFO_REVERSION_ORACLE_ACTION=Upgrade requires manual action
INFO_REVERSION_ORACLE_INFO=Upgrade information
INFO_REVERSION_ORACLE_UNSUPPORTED=Reversion not supported from version %s to \
 version %s is not supported.  To upgrade you must uninstall the current \
 version %s. To revert you must uninstall the current \
 server, install the new server, and manually migrate your data: %s
INFO_UPGRADE_ORACLE_SAME_VERSION=The current version and the version of the \
 binaries to upgrade to are the same (%s)
opends/src/messages/messages/version.properties
@@ -108,3 +108,5 @@
 or assertion value will be reverted to a prior version.  In order to revert this server \
 you will have to export the data from this server and reimport it after the \
 reversion has finished
INFO_5278_REVERSION_17=Reversion for revision 5278 to a previous version is \
not supported
opends/src/quicksetup/org/opends/quicksetup/upgrader/ReversionIssueNotifier.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2008 Sun Microsystems, Inc.
 *      Copyright 2008-2009 Sun Microsystems, Inc.
 */
package org.opends.quicksetup.upgrader;
@@ -178,12 +178,19 @@
    // If the import/export effect is present, append the detailed
    // instructions.
    if (effects.contains(Effect.REVERSION_DATA_EXPORT_AND_REIMPORT_REQUIRED)) {
      String lineBreak = ui.isCLI() ?
          Constants.LINE_SEPARATOR : Constants.HTML_LINE_BREAK;
      msg = new MessageBuilder(msg)
              .append(lineBreak)
              .append(ui.createUnorderedList(getExportImportInstructions()))
              .toMessage();
      if (ui != null)
      {
        String lineBreak = ui.isCLI() ? Constants.LINE_SEPARATOR
            : Constants.HTML_LINE_BREAK;
        msg = new MessageBuilder(msg).append(lineBreak).append(
            ui.createUnorderedList(getExportImportInstructions())).toMessage();
      }
      else
      {
        String lineBreak = Constants.LINE_SEPARATOR;
        msg = new MessageBuilder(msg).append(lineBreak).append(
            createUnorderedList(getExportImportInstructions())).toMessage();
      }
    }
    return msg;
  }
opends/src/quicksetup/org/opends/quicksetup/upgrader/Reverter.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2007-2008 Sun Microsystems, Inc.
 *      Copyright 2007-2009 Sun Microsystems, Inc.
 */
package org.opends.quicksetup.upgrader;
@@ -1108,8 +1108,13 @@
    }
    if (currentVersion != null && newVersion != null) {
      UserInteraction ui = userInteraction() ;
      if (ui == null)
      {
        ui = new CliUserInteraction();
      }
      ReversionIssueNotifier uo = new ReversionIssueNotifier(
              userInteraction(), currentVersion, newVersion);
              ui,currentVersion,newVersion);
      uo.notifyUser();
      if (uo.noServerStartFollowingOperation()) {
        // Some issue dictates that we don't try and restart the server
opends/src/quicksetup/org/opends/quicksetup/upgrader/UpgradeIssueNotifier.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 */
package org.opends.quicksetup.upgrader;
@@ -179,16 +179,25 @@
    // If the import/export effect is present, append the detailed
    // instructions.
    if (effects.contains(Effect.UPGRADE_DATA_EXPORT_AND_REIMPORT_REQUIRED)) {
      String lineBreak = ui.isCLI() ?
          Constants.LINE_SEPARATOR : Constants.HTML_LINE_BREAK;
      msg = new MessageBuilder(msg)
              .append(lineBreak)
              .append(ui.createUnorderedList(getExportImportInstructions()))
              .toMessage();
      if (ui != null)
      {
        String lineBreak = ui.isCLI() ? Constants.LINE_SEPARATOR
            : Constants.HTML_LINE_BREAK;
        msg = new MessageBuilder(msg).append(lineBreak).append(
            ui.createUnorderedList(getExportImportInstructions())).toMessage();
      }
      else
      {
        String lineBreak = Constants.LINE_SEPARATOR ;
        msg = new MessageBuilder(msg).append(lineBreak).append(
            createUnorderedList(getExportImportInstructions())).toMessage();
      }
    }
    return msg;
  }
  /**
   * {@inheritDoc}
   */
opends/src/quicksetup/org/opends/quicksetup/upgrader/VersionIssueNotifier.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2007-2008 Sun Microsystems, Inc.
 *      Copyright 2007-2009 Sun Microsystems, Inc.
 */
package org.opends.quicksetup.upgrader;
@@ -30,6 +30,7 @@
import org.opends.quicksetup.BuildInformation;
import org.opends.quicksetup.ApplicationException;
import org.opends.quicksetup.Constants;
import org.opends.quicksetup.UserInteraction;
import org.opends.server.util.VersionCompatibilityIssue;
@@ -148,9 +149,25 @@
    // Get the list of possible version incompatibility events (aka flag days)
    List<VersionCompatibilityIssue> compatibilityIssues;
    Set<Integer> excludeIds = current.getIncompatibilityEventIds();
    Set<Integer> excludeIds ;
    boolean isUpgrade = neu.compareTo(current) >= 0;
    if (isUpgrade)
    {
      excludeIds = current.getIncompatibilityEventIds();
    }
    else
    {
      excludeIds = neu.getIncompatibilityEventIds();
    }
    if (excludeIds != null) {
      if (isUpgrade)
      {
      compatibilityIssues = getEvents(excludeIds, current, neu);
      }
      else
      {
        compatibilityIssues = getEvents(excludeIds, neu, current);
      }
    } else {
      // This method is only used as a fallback for pre 1.0.0 servers which
      // do not advertise incompatible version events.
@@ -300,7 +317,7 @@
   */
  protected List<Message> getExportImportInstructions() {
    List<Message> instructions = new ArrayList<Message>();
    if (ui.isCLI())
    if ((ui == null) || (ui.isCLI()))
    {
      instructions.add(INFO_ORACLE_EI_ACTION_STEP1_CLI.get());
    }
@@ -355,4 +372,22 @@
    return Collections.unmodifiableList(directives);
  }
  /**
   * Creates a list appropriate for the presentation implementation.
   *
   * @param list to format
   * @return String representing the list
   */
  protected String createUnorderedList(List list) {
    StringBuilder sb = new StringBuilder();
    if (list != null) {
      for (Object o : list) {
        sb.append(/*bullet=*/"* ");
        sb.append(o.toString());
        sb.append(Constants.LINE_SEPARATOR);
      }
    }
    return sb.toString();
  }
}
opends/src/server/org/opends/server/util/VersionCompatibilityIssue.java
@@ -218,6 +218,17 @@
   */
  public enum Cause {
    /**
     * We not support the revert to the previous version.
     */
    REVERT_NOT_SUPPORTED_1(
        9, // Unique ID.  See javadoc for more information.
        INFO_5278_REVERSION.get(),
        INFO_5278_REVERSION.get(),
        Effect.REVERSION_NOT_POSSIBLE,
        Effect.UPGRADE_SHOW_INFO_MESSAGE),
    /**
     * Incompatible changes in attribute value normalization. This causes
     * indexes to be invalidated.
     */
@@ -470,6 +481,7 @@
  //***************************************************
  static {
    register (Cause.REVERT_NOT_SUPPORTED_1, new BuildVersion(2,0,0,5278));
    register(Cause.STRINGPREP_NORMALIZATION_CHANGE_1,
            new BuildVersion(1,2,0,5134));
    register(Cause.DN_NORMALIZATION_CHANGE_1, new BuildVersion(1, 0, 0, 3873));