From 7a6f3dd0c046db02a9cebddd7e635c2189e378ff Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Sat, 21 Jul 2012 20:43:37 +0000
Subject: [PATCH] Fix OPENDJ-522: Add capability to force the upgrade to complete if errors occur during non-interactive mode

---
 opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java |   40 +++++++++++++++++++++-------------------
 1 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java b/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java
index 518caf7..63f414d 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java
+++ b/opends/src/quicksetup/org/opends/quicksetup/ui/GuiApplication.java
@@ -23,6 +23,7 @@
  *
  *
  *      Copyright 2008-2010 Sun Microsystems, Inc.
+ *      Portions copyright 2012 ForgeRock AS.
  */
 
 package org.opends.quicksetup.ui;
@@ -46,6 +47,7 @@
 
 import javax.swing.*;
 import java.awt.event.WindowEvent;
+import java.lang.reflect.Constructor;
 import java.security.cert.X509Certificate;
 import java.util.LinkedHashSet;
 import java.util.Set;
@@ -605,27 +607,27 @@
   /**
    * {@inheritDoc}
    */
-  public UserInteraction userInteraction() {
-    UserInteraction ui = null;
-    if (getUserData().isInteractive()) {
-      if (Utils.isCli()) {
-        // Use reflection to avoid breaking the java web start in some
-        // platforms.
-        try
-        {
-          Class<?> cl =
-            Class.forName("org.opends.quicksetup.CliUserInteraction");
-          ui = (UserInteraction) cl.newInstance();
-        }
-        catch (Throwable t)
-        {
-          throw new IllegalStateException("Unexpected error: "+t, t);
-        }
-      } else {
-        ui = new GuiUserInteraction(qs.getFrame());
+  public UserInteraction userInteraction()
+  {
+    if (Utils.isCli())
+    {
+      // Use reflection to avoid breaking the java web start in some
+      // platforms.
+      try
+      {
+        Class<?> cl = Class.forName("org.opends.quicksetup.CliUserInteraction");
+        Constructor<?> c = cl.getConstructor(UserData.class);
+        return (UserInteraction) c.newInstance(getUserData());
+      }
+      catch (Throwable t)
+      {
+        throw new IllegalStateException("Unexpected error: " + t, t);
       }
     }
-    return ui;
+    else
+    {
+      return new GuiUserInteraction(qs.getFrame());
+    }
   }
 
   /**

--
Gitblit v1.10.0