From adc012b618096504d36bcfb1718455b03511ad96 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 02 May 2008 13:10:04 +0000
Subject: [PATCH] Fix for issue 3224 (uninstall raises execption if specified keystore does not exist)

---
 opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java |   26 ++++++++++++++++----------
 1 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
index 46c8b5e..66a9241 100644
--- a/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
+++ b/opendj-sdk/opends/src/guitools/org/opends/guitools/uninstaller/UninstallCliHelper.java
@@ -254,9 +254,12 @@
     {
       LOG.log(Level.WARNING,
           "Error retrieving a valid LDAP URL in conf file: "+ce, ce);
-      println();
-      println(ERR_COULD_NOT_FIND_VALID_LDAPURL.get());
-      println();
+      if (!parser.isInteractive())
+      {
+        Message msg = ERR_COULD_NOT_FIND_VALID_LDAPURL.get();
+        throw new ApplicationException(ReturnCode.APPLICATION_ERROR, msg,
+            ce);
+      }
     }
     userData.setReferencedHostName(referencedHostName);
 
@@ -748,9 +751,10 @@
    *  remote servers.  <CODE>false</CODE> otherwise.
    *  @throws UserDataException if there is a problem with the information
    *  provided by the user.
+   *  @throws ApplicationException if there is an error processing data.
    */
   private boolean askForAuthenticationIfNeeded(UninstallUserData userData)
-  throws UserDataException
+  throws UserDataException, ApplicationException
   {
     boolean accepted = true;
     String uid = userData.getAdminUID();
@@ -883,11 +887,12 @@
       }
       catch (ConfigException ce)
       {
+        // This is unexpected
         LOG.log(Level.WARNING,
             "Error retrieving a valid LDAP URL in conf file: "+ce, ce);
-        println();
-        println(ERR_COULD_NOT_FIND_VALID_LDAPURL.get());
-        println();
+        Message msg = ERR_COULD_NOT_FIND_VALID_LDAPURL.get();
+        throw new ApplicationException(ReturnCode.APPLICATION_ERROR, msg,
+            ce);
       }
       finally
       {
@@ -1133,11 +1138,12 @@
     }
     catch (ConfigException ce)
     {
+      // This is unexpected, when calling this code this should already been
+      // checked.
       LOG.log(Level.WARNING,
           "Error retrieving a valid LDAP URL in conf file: "+ce, ce);
-      println();
-      println(ERR_COULD_NOT_FIND_VALID_LDAPURL.get());
-      userData.setLocalServerUrl("ldap://localhost:389");
+      Message msg = ERR_COULD_NOT_FIND_VALID_LDAPURL.get();
+      throw new ApplicationException(ReturnCode.APPLICATION_ERROR, msg, ce);
     }
     catch (NamingException ne)
     {

--
Gitblit v1.10.0