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

ZipFileStore#supportsFileAttributeView(String) doesn't throw NPE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 21
    • 13, 17, 21
    • core-libs
    • None
    • 13
    • b05

      I've noticed that ZipFileStore#supportsFileAttributeView(String)
      doesn't throw NullPointerException when 'null' is passed as an
      argument.

      public boolean supportsFileAttributeView(String name) {
          return "basic".equals(name) || "zip".equals(name) ||
                 (("owner".equals(name) || "posix".equals(name)) && zfs.supportPosix);
      }

      Package level javadoc for {{java.nio.file}} package mentions that NullPointerException is expected from all methods which pass {{null}}:

      >Unless otherwise noted, passing a null argument to a constructor or method in any class or interface in this package will cause a NullPointerException to be thrown.

      Other JDK implementations of FileStore throw NPE in this method in case of null.

            pminborg Per-Ake Minborg
            aturbanov Andrey Turbanov
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: