jdk/src/share/classes/java/nio/file/attribute/AclEntry.java
changeset 11358 8821bb789678
parent 9035 1255eb81cc2f
child 18574 4aeaeb541678
--- a/jdk/src/share/classes/java/nio/file/attribute/AclEntry.java	Thu Dec 22 15:35:55 2011 +0800
+++ b/jdk/src/share/classes/java/nio/file/attribute/AclEntry.java	Thu Dec 22 10:52:17 2011 +0000
@@ -175,9 +175,15 @@
          *          AclEntryPermission}
          */
         public Builder setPermissions(Set<AclEntryPermission> perms) {
-            // copy and check for erroneous elements
-            perms = EnumSet.copyOf(perms);
-            checkSet(perms, AclEntryPermission.class);
+            if (perms.isEmpty()) {
+                // EnumSet.copyOf does not allow empty set
+                perms = Collections.emptySet();
+            } else {
+                // copy and check for erroneous elements
+                perms = EnumSet.copyOf(perms);
+                checkSet(perms, AclEntryPermission.class);
+            }
+
             this.perms = perms;
             return this;
         }
@@ -212,9 +218,15 @@
          *          AclEntryFlag}
          */
         public Builder setFlags(Set<AclEntryFlag> flags) {
-            // copy and check for erroneous elements
-            flags = EnumSet.copyOf(flags);
-            checkSet(flags, AclEntryFlag.class);
+            if (flags.isEmpty()) {
+                // EnumSet.copyOf does not allow empty set
+                flags = Collections.emptySet();
+            } else {
+                // copy and check for erroneous elements
+                flags = EnumSet.copyOf(flags);
+                checkSet(flags, AclEntryFlag.class);
+            }
+
             this.flags = flags;
             return this;
         }