protected void validateArgumentList(String[] args, boolean supportsTarget, boolean supportsDefaultTarget) {
        checkRequiredArguments(args, !supportsTarget || supportsDefaultTarget);

        // If the command supports a target name
        // skip the first argument if it is the target name.
        int firstArg = 1;
        if (supportsTarget) {
            if (!supportsDefaultTarget) {
                firstArg = 2;
            } else {
                if (args.length > 1) {
                    String primArg = args[1];
                    if (!primArg.startsWith("-"))
                        firstArg = 2;
                }
            }
        }

        // Arguments and values come in pairs (expect -password).
        // Anything outside of that pattern is invalid.
        // Loop through, jumping in pairs except when we encounter
        // -password -- that may be an interactive prompt which won't
        // define a value.
        for (int i = firstArg; i < args.length; i++) {
            String argName = getArgName(args[i]);
            if (!isKnownArgument(argName)) {
                throw new IllegalArgumentException(getMessage("invalidArg", argName));
            }
            // Everything we accept as an arg expects an name=value pair.
            // If we see anything without the =value pair, error
            if (!args[i].contains("=")) {
                throw new IllegalArgumentException(getMessage("missingValue", argName));
            }
        }
    }
protected void validateArgumentList ( String [ ] args , boolean supportsTarget , boolean supportsDefaultTarget ) { checkRequiredArguments ( args , ! supportsTarget || supportsDefaultTarget ) ; int firstArg = 1 ; if ( supportsTarget ) { if ( ! supportsDefaultTarget ) { firstArg = 2 ; } else { if ( args . length > 1 ) { String primArg = args [ 1 ] ; if ( ! primArg . startsWith ( "-" ) ) firstArg = 2 ; } } } for ( int i = firstArg ; i < args . length ; i ++ ) { String argName = getArgName ( args [ i ] ) ; if ( ! isKnownArgument ( argName ) ) { throw new IllegalArgumentException ( getMessage ( "invalidArg" , argName ) ) ; } if ( ! args [ i ] . contains ( "=" ) ) { throw new IllegalArgumentException ( getMessage ( "missingValue" , argName ) ) ; } } }
Validates that there are no unknown arguments or values specified
to the task.

@param args the arguments to the task
@param supportsTarget
@param supportsDefaultTarget
@throws IllegalArgumentException if an argument is defined is unknown