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

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

    XMLWordPrintable

Details

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

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: