< prev index next >

src/java.base/share/classes/sun/net/www/protocol/jar/JarURLConnection.java

Print this page
rev 13123 : 8132734: JDK 9 runtime changes to support multi-release jar files
Summary: JEP 238 Multi-Release JAR Files runtime support
Contributed-by: steve.drach@oracle.com
rev 12142 : 8081517: minor cleanup for docs
Summary: fix some tidy and javadoc warnings/errors
Reviewed-by: lancea, rriggs
rev 10469 : 8054834: Modular Source Code
Reviewed-by: alanb, chegar, ihse, mduigou
Contributed-by: alan.bateman@oracle.com, alex.buckley@oracle.com, chris.hegarty@oracle.com, erik.joelsson@oracle.com, jonathan.gibbons@oracle.com, karen.kinnear@oracle.com, magnus.ihse.bursie@oracle.com, mandy.chung@oracle.com, mark.reinhold@oracle.com, paul.sandoz@oracle.com

@@ -74,17 +74,22 @@
     private JarFile jarFile;
 
     /* the content type for this connection */
     private String contentType;
 
+    /* should multi-release jar runtime version processing be used */
+    private boolean runtimeVersioned;
+
     public JarURLConnection(URL url, Handler handler)
     throws MalformedURLException, IOException {
         super(url);
 
         jarFileURL = getJarFileURL();
         jarFileURLConnection = jarFileURL.openConnection();
         entryName = getEntryName();
+        String ref = url.getRef();
+        runtimeVersioned = ref == null ? false : ref.equals("runtime");
     }
 
     public JarFile getJarFile() throws IOException {
         connect();
         return jarFile;

@@ -112,12 +117,10 @@
                 }
             }
         }
     }
 
-
-
     public void connect() throws IOException {
         if (!connected) {
             /* the factory call will do the security checks */
             jarFile = factory.get(getJarFileURL(), getUseCaches());
 

@@ -127,11 +130,13 @@
             if (getUseCaches()) {
                 jarFileURLConnection = factory.getConnection(jarFile);
             }
 
             if ((entryName != null)) {
-                jarEntry = (JarEntry)jarFile.getEntry(entryName);
+                jarEntry = runtimeVersioned
+                        ? jarFile.getRuntimeVersionedEntry(entryName)
+                        : (JarEntry)jarFile.getEntry(entryName);
                 if (jarEntry == null) {
                     try {
                         if (!getUseCaches()) {
                             jarFile.close();
                         }
< prev index next >