RFR JDK-8149769: Null pointer exception in ZipFileSystemProvider
Steve Drach
steve.drach at oracle.com
Fri Feb 12 23:55:26 UTC 2016
> What's the issue? The bug description only includes the fix. If the env is null, shouldn't
> it trigger a NPE?
>
> The java.nio.file.spi package does have the note that "NPE, unless otherwise noted ..."
> The api for FilesystemProvider.newFileSystem(..., env) says "env" can be empty, means
> NPE for "null".
>
> Maybe I miss something here?
No, you are not missing anything, I was. I see ZipFileSystem will throw the NPE instead of ZipFileSystemProvider if my “fix” goes in, so it’ll still happen. I rescind my request and will close the bug report with appropriate comment.
>
> -Sherman
>
> On 2/12/16 1:11 PM, Steve Drach wrote:
>> Hi,
>>
>> Please review this simple fix to ZipFileSystemProvider. The issue is JDK-8149769 <https://bugs.openjdk.java.net/browse/JDK-8149769>. I didn’t do a webrev but instead provide the following patch.
>>
>> Thanks
>> Steve
>>
>> diff -r 2d6c2c75f338 src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystemProvider.java
>> --- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystemProvider.java Tue Feb 09 14:07:28 2016 -0800
>> +++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystemProvider.java Fri Feb 12 12:59:46 2016 -0800
>> @@ -100,7 +100,7 @@
>> }
>> ZipFileSystem zipfs = null;
>> try {
>> - if (env.containsKey("multi-release")) {
>> + if (env != null && env.containsKey("multi-release")) {
>> zipfs = new JarFileSystem(this, path, env);
>> } else {
>> zipfs = new ZipFileSystem(this, path, env);
>
More information about the core-libs-dev
mailing list