static String validate()

in src/main/java/org/apache/commons/cli/OptionValidator.java [60:82]


    static String validate(final String option) throws IllegalArgumentException {
        // if opt is NULL do not check further
        if (option == null) {
            return null;
        }

        // handle the single character opt
        if (option.length() == 1) {
            final char ch = option.charAt(0);

            if (!isValidOpt(ch)) {
                throw new IllegalArgumentException("Illegal option name '" + ch + "'");
            }
        } else {
            // handle the multi character opt
            for (final char ch : option.toCharArray()) {
                if (!isValidChar(ch)) {
                    throw new IllegalArgumentException("The option '" + option + "' contains an illegal " + "character : '" + ch + "'");
                }
            }
        }
        return option;
    }