You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2021/01/12 10:21:44 UTC

[GitHub] [commons-io] tza opened a new pull request #185: IO-700: provide method overload for moveFile

tza opened a new pull request #185:
URL: https://github.com/apache/commons-io/pull/185


   - added test cases
   - updated javadoc for "copy and delete" with setLastModified


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-io] tza commented on pull request #185: IO-700: provide method overload for moveFile

Posted by GitBox <gi...@apache.org>.
tza commented on pull request #185:
URL: https://github.com/apache/commons-io/pull/185#issuecomment-758626574


   So far the test cases seem ok for me: 
   The failing tests FileUtilsCleanDirectoryTestCase were introduced with commit 0cee29aa4c1818963ed1a55058219282e89d7488 and failed in my workspace before changing anything.
   The AbstractInputStreamTest.tearDown IllegalAccess error also happened before, eg. in pull 181. Seems unrelated with my changes.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-io] garydgregory commented on pull request #185: IO-700: provide method overload for moveFile

Posted by GitBox <gi...@apache.org>.
garydgregory commented on pull request #185:
URL: https://github.com/apache/commons-io/pull/185#issuecomment-758647935


   > So far the test cases seem ok for me:
   > The failing tests FileUtilsCleanDirectoryTestCase were introduced with commit [0cee29a](https://github.com/apache/commons-io/commit/0cee29aa4c1818963ed1a55058219282e89d7488) and failed in my workspace before changing anything.
   > The AbstractInputStreamTest.tearDown IllegalAccess error also happened before, eg. in pull 181. Seems unrelated with my changes.
   
   I must have messed up, the build passed for me locally, but, obviously it's broken. I will look...


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-io] tza commented on a change in pull request #185: IO-700: provide method overload for moveFile

Posted by GitBox <gi...@apache.org>.
tza commented on a change in pull request #185:
URL: https://github.com/apache/commons-io/pull/185#discussion_r555985076



##########
File path: src/main/java/org/apache/commons/io/FileUtils.java
##########
@@ -2172,12 +2177,39 @@ public static void moveDirectoryToDirectory(final File src, final File destDir,
      * @since 1.4
      */
     public static void moveFile(final File srcFile, final File destFile) throws IOException {
+        moveFile(srcFile, destFile, true);
+    }
+
+    /**
+     * Moves a file.
+     * <p>
+     * When the destination file is on another file system, do a "copy and delete".
+     * </p>
+     * <p>
+     * <strong>Note:</strong> Setting <code>preserveFileDate</code> to {@code true} tries to preserve the files' last
+     * modified date/times using {@link File#setLastModified(long)} when destination is another file system, however it
+     * is not guaranteed that those operations will succeed. If the modification operation fails, the methods throws
+     * IOException.
+     * </p>
+     *
+     * @param srcFile the file to be moved.
+     * @param destFile the destination file.
+     * @param preserveFileDate true if the file date of the "copy and delete" should be the same as the original when
+     *            destination is on another file system. Param is not used if destination is on same file system.
+     * @throws NullPointerException if any of the given {@code File}s are {@code null}.
+     * @throws FileExistsException if the destination file exists.
+     * @throws IOException if source or destination is invalid.
+     * @throws IOException if an error occurs or setting the last-modified time didn't succeeded.
+     * @since 1.4

Review comment:
       Rebased and fixed since tag.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-io] coveralls commented on pull request #185: IO-700: provide method overload for moveFile

Posted by GitBox <gi...@apache.org>.
coveralls commented on pull request #185:
URL: https://github.com/apache/commons-io/pull/185#issuecomment-758918261


   
   [![Coverage Status](https://coveralls.io/builds/36274047/badge)](https://coveralls.io/builds/36274047)
   
   Coverage increased (+0.003%) to 88.978% when pulling **380fc037cb85b424eb8963b9ee23833515b5f127 on tza:master** into **73a31d9a2f0f194a2e115f33fbf6786ef056408d on apache:master**.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-io] garydgregory merged pull request #185: IO-700: provide method overload for moveFile

Posted by GitBox <gi...@apache.org>.
garydgregory merged pull request #185:
URL: https://github.com/apache/commons-io/pull/185


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-io] garydgregory commented on a change in pull request #185: IO-700: provide method overload for moveFile

Posted by GitBox <gi...@apache.org>.
garydgregory commented on a change in pull request #185:
URL: https://github.com/apache/commons-io/pull/185#discussion_r555848248



##########
File path: src/main/java/org/apache/commons/io/FileUtils.java
##########
@@ -2172,12 +2177,39 @@ public static void moveDirectoryToDirectory(final File src, final File destDir,
      * @since 1.4
      */
     public static void moveFile(final File srcFile, final File destFile) throws IOException {
+        moveFile(srcFile, destFile, true);
+    }
+
+    /**
+     * Moves a file.
+     * <p>
+     * When the destination file is on another file system, do a "copy and delete".
+     * </p>
+     * <p>
+     * <strong>Note:</strong> Setting <code>preserveFileDate</code> to {@code true} tries to preserve the files' last
+     * modified date/times using {@link File#setLastModified(long)} when destination is another file system, however it
+     * is not guaranteed that those operations will succeed. If the modification operation fails, the methods throws
+     * IOException.
+     * </p>
+     *
+     * @param srcFile the file to be moved.
+     * @param destFile the destination file.
+     * @param preserveFileDate true if the file date of the "copy and delete" should be the same as the original when
+     *            destination is on another file system. Param is not used if destination is on same file system.
+     * @throws NullPointerException if any of the given {@code File}s are {@code null}.
+     * @throws FileExistsException if the destination file exists.
+     * @throws IOException if source or destination is invalid.
+     * @throws IOException if an error occurs or setting the last-modified time didn't succeeded.
+     * @since 1.4

Review comment:
       This is a new method for 2.9.0, please adjust the since tag.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [commons-io] tza commented on pull request #185: IO-700: provide method overload for moveFile

Posted by GitBox <gi...@apache.org>.
tza commented on pull request #185:
URL: https://github.com/apache/commons-io/pull/185#issuecomment-758651178


   Thanks, just let me know if I should rebase and push again. 
   
   ps. I'm pretty new in the open-source / github community, so sorry for any rookie mistake :)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org