From 8298101415278c4a3504c1f5dc09e0e53dd83e37 Mon Sep 17 00:00:00 2001
From: Violette Roche-Montane <violette.roche-montane@forgerock.com>
Date: Mon, 14 Apr 2014 14:52:42 +0000
Subject: [PATCH] OPENDJ-1343 Migrate dsconfig - Removed unnecessary interface ManagementContextFactory. - Minor code cleanup.

---
 opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/DSConfig.java |   26 ++++----------------------
 1 files changed, 4 insertions(+), 22 deletions(-)

diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/DSConfig.java b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/DSConfig.java
index 99ca1e3..810eab2 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/DSConfig.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/dsconfig/DSConfig.java
@@ -116,8 +116,6 @@
     /** The sub-command handler. */
     private final SubCommandHandler handler;
 
-
-
     /**
      * Creates a new sub-command handler call-back.
      *
@@ -128,8 +126,6 @@
       this.handler = handler;
     }
 
-
-
     /** {@inheritDoc} */
     @Override
     public MenuResult<Integer> invoke(ConsoleApplication app)
@@ -160,8 +156,6 @@
     }
   }
 
-
-
   /**
    * The interactive mode sub-menu implementation.
    */
@@ -170,8 +164,6 @@
     /** The menu. */
     private final Menu<Integer> menu;
 
-
-
     /**
      * Creates a new sub-menu implementation.
      *
@@ -256,8 +248,6 @@
       this.menu = builder.toMenu();
     }
 
-
-
     /** {@inheritDoc} */
     @Override
     public final MenuResult<Integer> invoke(ConsoleApplication app)
@@ -314,8 +304,6 @@
     }
   }
 
-
-
   /**
    * Provides the command-line arguments to the main application for
    * processing and returns the exit code as an integer.
@@ -334,8 +322,7 @@
       OutputStream errStream)
   {
     JDKLogging.disableLogging();
-    DSConfig app =
-        new DSConfig(System.in, outStream, errStream);
+    final DSConfig app = new DSConfig(System.in, outStream, errStream);
     app.sessionStartTime = System.currentTimeMillis();
     /*
      * FIXME: obtain path info from system properties.
@@ -365,7 +352,7 @@
    * The factory which the application should use to retrieve its management
    * context.
    */
-  private ManagementContextFactory factory = null;
+  private LDAPManagementContextFactory factory = null;
 
   /**
    * Flag indicating whether or not the global arguments have already been
@@ -762,12 +749,7 @@
       retCode = runSubCommand(handler);
     }
 
-    try {
-      // Close the Management context ==> an LDAP UNBIND is sent
-      factory.close();
-    } catch (Exception e) {
-      // Nothing to report in this case
-    }
+    factory.close();
 
     return retCode;
   }
@@ -1176,7 +1158,7 @@
         String[] allArgsArray = allArguments.toArray(new String[]{});
 
         int exitCode = main(allArgsArray, getOutputStream(), getErrorStream());
-        if (exitCode != 0)
+        if (exitCode != ReturnCode.SUCCESS.get())
         {
           System.exit(filterExitCode(exitCode));
         }

--
Gitblit v1.10.0