mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Gaetan Boismal
25.06.2016 14008013116d3a95440c6d33c1509ed1bb8e6bf3
OPENDJSDK-42 Code cleanup

PR-278 sdk PR-45
Consequences of cleanup done in sdk modules.
Removes useless null assignments.
Use interface instead of implementation as declarative type.
12 files modified
578 ■■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/admin/client/cli/TaskScheduleArgs.java 34 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/controls/MatchedValuesControl.java 7 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDS.java 8 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPCompare.java 73 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPDelete.java 65 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPModify.java 70 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPSearch.java 116 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/ListBackends.java 13 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/WaitForFileDelete.java 18 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java 151 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliMain.java 18 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/tools/tasks/TaskScheduleUserData.java 5 ●●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/admin/client/cli/TaskScheduleArgs.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions Copyright 2014 ForgeRock AS
 *      Portions Copyright 2014-2016 ForgeRock AS
 */
package org.opends.server.admin.client.cli;
@@ -33,7 +33,6 @@
import java.util.Collections;
import java.util.Date;
import java.util.EnumSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
@@ -208,25 +207,8 @@
      }
    }
    if (completionNotificationArg.isPresent()) {
      LinkedList<String> addrs = completionNotificationArg.getValues();
      for (String addr : addrs) {
        if (!StaticUtils.isEmailAddress(addr)) {
          throw new ArgumentException(ERR_TASKTOOL_INVALID_EMAIL_ADDRESS.get(
                  addr, completionNotificationArg.getLongIdentifier()));
        }
      }
    }
    if (errorNotificationArg.isPresent()) {
      LinkedList<String> addrs = errorNotificationArg.getValues();
      for (String addr : addrs) {
        if (!StaticUtils.isEmailAddress(addr)) {
          throw new ArgumentException(ERR_TASKTOOL_INVALID_EMAIL_ADDRESS.get(
                  addr, errorNotificationArg.getLongIdentifier()));
        }
      }
    }
    checkEmailArgument(completionNotificationArg);
    checkEmailArgument(errorNotificationArg);
    if (failedDependencyActionArg.isPresent()) {
@@ -244,6 +226,16 @@
    }
  }
  private void checkEmailArgument(final StringArgument argument) throws ArgumentException {
    if (argument.isPresent()) {
      for (final String email : argument.getValues()) {
        if (!StaticUtils.isEmailAddress(email)) {
          throw new ArgumentException(ERR_TASKTOOL_INVALID_EMAIL_ADDRESS.get(email, argument.getLongIdentifier()));
        }
      }
    }
  }
  /**
   * Validates arguments related to task scheduling.  This should be
   * called after the <code>ArgumentParser.parseArguments</code> has
opendj-server-legacy/src/main/java/org/opends/server/controls/MatchedValuesControl.java
@@ -31,6 +31,7 @@
import java.util.ArrayList;
import java.io.IOException;
import java.util.List;
import org.forgerock.opendj.io.*;
import org.forgerock.opendj.ldap.schema.AttributeType;
@@ -122,7 +123,7 @@
  /** The set of matched values filters for this control. */
  private final ArrayList<MatchedValuesFilter> filters;
  private final List<MatchedValuesFilter> filters;
