From ee021bead4d9a72f6f2e6b52222ff4013cbc8b71 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 20 Jan 2015 09:26:46 +0000
Subject: [PATCH] OPENDJ-1734 (CR-5811) V/-version option does not work for some tools

---
 opendj3-server-dev/src/server/org/opends/server/tools/status/StatusCliArgumentParser.java |   29 ++++++++++-------------------
 1 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/opendj3-server-dev/src/server/org/opends/server/tools/status/StatusCliArgumentParser.java b/opendj3-server-dev/src/server/org/opends/server/tools/status/StatusCliArgumentParser.java
index 1e3aac7..0de4a76 100644
--- a/opendj3-server-dev/src/server/org/opends/server/tools/status/StatusCliArgumentParser.java
+++ b/opendj3-server-dev/src/server/org/opends/server/tools/status/StatusCliArgumentParser.java
@@ -22,9 +22,8 @@
  *
  *
  *      Copyright 2008-2009 Sun Microsystems, Inc.
- *      Portions Copyright 2012-2014 ForgeRock AS
+ *      Portions Copyright 2012-2015 ForgeRock AS
  */
-
 package org.opends.server.tools.status;
 
 import static org.opends.messages.AdminToolMessages.*;
@@ -35,6 +34,7 @@
 
 import org.opends.server.admin.client.cli.SecureConnectionCliArgs;
 import org.opends.server.admin.client.cli.SecureConnectionCliParser;
+import org.opends.server.core.DirectoryServer.DirectoryServerVersionHandler;
 
 import com.forgerock.opendj.cli.Argument;
 import com.forgerock.opendj.cli.ArgumentException;
@@ -46,23 +46,16 @@
 /**
  * The class that is used to parse the arguments provided in the status command
  * line.
- *
  */
 public class StatusCliArgumentParser extends SecureConnectionCliParser
 {
   private BooleanArgument noPromptArg;
-
-  // This CLI is always using the administration connector with SSL
+  /** This CLI is always using the administration connector with SSL. */
   private static final boolean alwaysSSL = true;
 
-
-  /**
-   * The 'refresh' argument.
-   */
+  /** The 'refresh' argument. */
   private IntegerArgument refreshArg;
-  /**
-   * The 'scriptFriendly' argument.
-   */
+  /** The 'scriptFriendly' argument. */
   private BooleanArgument scriptFriendlyArg;
 
   /**
@@ -76,6 +69,7 @@
   public StatusCliArgumentParser(String mainClassName)
   {
     super(mainClassName, INFO_STATUS_CLI_USAGE_DESCRIPTION.get(), false);
+    setVersionHandler(new DirectoryServerVersionHandler());
   }
 
   /**
@@ -133,6 +127,7 @@
   {
     return secureArgsList;
   }
+
   /**
    * Tells whether the user specified to have an interactive status CLI or not.
    * This method must be called after calling parseArguments.
@@ -176,10 +171,7 @@
             "should be called after parsing the attributes: "+ae, ae);
       }
     }
-    else
-    {
-      return -1;
-    }
+    return -1;
   }
 
   /**
@@ -189,12 +181,11 @@
    */
   public String getExplicitBindDn()
   {
-    String dn = null;
     if (secureArgsList.bindDnArg.isPresent())
     {
-      dn = secureArgsList.bindDnArg.getValue();
+      return secureArgsList.bindDnArg.getValue();
     }
-    return dn;
+    return null;
   }
 
   /**

--
Gitblit v1.10.0