RFR: 8299835: (jrtfs) Unnecessary null check in JrtPath.getAttributes
Alan Bateman
alanb at openjdk.org
Tue Jan 10 08:56:52 UTC 2023
On Mon, 9 Jan 2023 20:55:14 GMT, Andrey Turbanov <aturbanov at openjdk.org> wrote:
> `jdk.internal.jrtfs.JrtFileSystem#getFileAttributes` never return `null`
>
> https://github.com/openjdk/jdk/blob/679e485838881c1364845072af305fb60d95e60a/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java#L206-L213
> So, no need to check for `null` its result.
> Seems it was copied from ZipPath (name of variable suggests that) - https://github.com/openjdk/jdk/blob/master/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipPath.java#L769. But for ZipFileSystem `null` is expected.
This looks okay as the 2-arg getFileAttrbutes will throw if the entry doesn't exist in the file system. I assume you'll update the end copyright year to 2023 before you integrate this.
-------------
Marked as reviewed by alanb (Reviewer).
PR: https://git.openjdk.org/jdk/pull/11911
More information about the core-libs-dev
mailing list