From 46ca4c41238b4d01f40cf203e06629e7e74bdb2b Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 06 Dec 2013 15:44:45 +0000
Subject: [PATCH] ArgumentParser.java: Extracted method normalizeArguments(). Made printVersion() protected.

---
 opendj-sdk/opends/src/server/org/opends/server/util/args/ArgumentParser.java |   29 +++++++++++++++++++++++------
 1 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/util/args/ArgumentParser.java b/opendj-sdk/opends/src/server/org/opends/server/util/args/ArgumentParser.java
index c0abeee..e9b6887 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/util/args/ArgumentParser.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/util/args/ArgumentParser.java
@@ -1169,10 +1169,25 @@
       argumentProperties = checkExternalProperties();
     }
 
-    // Iterate through all of the arguments.  For any that were not provided on
-    // the command line, see if there is an alternate default that can be used.
-    // For cases where there is not, see that argument is required.
-    for (Argument a : argumentList)
+    normalizeArguments(argumentProperties, argumentList);
+  }
+
+  /**
+   * Iterate through all the arguments and make sure that they have values or a
+   * suitable default is available.
+   *
+   * @param argumentProperties
+   *          A set of properties that may be used to provide default values for
+   *          arguments not included in the given raw arguments.
+   * @param arguments
+   *          the arguments to normalize
+   * @throws ArgumentException
+   *           if no value or default value exists for a required argument
+   */
+  protected void normalizeArguments(Properties argumentProperties,
+      List<Argument> arguments) throws ArgumentException
+  {
+    for (Argument a : arguments)
     {
       if (!a.isPresent()
           // See if there is a value in the properties that can be used
@@ -1201,7 +1216,6 @@
         }
       }
 
-
       if (!a.isPresent() && a.needsValue())
       {
         // See if the argument defines a default.
@@ -1222,7 +1236,10 @@
     }
   }
 
-  private void printVersion()
+  /**
+   * Prints out the version string of the server.
+   */
+  protected void printVersion()
   {
     try
     {

--
Gitblit v1.10.0