FileUtils.copyFileToDirectory can lead to not accessible file
when preserving the file date
Update Javadoc
MODIFY
src/main/java/org/apache/commons/io/FileUtils.java
src/main/java/org/apache/commons/io/FileUtils.java
@@ -745,7 +745,7 @@ public static void copyDirectoryToDirectory(final File sourceDir, final File des
* </p>
* <p>
* <strong>Note:</strong> This method tries to preserve the file's last modified date/times using
- * {@link File#setLastModified(long)}, however it is not guaranteed that the operation will succeed. If the
+ * {@link StandardCopyOption#COPY_ATTRIBUTES}, however it is not guaranteed that the operation will succeed. If the
* modification operation fails, the methods throws IOException.
* </p>
*
@@ -771,7 +771,7 @@ public static void copyFile(final File srcFile, final File destFile) throws IOEx
* </p>
* <p>
* <strong>Note:</strong> Setting {@code preserveFileDate} to {@code true} tries to preserve the file's last
- * modified date/times using {@link File#setLastModified(long)}, however it is not guaranteed that the operation
+ * modified date/times using {@link StandardCopyOption#COPY_ATTRIBUTES}, however it is not guaranteed that the operation
* will succeed. If the modification operation fails, the methods throws IOException.
* </p>
*
@@ -801,7 +801,7 @@ public static void copyFile(final File srcFile, final File destFile, final boole
* </p>
* <p>
* <strong>Note:</strong> Setting {@code preserveFileDate} to {@code true} tries to preserve the file's last
- * modified date/times using {@link File#setLastModified(long)}, however it is not guaranteed that the operation
+ * modified date/times using {@link StandardCopyOption#COPY_ATTRIBUTES}, however it is not guaranteed that the operation
* will succeed. If the modification operation fails, the methods throws IOException.
* </p>
*
@@ -886,7 +886,7 @@ public static long copyFile(final File input, final OutputStream output) throws
* </p>
* <p>
* <strong>Note:</strong> This method tries to preserve the file's last modified date/times using
- * {@link File#setLastModified(long)}, however it is not guaranteed that the operation will succeed. If the
+ * {@link StandardCopyOption#COPY_ATTRIBUTES}, however it is not guaranteed that the operation will succeed. If the
* modification operation fails, the methods throws IOException.
* </p>
*
@@ -910,7 +910,7 @@ public static void copyFileToDirectory(final File srcFile, final File destDir) t
* </p>
* <p>
* <strong>Note:</strong> Setting {@code preserveFileDate} to {@code true} tries to preserve the file's last
- * modified date/times using {@link File#setLastModified(long)}, however it is not guaranteed that the operation
+ * modified date/times using {@link StandardCopyOption#COPY_ATTRIBUTES}, however it is not guaranteed that the operation
* will succeed. If the modification operation fails, the methods throws IOException.
* </p>
*
@@ -963,13 +963,14 @@ public static void copyInputStreamToFile(final InputStream source, final File de
* specified destination directory.
* </p>
* <p>
- * The destination directory is created if it does not exist. If the destination directory did exist, then this
- * method merges the source with the destination, with the source taking precedence.
+ * The destination directory is created if it does not exist. If the destination directory did exist, then this method
+ * merges the source with the destination, with the source taking precedence.
* </p>
* <p>
* <strong>Note:</strong> This method tries to preserve the files' last modified date/times using
- * {@link File#setLastModified(long)}, however it is not guaranteed that those operations will succeed. If the
- * modification operation fails, the methods throws IOException.
+ * {@link StandardCopyOption#COPY_ATTRIBUTES} or {@link File#setLastModified(long)} depending on the input, however it
+ * is not guaranteed that those operations will succeed. If the modification operation fails, the methods throws
+ * IOException.
* </p>
*
* @param sourceFile an existing file or directory to copy, must not be {@code null}.

[IO-769] FileUtils.copyFileToDirectory can lead to not accessible file
when preserving the file date

Update Javadoc