@@ -136,7 +137,7 @@
   *                     return.
   */
  public MatchedValuesControl(boolean isCritical,
                              ArrayList<MatchedValuesFilter> filters)
                              List<MatchedValuesFilter> filters)
  {
    super(OID_MATCHED_VALUES, isCritical);
@@ -173,7 +174,7 @@
   *
   * @return  The set of filters associated with this matched values control.
   */
  public ArrayList<MatchedValuesFilter> getFilters()
  public List<MatchedValuesFilter> getFilters()
  {
    return filters;
  }
opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDS.java
@@ -23,7 +23,7 @@
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2011 profiq s.r.o.
 *      Portions Copyright 2011-2015 ForgeRock AS
 *      Portions Copyright 2011-2016 ForgeRock AS
 */
package org.opends.server.tools;
@@ -422,7 +422,7 @@
  {
    if (!isInteractive())
    {
      initializeUserDataWithParser(uData);
      initializeNonInteractiveUserDataWithParser(uData);
      return InstallReturnCode.SUCCESSFUL;
    }
@@ -440,7 +440,7 @@
      boolean promptAgain = true;
      printSummary(uData);
      while (isInteractive() && promptAgain)
      while (promptAgain)
      {
        promptAgain = false;
        final ConfirmCode confirm = askForConfirmation();
@@ -682,7 +682,7 @@
   * @throws UserDataException
   *           if something went wrong checking the data.
   */
  private void initializeUserDataWithParser(UserData uData) throws UserDataException
  private void initializeNonInteractiveUserDataWithParser(UserData uData) throws UserDataException
  {
    uData.setQuiet(isQuiet());
    uData.setVerbose(isVerbose());
opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPCompare.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2012-2015 ForgeRock AS.
 *      Portions Copyright 2012-2016 ForgeRock AS.
 */
package org.opends.server.tools;
@@ -42,6 +42,7 @@
import java.io.Reader;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import org.forgerock.i18n.LocalizableMessage;
@@ -124,7 +125,7 @@
   * @throws  LDAPException  If the server returns an error response.
   */
  public int readAndExecute(LDAPConnection connection, String attributeType,
                             byte[] attributeVal, ArrayList<String> lines,
                             byte[] attributeVal, List<String> lines,
                             LDAPCompareOptions compareOptions)
         throws IOException, LDAPException
  {
@@ -359,41 +360,41 @@
    LDAPCompareOptions compareOptions = new LDAPCompareOptions();
    LDAPConnection connection = null;
    BooleanArgument   continueOnError        = null;
    BooleanArgument   noop                   = null;
    BooleanArgument   saslExternal           = null;
    BooleanArgument   showUsage              = null;
    BooleanArgument   useCompareResultCode   = null;
    BooleanArgument   startTLS               = null;
    BooleanArgument   trustAll               = null;
    BooleanArgument   useSSL                 = null;
    BooleanArgument   verbose                = null;
    FileBasedArgument bindPasswordFile       = null;
    FileBasedArgument keyStorePasswordFile   = null;
    FileBasedArgument trustStorePasswordFile = null;
    IntegerArgument   port                   = null;
    IntegerArgument   version                = null;
    StringArgument    assertionFilter        = null;
    StringArgument    bindDN                 = null;
    StringArgument    bindPassword           = null;
    StringArgument    certNickname           = null;
    StringArgument    controlStr             = null;
    StringArgument    encodingStr            = null;
    StringArgument    filename               = null;
    StringArgument    hostName               = null;
    StringArgument    keyStorePath           = null;
    StringArgument    keyStorePassword       = null;
    StringArgument    saslOptions            = null;
    StringArgument    trustStorePath         = null;
    StringArgument    trustStorePassword     = null;
    IntegerArgument   connectTimeout         = null;
    BooleanArgument   scriptFriendlyArgument = null;
    StringArgument    propertiesFileArgument = null;
    BooleanArgument   noPropertiesFileArgument = null;
    final BooleanArgument continueOnError;
    final BooleanArgument noop;
    final BooleanArgument saslExternal;
    final BooleanArgument showUsage;
    final BooleanArgument useCompareResultCode;
    final BooleanArgument startTLS;
    final BooleanArgument trustAll;
    final BooleanArgument useSSL;
    final BooleanArgument verbose;
    final FileBasedArgument bindPasswordFile;
    final FileBasedArgument keyStorePasswordFile;
    final FileBasedArgument trustStorePasswordFile;
    final IntegerArgument port;
    final IntegerArgument version;
    final StringArgument assertionFilter;
    final StringArgument bindDN;
    final StringArgument bindPassword;
    final StringArgument certNickname;
    final StringArgument controlStr;
    final StringArgument encodingStr;
    final StringArgument filename;
    final StringArgument hostName;
    final StringArgument keyStorePath;
    final StringArgument keyStorePassword;
    final StringArgument saslOptions;
    final StringArgument trustStorePath;
    final StringArgument trustStorePassword;
    final IntegerArgument connectTimeout;
    final StringArgument propertiesFileArgument;
    final BooleanArgument noPropertiesFileArgument;
    BooleanArgument scriptFriendlyArgument = null;
    ArrayList<String> dnStrings = new ArrayList<> ();
    String attributeType = null;
    byte[] attributeVal = null;
    final List<String> dnStrings = new ArrayList<> ();
    final String attributeType;
    final byte[] attributeVal;
    Reader rdr = null;
    // Create the command-line argument parser for use with this program.
opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPDelete.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2012-2015 ForgeRock AS.
 *      Portions Copyright 2012-2016 ForgeRock AS.
 */
package org.opends.server.tools;
@@ -41,6 +41,7 @@
import java.io.PrintStream;
import java.io.Reader;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import org.forgerock.i18n.LocalizableMessage;
@@ -117,7 +118,7 @@
   * @throws  LDAPException  If the Directory Server returns an error response.
   */
  public void readAndExecute(LDAPConnection connection,
                             ArrayList<String> lines,
                             List<String> lines,
                             LDAPDeleteOptions deleteOptions)
    throws IOException, LDAPException
  {
@@ -286,38 +287,38 @@
    LDAPDeleteOptions deleteOptions = new LDAPDeleteOptions();
    LDAPConnection connection = null;
    BooleanArgument   continueOnError        = null;
    BooleanArgument   deleteSubtree          = null;
    BooleanArgument   noop                   = null;
    BooleanArgument   saslExternal           = null;
    BooleanArgument   showUsage              = null;
    BooleanArgument   startTLS               = null;
    BooleanArgument   trustAll               = null;
    BooleanArgument   useSSL                 = null;
    BooleanArgument   verbose                = null;
    FileBasedArgument bindPasswordFile       = null;
    FileBasedArgument keyStorePasswordFile   = null;
    FileBasedArgument trustStorePasswordFile = null;
    IntegerArgument   port                   = null;
    IntegerArgument   version                = null;
    StringArgument    bindDN                 = null;
    StringArgument    bindPassword           = null;
    StringArgument    certNickname           = null;
    StringArgument    controlStr             = null;
    StringArgument    encodingStr            = null;
    StringArgument    filename               = null;
    StringArgument    hostName               = null;
    StringArgument    keyStorePath           = null;
    StringArgument    keyStorePassword       = null;
    StringArgument    saslOptions            = null;
    StringArgument    trustStorePath         = null;
    StringArgument    trustStorePassword     = null;
    IntegerArgument   connectTimeout         = null;
    StringArgument    propertiesFileArgument = null;
    BooleanArgument   noPropertiesFileArgument = null;
    final BooleanArgument continueOnError;
    final BooleanArgument deleteSubtree;
    final BooleanArgument noop;
    final BooleanArgument saslExternal;
    final BooleanArgument showUsage;
    final BooleanArgument startTLS;
    final BooleanArgument trustAll;
    final BooleanArgument useSSL;
    final BooleanArgument verbose;
    final FileBasedArgument bindPasswordFile;
    final FileBasedArgument keyStorePasswordFile;
    final FileBasedArgument trustStorePasswordFile;
    final IntegerArgument port;
    final IntegerArgument version;
    final StringArgument bindDN;
    final StringArgument bindPassword;
    final StringArgument certNickname;
    final StringArgument controlStr;
    final StringArgument encodingStr;
    final StringArgument filename;
    final StringArgument hostName;
    final StringArgument keyStorePath;
    final StringArgument keyStorePassword;
    final StringArgument saslOptions;
    final StringArgument trustStorePath;
    final StringArgument trustStorePassword;
    final IntegerArgument connectTimeout;
    final StringArgument propertiesFileArgument;
    final BooleanArgument noPropertiesFileArgument;
    Reader rdr = null;
    ArrayList<String> dnStrings = new ArrayList<>();
    List<String> dnStrings = new ArrayList<>();
    // Create the command-line argument parser for use with this program.
    LocalizableMessage toolDescription = INFO_LDAPDELETE_TOOL_DESCRIPTION.get();
opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPModify.java
@@ -23,7 +23,7 @@
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2012 profiq, s.r.o.
 *      Portions Copyright 2012-2015 ForgeRock AS.
 *      Portions Copyright 2012-2016 ForgeRock AS.
 */
package org.opends.server.tools;
@@ -558,40 +558,40 @@
    LDAPModifyOptions modifyOptions = new LDAPModifyOptions();
    LDAPConnection connection = null;
    BooleanArgument   continueOnError        = null;
    BooleanArgument   defaultAdd             = null;
    BooleanArgument   noop                   = null;
    BooleanArgument   reportAuthzID          = null;
    BooleanArgument   saslExternal           = null;
    BooleanArgument   showUsage              = null;
    BooleanArgument   startTLS               = null;
    BooleanArgument   trustAll               = null;
    BooleanArgument   useSSL                 = null;
    BooleanArgument   verbose                = null;
    FileBasedArgument bindPasswordFile       = null;
    FileBasedArgument keyStorePasswordFile   = null;
    FileBasedArgument trustStorePasswordFile = null;
    IntegerArgument   connectTimeout         = null;
    IntegerArgument   port                   = null;
    IntegerArgument   version                = null;
    StringArgument    assertionFilter        = null;
    StringArgument    bindDN                 = null;
    StringArgument    bindPassword           = null;
    StringArgument    certNickname           = null;
    StringArgument    controlStr             = null;
    StringArgument    encodingStr            = null;
    StringArgument    filename               = null;
    StringArgument    hostName               = null;
    StringArgument    keyStorePath           = null;
    StringArgument    keyStorePassword       = null;
    StringArgument    postReadAttributes     = null;
    StringArgument    preReadAttributes      = null;
    StringArgument    proxyAuthzID           = null;
    StringArgument    saslOptions            = null;
    StringArgument    trustStorePath         = null;
    StringArgument    trustStorePassword     = null;
    StringArgument    propertiesFileArgument   = null;
    BooleanArgument   noPropertiesFileArgument = null;
    final BooleanArgument continueOnError;
    final BooleanArgument defaultAdd;
    final BooleanArgument noop;
    final BooleanArgument reportAuthzID;
    final BooleanArgument saslExternal;
    final BooleanArgument showUsage;
    final BooleanArgument startTLS;
    final BooleanArgument trustAll;
    final BooleanArgument useSSL;
    final BooleanArgument verbose;
    final FileBasedArgument bindPasswordFile;
    final FileBasedArgument keyStorePasswordFile;
    final FileBasedArgument trustStorePasswordFile;
    final IntegerArgument connectTimeout;
    final IntegerArgument port;
    final IntegerArgument version;
    final StringArgument assertionFilter;
    final StringArgument bindDN;
    final StringArgument bindPassword;
    final StringArgument certNickname;
    final StringArgument controlStr;
    final StringArgument encodingStr;
    final StringArgument filename;
    final StringArgument hostName;
    final StringArgument keyStorePath;
    final StringArgument keyStorePassword;
    final StringArgument postReadAttributes;
    final StringArgument preReadAttributes;
    final StringArgument proxyAuthzID;
    final StringArgument saslOptions;
    final StringArgument trustStorePath;
    final StringArgument trustStorePassword;
    final StringArgument propertiesFileArgument;
    final BooleanArgument noPropertiesFileArgument;
    // Create the command-line argument parser for use with this program.
    LocalizableMessage toolDescription = INFO_LDAPMODIFY_TOOL_DESCRIPTION.get();
opendj-server-legacy/src/main/java/org/opends/server/tools/LDAPSearch.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2012-2015 ForgeRock AS.
 *      Portions Copyright 2012-2016 ForgeRock AS.
 */
package org.opends.server.tools;
@@ -128,8 +128,8 @@
   * @throws  LDAPException  If the Directory Server returns an error response.
   */
  public int executeSearch(LDAPConnection connection, String baseDN,
                           ArrayList<LDAPFilter> filters,
                           LinkedHashSet<String> attributes,
                           List<LDAPFilter> filters,
                           Set<String> attributes,
                           LDAPSearchOptions searchOptions,
                           int wrapColumn )
         throws IOException, LDAPException
@@ -629,58 +629,57 @@
    LDAPConnectionOptions connectionOptions = new LDAPConnectionOptions();
    LDAPSearchOptions searchOptions = new LDAPSearchOptions();
    LDAPConnection connection = null;
    ArrayList<LDAPFilter> filters = new ArrayList<>();
    LinkedHashSet<String> attributes = new LinkedHashSet<>();
    final List<LDAPFilter> filters = new ArrayList<>();
    final Set<String> attributes = new LinkedHashSet<>();
    BooleanArgument   continueOnError          = null;
    BooleanArgument   countEntries             = null;
    BooleanArgument   dontWrap                 = null;
    BooleanArgument   noop                     = null;
    BooleanArgument   reportAuthzID            = null;
    BooleanArgument   saslExternal             = null;
    BooleanArgument   showUsage                = null;
    BooleanArgument   trustAll                 = null;
    BooleanArgument   usePasswordPolicyControl = null;
    BooleanArgument   useSSL                   = null;
    BooleanArgument   startTLS                 = null;
    BooleanArgument   typesOnly                = null;
    BooleanArgument   verbose                  = null;
    FileBasedArgument bindPasswordFile         = null;
    FileBasedArgument keyStorePasswordFile     = null;
    FileBasedArgument trustStorePasswordFile   = null;
    IntegerArgument   port                     = null;
    IntegerArgument   simplePageSize           = null;
    IntegerArgument   sizeLimit                = null;
    IntegerArgument   timeLimit                = null;
    IntegerArgument   version                  = null;
    StringArgument    assertionFilter          = null;
    StringArgument    baseDN                   = null;
    StringArgument    bindDN                   = null;
    StringArgument    bindPassword             = null;
    StringArgument    certNickname             = null;
    StringArgument    controlStr               = null;
    StringArgument    dereferencePolicy        = null;
    StringArgument    encodingStr              = null;
    StringArgument    filename                 = null;
    StringArgument    hostName                 = null;
    StringArgument    keyStorePath             = null;
    StringArgument    keyStorePassword         = null;
    StringArgument    matchedValuesFilter      = null;
    StringArgument    proxyAuthzID             = null;
    StringArgument    pSearchInfo              = null;
    StringArgument    saslOptions              = null;
    MultiChoiceArgument searchScope              = null;
    StringArgument    sortOrder                = null;
    StringArgument    trustStorePath           = null;
    StringArgument    trustStorePassword       = null;
    IntegerArgument   connectTimeout           = null;
    StringArgument    vlvDescriptor            = null;
    StringArgument    effectiveRightsUser      = null;
    StringArgument    effectiveRightsAttrs     = null;
    StringArgument    propertiesFileArgument   = null;
    BooleanArgument   noPropertiesFileArgument = null;
    BooleanArgument   subEntriesArgument       = null;
    final BooleanArgument continueOnError;
    final BooleanArgument countEntries;
    final BooleanArgument dontWrap;
    final BooleanArgument noop;
    final BooleanArgument reportAuthzID;
    final BooleanArgument saslExternal;
    final BooleanArgument showUsage;
    final BooleanArgument trustAll;
    final BooleanArgument usePasswordPolicyControl;
    final BooleanArgument useSSL;
    final BooleanArgument startTLS;
    final BooleanArgument typesOnly;
    final BooleanArgument verbose;
    final FileBasedArgument bindPasswordFile;
    final FileBasedArgument keyStorePasswordFile;
    final FileBasedArgument trustStorePasswordFile;
    final IntegerArgument port;
    final IntegerArgument simplePageSize;
    final IntegerArgument sizeLimit;
    final IntegerArgument timeLimit;
    final IntegerArgument version;
    final StringArgument assertionFilter;
    final StringArgument baseDN;
    final StringArgument bindDN;
    final StringArgument bindPassword;
    final StringArgument certNickname;
    final StringArgument controlStr;
    final StringArgument dereferencePolicy;
    final StringArgument encodingStr;
    final StringArgument filename;
    final StringArgument hostName;
    final StringArgument keyStorePath;
    final StringArgument keyStorePassword;
    final StringArgument matchedValuesFilter;
    final StringArgument proxyAuthzID;
    final StringArgument pSearchInfo;
    final StringArgument saslOptions;
    final MultiChoiceArgument searchScope;
    final StringArgument sortOrder;
    final StringArgument trustStorePath;
    final StringArgument trustStorePassword;
    final IntegerArgument connectTimeout;
    final StringArgument vlvDescriptor;
    final StringArgument effectiveRightsUser;
    final StringArgument effectiveRightsAttrs;
    final StringArgument propertiesFileArgument;
    final BooleanArgument noPropertiesFileArgument;
    final BooleanArgument subEntriesArgument ;
    // Create the command-line argument parser for use with this program.
    LocalizableMessage toolDescription = INFO_LDAPSEARCH_TOOL_DESCRIPTION.get();
@@ -1087,8 +1086,7 @@
      return 0;
    }
    ArrayList<String> filterAndAttributeStrings =
      argParser.getTrailingArguments();
    final List<String> filterAndAttributeStrings = argParser.getTrailingArguments();
    if(!filterAndAttributeStrings.isEmpty())
    {
      // the list of trailing arguments should be structured as follow:
@@ -1407,8 +1405,8 @@
    if (matchedValuesFilter.isPresent())
    {
      LinkedList<String> mvFilterStrings = matchedValuesFilter.getValues();
      ArrayList<MatchedValuesFilter> mvFilters = new ArrayList<>();
      List<String> mvFilterStrings = matchedValuesFilter.getValues();
      List<MatchedValuesFilter> mvFilters = new ArrayList<>();
      for (String s : mvFilterStrings)
      {
        try
@@ -1505,7 +1503,7 @@
    connectionOptions.setSASLExternal(saslExternal.isPresent());
    if(saslOptions.isPresent())
    {
      LinkedList<String> values = saslOptions.getValues();
      List<String> values = saslOptions.getValues();
      for(String saslOption : values)
      {
        if(saslOption.startsWith("mech="))
opendj-server-legacy/src/main/java/org/opends/server/tools/ListBackends.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Portions Copyright 2012-2015 ForgeRock AS.
 *      Portions Copyright 2012-2016 ForgeRock AS.
 */
package org.opends.server.tools;
@@ -38,6 +38,7 @@
import java.io.PrintStream;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.TreeMap;
import java.util.TreeSet;
@@ -377,15 +378,7 @@
    }
    else
    {
      LinkedList<String> backendIDs;
      if (backendID.isPresent())
      {
        backendIDs = backendID.getValues();
      }
      else
      {
        backendIDs = new LinkedList<>(backends.keySet());
      }
      List<String> backendIDs = backendID.isPresent() ? backendID.getValues() : new LinkedList<>(backends.keySet());
      // Figure out the length of the longest backend ID and base DN defined in
      // the server.  We'll use that information to try to align the output.
opendj-server-legacy/src/main/java/org/opends/server/tools/WaitForFileDelete.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 *      Portions Copyright 2013-2015 ForgeRock AS
 *      Portions Copyright 2013-2016 ForgeRock AS
 */
package org.opends.server.tools;
@@ -166,13 +166,12 @@
  private int mainWait(String[] args)
  {
    // Create all of the command-line arguments for this program.
    BooleanArgument showUsage      = null;
    IntegerArgument timeout        = null;
    StringArgument  logFilePath    = null;
    StringArgument  targetFilePath = null;
    StringArgument  outputFilePath = null;
    BooleanArgument useLastKnownGoodConfig = null;
    BooleanArgument quietMode              = null;
    final BooleanArgument showUsage;
    final IntegerArgument timeout;
    final StringArgument logFilePath;
    final StringArgument targetFilePath;
    final StringArgument outputFilePath;
    final BooleanArgument quietMode;
    LocalizableMessage toolDescription = INFO_WAIT4DEL_TOOL_DESCRIPTION.get();
    ArgumentParser argParser = new ArgumentParser(CLASS_NAME, toolDescription,
@@ -218,8 +217,7 @@
                               INFO_DSCORE_DESCRIPTION_LASTKNOWNGOODCFG.get());
      argParser.addArgument(useLastKnownGoodConfig);
      // Not used in this class, but required by the start-ds script
      // (see issue #3814)
      // Not used in this class, but required by the start-ds script (see issue #3814)
      quietMode = CommonArguments.getQuiet();
      argParser.addArgument(quietMode);
opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliArgumentParser.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2007-2010 Sun Microsystems, Inc.
 *      Portions Copyright 2012-2015 ForgeRock AS.
 *      Portions Copyright 2012-2016 ForgeRock AS.
 */
package org.opends.server.tools.dsreplication;
@@ -36,7 +36,7 @@
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizableMessageBuilder;
@@ -352,7 +352,7 @@
    if (baseDNsArg.isPresent())
    {
      LinkedList<String> baseDNs = baseDNsArg.getValues();
      List<String> baseDNs = baseDNsArg.getValues();
      for (String dn : baseDNs)
      {
        if (!isDN(dn))
@@ -1081,28 +1081,6 @@
  }
  /**
   * Returns the server bind dn default value in the disable replication
   * subcommand.
   * @return the server bind dn default value in the enable replication
   * subcommand.
   */
  public String getDefaultBindDnToDisable()
  {
    return getDefaultValue(secureArgsList.bindDnArg);
  }
  /**
   * Returns the host name explicitly provided in the status replication
   * subcommand.
   * @return the host name explicitly provided in the status replication
   * subcommand.
   */
  public String getHostNameToStatus()
  {
    return getValue(secureArgsList.hostNameArg);
  }
  /**
   * Returns the host name default value in the status replication subcommand.
   * @return the host name default value in the status replication subcommand.
   */
@@ -1112,17 +1090,6 @@
  }
  /**
   * Returns the host name explicitly provided in the initialize all replication
   * subcommand.
   * @return the host name explicitly provided in the initialize all replication
   * subcommand.
   */
  public String getHostNameToInitializeAll()
  {
    return getValue(secureArgsList.hostNameArg);
  }
  /**
   * Returns the host name default value in the initialize all replication
   * subcommand.
   * @return the host name default value in the initialize all replication
@@ -1134,50 +1101,6 @@
  }
  /**
   * Returns the host name explicitly provided in the pre external
   * initialization subcommand.
   * @return the host name explicitly provided in the pre external
   * initialization subcommand.
   */
  public String getHostNameToPreExternalInitialization()
  {
    return getValue(secureArgsList.hostNameArg);
  }
  /**
   * Returns the host name default value in the pre external initialization
   * subcommand.
   * @return the host name default value in the pre external initialization
   * subcommand.
   */
  public String getDefaultHostNameToPreExternalInitialization()
  {
    return getDefaultValue(secureArgsList.hostNameArg);
  }
  /**
   * Returns the host name explicitly provided in the post external
   * initialization subcommand.
   * @return the host name explicitly provided in the post external
   * initialization subcommand.
   */
  public String getHostNameToPostExternalInitialization()
  {
    return getValue(secureArgsList.hostNameArg);
  }
  /**
   * Returns the host name default value in the post external initialization
   * subcommand.
   * @return the host name default value in the post external initialization
   * subcommand.
   */
  public String getDefaultHostNameToPostExternalInitialization()
  {
    return getDefaultValue(secureArgsList.hostNameArg);
  }
  /**
   * Returns the source host name explicitly provided in the initialize
   * replication subcommand.
   * @return the source host name explicitly provided in the initialize
@@ -1288,17 +1211,6 @@
  }
  /**
   * Returns the server port explicitly provided in the initialize all
   * replication subcommand.
   * @return the server port explicitly provided in the initialize all
   * replication subcommand.  Returns -1 if no port was explicitly provided.
   */
  public int getPortToInitializeAll()
  {
    return getValue(secureArgsList.portArg);
  }
  /**
   * Returns the server port default value in the initialize all replication
   * subcommand.
   * @return the server port default value in the initialize all replication
@@ -1310,61 +1222,6 @@
  }
  /**
   * Returns the server port explicitly provided in the pre external
   * initialization subcommand.
   * @return the server port explicitly provided in the pre external
   * initialization subcommand.  Returns -1 if no port was explicitly provided.
   */
  public int getPortToPreExternalInitialization()
  {
    return getValue(secureArgsList.portArg);
  }
  /**
   * Returns the server port default value in the pre external initialization
   * subcommand.
   * @return the server port default value in the pre external initialization
   * subcommand.
   */
  public int getDefaultPortToPreExternalInitialization()
  {
    return getDefaultValue(secureArgsList.portArg);
  }
  /**
   * Returns the server port explicitly provided in the post external
   * initialization subcommand.
   * @return the server port explicitly provided in the post external
   * initialization subcommand.  Returns -1 if no port was explicitly provided.
   */
  public int getPortToPostExternalInitialization()
  {
    return getValue(secureArgsList.portArg);
  }
  /**
   * Returns the server port default value in the post external initialization
   * subcommand.
   * @return the server port default value in the post external initialization
   * subcommand.
   */
  public int getDefaultPortToPostExternalInitialization()
  {
    return getDefaultValue(secureArgsList.portArg);
  }
  /**
   * Returns the server port explicitly provided in the status replication
   * subcommand.
   * @return the server port explicitly provided in the status replication
   * subcommand.  Returns -1 if no port was explicitly provided.
   */
  public int getPortToStatus()
  {
    return getValue(secureArgsList.portArg);
  }
  /**
   * Returns the server port default value in the status replication subcommand.
   * @return the server port default value in the status replication subcommand.
   */
@@ -1377,7 +1234,7 @@
   * Returns the list of base DNs provided by the user.
   * @return the list of base DNs provided by the user.
   */
  public LinkedList<String> getBaseDNs()
  public List<String> getBaseDNs()
  {
    return baseDNsArg.getValues();
  }
opendj-server-legacy/src/main/java/org/opends/server/tools/dsreplication/ReplicationCliMain.java
@@ -2003,7 +2003,7 @@
      }
      uData.setMaximumDuration(maximumDuration);
      LinkedList<String> suffixes = argParser.getBaseDNs();
      List<String> suffixes = argParser.getBaseDNs();
      if (uData.isOnline())
      {
        checkSuffixesForPurgeHistorical(suffixes, ctx, true);
@@ -2724,7 +2724,7 @@
    if (!cancelled)
    {
      LinkedList<String> suffixes = argParser.getBaseDNs();
      List<String> suffixes = argParser.getBaseDNs();
      checkSuffixesForEnableReplication(suffixes, ctx1, ctx2, true, uData);
      cancelled = suffixes.isEmpty();
@@ -2878,7 +2878,7 @@
    uData.setDisableReplicationServer(disableReplicationServer);
    if (!cancelled && !disableAll)
    {
      LinkedList<String> suffixes = argParser.getBaseDNs();
      List<String> suffixes = argParser.getBaseDNs();
      checkSuffixesForDisableReplication(suffixes, ctx, true, !disableReplicationServer);
      cancelled = suffixes.isEmpty() && !disableReplicationServer;
@@ -2967,7 +2967,7 @@
        return false;
      }
      LinkedList<String> suffixes = argParser.getBaseDNs();
      List<String> suffixes = argParser.getBaseDNs();
      checkSuffixesForInitializeReplication(suffixes, ctx, true);
      if (suffixes.isEmpty())
      {
@@ -3032,7 +3032,7 @@
      {
        return false;
      }
      LinkedList<String> suffixes = argParser.getBaseDNs();
      List<String> suffixes = argParser.getBaseDNs();
      checkSuffixesForInitializeReplication(suffixes, ctx, true);
      uData.setBaseDNs(suffixes);
      return !suffixes.isEmpty();
@@ -3287,7 +3287,7 @@
    if (!cancelled)
    {
      LinkedList<String> suffixes = argParser.getBaseDNs();
      List<String> suffixes = argParser.getBaseDNs();
      cancelled = serversOperations.continueAfterUserInput(suffixes, ctxSource, ctxDestination, true);
      uData.setBaseDNs(suffixes);
    }
@@ -4586,7 +4586,7 @@
        errPrintln(ERR_NO_SUFFIXES_AVAILABLE_TO_ENABLE_REPLICATION.get());
      }
      LinkedList<String> userProvidedSuffixes = argParser.getBaseDNs();
      List<String> userProvidedSuffixes = argParser.getBaseDNs();
      TreeSet<String> userProvidedReplicatedSuffixes = new TreeSet<>();
      for (String s1 : userProvidedSuffixes)
@@ -4688,7 +4688,7 @@
        errPrintln();
        errPrintln(ERR_NO_SUFFIXES_AVAILABLE_TO_DISABLE_REPLICATION.get());
      }
      LinkedList<String> userProvidedSuffixes = argParser.getBaseDNs();
      List<String> userProvidedSuffixes = argParser.getBaseDNs();
      TreeSet<String> userProvidedNotReplicatedSuffixes = new TreeSet<>();
      for (String s1 : userProvidedSuffixes)
      {
@@ -4840,7 +4840,7 @@
        errPrintln(
            ERR_NO_SUFFIXES_AVAILABLE_TO_INITIALIZE_LOCAL_REPLICATION.get());
      }
      LinkedList<String> userProvidedSuffixes = argParser.getBaseDNs();
      List<String> userProvidedSuffixes = argParser.getBaseDNs();
      TreeSet<String> userProvidedNotReplicatedSuffixes = new TreeSet<>();
      for (String s1 : userProvidedSuffixes)
      {
opendj-server-legacy/src/main/java/org/opends/server/tools/tasks/TaskScheduleUserData.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2010 Sun Microsystems, Inc.
 *      Portions Copyright 2014-2015 ForgeRock AS
 *      Portions Copyright 2014-2016 ForgeRock AS
 */
package org.opends.server.tools.tasks;
@@ -271,8 +271,7 @@
    }
  }
  private static StringArgument getArgument(
      StringArgument argToClone, Collection<?> values)
  private static StringArgument getArgument(StringArgument argToClone, Collection<?> values)
  {
    StringArgument arg;
    try