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
492281
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));
            }
        }
    }
880730
protected void assertArgumentNotNull(String argumentName, Object value) {
        if (argumentName == null) {
            String msg = "The argument name should not be null: argName=null value=" + value;
            throw new IllegalArgumentException(msg);
        }
        if (value == null) {
            String msg = "The value should not be null: argName=" + argumentName;
            throw new IllegalArgumentException(msg);
        }
    }
38488
public Arguments processArgs(final String[] arguments) {
        useColor = getUseColor();

        final Map<String, Object> definedProps = new HashMap<>();
        final Deque<String> args = new ArrayDeque<>(Arrays.asList(arguments));
        while (!args.isEmpty()) {
            final String arg = args.pop();

            if (isLongForm(arg, "-help") || arg.equals("-h")) {
                justPrintUsage = true;
            } else if (isLongForm(arg, "-version")) {
                justPrintVersion = true;
            } else if (isLongForm(arg, "-plugins")) {
                justPrintPlugins = true;
            } else if (isLongForm(arg, "-transtypes")) {
                justPrintTranstypes = true;
            } else if (isLongForm(arg, "-deliverables")) {
                justPrintDeliverables = true;
            } else if (isLongForm(arg, "-install")) {
                handleArgInstall(arg, args);
            } else if (isLongForm(arg, "-project") || arg.equals("-p")) {
                handleArgProject(arg, args);
            } else if (isLongForm(arg, "-force")) {
                definedProps.put("force", "true");
            } else if (isLongForm(arg, "-uninstall")) {
                handleArgUninstall(arg, args);
            } else if (isLongForm(arg, "-diagnostics")) {
                justPrintDiagnostics = true;
            } else if (isLongForm(arg, "-verbose") || arg.equals("-v")) {
                msgOutputLevel = Project.MSG_INFO;
            } else if (isLongForm(arg, "-debug") || arg.equals("-d")) {
                msgOutputLevel = Project.MSG_VERBOSE;
            } else if (isLongForm(arg, "-noinput")) {
                allowInput = false;
            } else if (isLongForm(arg, "-logfile") || arg.equals("-l")) {
                handleArgLogFile(arg, args);
            } else if (isLongForm(arg, "-buildfile") || isLongForm(arg, "-file")) { //|| arg.equals("-f")
                handleArgBuildFile(args);
            } else if (isLongForm(arg, "-listener")) {
                handleArgListener(args);
            } else if (arg.startsWith("-D")) {
                handleArgDefine(arg, args);
            } else if (isLongForm(arg, "-logger")) {
                handleArgLogger(args);
            } else if (isLongForm(arg, "-inputhandler")) {
                handleArgInputHandler(args);
            } else if (isLongForm(arg, "-emacs") || arg.equals("-e")) {
                emacsMode = true;
            } else if (isLongForm(arg, "-propertyfile")) {
                handleArgPropertyFile(arg, args);
            } else if (arg.equals("-k") || isLongForm(arg, "-keep-going")) {
                keepGoingMode = true;
            } else if (isLongForm(arg, "-nice")) {
                handleArgNice(args);
            } else if (isLongForm(arg, "-input") || arg.equals("-i")) {
                handleArgInput(arg, args, ARGUMENTS.get(getArgumentName(arg)));
            } else if (ARGUMENTS.containsKey(getArgumentName(arg))) {
                definedProps.putAll(handleParameterArg(arg, args, ARGUMENTS.get(getArgumentName(arg))));
            } else if (getPluginArguments().containsKey(getArgumentName(arg))) {
                definedProps.putAll(handleParameterArg(arg, args, getPluginArguments().get(getArgumentName(arg))));
            } else if (LAUNCH_COMMANDS.contains(arg)) {
                // catch script/ant mismatch with a meaningful message
                // we could ignore it, but there are likely to be other
                // version problems, so we stamp down on the configuration now
                final String msg = "Ant's Main method is being handed " + "an option " + arg
                        + " that is only for the launcher class."
                        + "\nThis can be caused by a version mismatch between "
                        + "the ant script/.bat file and Ant itself.";
                throw new BuildException(msg);
            } else if (isLongForm(arg, "-autoproxy")) {
                proxy = true;
            } else if (arg.startsWith("-") || arg.startsWith("/")) {
                // we don't have any more args to recognize!
                throw new IllegalArgumentException(arg);
            } else {
                // if it's no other arg, it may be the target
                targets.addElement(arg);
            }
        }
        if (!inputs.isEmpty()) {
            definedProps.put("args.input", inputs.get(0));
        }

        if (install && msgOutputLevel < Project.MSG_INFO) {
            emacsMode = true;
        }

        definedProps.putAll(loadPropertyFiles());

        return new Arguments(useColor, msgOutputLevel, buildFile, install, installFile, projectFile, uninstallId,
                inputs, targets, listeners, propertyFiles, allowInput, keepGoingMode, loggerClassname,
                inputHandlerClassname, emacsMode, threadPriority, proxy, justPrintUsage, justPrintVersion,
                justPrintDiagnostics, justPrintPlugins, justPrintTranstypes, justPrintDeliverables, logFile,
                definedProps);
    }
