JarLoader( URL url, @SuppressWarnings("unused") boolean canLockJar, int index, boolean preloadJarContents) throws IOException { super(new URL("jar", "", -1, url + "!/"), index); myCanonicalFile = new File(FileUtil.unquote(url.getFile())).getCanonicalFile(); myCanLockJar = canLockJar; ZipFile zipFile = getZipFile(); // IOException from opening is propagated to caller if zip file isn't valid, try { myAttributes = getAttributes(zipFile); if (preloadJarContents) { JarMemoryLoader loader = JarMemoryLoader.load(zipFile, getBaseURL(), myAttributes); if (loader != null) { myMemoryLoader = new SoftReference<JarMemoryLoader>(loader); } } } finally { releaseZipFile(zipFile); } }
void preLoadClasses() { ZipFile zipFile = null; try { zipFile = acquireZipFile(); if (zipFile == null) return; try { File file = new File(zipFile.getName()); myMemoryLoader = new SoftReference<JarMemoryLoader>(JarMemoryLoader.load(file, getBaseURL())); } catch (Exception e) { LOG.error(e); } } catch (Exception e) { // it happens :) eg tools.jar under MacOS } finally { try { releaseZipFile(zipFile); } catch (IOException ignore) { } } }