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

Jean-Noel Rouvignac
21.38.2015 9166c5ce64710c0eb6a4f714d5b262616e2f648d
OPENDJ-1749 dsconfig does not work anymore and always reports the same error (conflict on short options)

Problem caused by r11605, reverted some of these changes to ensure the code works as before.
3 files modified
66 ■■■■■ changed files
opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java 14 ●●●●● patch | view | raw | blame | history
opendj-cli/src/main/java/com/forgerock/opendj/cli/ConnectionFactoryProvider.java 32 ●●●● patch | view | raw | blame | history
opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommandArgumentParser.java 20 ●●●●● patch | view | raw | blame | history
opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java
@@ -359,6 +359,20 @@
    }
    /**
     * Adds the provided argument to the set of arguments handled by this parser
     * and puts the argument in the LDAP connection group.
     *
     * @param argument
     *            The argument to be added.
     * @throws ArgumentException
     *             If the provided argument conflicts with another argument that
     *             has already been defined.
     */
    public void addLdapConnectionArgument(final Argument argument) throws ArgumentException {
        addArgument(argument, ldapArgGroup);
    }
    /**
     * Indicates whether this parser will allow unnamed trailing arguments.
     * These will be arguments at the end of the list that are not preceded by
     * either a long or short identifier and will need to be manually parsed by
opendj-cli/src/main/java/com/forgerock/opendj/cli/ConnectionFactoryProvider.java
@@ -185,7 +185,7 @@
        useSSLArg = CommonArguments.getUseSSL();
        if (!alwaysSSL) {
            argumentParser.addArgument(useSSLArg);
            argumentParser.addLdapConnectionArgument(useSSLArg);
        } else {
            // simulate that the useSSL arg has been given in the CLI
            useSSLArg.setPresent(true);
@@ -193,7 +193,7 @@
        useStartTLSArg = CommonArguments.getStartTLS();
        if (!alwaysSSL) {
            argumentParser.addArgument(useStartTLSArg);
            argumentParser.addLdapConnectionArgument(useStartTLSArg);
        }
        String defaultHostName;
@@ -203,7 +203,7 @@
            defaultHostName = "Unknown (" + e + ")";
        }
        hostNameArg = CommonArguments.getHostName(defaultHostName);
        argumentParser.addArgument(hostNameArg);
        argumentParser.addLdapConnectionArgument(hostNameArg);
        LocalizableMessage portDescription = INFO_DESCRIPTION_PORT.get();
        if (alwaysSSL) {
@@ -211,43 +211,43 @@
        }
        portArg = CommonArguments.getPort(defaultPort, portDescription);
        argumentParser.addArgument(portArg);
        argumentParser.addLdapConnectionArgument(portArg);
        bindNameArg = CommonArguments.getBindDN(defaultBindDN);
        argumentParser.addArgument(bindNameArg);
        argumentParser.addLdapConnectionArgument(bindNameArg);
        bindPasswordArg = CommonArguments.getBindPassword();
        argumentParser.addArgument(bindPasswordArg);
        argumentParser.addLdapConnectionArgument(bindPasswordArg);
        bindPasswordFileArg = CommonArguments.getBindPasswordFile();
        argumentParser.addArgument(bindPasswordFileArg);
        argumentParser.addLdapConnectionArgument(bindPasswordFileArg);
        saslOptionArg = CommonArguments.getSASL();
        argumentParser.addArgument(saslOptionArg);
        argumentParser.addLdapConnectionArgument(saslOptionArg);
        trustAllArg = CommonArguments.getTrustAll();
        argumentParser.addArgument(trustAllArg);
        argumentParser.addLdapConnectionArgument(trustAllArg);
        trustStorePathArg = CommonArguments.getTrustStorePath();
        argumentParser.addArgument(trustStorePathArg);
        argumentParser.addLdapConnectionArgument(trustStorePathArg);
        trustStorePasswordArg = CommonArguments.getTrustStorePassword();
        argumentParser.addArgument(trustStorePasswordArg);
        argumentParser.addLdapConnectionArgument(trustStorePasswordArg);
        trustStorePasswordFileArg = CommonArguments.getTrustStorePasswordFile();
        argumentParser.addArgument(trustStorePasswordFileArg);
        argumentParser.addLdapConnectionArgument(trustStorePasswordFileArg);
        keyStorePathArg = CommonArguments.getKeyStorePath();
        argumentParser.addArgument(keyStorePathArg);
        argumentParser.addLdapConnectionArgument(keyStorePathArg);
        keyStorePasswordArg = CommonArguments.getKeyStorePassword();
        argumentParser.addArgument(keyStorePasswordArg);
        argumentParser.addLdapConnectionArgument(keyStorePasswordArg);
        keyStorePasswordFileArg = CommonArguments.getKeyStorePasswordFile();
        argumentParser.addArgument(keyStorePasswordFileArg);
        argumentParser.addLdapConnectionArgument(keyStorePasswordFileArg);
        certNicknameArg = CommonArguments.getCertNickName();
        argumentParser.addArgument(certNicknameArg);
        argumentParser.addLdapConnectionArgument(certNicknameArg);
        reportAuthzIDArg = CommonArguments.getReportAuthzId();
        argumentParser.addArgument(reportAuthzIDArg);
opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommandArgumentParser.java
@@ -244,15 +244,19 @@
        addGlobalArgument(argument, null);
    }
    /** {@inheritDoc} */
    /**
     * Adds the provided argument to the set of arguments handled by this parser and puts the argument in the LDAP
     * connection group.
     *
     * @param argument
     *            The argument to add to this sub command.
     * @throws ArgumentException
     *             If the provided argument conflicts with another global or subcommand argument that has already been
     *             defined.
     */
    @Override
    public void addArgument(Argument argument) throws ArgumentException {
        final ArgumentGroup group = getStandardGroup(argument);
        if (group == ldapArgGroup) {
            addGlobalArgument(argument);
        } else {
            super.addArgument(argument);
        }
    public void addLdapConnectionArgument(final Argument argument) throws ArgumentException {
        addGlobalArgument(argument, null);
    }
    /**