JDK-8299864 : ZipFileStore#supportsFileAttributeView(String) doesn't throw NPE
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.nio
  • Affected Version: 13,17,21
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-01-10
  • Updated: 2023-01-12
  • Resolved: 2023-01-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 21
21 b05Fixed
Related Reports
Relates :  
Description
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.
Comments
Changeset: 7d3400b1 Author: Per Minborg <pminborg@openjdk.org> Date: 2023-01-11 15:08:52 +0000 URL: https://git.openjdk.org/jdk/commit/7d3400b1cf6befd28af81113b218d0aae60ac05f
11-01-2023

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/11926 Date: 2023-01-10 15:26:05 +0000
10-01-2023