{"record":{"id":"920dd32be2951642","repo":"apache/maven","slug":"unable-to-parse-unicode-value","errorCode":null,"errorMessage":"Unable to parse unicode value: {}","messagePattern":"Unable to parse unicode value: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"impl/maven-cli/src/main/java/org/apache/maven/cling/props/MavenProperties.java","lineNumber":603,"sourceCode":"        boolean hadSlash = false;\n        boolean inUnicode = false;\n        for (int i = 0; i < sz; i++) {\n            char ch = str.charAt(i);\n            if (inUnicode) {\n                // if in unicode, then we're reading unicode\n                // values in somehow\n                unicode.append(ch);\n                if (unicode.length() == UNICODE_LEN) {\n                    // unicode now contains the four hex digits\n                    // which represents our unicode character\n                    try {\n                        int value = Integer.parseInt(unicode.toString(), HEX_RADIX);\n                        out.append((char) value);\n                        unicode.setLength(0);\n                        inUnicode = false;\n                        hadSlash = false;\n                    } catch (NumberFormatException nfe) {\n                        throw new IllegalArgumentException(\"Unable to parse unicode value: \" + unicode, nfe);\n                    }\n                }\n                continue;\n            }\n\n            if (hadSlash) {\n                // handle an escaped value\n                hadSlash = false;\n                switch (ch) {\n                    case '\\\\':\n                        out.append('\\\\');\n                        break;\n                    case '\\'':\n                        out.append('\\'');\n                        break;\n                    case '\\\"':\n                        out.append('\"');\n                        break;","sourceCodeStart":585,"sourceCodeEnd":621,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-cli/src/main/java/org/apache/maven/cling/props/MavenProperties.java#L585-L621","documentation":"MavenProperties.unescapeJava processes Java-style escapes while Maven loads its properties files (installation conf/maven-system.properties, conf/maven-user.properties and their includes). When it meets `\\u` the next four characters must be hex digits; Integer.parseInt(...,16) throwing NumberFormatException is wrapped as IllegalArgumentException 'Unable to parse unicode value'. The classic producer is an unescaped Windows path, where the `\\u` of `\\users` or `\\util` starts an escape.","triggerScenarios":"A property value containing a backslash-u sequence not followed by exactly four hex digits, e.g. `dir=C:\\users\\build` (the `\\use` after `C:` is read as a unicode escape), or a hand-typed `\\u00G1`.","commonSituations":"Windows paths pasted into the installation's properties files; generated files that do not escape backslashes; values copied from documentation containing literal backslashes.","solutions":["Escape every backslash: `dir=C:\\\\users\\\\build`.","Prefer forward slashes on Windows paths: `dir=C:/users/build`.","Fix malformed \\uXXXX escapes to carry exactly four hex digits (0-9, a-f).","Regenerate the file with java.util.Properties.store, which escapes backslashes correctly."],"exampleFix":"# before: '\\u' in the path starts a unicode escape\ndist.dir=C:\\users\\me\\build\n\n# after\ndist.dir=C:/users/me/build","handlingStrategy":"validation","validationCode":"Pattern BAD_UNICODE = Pattern.compile(\"\\\\\\\\u(?![0-9a-fA-F]{4})\");\nfor (String line : Files.readAllLines(propsFile, StandardCharsets.UTF_8)) {\n    if (BAD_UNICODE.matcher(line).find()) {\n        throw new IllegalArgumentException(\"Invalid \\\\u escape in \" + propsFile + \": \" + line);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use forward slashes in Windows paths inside properties files.","Escape all backslashes as \\\\\\\\ when literals are required.","Prefer Properties.store to generate files; it escapes correctly."],"tags":["maven","properties","unicode","escaping","configuration"],"backgroundTag":"properties-unicode-escape-invalid","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}