From 55b437508acb80b4931a5d7f37b987adf367fa46 Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Thu, 05 Jan 2012 17:37:33 +0000
Subject: [PATCH] Spring cleaning ! Fix minor issues and optimizations suggested by FindBugs and NetBeans.

---
 opends/src/server/org/opends/server/tools/ManageTasks.java |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/opends/src/server/org/opends/server/tools/ManageTasks.java b/opends/src/server/org/opends/server/tools/ManageTasks.java
index 620a28a..665ca65 100644
--- a/opends/src/server/org/opends/server/tools/ManageTasks.java
+++ b/opends/src/server/org/opends/server/tools/ManageTasks.java
@@ -23,6 +23,7 @@
  *
  *
  *      Copyright 2008-2009 Sun Microsystems, Inc.
+ *      Portions Copyright 2012 ForgeRock AS
  */
 
 package org.opends.server.tools;
@@ -73,7 +74,7 @@
   private static ErrorLogPublisher errorLogPublisher = null;
 
   // This CLI is always using the administration connector with SSL
-  private final boolean alwaysSSL = true;
+  private static final boolean alwaysSSL = true;
 
   /**
    * The main method for TaskInfo tool.
@@ -346,6 +347,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public boolean isAdvancedMode() {
     return false;
   }
@@ -353,6 +355,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public boolean isInteractive() {
     return !noPrompt.isPresent();
   }
@@ -360,6 +363,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public boolean isMenuDrivenMode() {
     return !task.isPresent() && !cancel.isPresent() && !summary.isPresent() &&
            !noPrompt.isPresent();
@@ -368,6 +372,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public boolean isQuiet() {
     return false;
   }
@@ -375,6 +380,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public boolean isScriptFriendly() {
     return false;
   }
@@ -382,6 +388,7 @@
   /**
    * {@inheritDoc}
    */
+  @Override
   public boolean isVerbose() {
     return false;
   }
@@ -513,6 +520,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public MenuResult<Void> invoke(ConsoleApplication app) throws CLIException {
       return invoke((ManageTasks)app);
     }
@@ -550,6 +558,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public MenuResult<TaskEntry> invoke(ConsoleApplication app)
             throws CLIException
     {
@@ -569,6 +578,7 @@
    */
   static private class PrintSummaryTop extends TopMenuCallback {
 
+    @Override
     public MenuResult<Void> invoke(ManageTasks app)
             throws CLIException
     {
@@ -598,6 +608,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public MenuResult<Void> invoke(ManageTasks app) throws CLIException {
       MenuResult<TaskEntry> res = new PrintTaskInfo(taskId).invoke(app);
       TaskEntry taskEntry = res.getValue();
@@ -664,11 +675,12 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public MenuResult<TaskEntry> invoke(ManageTasks app)
             throws CLIException
     {
-      Message m = null;
-      TaskEntry taskEntry = null;
+      Message m;
+      TaskEntry taskEntry;
       try {
         taskEntry = app.getTaskClient().getTaskEntry(taskId);
 
@@ -824,9 +836,9 @@
                                       Message noneLabel) {
       table.startRow();
       table.appendCell(fieldLabel);
-      if (values.size() == 0) {
+      if (values.isEmpty()) {
         table.appendCell(noneLabel);
-      } else if (values.size() > 0) {
+      } else {
         table.appendCell(values.get(0));
       }
       if (values.size() > 1) {
@@ -856,6 +868,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     protected MenuResult<TaskEntry> invoke(ManageTasks app)
             throws CLIException
     {
@@ -916,6 +929,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public MenuResult<Void> invoke(ManageTasks app)
             throws CLIException
     {
@@ -988,6 +1002,7 @@
     /**
      * {@inheritDoc}
      */
+    @Override
     public MenuResult<TaskEntry> invoke(ManageTasks app)
             throws CLIException
     {

--
Gitblit v1.10.0