From 6c06c2c0fd1bfb5c261b910ee8092037184e70a5 Mon Sep 17 00:00:00 2001
From: kenneth_suter <kenneth_suter@localhost>
Date: Fri, 31 Aug 2007 15:43:58 +0000
Subject: [PATCH] Exposes the reversion functionality of the upgrader (issue 2169).  Originally it was intended to be exposed as a new script but in order to avoid the negativity of having a command devoted to undoing the upgrade and to avoid more scripts in the top-level directory, I've exposed the functionality as 2 new options in the existing upgrade script.  I will update the Wiki with documentation for these new options soon.

---
 opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java |   39 ++++++++++++++++++++++-----------------
 1 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java
index eba7e0a..0d32f1a 100644
--- a/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java
+++ b/opendj-sdk/opends/src/quicksetup/org/opends/quicksetup/QuickSetupCli.java
@@ -30,10 +30,10 @@
 import org.opends.quicksetup.util.ProgressMessageFormatter;
 import org.opends.quicksetup.util.PlainTextProgressMessageFormatter;
 import org.opends.quicksetup.util.Utils;
-import org.opends.quicksetup.ApplicationReturnCode.ReturnCode;
 import org.opends.quicksetup.event.ProgressUpdateListener;
 import org.opends.quicksetup.event.ProgressUpdateEvent;
 import org.opends.server.util.StaticUtils;
+import org.opends.messages.Message;
 
 /**
  * This enum contains the different type of ApplicationException that we can
@@ -91,10 +91,13 @@
           cliApp.addProgressUpdateListener(
                   new ProgressUpdateListener() {
                     public void progressUpdate(ProgressUpdateEvent ev) {
-                      System.out.print(
-                              org.opends.server.util.StaticUtils.wrapText(
-                                      ev.getNewLogs(),
-                                      Utils.getCommandLineMaxLineWidth()));
+                      Message newLogs = ev.getNewLogs();
+                      if (newLogs != null) {
+                        System.out.print(
+                                StaticUtils.wrapText(
+                                        newLogs,
+                                        Utils.getCommandLineMaxLineWidth()));
+                      }
                     }
                   });
         }
@@ -107,21 +110,23 @@
             // do nothing;
           }
         }
-
-        ApplicationException ue = cliApp.getRunError();
-        if (ue != null)
-        {
-          returnValue = ue.getType();
-        }
-        else
-        {
-          returnValue = ApplicationReturnCode.ReturnCode.SUCCESSFUL;
+        returnValue = cliApp.getReturnCode();
+        if (returnValue == null) {
+          ApplicationException ue = cliApp.getRunError();
+          if (ue != null)
+          {
+            returnValue = ue.getType();
+          }
+          else
+          {
+            returnValue = ReturnCode.SUCCESSFUL;
+          }
         }
       }
-      else
-      {
+    else
+    {
         // User cancelled installation.
-        returnValue = ApplicationReturnCode.ReturnCode.CANCELLED;
+        returnValue = ReturnCode.CANCELLED;
       }
     }
     catch (UserDataException uude)

--
Gitblit v1.10.0