Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7076310

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 8
    • 7
    • core-libs
    • 7
    • b21
    • x86
    • windows_vista
    • Verified

      Given JavaDoc:

          public AclEntry.Builder setFlags(Set<AclEntryFlag> flags)

          Sets the flags component of this builder. On return, the flags
          component of this builder is a copy of the given set.

          Returns:
          this builder

          Throws:

          ClassCastException - if the set contains elements that are not of type
                               AclEntryFlag

      I would expect an empty set argument in "flags" to work (and so does the JDK "sample"
      app AclEdit.java, by the way), but no:

      > java -cp . AclEdit A2=Alle:write_data/append_data:deny derby.log

          Exception in thread "main" java.lang.IllegalArgumentException: Collection is empty
           at java.util.EnumSet.copyOf(EnumSet.java:166)
                 at java.nio.file.attribute.AclEntry$Builder.setFlags(AclEntry.java:216)
               at AclEdit.parseAceString(AclEdit.java:162)
           at AclEdit.main(AclEdit.java:294)

      Alan Bateman confirmed this is a code bug.

            sflores Stephen Flores (Inactive)
            dwanvik Dag Wanvik
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: