openjdk/jdk · error · BuildException

PropertiesParser failed.

Error message

PropertiesParser failed.

What it means

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.

Source

Thrown at make/langtools/tools/anttasks/PropertiesParserTask.java:86

                    // Arguably, the comparison in the next line should be ">", not ">="
                    // but that assumes the resolution of the last modified time is fine
                    // grained enough; in practice, it is better to use ">=".
                    if (destFile.exists() && destFile.lastModified() >= srcFile.lastModified())
                        continue;
                    destDir.mkdirs();
                    mainOpts.add("-compile");
                    mainOpts.add(srcFile.getPath());
                    mainOpts.add(destDir.getPath());
                    count++;
                }
            }
        }
        if (mainOpts.size() > 0) {
            log("Generating " + count + " resource files to " + destDir, Project.MSG_INFO);
            PropertiesParser pp = new PropertiesParser(msg -> log(msg, Project.MSG_INFO));
            boolean ok = pp.run(mainOpts.toArray(new String[mainOpts.size()]));
            if (!ok)
                throw new BuildException("PropertiesParser failed.");
        }
    }

    private Path srcDirs;
    private File destDir;
}

View on GitHub (pinned to 88dfb74bbe)

Solutions

  1. Re-run with Ant -v: every parser message is logged at MSG_INFO and will name the file and line that failed.
  2. Fix duplicate keys / bad \u escapes in the reported file.
  3. Clean and recreate the destDir so all files regenerate.
Defensive patterns

Strategy: validation

Validate before calling

// screen files before handing them to PropertiesParser
for (String f : filesToParse) {
    Properties tmp = new Properties();
    try (Reader r = Files.newBufferedReader(Paths.get(f), StandardCharsets.ISO_8859_1)) {
        tmp.load(r);
    } catch (Exception e) {
        throw new IllegalStateException("properties file fails pre-parse: " + f, e);
    }
}

Try / catch

try {
    propertiesParserTask.execute();
} catch (BuildException e) {
    // parser diagnostics were logged via the msg -> log(msg, MSG_INFO) consumer; read them first
    throw new BuildException("PropertiesParser failed; see parser log output above", e.getCause());
}

Prevention

When it happens

Trigger: 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.

Common situations: Merging branches that both add the same key to a bundle; hand-edited properties files with typos; a read-only or deleted gensrc directory.

Related errors


AI-assisted analysis of openjdk/jdk@88dfb74bbe (2026-08-14). Data as JSON: /api/errors/44518b8654d940d0. Report an issue: GitHub.