This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-io.git
The following commit(s) were added to refs/heads/master by this push: new 2d7d569 LockableFileWriter.close() should fail when the lock file cannot be deleted. 2d7d569 is described below commit 2d7d569209c65882432e9c0661fc436b4a42df49 Author: Gary Gregory <gardgreg...@gmail.com> AuthorDate: Sat Jan 23 08:56:46 2021 -0500 LockableFileWriter.close() should fail when the lock file cannot be deleted. --- src/changes/changes.xml | 3 +++ src/main/java/org/apache/commons/io/output/LockableFileWriter.java | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index dd482b2..0f839f9 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -105,6 +105,9 @@ The <action> type attribute can be add,update,fix,remove. <action issue="IO-705" dev="ggregory" type="fix" due-to="Hao Zhong, Gary Gregory"> MarkShieldInputStream#reset should throw UnsupportedOperationException. </action> + <action issue="IO-705" dev="ggregory" type="fix" due-to="Hao Zhong, Gary Gregory"> + LockableFileWriter.close() should fail when the lock file cannot be deleted. + </action> <!-- ADD --> <action dev="ggregory" type="add" due-to="Gary Gregory"> Add FileSystemProviders class. diff --git a/src/main/java/org/apache/commons/io/output/LockableFileWriter.java b/src/main/java/org/apache/commons/io/output/LockableFileWriter.java index ab3392f..28e04be 100644 --- a/src/main/java/org/apache/commons/io/output/LockableFileWriter.java +++ b/src/main/java/org/apache/commons/io/output/LockableFileWriter.java @@ -279,7 +279,7 @@ public class LockableFileWriter extends Writer { } /** - * Closes the file writer and deletes the lock file (if possible). + * Closes the file writer and deletes the lock file. * * @throws IOException if an I/O error occurs */ @@ -288,7 +288,7 @@ public class LockableFileWriter extends Writer { try { out.close(); } finally { - lockFile.delete(); + FileUtils.delete(lockFile); } }