From 310df200f78f7d98cc52e4ab97d8a5feb744fa52 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Thu, 28 Apr 2016 09:04:35 +0000
Subject: [PATCH] UCDetector and AutoRefactor code cleanup

---
 opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPPasswordModify.java |   45 ++-------------------------------------------
 1 files changed, 2 insertions(+), 43 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPPasswordModify.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPPasswordModify.java
index d42a00b..243f0f8 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPPasswordModify.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPPasswordModify.java
@@ -78,15 +78,10 @@
  */
 public class LDAPPasswordModify
 {
-  /**
-   * The fully-qualified name of this class.
-   */
+  /** The fully-qualified name of this class. */
   private static final String CLASS_NAME =
        "org.opends.server.tools.LDAPPasswordModify";
 
-
-
-
   /**
    * Parses the command-line arguments, establishes a connection to the
    * Directory Server, sends the password modify request, and reads the
@@ -103,25 +98,6 @@
     }
   }
 
-
-
-  /**
-   * Parses the command-line arguments, establishes a connection to the
-   * Directory Server, sends the password modify request, and reads the
-   * response.
-   *
-   * @param  args  The command-line arguments provided to this program.
-   *
-   * @return  An integer value of zero if everything completed successfully, or
-   *          a nonzero value if an error occurred.
-   */
-  public static int mainPasswordModify(String[] args)
-  {
-    return mainPasswordModify(args, true, System.out, System.err);
-  }
-
-
-
   /**
    * Parses the command-line arguments, establishes a connection to the
    * Directory Server, sends the password modify request, and reads the
@@ -143,7 +119,6 @@
     PrintStream out = NullOutputStream.wrapOrNullStream(outStream);
     PrintStream err = NullOutputStream.wrapOrNullStream(errStream);
 
-
     // Create the arguments that will be used by this program.
     BooleanArgument   provideDNForAuthzID;
     BooleanArgument   showUsage;
@@ -172,7 +147,6 @@
     StringArgument    propertiesFileArgument;
     BooleanArgument   noPropertiesFileArgument;
 
-
     // Initialize the argument parser.
     LocalizableMessage toolDescription = INFO_LDAPPWMOD_TOOL_DESCRIPTION.get();
     ArgumentParser argParser = new ArgumentParser(CLASS_NAME, toolDescription,
@@ -342,7 +316,6 @@
       return CLIENT_SIDE_PARAM_ERROR;
     }
 
-
     // Parse the command-line arguments provided to this program.
     try
     {
@@ -354,7 +327,6 @@
       return CLIENT_SIDE_PARAM_ERROR;
     }
 
-
     // If the usage or version argument was provided,
     // then we don't need to do anything else.
     if (argParser.usageOrVersionDisplayed())
@@ -362,7 +334,6 @@
       return 0;
     }
 
-
     // Make sure that the user didn't specify any conflicting arguments.
     try
     {
@@ -412,7 +383,6 @@
       }
     }
 
-
     // Get the host and port.
     String host = ldapHost.getValue();
     int    port;
@@ -427,7 +397,6 @@
       return CLIENT_SIDE_PARAM_ERROR;
     }
 
-
     // If a control string was provided, then decode the requested controls.
     ArrayList<Control> controls = new ArrayList<>();
     if(controlStr.isPresent())
@@ -444,14 +413,12 @@
       }
     }
 
-
     // Perform a basic Directory Server bootstrap if appropriate.
     if (initializeServer)
     {
       EmbeddedUtils.initializeForClientUse();
     }
 
-
     // Establish a connection to the Directory Server.
     AtomicInteger nextMessageID = new AtomicInteger(1);
     LDAPConnectionOptions connectionOptions = new LDAPConnectionOptions();
@@ -512,7 +479,7 @@
     {
       dn = bindDN.getValue();
       pw = bindPW.getValue();
-      if(pw != null && pw.equals("-"))
+      if ("-".equals(pw))
       {
         // read the password from the stdin.
         try
@@ -567,7 +534,6 @@
     LDAPReader reader = connection.getLDAPReader();
     LDAPWriter writer = connection.getLDAPWriter();
 
-
     // Construct the password modify request.
     ByteStringBuilder builder = new ByteStringBuilder();
     ASN1Writer asn1Writer = ASN1.getWriter(builder);
@@ -625,7 +591,6 @@
          new LDAPMessage(nextMessageID.getAndIncrement(), extendedRequest,
                          controls);
 
-
     // Send the request to the server and read the response.
     try
     {
@@ -639,7 +604,6 @@
       return 1;
     }
 
-
     // Read the response from the server.
     LDAPMessage responseMessage = null;
     try
@@ -654,7 +618,6 @@
       return 1;
     }
 
-
     // Make sure that the response was acceptable.
     ExtendedResponseProtocolOp extendedResponse =
          responseMessage.getExtendedResponseProtocolOp();
@@ -689,7 +652,6 @@
       }
     }
 
-
     // See if the response included any controls that we recognize, and if so
     // then handle them.
     List<Control> responseControls = responseMessage.getControls();
@@ -728,7 +690,6 @@
       }
     }
 
-
     // See if the response included a generated password.
     ByteString responseValue = extendedResponse.getValue();
     if (responseValue != null)
@@ -759,7 +720,6 @@
       }
     }
 
-
     // Unbind from the server and close the connection.
     unbind(nextMessageID, writer);
     close(reader, writer);
@@ -777,4 +737,3 @@
     catch (Exception e) {}
   }
 }
-

--
Gitblit v1.10.0