#8 Add patch of JDK-8193802 for RHBZ#1557375.
Merged 5 years ago by jerboaa. Opened 5 years ago by jerboaa.
rpms/ jerboaa/java-openjdk master  into  master

@@ -0,0 +1,72 @@ 

+ # HG changeset patch

+ # User sherman

+ # Date 1525080541 -7200

+ #      Mon Apr 30 11:29:01 2018 +0200

+ # Node ID c3e284205e149a6d786ff5aa7dca9338cf70ba60

+ # Parent  e541eaa797070bafe8c3dc41f4beec8395c78276

+ 8193802: NullPointerException from JarFileSystem.getVersionMap()

+ Reviewed-by: mchung

+ 

+ diff --git a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java

+ --- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java

+ +++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java

+ @@ -1,5 +1,5 @@

+  /*

+ - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.

+ + * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.

+   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

+   *

+   * This code is free software; you can redistribute it and/or modify it

+ @@ -109,7 +109,9 @@

+       */

+      private Function<byte[],byte[]> createVersionedLinks(int version) {

+          HashMap<IndexNode,byte[]> aliasMap = new HashMap<>();

+ -        getVersionMap(version, getInode(getBytes("/META-INF/versions"))).values()

+ +        IndexNode verdir = getInode(getBytes("/META-INF/versions"));

+ +        if (verdir != null) {

+ +            getVersionMap(version, verdir).values()

+                  .forEach(versionNode -> {   // for each META-INF/versions/{n} directory

+                      // put all the leaf inodes, i.e. entries, into the alias map

+                      // possibly shadowing lower versioned entries

+ @@ -124,6 +126,7 @@

+                          }

+                      });

+                  });

+ +        }

+          return path -> aliasMap.get(IndexNode.keyOf(path));

+      }

+  

+ diff --git a/test/jdk/jdk/nio/zipfs/MultiReleaseJarTest.java b/test/jdk/jdk/nio/zipfs/MultiReleaseJarTest.java

+ --- a/test/jdk/jdk/nio/zipfs/MultiReleaseJarTest.java

+ +++ b/test/jdk/jdk/nio/zipfs/MultiReleaseJarTest.java

+ @@ -23,7 +23,7 @@

+  

+  /*

+   * @test

+ - * @bug 8144355 8144062 8176709

+ + * @bug 8144355 8144062 8176709 8193802

+   * @summary Test aliasing additions to ZipFileSystem for multi-release jar files

+   * @library /lib/testlibrary/java/util/jar

+   * @build Compiler JarBuilder CreateMultiReleaseTestJars

+ @@ -205,6 +205,21 @@

+          //testCustomMultiReleaseValue("true\r\n true", false);

+      }

+  

+ +    @Test

+ +    public void testMultiReleaseJarWithNonVersionDir() throws Exception {

+ +        String jfname = "multi-release-non-ver.jar";

+ +        Path jfpath = Paths.get(jfname);

+ +        URI uri = new URI("jar", jfpath.toUri().toString() , null);

+ +        JarBuilder jb = new JarBuilder(jfname);

+ +        jb.addAttribute("Multi-Release", "true");

+ +        jb.build();

+ +        Map<String,String> env = Map.of("multi-release", "runtime");

+ +        try (FileSystem fs = FileSystems.newFileSystem(uri, env)) {

+ +            Assert.assertTrue(true);

+ +        }

+ +        Files.delete(jfpath);

+ +    }

+ +

+      private static final AtomicInteger JAR_COUNT = new AtomicInteger(0);

+  

+      private void testCustomMultiReleaseValue(String value, boolean expected)

file modified
+10 -1
@@ -834,7 +834,7 @@ 

  

  Name:    java-%{origin}

  Version: %{newjavaver}.%{buildver}

- Release: 3%{?dist}

+ Release: 4%{?dist}

  # java-1.5.0-ibm from jpackage.org set Epoch to 1 for unknown reasons

  # and this change was brought into RHEL-4. java-1.5.0-ibm packages

  # also included the epoch in their virtual provides. This created a
@@ -918,6 +918,10 @@ 

  # being built. Not an issue on JDK 11. Missing fix for

  # 10 upstream.

  Patch105:  JDK-8202262-libjsig.so-extra-link-flags.patch

+ # NPE from JarFileSystem.getVersionMap. Fixed in JDK 11,

+ # not backported to JDK 10. See RHBZ#1557375 for the

+ # downstream issue. Not applicable for JDK 8.

+ Patch106:  JDK-8193802-npe-jar-getVersionMap.patch

  

  # aarch64 slowdebug build fix. Pending upstream

  Patch400:  JDK-8200556-aarch64-slowdebug-crash.patch
@@ -1187,6 +1191,7 @@ 

  %patch103 -p1

  %patch104 -p1

  %patch105 -p1

+ %patch106 -p1

  

  %patch400 -p1

  
@@ -1739,6 +1744,10 @@ 

  

  

  %changelog

+ * Mon Apr 30 2018 Severin Gehwolf <sgehwolf@redhat.com> - 1:10.0.1.10-4

+ - Add JDK-8193802-npe-jar-getVersionMap.patch so as to fix

+   RHBZ#1557375.

+ 

  * Mon Apr 23 2018 Severin Gehwolf <sgehwolf@redhat.com> - 1:10.0.1.10-3

  - Inject build flags properly. See RHBZ#1571359

  - Added patch JDK-8202262-libjsig.so-extra-link-flags.patch

no initial comment

Pull-Request has been merged by jerboaa

5 years ago