You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2023/04/28 20:47:46 UTC

[commons-io] 02/02: Missing throw in org.apache.commons.io.FileUtils.copyFile(File, File, boolean, CopyOption...)

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

commit b8c11df6c016067c19211fdfba2a28d1cd599be7
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Apr 28 16:47:39 2023 -0400

    Missing throw in org.apache.commons.io.FileUtils.copyFile(File, File,
    boolean, CopyOption...)
---
 src/main/java/org/apache/commons/io/FileUtils.java | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/commons/io/FileUtils.java b/src/main/java/org/apache/commons/io/FileUtils.java
index 6c832768..b4bb92b2 100644
--- a/src/main/java/org/apache/commons/io/FileUtils.java
+++ b/src/main/java/org/apache/commons/io/FileUtils.java
@@ -813,10 +813,8 @@ public class FileUtils {
         Files.copy(srcFile.toPath(), destFile.toPath(), copyOptions);
 
         // On Windows, the last modified time is copied by default.
-        if (preserveFileDate) {
-            if (!setTimes(srcFile, destFile)) {
-                throw new IOException("Cannot set the file time.");
-            }
+        if (preserveFileDate && !setTimes(srcFile, destFile)) {
+            throw new IOException("Cannot set the file time.");
         }
     }