8388046: (fs) UnixFileSystem Flags.failIfUnableToCopyPosix and Flags.failIfUnableToCopyNonPosix no longer needed

Reviewed-by: alanb
This commit is contained in:
Benjamin Peterson 2026-07-21 12:00:29 +00:00 committed by Alan Bateman
parent 659a1f3873
commit 32ef6a78c9
2 changed files with 3 additions and 19 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -132,8 +132,6 @@ class BsdFileSystem extends UnixFileSystem {
try {
chown(target, attrs.uid(), attrs.gid());
} catch (UnixException x) {
if (flags.failIfUnableToCopyPosix)
x.rethrowAsIOException(target);
}
return;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -389,10 +389,8 @@ abstract class UnixFileSystem
boolean copyPosixAttributes;
boolean copyNonPosixAttributes;
// flags that indicate if we should fail if attributes cannot be copied
// flag that indicates if we should fail if basic attributes cannot be copied
boolean failIfUnableToCopyBasic;
boolean failIfUnableToCopyPosix;
boolean failIfUnableToCopyNonPosix;
static Flags fromCopyOptions(CopyOption... options) {
Flags flags = new Flags();
@ -483,10 +481,6 @@ abstract class UnixFileSystem
dfd = open(target, O_RDONLY, 0);
} catch (UnixException x) {
// access to target directory required to copy named attributes
if (flags.copyNonPosixAttributes && flags.failIfUnableToCopyNonPosix) {
try { rmdir(target); } catch (UnixException ignore) { }
x.rethrowAsIOException(target);
}
}
boolean done = false;
@ -503,8 +497,6 @@ abstract class UnixFileSystem
}
} catch (UnixException x) {
// unable to set owner/group
if (flags.failIfUnableToCopyPosix)
x.rethrowAsIOException(target);
}
}
// copy other attributes
@ -513,8 +505,6 @@ abstract class UnixFileSystem
try {
sfd = open(source, O_RDONLY, 0);
} catch (UnixException x) {
if (flags.failIfUnableToCopyNonPosix)
x.rethrowAsIOException(source);
}
if (sfd >= 0) {
source.getFileSystem().copyNonPosixAttributes(sfd, dfd);
@ -663,8 +653,6 @@ abstract class UnixFileSystem
fchown(fo, attrs.uid(), attrs.gid());
fchmod(fo, attrs.mode());
} catch (UnixException x) {
if (flags.failIfUnableToCopyPosix)
x.rethrowAsIOException(target);
}
}
// copy non POSIX attributes (depends on file system)
@ -749,8 +737,6 @@ abstract class UnixFileSystem
chown(target, attrs.uid(), attrs.gid());
chmod(target, attrs.mode());
} catch (UnixException x) {
if (flags.failIfUnableToCopyPosix)
x.rethrowAsIOException(target);
}
}
if (flags.copyBasicAttributes) {