From fe9d45d7f26b89b9fb2b87011e1656d4feecf551 Mon Sep 17 00:00:00 2001
From: Violette Roche-Montane <violette.roche-montane@forgerock.com>
Date: Mon, 24 Mar 2014 14:07:56 +0000
Subject: [PATCH] OPENDJ-1343 Migrate dsconfig - Removed CommunicationException from dsconfig package. - Replaced ReturnCode.TODO by appropriate return code.

---
 opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java |   31 ++++++-------------------------
 1 files changed, 6 insertions(+), 25 deletions(-)

diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java
index f1da683..314c870 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/SubCommandHandler.java
@@ -72,7 +72,6 @@
 import org.forgerock.opendj.config.client.ManagementContext;
 import org.forgerock.opendj.ldap.AuthorizationException;
 import org.forgerock.opendj.ldap.ErrorResultException;
-import org.opends.server.admin.client.CommunicationException;
 import org.opends.server.util.ServerConstants;
 
 import com.forgerock.opendj.cli.Argument;
@@ -114,8 +113,6 @@
 
     private AuthorizationException authze;
 
-    private CommunicationException ce;
-
     private ErrorResultException ere;
 
     /**
@@ -209,9 +206,6 @@
         } catch (ErrorResultException e) {
           ere = e;
           result = MenuResult.quit();
-        } catch (CommunicationException e) {
-          ce = e;
-          result = MenuResult.quit();
         }
       }
     }
@@ -309,7 +303,7 @@
               String typeUsage = getSubTypesUsage(d);
               LocalizableMessage msg = ERR_DSCFG_ERROR_SUB_TYPE_UNRECOGNIZED.get(
                   name, r.getUserFriendlyName(), typeUsage);
-              clie = new ClientException(ReturnCode.TODO, msg);
+              clie = new ClientException(ReturnCode.APPLICATION_ERROR, msg);
               result = MenuResult.quit();
               return;
             } else {
@@ -346,9 +340,6 @@
         } catch (ErrorResultException e) {
           ere = e;
           result = MenuResult.quit();
-        } catch (CommunicationException e) {
-          ce = e;
-          result = MenuResult.quit();
         }
       }
     }
@@ -432,13 +423,10 @@
      *           If the server refuses to retrieve the managed object
      *           because the client does not have the correct
      *           privileges.
-     * @throws CommunicationException
-     *           If the client cannot contact the server due to an
-     *           underlying communication problem.
      */
     public MenuResult<ManagedObject<?>> find(ConsoleApplication app,
         ManagementContext context, ManagedObjectPath<?, ?> path,
-        List<String> args) throws ClientException, CommunicationException,
+        List<String> args) throws ClientException,
         AuthorizationException, ConcurrentModificationException,
         DefinitionDecodingException, ManagedObjectDecodingException,
         ManagedObjectNotFoundException {
@@ -450,7 +438,6 @@
 
       this.clie = null;
       this.authze = null;
-      this.ce = null;
       this.cme = null;
       this.dde = null;
       this.mode = null;
@@ -464,8 +451,6 @@
         throw clie;
       } else if (authze != null) {
         throw authze;
-      } else if (ce != null) {
-        throw ce;
       } else if (cme != null) {
         throw cme;
       } else if (dde != null) {
@@ -964,9 +949,6 @@
    *           If the server refuses to retrieve the managed object
    *           because the client does not have the correct
    *           privileges.
-   * @throws CommunicationException
-   *           If the client cannot contact the server due to an
-   *           underlying communication problem.
    * @throws ClientException
    *           If one of the naming arguments referenced a managed
    *           object of the wrong type.
@@ -977,8 +959,8 @@
       ConsoleApplication app, ManagementContext context,
       ManagedObjectPath<?, ?> path, List<String> args) throws ClientException,
       AuthorizationException, DefinitionDecodingException,
-      ManagedObjectDecodingException, CommunicationException,
-      ConcurrentModificationException, ManagedObjectNotFoundException
+      ManagedObjectDecodingException, ConcurrentModificationException,
+      ManagedObjectNotFoundException
   {
     ManagedObjectFinder finder = new ManagedObjectFinder();
     return finder.find(app, context, path, args);
@@ -1129,8 +1111,6 @@
    *         {@link MenuResult#quit()}, or {@link MenuResult#cancel()},
    *         if the sub-command was run interactive and the user chose
    *         to quit or cancel.
-   * @throws CommunicationException
-   *           If the server cannot be contacted.
    * @throws ConcurrentModificationException
    *           If the parent managed object has been deleted.
    * @throws AuthorizationException
@@ -1146,7 +1126,8 @@
       RelationDefinition<C, S> r,
       AbstractManagedObjectDefinition<? extends C, ? extends S> d)
       throws AuthorizationException, ConcurrentModificationException,
-      CommunicationException, ClientException {
+      ClientException
+  {
     if (d == null) {
       d = r.getChildDefinition();
     }

--
Gitblit v1.10.0