Skip to content

Commit

Permalink
8314810: (fs) java/nio/file/Files/CopyInterference.java should use Te…
Browse files Browse the repository at this point in the history
…stUtil::supportsLinks

Reviewed-by: aturbanov, alanb
  • Loading branch information
Brian Burkhalter committed Aug 23, 2023
1 parent 6261020 commit 096b7ff
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions test/jdk/java/nio/file/Files/CopyInterference.java
Expand Up @@ -24,6 +24,8 @@
/* @test
* @bug 8114830
* @summary Verify FileAlreadyExistsException is not thrown for REPLACE_EXISTING
* @library ..
* @build CopyInterference
* @run junit CopyInterference
*/
import java.io.InputStream;
Expand Down Expand Up @@ -112,17 +114,22 @@ private static Stream<Arguments> pathAndOptionsProvider()
new CopyOption[] {REPLACE_EXISTING});
list.add(args);

// symblic link, followed
Path link = dir.resolve("link");
Files.createSymbolicLink(link, sourceFile);
args = Arguments.of(link, dir.resolve("linkFollowed"),
new CopyOption[] {REPLACE_EXISTING});
list.add(args);

// symblic link, not followed
args = Arguments.of(link, dir.resolve("linkNotFollowed"),
new CopyOption[] {REPLACE_EXISTING, NOFOLLOW_LINKS});
list.add(args);
if (TestUtil.supportsLinks(dir)) {
// symbolic link, followed
Path link = dir.resolve("link");
Files.createSymbolicLink(link, sourceFile);
args = Arguments.of(link, dir.resolve("linkFollowed"),
new CopyOption[] {REPLACE_EXISTING});
list.add(args);

// symbolic link, not followed
args = Arguments.of(link, dir.resolve("linkNotFollowed"),
new CopyOption[] {REPLACE_EXISTING,
NOFOLLOW_LINKS});
list.add(args);
} else {
System.out.println("Links not supported: not testing links");
}

return list.stream();
}
Expand Down

1 comment on commit 096b7ff

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.