7076310: (file) AclEntry.Builder setFlags throws IllegalArgumentException if set argument is empty

Stephen Flores stephen.flores at oracle.com
Tue Dec 20 21:51:18 PST 2011


Please review the following webrev (includes new test to demonstrate the 
bug):

   http://cr.openjdk.java.net/~sflores/7076310/

for bug: 7076310: (file) AclEntry.Builder setFlags throws
          IllegalArgumentException if set argument is empty

Description:

   AclEntry.Builder.setFlags incorrectly throws
   IllegalArgumentException if set argument is empty and is
   not an instance of EnumSet. Empty EnumSets work fine.

   Example that yields exception:

       Set<AclEntryFlag> flags;

       flags = new HashSet<AclEntryFlag>();
       AclEntry.newBuilder().setFlags(flags);

Evaluation:

   AclEntry.Builder.setFlags uses EnumSet.copyOf which throws
   IllegalArgumentException if the Collection argument is empty and
   is not an instance of EnumSet.

Description of fix:

   AclEntry.Builder.setFlags should create empty set of flags for
   Builder if given and empty Set, instead of trying to copy and
   empty Set.

Thanks,

   Steve.



More information about the nio-dev mailing list