Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8174151

URLClassLoader no longer uses custom URLStreamHandler for jar URLs

    XMLWordPrintable

Details

    • b158
    • generic
    • generic
    • Verified

    Backports

      Description

        FULL PRODUCT VERSION :
        java version "9-ea"
        Java(TM) SE Runtime Environment (build 9-ea+155)
        Java HotSpot(TM) 64-Bit Server VM (build 9-ea+155, mixed mode)

        ADDITIONAL OS VERSION INFORMATION :
        Darwin aw-rmbp.home 14.5.0 Darwin Kernel Version 14.5.0: Sun Sep 25 22:07:15 PDT 2016; root:xnu-2782.50.9~1/RELEASE_X86_64 x86_64

        A DESCRIPTION OF THE PROBLEM :
        I am a developer on Spring Boot where we use the java.protocol.handler.pkgs system property to install a custom URLStreamHandler for jar URLs. The custom handler enables Spring Boot's support for nested jars with a single, executable "fat" jar. This works fine on Java 6, 7, and 8

        Running on Java 9, our custom URLStreamHandler is no longer used for URLs with which a URLClassLoader has been configured. This breaks our executable jar support. I believe this is due to this change in OpenJDK: http://hg.openjdk.java.net/jdk9/jdk9/jdk/diff/c49b0409a802/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java

        REGRESSION. Last worked in version 8u121

        ADDITIONAL REGRESSION INFORMATION:
        java version "1.8.0_121"
        Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
        Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Please see https://github.com/wilkinsona/jar-handler-regression

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        The output should be:

        URLs handled by custom handler: 1
        ACTUAL -
        The output is:

        URLs handled by custom handler: 0

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        Please see https://github.com/wilkinsona/jar-handler-regression
        ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

                psandoz Paul Sandoz
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: