{"record":{"id":"44518b8654d940d0","repo":"openjdk/jdk","slug":"propertiesparser-failed","errorCode":null,"errorMessage":"PropertiesParser failed.","messagePattern":"PropertiesParser failed\\.","errorType":"exception","errorClass":"BuildException","httpStatus":null,"severity":"error","filePath":"make/langtools/tools/anttasks/PropertiesParserTask.java","lineNumber":86,"sourceCode":"                    // Arguably, the comparison in the next line should be \">\", not \">=\"\n                    // but that assumes the resolution of the last modified time is fine\n                    // grained enough; in practice, it is better to use \">=\".\n                    if (destFile.exists() && destFile.lastModified() >= srcFile.lastModified())\n                        continue;\n                    destDir.mkdirs();\n                    mainOpts.add(\"-compile\");\n                    mainOpts.add(srcFile.getPath());\n                    mainOpts.add(destDir.getPath());\n                    count++;\n                }\n            }\n        }\n        if (mainOpts.size() > 0) {\n            log(\"Generating \" + count + \" resource files to \" + destDir, Project.MSG_INFO);\n            PropertiesParser pp = new PropertiesParser(msg -> log(msg, Project.MSG_INFO));\n            boolean ok = pp.run(mainOpts.toArray(new String[mainOpts.size()]));\n            if (!ok)\n                throw new BuildException(\"PropertiesParser failed.\");\n        }\n    }\n\n    private Path srcDirs;\n    private File destDir;\n}\n","sourceCodeStart":68,"sourceCodeEnd":93,"githubUrl":"https://github.com/openjdk/jdk/blob/88dfb74bbeefcf2b0aa11835183bcd949998fc8f/make/langtools/tools/anttasks/PropertiesParserTask.java#L68-L93","documentation":"Thrown by the PropertiesParser Ant task when PropertiesParser.run() returns false. PropertiesParser validates and (with -compile) generates resource-bundle-like output from .properties files; failure means one of the collected files failed parsing or code generation, with the reason already logged through the task's logger.","triggerScenarios":"Running the properties-parser target where mainOpts is non-empty and a .properties file violates the parser's rules (duplicate keys, malformed escapes) or its generated output cannot be written to destDir.","commonSituations":"Merging branches that both add the same key to a bundle; hand-edited properties files with typos; a read-only or deleted gensrc directory.","solutions":["Re-run with Ant -v: every parser message is logged at MSG_INFO and will name the file and line that failed.","Fix duplicate keys / bad \\u escapes in the reported file.","Clean and recreate the destDir so all files regenerate."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// screen files before handing them to PropertiesParser\nfor (String f : filesToParse) {\n    Properties tmp = new Properties();\n    try (Reader r = Files.newBufferedReader(Paths.get(f), StandardCharsets.ISO_8859_1)) {\n        tmp.load(r);\n    } catch (Exception e) {\n        throw new IllegalStateException(\"properties file fails pre-parse: \" + f, e);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    propertiesParserTask.execute();\n} catch (BuildException e) {\n    // parser diagnostics were logged via the msg -> log(msg, MSG_INFO) consumer; read them first\n    throw new BuildException(\"PropertiesParser failed; see parser log output above\", e.getCause());\n}","preventionTips":["Run a properties lint (duplicate keys, escapes) in CI before the build.","Keep bundles Latin-1 encoded; run native2ascii-style conversion for non-ASCII.","Clean gensrc output directories between major builds."],"tags":["ant","properties","i18n","build","validation"],"backgroundTag":null,"analyzedSha":"88dfb74bbeefcf2b0aa11835183bcd949998fc8f","analyzedAt":"2026-08-14T11:45:09.665Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}