From e0dcbe0d17e7fccc9741dd4bdb1252c2c885aad8 Mon Sep 17 00:00:00 2001
From: lutoff <lutoff@localhost>
Date: Mon, 04 May 2009 12:46:36 +0000
Subject: [PATCH]  Fix for issue #3965 (revert should not be supported from 2.0 to a previous version)

---
 opends/src/quicksetup/org/opends/quicksetup/upgrader/VersionIssueNotifier.java |   43 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/upgrader/VersionIssueNotifier.java b/opends/src/quicksetup/org/opends/quicksetup/upgrader/VersionIssueNotifier.java
index f884663..04d8be6 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/upgrader/VersionIssueNotifier.java
+++ b/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) {
-      compatibilityIssues = getEvents(excludeIds, current, neu);
+      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();
+  }
+
 }

--
Gitblit v1.10.0