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

(fs) UnixUserDefinedFileAttributeView cleanup

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 17
    • None
    • core-libs
    • None
    • b16

      As suggest in https://mail.openjdk.java.net/pipermail/nio-dev/2021-March/008514.html, in a first step to clean up code in UnixUserDefinedFileAttributeView, we will deduplicate code in `list()` and `copyExtendedAttributes()`. Both methods share almost identical chunks of code around the native `flistxattr()` call.

      The difference between both methods lies primarily in the filtering of `user:` attributes, as currently done in `asList(...)`. The logic that increases the buffer size in case of `ERANGE` (currently implemented as for-loops in both methods) should be moved to a shared private method.

      The filtering for `user:` attributes should be done where it is required, not as a side effect of `asList(...)`.

      The `buffer` variable should not longer get re-assigned, so its lifecycle is easy to understand and errors are avoided.

            sstenzel Sebastian Stenzel
            alanb Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: