From 57eb7a1533fdad5b84c064d149039b771cfbadba Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Thu, 10 Apr 2008 23:07:07 +0000
Subject: [PATCH] Fix for issue 3144 (Uninstall's exit status 0 (success) despite user error and Input tries limit reached (5)) and 3127 ( "uninstall --help" unclear message).

---
 opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java |   56 ++++++++++++++++++++------------------------------------
 1 files changed, 20 insertions(+), 36 deletions(-)

diff --git a/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java b/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
index 99df8b3..64a0b56 100644
--- a/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
+++ b/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
@@ -274,7 +274,7 @@
    * otherwise.
    */
   private boolean askWhatToDelete(UninstallUserData userData,
-      Set<String> outsideDbs, Set<String> outsideLogs)
+      Set<String> outsideDbs, Set<String> outsideLogs) throws UserDataException
   {
     boolean cancelled = false;
     final int REMOVE_ALL = 1;
@@ -322,13 +322,8 @@
     }
     catch (CLIException ce)
     {
-      choice = REMOVE_ALL;
-      cancelled = true;
       LOG.log(Level.WARNING, "Error reading input: "+ce, ce);
-      if (ce.getMessageObject().getDescriptor().equals(ERR_TRIES_LIMIT_REACHED))
-      {
-        println(ce.getMessageObject());
-      }
+      throw new UserDataException(null, ce.getMessageObject(), ce);
     }
 
     if (cancelled)
@@ -389,9 +384,7 @@
         }
         catch (CLIException ce)
         {
-          println(ce.getMessageObject());
-          println();
-          cancelled = true;
+          throw new UserDataException(null, ce.getMessageObject(), ce);
         }
 
         if (!cancelled)
@@ -529,9 +522,7 @@
           }
           catch (CLIException ce)
           {
-            println(ce.getMessageObject());
-            println();
-            cancelled = true;
+            throw new UserDataException(null, ce.getMessageObject(), ce);
           }
         }
         else
@@ -589,9 +580,7 @@
           }
           catch (CLIException ce)
           {
-            println(ce.getMessageObject());
-            println();
-            cancelled = true;
+            throw new UserDataException(null, ce.getMessageObject(), ce);
           }
         }
         else
@@ -640,9 +629,7 @@
         }
         catch (CLIException ce)
         {
-          println(ce.getMessageObject());
-          println();
-          cancelled = true;
+          throw new UserDataException(null, ce.getMessageObject(), ce);
         }
       }
       else
@@ -658,9 +645,7 @@
           }
           catch (CLIException ce)
           {
-            println(ce.getMessageObject());
-            println();
-            cancelled = true;
+            throw new UserDataException(null, ce.getMessageObject(), ce);
           }
         }
       }
@@ -733,8 +718,11 @@
    *  to update the remote servers.
    *  @return <CODE>true</CODE> if the user wants to continue and update the
    *  remote servers.  <CODE>false</CODE> otherwise.
+   *  @throws UserDataException if there is a problem with the information
+   *  provided by the user.
    */
   private boolean askForAuthenticationIfNeeded(UninstallUserData userData)
+  throws UserDataException
   {
     boolean accepted = true;
     String uid = userData.getAdminUID();
@@ -903,9 +891,7 @@
         }
         catch (CLIException ce)
         {
-          println(ce.getMessageObject());
-          println();
-          accepted = false;
+          throw new UserDataException(null, ce.getMessageObject(), ce);
         }
       }
     }
@@ -1170,18 +1156,19 @@
         if (forceOnError)
         {
           println(ERR_UNINSTALL_ERROR_UPDATING_REMOTE_FORCE.get(
-              parser.getSecureArgsList().adminUidArg.getLongIdentifier(),
-              ToolConstants.OPTION_LONG_BINDPWD,
-              ToolConstants.OPTION_LONG_BINDPWD_FILE));
+              "--"+parser.getSecureArgsList().adminUidArg.getLongIdentifier(),
+              "--"+ToolConstants.OPTION_LONG_BINDPWD,
+              "--"+ToolConstants.OPTION_LONG_BINDPWD_FILE));
         }
         else
         {
           throw new UserDataException(null,
               ERR_UNINSTALL_ERROR_UPDATING_REMOTE_NO_FORCE.get(
+                  "--"+
                   parser.getSecureArgsList().adminUidArg.getLongIdentifier(),
-                  ToolConstants.OPTION_LONG_BINDPWD,
-                  ToolConstants.OPTION_LONG_BINDPWD_FILE,
-                  parser.forceOnErrorArg.getLongIdentifier()));
+                  "--"+ToolConstants.OPTION_LONG_BINDPWD,
+                  "--"+ToolConstants.OPTION_LONG_BINDPWD_FILE,
+                  "--"+parser.forceOnErrorArg.getLongIdentifier()));
         }
       }
       else
@@ -1194,8 +1181,7 @@
         }
         catch (CLIException ce)
         {
-          println(ce.getMessageObject());
-          accepted = false;
+          throw new UserDataException(null, ce.getMessageObject(), ce);
         }
       }
     }
@@ -1303,9 +1289,7 @@
         }
         catch (CLIException ce)
         {
-          println(ce.getMessageObject());
-          println();
-          returnValue = false;
+          throw new UserDataException(null, ce.getMessageObject(), ce);
         }
       }
       else if (reloadTopologyCache)

--
Gitblit v1.10.0