{"record":{"id":"ddb2466b3bde8d03","repo":"apache/maven","slug":"lower-function-requires-exactly-one-argument","errorCode":null,"errorMessage":"lower function requires exactly one argument","messagePattern":"lower 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":90,"sourceCode":"     */\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();\n    }\n\n    /**\n     * Returns a substring of the given string.\n     *\n     * @param args A list containing 2 or 3 arguments: the string, start index, and optionally end index\n     * @return The substring\n     * @throws IllegalArgumentException if the number of arguments is not 2 or 3\n     */\n    public Object substring(List<Object> args) {\n        if (args.size() < 2 || args.size() > 3) {\n            throw new IllegalArgumentException(\"substring function requires 2 or 3 arguments\");\n        }\n        String s = ConditionParser.toString(args.get(0));\n        int start = toInt(args.get(1));","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-impl/src/main/java/org/apache/maven/impl/model/profile/ConditionFunctions.java#L72-L108","documentation":"lower() is a built-in function of Maven 4.1 profile activation conditions (<activation><condition>). ConditionFunctions.lower throws IllegalArgumentException unless exactly one argument is supplied; the activator reports it as 'Error parsing profile activation condition' and the profile remains inactive.","triggerScenarios":"A condition like lower() or lower(${os.name}, 'en') — the correct form is lower(${os.name}) == 'linux' with one string argument.","commonSituations":"Copying a locale argument from other APIs; an editing slip leaving an empty argument list; mixing up lower with substring-style multi-argument functions.","solutions":["Rewrite the call as lower(x) with exactly one argument","Verify with mvn help:active-profiles that the profile activates","Keep a signature table of the condition functions handy when writing activations"],"exampleFix":"<!-- before -->\n<condition>lower(${os.name}, 'en') == 'linux'</condition>\n\n<!-- after -->\n<condition>lower(${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, \"lower\", 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":["lower takes exactly one string argument; no locale variant","Review every condition you migrate from old <os>/<property> activation blocks for stray arguments"],"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"}