openjdk/jdk · error · BuildException

error reading property file

Error message

error reading property file

What it means

Thrown by SelectToolTask.readProperties when loading the langtools properties file (e.g. the build's tool selection state) raises an IOException — the file exists but cannot be opened or parsed. The original IOException is attached as the cause.

Source

Thrown at make/langtools/tools/anttasks/SelectToolTask.java:265

        okButton.addActionListener(e -> {
            JDialog d = (JDialog) SwingUtilities.getAncestorOfClass(JDialog.class, p);
            d.setVisible(false);
        });
        p.setOptions(new Object[] { okButton });

        return p;
    }

    Properties readProperties(File file) {
        Properties p = new Properties();
        if (file != null && file.exists()) {
            Reader in = null;
            try {
                in = new BufferedReader(new FileReader(file));
                p.load(in);
                in.close();
            } catch (IOException e) {
                throw new BuildException("error reading property file", e);
            } finally {
                if (in != null) {
                    try {
                        in.close();
                    } catch (IOException e) {
                        throw new BuildException("cannot close property file", e);
                    }
                }
            }
        }
        return p;
    }

    void writeProperties(File file, Properties p) {
        if (file != null) {
            Writer out = null;
            try {
                File dir = file.getParentFile();

View on GitHub (pinned to 88dfb74bbe)

Solutions

  1. Check file permissions on the path reported by the task and chmod it readable.
  2. Look at the wrapped cause (BuildException.getCause()) for the exact IOException type.
  3. If the file is corrupt or truncated, delete it — the task regenerates defaults and prompts for tool selection again.
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check readability of the property file
if (file != null && file.exists() && !file.canRead())
    throw new BuildException("property file not readable: " + file);

Try / catch

try {
    return readProperties(file);
} catch (BuildException e) {
    IOException cause = (IOException) e.getCause();
    if (cause != null && cause.getMessage() != null && cause.getMessage().contains("Permission denied"))
        throw new BuildException("fix permissions on " + file, cause);
    throw e;
}

Prevention

When it happens

Trigger: Calling the select-tool Ant task when the configured property file exists but lacks read permission, is locked by another process, or contains bytes that break the Reader-based load.

Common situations: A properties file created by a different user/root during a previous build; a network filesystem returning transient I/O errors; a truncated file from an interrupted write.

Related errors


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