7033824: TEST_BUG: java/nio/file/Files/CopyAndMove.java fails intermittently

Chris Hegarty chris.hegarty at oracle.com
Fri Aug 31 04:12:15 PDT 2012


Seems reasonable Alan.

-Chris.

On 31/08/12 10:32, Alan Bateman wrote:
>
> This is small change to a test that fails if the test working directory
> is on a different file system to temporary file system. The test
> exercises copy and move operations on the same file system and different
> file systems if it can. When testing a move of a symbolic link from one
> file system to another then the test incorrectly checks that the last
> modified time is copied. The proposed patch is below. I should mention
> taht the spec is clear that when copying a symbolic link that there is
> no guarantee that its attributes are copied, this isn't made clear in
> the move specification so this is something we need to clarify at some
> point.
>
> -Alan
>
> diff --git a/test/java/nio/file/Files/CopyAndMove.java
> b/test/java/nio/file/Files/CopyAndMove.java
> --- a/test/java/nio/file/Files/CopyAndMove.java
> +++ b/test/java/nio/file/Files/CopyAndMove.java
> @@ -86,10 +86,12 @@ public class CopyAndMove {
>           assertTrue(attrs1.isSymbolicLink() == attrs2.isSymbolicLink());
>           assertTrue(attrs1.isOther() == attrs2.isOther());
>
> -        // check last modified time
> -        long time1 = attrs1.lastModifiedTime().toMillis();
> -        long time2 = attrs2.lastModifiedTime().toMillis();
> -        assertTrue(time1 == time2);
> +        // check last modified time if not a symbolic link
> +        if (!attrs1.isSymbolicLink()) {
> +            long time1 = attrs1.lastModifiedTime().toMillis();
> +            long time2 = attrs2.lastModifiedTime().toMillis();
> +            assertTrue(time1 == time2);
> +        }
>
>           // check size
>           if (attrs1.isRegularFile())
>


More information about the nio-dev mailing list