293495
def verify_arguments(self, args=None, kwargs=None):
        

        args = self.args if args is None else args
        kwargs = self.kwargs if kwargs is None else kwargs

        try:
            verify_arguments(self._target, self._method_name, args, kwargs)
        except VerifyingBuiltinDoubleArgumentError:
            if doubles.lifecycle.ignore_builtin_verification():
                raise
551736
private void validateArgumentValues()  {
        namedArgumentDefinitions = validatePluginArgumentValues(); // trim the list of plugin-derived argument definitions before validation
        for (final NamedArgumentDefinition argumentDefinition : namedArgumentDefinitions) {
            argumentDefinition.validateValues(this);
        }
        if (positionalArgumentDefinition != null) {
            positionalArgumentDefinition.validateValues(this);
        }
    }
607166
public void setArgs(String[] args) {
        if (args == null) {
            args = new String[]{};
        }
        this.args = args;
        this.argsList = Collections.unmodifiableList(new ArrayList<String>(Arrays.asList(args)));
    }
1228469
function checkArgs() {
  if (arguments.length === 0) {
    throw new Error('no argument for executing resource service');
  }

  var args = arguments[0];
  if (args.name === void 0) {
    throw new Error('no name for executing resource service');
  }

  return args;
}
66053
public static void isNotEmpty( Collection<?> argument,
                                   String name ) {
        isNotNull(argument, name);
        if (argument.isEmpty()) {
            throw new IllegalArgumentException(CommonI18n.argumentMayNotBeEmpty.text(name));
        }
    }
832067
function validateRunnerArgs(Ctor, config, argv, cb) {
  if (typeof cb !== 'function') {
    throw new Error('expected a callback function');
  }
  if (argv == null || typeof argv !== 'object') {
    return new Error('expected the third argument to be an options object');
  }

  if (config == null || typeof config !== 'object') {
    return new Error('expected the second argument to be a liftoff config object');
  }

  if (typeof Ctor !== 'function' || typeof Ctor.namespace !== 'function') {
    return new Error('expected the first argument to be a Base constructor');
  }
}
50667
private void parseCommandLineArgs(String[] args) throws ConfigurationException {
        if (args == null || args.length == 0) {
            return;
        }
        logger.info("Parsing command line arguments");
        m_commandLineArgs = args;
        
        try {
            for (int inx = 0; inx < args.length; inx++) {
                String arg = args[inx];
                if (arg.equals("-?") || arg.equalsIgnoreCase("-h") || arg.equalsIgnoreCase("-help")) {
                    System.out.println("See documentation and doradus.yaml for help.");
                    System.exit(0);
                }
                Utils.require(arg.charAt(0) == '-', "Unrecognized argument: %s", arg);
                Utils.require(inx + 1 < args.length, "A value is expected after: %s", arg);
                String name = arg.substring(1);
                String value = args[++inx];
                setCommandLineParam(name, value);
            }
        } catch (Exception e) {
            logger.error("Failed to parse command line arguments", e);
            throw new ConfigurationException("Failed to parse command line arguments", e);
        }
    }
