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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • None
    • 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.

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

              Created:
              Updated:
              Resolved: