From 3751c3aa75e5a9497a01a22fc8966e719ec68111 Mon Sep 17 00:00:00 2001
From: Gaetan Boismal <gaetan.boismal@forgerock.com>
Date: Thu, 24 Nov 2016 12:51:28 +0000
Subject: [PATCH] Code cleanup

---
 opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java |   12 ++++++------
 opendj-cli/src/main/java/com/forgerock/opendj/cli/ConsoleApplication.java            |   33 ++++++++++++++++-----------------
 opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java                |   15 ++++-----------
 3 files changed, 26 insertions(+), 34 deletions(-)

diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java
index 82afc52..8780bc8 100644
--- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java
+++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java
@@ -201,17 +201,10 @@
      *            Indicates whether long arguments should be treated in a
      *            case-sensitive manner.
      */
-    public ArgumentParser(final String mainClassName, final LocalizableMessage toolDescription,
-            final boolean longArgumentsCaseSensitive) {
-        this.mainClassName = mainClassName;
-        this.toolDescription = toolDescription;
-        this.longArgumentsCaseSensitive = longArgumentsCaseSensitive;
-
-        allowsTrailingArguments = false;
-        trailingArgsDisplayName = null;
-        maxTrailingArguments = 0;
-        minTrailingArguments = 0;
-        initGroups();
+    public ArgumentParser(final String mainClassName,
+                          final LocalizableMessage toolDescription,
+                          final boolean longArgumentsCaseSensitive) {
+        this(mainClassName, toolDescription, longArgumentsCaseSensitive, false, 0, 0, null);
     }
 
     /**
diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ConsoleApplication.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ConsoleApplication.java
index 388db59..0d5cea5 100644
--- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ConsoleApplication.java
+++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ConsoleApplication.java
@@ -310,7 +310,7 @@
      * @param progress
      *            The current percentage progress to print.
      */
-    private final void printProgressBar(final int linePos, final int progress) {
+    private void printProgressBar(final int linePos, final int progress) {
         if (!isQuiet()) {
             final int spacesLeft = MAX_LINE_WIDTH - linePos - 10;
             StringBuilder bar = new StringBuilder();
@@ -464,24 +464,23 @@
         if (msgStyle != null && msgStyle == Style.TITLE) {
             println();
         }
-        while (true) {
-            if (defaultValue != null) {
-                prompt = INFO_PROMPT_SINGLE_DEFAULT.get(prompt, defaultValue);
-            }
-            final String response = readLineOfInput(prompt);
 
-            if (msgStyle != null && (msgStyle == Style.TITLE || msgStyle == Style.SUBTITLE)) {
-                println();
-            }
-
-            if ("".equals(response)) {
-                if (defaultValue != null) {
-                    return defaultValue;
-                }
-                println(INFO_ERROR_EMPTY_RESPONSE.get());
-            }
-            return response;
+        if (defaultValue != null) {
+            prompt = INFO_PROMPT_SINGLE_DEFAULT.get(prompt, defaultValue);
         }
+        final String response = readLineOfInput(prompt);
+
+        if (msgStyle != null && (msgStyle == Style.TITLE || msgStyle == Style.SUBTITLE)) {
+            println();
+        }
+
+        if ("".equals(response)) {
+            if (defaultValue != null) {
+                return defaultValue;
+            }
+            println(INFO_ERROR_EMPTY_RESPONSE.get());
+        }
+        return response;
     }
 
     /**
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java
index 1fd0c29..930312b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/upgrade/UpgradeTasks.java
@@ -1365,12 +1365,6 @@
     };
   }
 
-  /** Prevent instantiation. */
-  private UpgradeTasks()
-  {
-    // Do nothing.
-  }
-
   /**
    * This task exists because OpenDJ 3.0.0 added an attribute type definition for
    * {@code ds-cfg-csv-delimiter-char}, but unfortunately trailing spaces existed after the closing
@@ -1521,4 +1515,10 @@
       }
     };
   }
+
+  /** Prevent instantiation. */
+  private UpgradeTasks()
+  {
+    // Do nothing.
+  }
 }

--
Gitblit v1.10.0