mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-17 05:52:26 +00:00
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:
1 parent
f304d5676c
commit
132ca44407
1 file changed
+7
-2
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user