Skip to content

Commit

Permalink
8322881: [TESTBUG]java/nio/file/Files/CopyMoveVariations.java fails w…
Browse files Browse the repository at this point in the history
…hen run with non-root user

Signed-off-by: sendaoYan <yansendao.ysd@alibaba-inc.com>
  • Loading branch information
sendaoYan committed Jan 28, 2024
1 parent 2e748c9 commit 952f014
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/jdk/java/nio/file/Files/CopyMoveVariations.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,12 @@ void op(OpType op, PathType type, String mode, boolean replaceExisting,
assertThrows(FileAlreadyExistsException.class,
() -> Files.move(src, dst, options));
} else {
Files.move(source, target, options);
assert Files.exists(target);
try {
Files.move(source, target, options);
assert Files.exists(target);
} catch (AccessDeniedException ade) {
assertTrue(mode.charAt(0) != 'r');
}
}
} else if (type == PathType.DIR) {
if (op == OpType.COPY) {
Expand All @@ -212,7 +216,7 @@ void op(OpType op, PathType type, String mode, boolean replaceExisting,
Files.move(source, target, options);
assert Files.exists(target);
} catch (AccessDeniedException ade) {
assertTrue(mode.charAt(1) != 'w');
assertTrue(mode.charAt(1) != 'r');
} catch (FileAlreadyExistsException faee) {
assertTrue(targetExists && !replaceExisting);
}
Expand Down

0 comments on commit 952f014

Please sign in to comment.