(fs) possible UnsupportedOperationException in UnixUserDefinedFileAttributeView.read(...)

XMLWordPrintable

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: P4
    • None
    • Affects Version/s: None
    • Component/s: core-libs
    • None

      Depending on the used ByteBuffer implementation, `read(...)` might fail with an UnsupportedOperationException.

      The `write(...)` method checks whether the ByteBuffer has an array from which it can copy the data that should get written: https://github.com/openjdk/jdk/blob/45e1bab87ccebd498d4f927a008dd89a47dd177b/src/java.base/unix/classes/sun/nio/fs/UnixUserDefinedFileAttributeView.java#L240-L251

      However, during `read(...)` an unchecked call to `dst.array()` in https://github.com/openjdk/jdk/blob/45e1bab87ccebd498d4f927a008dd89a47dd177b/src/java.base/unix/classes/sun/nio/fs/UnixUserDefinedFileAttributeView.java#L203 might cause an UnsupportedOperationException to be thrown, if `dst` is not backed by an array.

            Assignee:
            Sebastian Stenzel
            Reporter:
            Sebastian Stenzel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: