{"record":{"id":"25c902c4ebe3ab85","repo":"openjdk/jdk","slug":"error-reading-property-file","errorCode":null,"errorMessage":"error reading property file","messagePattern":"error reading property file","errorType":"exception","errorClass":"BuildException","httpStatus":null,"severity":"error","filePath":"make/langtools/tools/anttasks/SelectToolTask.java","lineNumber":265,"sourceCode":"        okButton.addActionListener(e -> {\n            JDialog d = (JDialog) SwingUtilities.getAncestorOfClass(JDialog.class, p);\n            d.setVisible(false);\n        });\n        p.setOptions(new Object[] { okButton });\n\n        return p;\n    }\n\n    Properties readProperties(File file) {\n        Properties p = new Properties();\n        if (file != null && file.exists()) {\n            Reader in = null;\n            try {\n                in = new BufferedReader(new FileReader(file));\n                p.load(in);\n                in.close();\n            } catch (IOException e) {\n                throw new BuildException(\"error reading property file\", e);\n            } finally {\n                if (in != null) {\n                    try {\n                        in.close();\n                    } catch (IOException e) {\n                        throw new BuildException(\"cannot close property file\", e);\n                    }\n                }\n            }\n        }\n        return p;\n    }\n\n    void writeProperties(File file, Properties p) {\n        if (file != null) {\n            Writer out = null;\n            try {\n                File dir = file.getParentFile();","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/openjdk/jdk/blob/88dfb74bbeefcf2b0aa11835183bcd949998fc8f/make/langtools/tools/anttasks/SelectToolTask.java#L247-L283","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check file permissions on the path reported by the task and chmod it readable.","Look at the wrapped cause (BuildException.getCause()) for the exact IOException type.","If the file is corrupt or truncated, delete it — the task regenerates defaults and prompts for tool selection again."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-check readability of the property file\nif (file != null && file.exists() && !file.canRead())\n    throw new BuildException(\"property file not readable: \" + file);","typeGuard":null,"tryCatchPattern":"try {\n    return readProperties(file);\n} catch (BuildException e) {\n    IOException cause = (IOException) e.getCause();\n    if (cause != null && cause.getMessage() != null && cause.getMessage().contains(\"Permission denied\"))\n        throw new BuildException(\"fix permissions on \" + file, cause);\n    throw e;\n}","preventionTips":["Keep build state files under a directory owned by the build user.","Avoid sudo/root builds that leave root-owned state files behind.","If state is corrupt, delete the properties file — the task rebuilds it."],"tags":["ant","properties","io","file-permissions"],"backgroundTag":null,"analyzedSha":"88dfb74bbeefcf2b0aa11835183bcd949998fc8f","analyzedAt":"2026-08-14T11:45:09.665Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}