{"record":{"id":"236301f87ddf1a8b","repo":"openjdk/jdk","slug":"error-writing-property-file","errorCode":null,"errorMessage":"error writing property file","messagePattern":"error writing property file","errorType":"exception","errorClass":"BuildException","httpStatus":null,"severity":"error","filePath":"make/langtools/tools/anttasks/SelectToolTask.java","lineNumber":290,"sourceCode":"                    }\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();\n                if (dir != null && !dir.exists())\n                    dir.mkdirs();\n                out = new BufferedWriter(new FileWriter(file));\n                p.store(out, \"langtools properties\");\n                out.close();\n            } catch (IOException e) {\n                throw new BuildException(\"error writing property file\", e);\n            } finally {\n                if (out != null) {\n                    try {\n                        out.close();\n                    } catch (IOException e) {\n                        throw new BuildException(\"cannot close property file\", e);\n                    }\n                }\n            }\n        }\n    }\n\n    String getDefaultArgsForTool(Properties props, ToolChoices tool) {\n        if (tool == null)\n            return \"\";\n        String toolName = tool.toolName;\n        return toolName.equals(\"\") ? \"\" : props.getProperty(toolName + \".args\", \"\");\n    }","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/openjdk/jdk/blob/88dfb74bbeefcf2b0aa11835183bcd949998fc8f/make/langtools/tools/anttasks/SelectToolTask.java#L272-L308","documentation":"Thrown by SelectToolTask.writeProperties when storing the tool-selection Properties raises an IOException — the task cannot persist its state file. The cause IOException identifies the underlying failure (disk full, permission denied, directory creation failed).","triggerScenarios":"The select-tool task finishing and attempting p.store() when the parent directory cannot be created by mkdirs(), the file is not writable, or the disk is full.","commonSituations":"Read-only checkout of the JDK forest; build dir owned by another user after running a build under sudo; disk quota exceeded on CI.","solutions":["Check writability of the target path: touch the file as the same user running Ant.","Free disk space or raise the quota if the cause is ENOSPC.","Correct ownership of the build directory (chown -R) after mixed-user builds."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before storing: verify the destination is creatable/writable\nFile dir = file.getParentFile();\nif (dir != null && !dir.exists() && !dir.mkdirs())\n    throw new BuildException(\"cannot create \" + dir);\nif (file.exists() && !file.canWrite())\n    throw new BuildException(\"not writable: \" + file);\n// optional disk-space sanity check on the target partition\nif (file.getUsableSpace() < 1024 * 1024)\n    throw new BuildException(\"low disk space on \" + file);","typeGuard":null,"tryCatchPattern":"try {\n    writeProperties(file, p);\n} catch (BuildException e) {\n    if (e.getCause() instanceof java.io.IOException ioe)\n        throw new BuildException(\"cannot persist tool selection to \" + file + \": \" + ioe.getMessage(), ioe);\n    throw e;\n}","preventionTips":["Make build/state directories user-owned and writable before starting Ant.","Monitor free disk space on CI hosts; state-file writes are among the first ENOSPC victims.","Never mix root and user builds in the same output tree."],"tags":["ant","properties","io","disk-full","permissions"],"backgroundTag":null,"analyzedSha":"88dfb74bbeefcf2b0aa11835183bcd949998fc8f","analyzedAt":"2026-08-14T11:45:09.665Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}