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

(fs spec) Files.readAttributes(Path, String, LinkOption...) not clear when called with zero attributes

XMLWordPrintable

    • b105

      -- It looks like there is some collision between two assertions:
      (1) "The attributes parameter identifies the attributes to be read and takes the form:
      [view-name:]attribute-list
      where square brackets [...] delineate an optional component and the character ':' stands for itself.
      view-name is the name of a FileAttributeView that identifies a set of file attributes. If not specified then it defaults to "basic", the name of the file attribute view that identifies the basic set of file attributes common to many file systems.
      The attribute-list component is a comma separated list of zero or more names of attributes to read. If the list contains the value "*" then all attributes are read. Attributes that are not supported are ignored and will not be present in the returned map. "
      (2) "IllegalArgumentException - if no attributes are specified or an unrecognized attributes is specified"

      Using the (1) assertion we could construct "correct" values "" and "basic:". But using (2) assertion we will recieve IAE in these cases. In practice method throws IAE in these cases. We think that it would be good if you would specify (1) part of spec more clearly.

      Tested with JDK9b37

            bpb Brian Burkhalter
            asolodkaya Anastasiya Solodkaya (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: