Skip to content

Commit 2d7d569

Browse files
author
Gary Gregory
committed
LockableFileWriter.close() should fail when the lock file cannot be
deleted.
1 parent 78f0019 commit 2d7d569

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/changes/changes.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ The <action> type attribute can be add,update,fix,remove.
105105
<action issue="IO-705" dev="ggregory" type="fix" due-to="Hao Zhong, Gary Gregory">
106106
MarkShieldInputStream#reset should throw UnsupportedOperationException.
107107
</action>
108+
<action issue="IO-705" dev="ggregory" type="fix" due-to="Hao Zhong, Gary Gregory">
109+
LockableFileWriter.close() should fail when the lock file cannot be deleted.
110+
</action>
108111
<!-- ADD -->
109112
<action dev="ggregory" type="add" due-to="Gary Gregory">
110113
Add FileSystemProviders class.

src/main/java/org/apache/commons/io/output/LockableFileWriter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ private Writer initWriter(final File file, final Charset charset, final boolean
279279
}
280280

281281
/**
282-
* Closes the file writer and deletes the lock file (if possible).
282+
* Closes the file writer and deletes the lock file.
283283
*
284284
* @throws IOException if an I/O error occurs
285285
*/
@@ -288,7 +288,7 @@ public void close() throws IOException {
288288
try {
289289
out.close();
290290
} finally {
291-
lockFile.delete();
291+
FileUtils.delete(lockFile);
292292
}
293293
}
294294

0 commit comments

Comments
 (0)