clean up a temporary file when failing to write.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@11297 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2008-08-06 21:04:27 +00:00
1 parent f304d5676c
commit 132ca44407
1 file changed
+7 -2
+7 -2
View File
@@ -53,8 +53,13 @@ public class TextFile {
public void write(String text) throws IOException {
file.getParentFile().mkdirs();
AtomicFileWriter w = new AtomicFileWriter(file);
w.write(text);
w.commit();
try {
w.write(text);
w.commit();
} catch (IOException e) {
w.abort();
throw e;
}
}
public String readTrim() throws IOException {