7076310: (file) AclEntry.Builder setFlags throws IllegalArgumentException if set argument is empty
Alan Bateman
Alan.Bateman at oracle.com
Wed Dec 21 01:46:58 PST 2011
On 21/12/2011 05:51, Stephen Flores wrote:
> Please review the following webrev (includes new test to demonstrate
> the bug):
>
> http://cr.openjdk.java.net/~sflores/7076310/
Thanks for taking one. It looks like the setPermissions method has the
same issue so I think we should fix both together.
The simplest solution is probably to replace EnumSet.copyOf(flags) with
new HashSet<>(flags). What you have is okay too although in theory
someone could clear the set at just around the time that setFlags is
called in which case the copyOf method would see an empty set (as
AclEntry.Builder is clearly specified to not be safe for use by multiple
concurrent threads then your approach is okay).
The test should be added to test/java/nio/file/attribute/AclEntry.
Looking at it now, it seems I neglected to include a unit test for
AclEntry which is probably how this bug sipped through (it is tested by
AclFileAttributeView as it tests reading and writing ACLs, just didn't a
complete test for AclEntry).
-Alan.
More information about the nio-dev
mailing list