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

jvergara
17.53.2007 8feee36de8e6042f928439b06a03d50018423afe
opends/src/server/org/opends/server/admin/client/cli/SecureConnectionCliParser.java
@@ -175,8 +175,7 @@
    Logger.getLogger(SecureConnectionCliParser.class.getName());
  /**
   * Creates a new instance of this subcommand argument parser with no
   * arguments.
   * Creates a new instance of this argument parser with no arguments.
   *
   * @param mainClassName
   *          The fully-qualified name of the Java class that should
@@ -295,6 +294,32 @@
  }
  /**
   * Get the password which has to be used for the command without prompting
   * the user.  If no password was specified, return null.
   *
   * @return The password stored into the specified file on by the
   *         command line argument, or null it if not specified.
   */
  public String getBindPassword()
  {
    String pwd;
    if (bindPasswordArg.isPresent())
    {
      pwd = bindPasswordArg.getValue();
    }
    else
    if (bindPasswordFileArg.isPresent())
    {
      pwd = bindPasswordFileArg.getValue();
    }
    else
    {
      pwd = null;
    }
    return pwd;
  }
  /**
   * Initialize Global option.
   *
   * @param outStream
@@ -435,10 +460,11 @@
  /**
   * Indication if provided global options are validate.
   *
   * @param err the stream to be used to print error message.
   * @param buf the MessageBuilder to write the error messages.
   * @return return code.
   */
  public int validateGlobalOption(PrintStream err) {
  public int validateGlobalOption(MessageBuilder buf)
  {
    ArrayList<Message> errors = new ArrayList<Message>();
    // Couldn't have at the same time bindPassword and bindPasswordFile
    if (bindPasswordArg.isPresent() && bindPasswordFileArg.isPresent()) {
@@ -491,7 +517,6 @@
    if (errors.size() > 0)
    {
      MessageBuilder buf = new MessageBuilder();
      for (Message error : errors)
      {
        if (buf.length() > 0)
@@ -500,12 +525,27 @@
        }
        buf.append(error);
      }
      err.println(wrapText(buf.toString(), MAX_LINE_WIDTH));
      return CONFLICTING_ARGS.getReturnCode();
    }
    return SUCCESSFUL_NOP.getReturnCode();
  }
  /**
   * Indication if provided global options are validate.
   *
   * @param err the stream to be used to print error message.
   * @return return code.
   */
  public int validateGlobalOption(PrintStream err)
  {
    MessageBuilder buf = new MessageBuilder();
    int returnValue = validateGlobalOption(buf);
    if (buf.length() > 0)
    {
      err.println(wrapText(buf.toString(), MAX_LINE_WIDTH));
    }
    return returnValue;
  }
  /**
   * Indicate if the verbose mode is required.