{"record":{"id":"5faef441e794ec43","repo":"apache/maven","slug":"upper-function-requires-exactly-one-argument","errorCode":null,"errorMessage":"upper function requires exactly one argument","messagePattern":"upper function requires exactly one argument","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/ConditionFunctions.java","lineNumber":75,"sourceCode":"     */\n    public Object length(List<Object> args) {\n        if (args.size() != 1) {\n            throw new IllegalArgumentException(\"length function requires exactly one argument\");\n        }\n        String s = ConditionParser.toString(args.get(0));\n        return s.length();\n    }\n\n    /**\n     * Converts the given string to uppercase.\n     *\n     * @param args A list containing a single string argument\n     * @return The uppercase version of the input string\n     * @throws IllegalArgumentException if the number of arguments is not exactly one\n     */\n    public Object upper(List<Object> args) {\n        if (args.size() != 1) {\n            throw new IllegalArgumentException(\"upper function requires exactly one argument\");\n        }\n        String s = ConditionParser.toString(args.get(0));\n        return s.toUpperCase();\n    }\n\n    /**\n     * Converts the given string to lowercase.\n     *\n     * @param args A list containing a single string argument\n     * @return The lowercase version of the input string\n     * @throws IllegalArgumentException if the number of arguments is not exactly one\n     */\n    public Object lower(List<Object> args) {\n        if (args.size() != 1) {\n            throw new IllegalArgumentException(\"lower function requires exactly one argument\");\n        }\n        String s = ConditionParser.toString(args.get(0));\n        return s.toLowerCase();","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/ConditionFunctions.java#L57-L93","documentation":"upper() is a built-in function of Maven 4.1 profile activation conditions (<activation><condition>). ConditionFunctions.upper throws IllegalArgumentException unless exactly one argument is supplied; the activator converts it into an 'Error parsing profile activation condition' problem and the profile stays inactive.","triggerScenarios":"A condition like upper(${os.name}, true) or upper() — the function takes exactly one string, e.g. upper(${os.name}) == 'LINUX'.","commonSituations":"Adding a locale or flag argument by analogy with other languages' toUpperCase(value, locale); a stray comma while editing the condition; templates that inject empty values leaving upper().","solutions":["Rewrite the call as upper(x) with exactly one argument, e.g. upper(${os.name}) == 'LINUX'","Verify with mvn help:active-profiles that the profile activates","Compare against the function reference for supported signatures (no locale variant exists)"],"exampleFix":"<!-- before -->\n<condition>upper(${os.name}, 'en') == 'LINUX'</condition>\n\n<!-- after -->\n<condition>upper(${os.name}) == 'LINUX'</condition>","handlingStrategy":"validation","validationCode":"static boolean arityOk(String condition, String fn, int min, int max) {\n    int i = condition.indexOf(fn + \"(\");\n    if (i < 0) return true;\n    String args = condition.substring(i + fn.length() + 1, condition.indexOf(')', i));\n    int n = args.isBlank() ? 0 : args.split(\",\", -1).length;\n    return n >= min && n <= max;\n}\nboolean ok = arityOk(condition, \"upper\", 1, 1);","typeGuard":null,"tryCatchPattern":"try {\n    Object r = new ConditionParser(functions, resolver).parse(condition);\n} catch (IllegalArgumentException e) {\n    // report and treat the profile as inactive\n}","preventionTips":["There is no locale/flags overload: upper takes exactly one string","For case-insensitive comparisons write upper(x) == upper(y) rather than adding arguments","Validate edited conditions with a quick help:active-profiles run"],"tags":["maven","profile-activation","condition-functions","argument-mismatch","string"],"backgroundTag":"invalid-function-arguments","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}