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

Gaetan Boismal
25.30.2016 6ea56ecde3d05b84f42a7338d7c2c159817d00d0
opendj-server-legacy/src/main/java/org/opends/server/tools/InstallDSArgumentParser.java
@@ -21,8 +21,7 @@
import static com.forgerock.opendj.cli.CliMessages.INFO_NUM_ENTRIES_PLACEHOLDER;
import static com.forgerock.opendj.cli.CliMessages.INFO_PORT_PLACEHOLDER;
import static com.forgerock.opendj.cli.CliMessages.INFO_ROOT_USER_PWD_FILE_PLACEHOLDER;
import static com.forgerock.opendj.cli.CliMessages.ERR_TOOL_CONFLICTING_ARGS;
import static com.forgerock.opendj.cli.Utils.addErrorMessageIfArgumentsConflict;
import static org.opends.messages.ToolMessages.*;
import static com.forgerock.opendj.cli.ArgumentConstants.*;
@@ -503,13 +502,7 @@
   */
  private void checkServerPassword(Collection<LocalizableMessage> errorMessages)
  {
    if (directoryManagerPwdStringArg.isPresent() &&
        directoryManagerPwdFileArg.isPresent())
    {
      errorMessages.add(ERR_TOOL_CONFLICTING_ARGS.get(
          directoryManagerPwdStringArg.getLongIdentifier(),
          directoryManagerPwdFileArg.getLongIdentifier()));
    }
    addErrorMessageIfArgumentsConflict(errorMessages, directoryManagerPwdStringArg, directoryManagerPwdFileArg);
    if (noPromptArg.isPresent() && !directoryManagerPwdStringArg.isPresent() &&
        !directoryManagerPwdFileArg.isPresent())
@@ -575,39 +568,13 @@
  private void checkImportDataArguments(Collection<LocalizableMessage> errorMessages)
  {
    //  Make sure that the user didn't provide conflicting arguments.
    if (addBaseEntryArg.isPresent())
    {
      if (importLDIFArg.isPresent())
      {
        errorMessages.add(conflictingArgs(addBaseEntryArg, importLDIFArg));
      }
      else if (sampleDataArg.isPresent())
      {
        errorMessages.add(conflictingArgs(addBaseEntryArg, sampleDataArg));
      }
    }
    else if (importLDIFArg.isPresent() && sampleDataArg.isPresent())
    {
      errorMessages.add(conflictingArgs(importLDIFArg, sampleDataArg));
    }
    if (rejectedImportFileArg.isPresent() && addBaseEntryArg.isPresent())
    {
      errorMessages.add(conflictingArgs(addBaseEntryArg, rejectedImportFileArg));
    }
    else if (rejectedImportFileArg.isPresent() && sampleDataArg.isPresent())
    {
      errorMessages.add(conflictingArgs(rejectedImportFileArg, sampleDataArg));
    }
    if (skippedImportFileArg.isPresent() && addBaseEntryArg.isPresent())
    {
      errorMessages.add(conflictingArgs(addBaseEntryArg, skippedImportFileArg));
    }
    else if (skippedImportFileArg.isPresent() && sampleDataArg.isPresent())
    {
      errorMessages.add(conflictingArgs(skippedImportFileArg, sampleDataArg));
    }
    addErrorMessageIfArgumentsConflict(errorMessages, addBaseEntryArg, importLDIFArg);
    addErrorMessageIfArgumentsConflict(errorMessages, addBaseEntryArg, sampleDataArg);
    addErrorMessageIfArgumentsConflict(errorMessages, importLDIFArg, sampleDataArg);
    addErrorMessageIfArgumentsConflict(errorMessages, addBaseEntryArg, rejectedImportFileArg);
    addErrorMessageIfArgumentsConflict(errorMessages, rejectedImportFileArg, sampleDataArg);
    addErrorMessageIfArgumentsConflict(errorMessages, addBaseEntryArg, skippedImportFileArg);
    addErrorMessageIfArgumentsConflict(errorMessages, skippedImportFileArg, sampleDataArg);
    final boolean noBaseDNProvided = !baseDNArg.isPresent() && baseDNArg.getDefaultValue() == null;
    if (noPromptArg.isPresent() && noBaseDNProvided)
@@ -623,11 +590,6 @@
    }
  }
  private LocalizableMessage conflictingArgs(Argument arg1, Argument arg2)
  {
    return ERR_TOOL_CONFLICTING_ARGS.get(arg1.getLongIdentifier(), arg2.getLongIdentifier());
  }
  /**
   * Checks that there are no conflicts with the security arguments.
   * If we are in no prompt mode, check that all the information required has
@@ -678,14 +640,7 @@
    {
      if (!generateSelfSignedCertificateArg.isPresent())
      {
        // Check that we have only a password.
        if (keyStorePasswordArg.isPresent() &&
            keyStorePasswordFileArg.isPresent())
        {
          errorMessages.add(ERR_TOOL_CONFLICTING_ARGS.get(
              keyStorePasswordArg.getLongIdentifier(),
              keyStorePasswordFileArg.getLongIdentifier()));
        }
        addErrorMessageIfArgumentsConflict(errorMessages, keyStorePasswordArg, keyStorePasswordFileArg);
        // Check that we have one password in no prompt mode.
        if (noPromptArg.isPresent() && !keyStorePasswordArg.isPresent() &&