Skip to content

Commit 64fb4dd

Browse files
author
Gary Gregory
committed
[IO-769] FileUtils.copyFileToDirectory can lead to not accessible file
when preserving the file date Update Javadoc
1 parent ea1cbed commit 64fb4dd

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

src/main/java/org/apache/commons/io/FileUtils.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ public static void copyDirectoryToDirectory(final File sourceDir, final File des
745745
* </p>
746746
* <p>
747747
* <strong>Note:</strong> This method tries to preserve the file's last modified date/times using
748-
* {@link File#setLastModified(long)}, however it is not guaranteed that the operation will succeed. If the
748+
* {@link StandardCopyOption#COPY_ATTRIBUTES}, however it is not guaranteed that the operation will succeed. If the
749749
* modification operation fails, the methods throws IOException.
750750
* </p>
751751
*
@@ -771,7 +771,7 @@ public static void copyFile(final File srcFile, final File destFile) throws IOEx
771771
* </p>
772772
* <p>
773773
* <strong>Note:</strong> Setting {@code preserveFileDate} to {@code true} tries to preserve the file's last
774-
* modified date/times using {@link File#setLastModified(long)}, however it is not guaranteed that the operation
774+
* modified date/times using {@link StandardCopyOption#COPY_ATTRIBUTES}, however it is not guaranteed that the operation
775775
* will succeed. If the modification operation fails, the methods throws IOException.
776776
* </p>
777777
*
@@ -801,7 +801,7 @@ public static void copyFile(final File srcFile, final File destFile, final boole
801801
* </p>
802802
* <p>
803803
* <strong>Note:</strong> Setting {@code preserveFileDate} to {@code true} tries to preserve the file's last
804-
* modified date/times using {@link File#setLastModified(long)}, however it is not guaranteed that the operation
804+
* modified date/times using {@link StandardCopyOption#COPY_ATTRIBUTES}, however it is not guaranteed that the operation
805805
* will succeed. If the modification operation fails, the methods throws IOException.
806806
* </p>
807807
*
@@ -886,7 +886,7 @@ public static long copyFile(final File input, final OutputStream output) throws
886886
* </p>
887887
* <p>
888888
* <strong>Note:</strong> This method tries to preserve the file's last modified date/times using
889-
* {@link File#setLastModified(long)}, however it is not guaranteed that the operation will succeed. If the
889+
* {@link StandardCopyOption#COPY_ATTRIBUTES}, however it is not guaranteed that the operation will succeed. If the
890890
* modification operation fails, the methods throws IOException.
891891
* </p>
892892
*
@@ -910,7 +910,7 @@ public static void copyFileToDirectory(final File srcFile, final File destDir) t
910910
* </p>
911911
* <p>
912912
* <strong>Note:</strong> Setting {@code preserveFileDate} to {@code true} tries to preserve the file's last
913-
* modified date/times using {@link File#setLastModified(long)}, however it is not guaranteed that the operation
913+
* modified date/times using {@link StandardCopyOption#COPY_ATTRIBUTES}, however it is not guaranteed that the operation
914914
* will succeed. If the modification operation fails, the methods throws IOException.
915915
* </p>
916916
*
@@ -963,13 +963,14 @@ public static void copyInputStreamToFile(final InputStream source, final File de
963963
* specified destination directory.
964964
* </p>
965965
* <p>
966-
* The destination directory is created if it does not exist. If the destination directory did exist, then this
967-
* method merges the source with the destination, with the source taking precedence.
966+
* The destination directory is created if it does not exist. If the destination directory did exist, then this method
967+
* merges the source with the destination, with the source taking precedence.
968968
* </p>
969969
* <p>
970970
* <strong>Note:</strong> This method tries to preserve the files' last modified date/times using
971-
* {@link File#setLastModified(long)}, however it is not guaranteed that those operations will succeed. If the
972-
* modification operation fails, the methods throws IOException.
971+
* {@link StandardCopyOption#COPY_ATTRIBUTES} or {@link File#setLastModified(long)} depending on the input, however it
972+
* is not guaranteed that those operations will succeed. If the modification operation fails, the methods throws
973+
* IOException.
973974
* </p>
974975
*
975976
* @param sourceFile an existing file or directory to copy, must not be {@code null}.

0 commit comments

Comments
 (0)