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

Print this page




 108                 super.close();
 109             } finally {
 110                 if (!getUseCaches()) {
 111                     jarFile.close();
 112                 }
 113             }
 114         }
 115     }
 116 
 117 
 118 
 119     public void connect() throws IOException {
 120         if (!connected) {
 121             /* the factory call will do the security checks */
 122             jarFile = factory.get(getJarFileURL(), getUseCaches());
 123 
 124             /* we also ask the factory the permission that was required
 125              * to get the jarFile, and set it as our permission.
 126              */
 127             if (getUseCaches()) {

 128                 jarFileURLConnection = factory.getConnection(jarFile);

 129             }
 130 
 131             if ((entryName != null)) {
 132                 jarEntry = (JarEntry)jarFile.getEntry(entryName);
 133                 if (jarEntry == null) {
 134                     try {
 135                         if (!getUseCaches()) {
 136                             jarFile.close();
 137                         }
 138                     } catch (Exception e) {
 139                     }
 140                     throw new FileNotFoundException("JAR entry " + entryName +
 141                                                     " not found in " +
 142                                                     jarFile.getName());
 143                 }
 144             }
 145             connected = true;
 146         }
 147     }
 148 




 108                 super.close();
 109             } finally {
 110                 if (!getUseCaches()) {
 111                     jarFile.close();
 112                 }
 113             }
 114         }
 115     }
 116 
 117 
 118 
 119     public void connect() throws IOException {
 120         if (!connected) {
 121             /* the factory call will do the security checks */
 122             jarFile = factory.get(getJarFileURL(), getUseCaches());
 123 
 124             /* we also ask the factory the permission that was required
 125              * to get the jarFile, and set it as our permission.
 126              */
 127             if (getUseCaches()) {
 128                 boolean oldUseCaches = jarFileURLConnection.getUseCaches();
 129                 jarFileURLConnection = factory.getConnection(jarFile);
 130                 jarFileURLConnection.setUseCaches(oldUseCaches);
 131             }
 132 
 133             if ((entryName != null)) {
 134                 jarEntry = (JarEntry)jarFile.getEntry(entryName);
 135                 if (jarEntry == null) {
 136                     try {
 137                         if (!getUseCaches()) {
 138                             jarFile.close();
 139                         }
 140                     } catch (Exception e) {
 141                     }
 142                     throw new FileNotFoundException("JAR entry " + entryName +
 143                                                     " not found in " +
 144                                                     jarFile.getName());
 145                 }
 146             }
 147             connected = true;
 148         }
 149     }
 150