1225772
private void parseArgs(String[] args) {
        int index = 0;
        while (index < args.length) {
            String name = args[index];
            if (name.equals("-?") || name.equalsIgnoreCase("-help")) {
                usage();
            }
            if (name.charAt(0) != '-') {
                m_logger.error("Unrecognized parameter: {}", name);
                usage();
            }
            if (++index >= args.length) {
                m_logger.error("Another parameter expected after '{}'", name);
                usage();
            }
            String value = args[index];
            try {
                m_config.set(name.substring(1), value);
            } catch (Exception e) {
                m_logger.error(e.toString());
                usage();
            }
            index++;
        }
    }
682875
public void setArgs(java.util.Collection<CodeGenNodeArg> args) {
        if (args == null) {
            this.args = null;
            return;
        }

        this.args = new java.util.ArrayList<CodeGenNodeArg>(args);
    }
977484
public static void main(String[] args) {

        // ArrayList<String> tmpArgs = new ArrayList<String>(Arrays.asList(args));

        // args = tmpArgs.toArray(new String[0]);

        FlagOption suppressStatusOutOpt = new FlagOption("suppressStatusOut", 'S', SUPPRESS_STATUS_OUT_MSG);

        FlagOption suppressResultOutOpt = new FlagOption("suppressResultOut", 'R', SUPPRESS_RESULT_OUT_MSG);

        IntOption statusUpdateFreqOpt = new IntOption("statusUpdateFrequency", 'F', STATUS_UPDATE_FREQ_MSG, 1000, 0, Integer.MAX_VALUE);

        Option[] extraOptions = new Option[] { suppressStatusOutOpt, suppressResultOutOpt, statusUpdateFreqOpt };

        StringBuilder cliString = new StringBuilder();
        for (String arg : args) {
            cliString.append(" ").append(arg);
        }
        logger.debug("Command line string = {}", cliString.toString());
        System.out.println("Command line string = " + cliString.toString());

        Task task;
        try {
            task = ClassOption.cliStringToObject(cliString.toString(), Task.class, extraOptions);
            logger.info("Successfully instantiating {}", task.getClass().getCanonicalName());
        } catch (Exception e) {
            logger.error("Fail to initialize the task", e);
            System.out.println("Fail to initialize the task" + e);
            return;
        }
        task.setFactory(new SimpleComponentFactory());
        task.init();
        SimpleEngine.submitTopology(task.getTopology());
    }
409140
private void validateArgumentDefinitions() {
        for (final NamedArgumentDefinition mutexSourceDef : namedArgumentDefinitions) {
            for (final String mutexTarget : mutexSourceDef.getMutexTargetList()) {
                final NamedArgumentDefinition mutexTargetDef = namedArgumentsDefinitionsByAlias.get(mutexTarget);
                if (mutexTargetDef == null) {
                    throw new CommandLineException.CommandLineParserInternalException(
                            String.format("Argument '%s' references a nonexistent mutex argument '%s'",
                                    mutexSourceDef.getArgumentAliasDisplayString(),
                                    mutexTarget)
                    );
                } else {
                    // Add at least one alias for the mutex source to the mutex target to ensure the
                    // relationship is symmetric for purposes of usage/help doc display.
                    mutexTargetDef.addMutexTarget(mutexSourceDef.getLongName());
                }
            }
        }
    }
967103
private void validateParameterResolvers(MethodTarget methodTarget) {
		Utils.createMethodParameters(methodTarget.getMethod())
				.forEach(parameter -> {
					parameterResolvers.stream()
							.filter(resolver -> resolver.supports(parameter))
							.findFirst()
							.orElseThrow(() -> new ParameterResolverMissingException(parameter));
				});
	}
379422
public static void checkArgument( Object argument, Class<?> expectedClass )
    {
        if ( !expectedClass.isInstance( argument ) )
        {
            throw new IllegalArgumentException( "Argument expected to be of type: " + expectedClass.getName() + " but was: " + argument );
        }
    }
916504
public function check(...$args)
    {
        if (count($args) !== count($this->constraints)) {
            throw new InvalidArgumentException(
                'Argument number mismatch.'
            );
        }

        foreach ($args as $key => $arg) {
            if (!$this->constraints[$key]->check($arg, $args)) {
                throw new InvalidArgumentException(vsprintf(
                    'Argument %s does not meet its constraints.'
                    . "\nFailed constraint: %s\nValue provided:%s",
                    [
                        $key,
                        $this->constraints[$key]->toString(),
                        print_r($arg, true)
                    ]
                ));
            }
        }
    }