[jdk11u-dev] RFR: 8263940: NPE when creating default file system when default file system provider is packaged as JAR file on class path

Goetz Lindenmaier goetz at openjdk.org
Thu Apr 25 08:40:35 UTC 2024


On Mon, 22 Apr 2024 18:59:02 GMT, Amos Shi <ashi at openjdk.org> wrote:

>> Backport of [JDK-8263940](https://bugs.openjdk.org/browse/JDK-8263940)
>> - This PR contains 2 commits
>>   - commit 1 - is the changed from `git apply`
>>   - commit 2 - is the manual merge based on the `ZipFile.java.rej` and `SetDefaultProvider.java.rej` files
>>     - We respect all the changes of the `.rej` files, 
>>     - In `ZipFile.java` - Added missing parameter `ZipCoder zc` in `private static class Key`
>>     - In `SetDefaultProvider.java` - Fixed Java 11 compile errors
>> 
>> - `git apply` log
>> 
>> github.com/dev-8263940-11
>> branch 'backport-8263940' set up to track 'origin/backport-8263940'.
>> Switched to a new branch 'backport-8263940'
>> 
>> patching file 'src/java.base/share/classes/java/util/zip/ZipFile.java'
>> Reversed (or previously applied) patch detected!  Assume -R? [y] y
>> 2 out of 3 hunks failed--saving rejects to 'src/java.base/share/classes/java/util/zip/ZipFile.java.rej'
>> patching file 'test/jdk/java/nio/file/spi/SetDefaultProvider.java'
>> 1 out of 3 hunks failed--saving rejects to 'test/jdk/java/nio/file/spi/SetDefaultProvider.java.rej'
>> 
>> 
>> - `git status` log
>> 
>> 
>> modified:   src/java.base/share/classes/java/util/zip/ZipFile.java
>> modified:   test/jdk/java/nio/file/spi/SetDefaultProvider.java
>> 
>> Untracked files:
>>   src/java.base/share/classes/java/util/zip/ZipFile.java.rej
>>   test/jdk/java/nio/file/spi/SetDefaultProvider.java.rej
>> 
>> 
>> - `diff` in `src/java.base/share/classes/java/util/zip/ZipFile.java.rej`
>> 
>> 
>> @@ -68,7 +69,6 @@
>>  import jdk.internal.ref.CleanerFactory;
>>  import jdk.internal.vm.annotation.Stable;
>>  import sun.nio.cs.UTF_8;
>> -import sun.nio.fs.DefaultFileSystemProvider;
>>  import sun.security.util.SignatureFileVerifier;
>>  
>>  import static java.util.zip.ZipConstants64.*;
>> @@ -1255,19 +1255,14 @@
>>              }
>>          }
>>          private static final HashMap<Key, Source> files = new HashMap<>();
>> -        /**
>> -         * Use the platform's default file system to avoid
>> -         * issues when the VM is configured to use a custom file system provider.
>> -         */
>> -        private static final java.nio.file.FileSystem builtInFS =
>> -                DefaultFileSystemProvider.theFileSystem();
>> +
>>  
>>          static Source get(File file, boolean toDelete, ZipCoder zc) throws IOException {
>>              final Key key;
>>              try {
>>                  key = new Key(file,
>> -                        Files.readAttributes(builtInFS.getPath(file.getPath()),
>> -                    ...
>
> src/java.base/share/classes/java/util/zip/ZipFile.java line 1410:
> 
>> 1408:                         return false;
>> 1409:                     }
>> 1410:                     if (!attrs.lastModifiedTime().equals(key.attrs.lastModifiedTime())) {
> 
> The `private static class Key` class does not have the `ZipCoder zc` constructor parameter, here we add it based on current latest code in https://github.com/openjdk/jdk/

The backported change does not add the zc argumenht to the call in lin 1436.
Can you please explain why you add it?  Originally it was added for larger change JDK-8243254

-------------

PR Review Comment: https://git.openjdk.org/jdk11u-dev/pull/2647#discussion_r1579100296


More information about the jdk-updates-dev mailing list