< prev index next >
src/java.base/share/classes/sun/misc/URLClassPath.java
Print this page
*** 618,628 ****
*/
static class JarLoader extends Loader {
private JarFile jar;
private URL csu;
private JarIndex index;
- private MetaIndex metaIndex;
private URLStreamHandler handler;
private HashMap<String, Loader> lmap;
private boolean closed = false;
private static final JavaUtilZipFileAccess zipAccess =
SharedSecrets.getJavaUtilZipFileAccess();
--- 618,627 ----
*** 638,673 ****
super(new URL("jar", "", -1, url + "!/", jarHandler));
csu = url;
handler = jarHandler;
lmap = loaderMap;
- if (!isOptimizable(url)) {
ensureOpen();
- } else {
- String fileName = url.getFile();
- if (fileName != null) {
- fileName = ParseUtil.decode(fileName);
- File f = new File(fileName);
- metaIndex = MetaIndex.forJar(f);
- // If the meta index is found but the file is not
- // installed, set metaIndex to null. A typical
- // senario is charsets.jar which won't be installed
- // when the user is running in certain locale environment.
- // The side effect of null metaIndex will cause
- // ensureOpen get called so that IOException is thrown.
- if (metaIndex != null && !f.exists()) {
- metaIndex = null;
- }
- }
-
- // metaIndex is null when either there is no such jar file
- // entry recorded in meta-index file or such jar file is
- // missing in JRE. See bug 6340399.
- if (metaIndex == null) {
- ensureOpen();
- }
- }
}
@Override
public void close () throws IOException {
// closing is synchronized at higher level
--- 637,647 ----
*** 697,707 ****
System.err.println("Opening " + csu);
Thread.dumpStack();
}
jar = getJarFile(csu);
! index = JarIndex.getJarIndex(jar, metaIndex);
if (index != null) {
String[] jarfiles = index.getJarFiles();
// Add all the dependent URLs to the lmap so that loaders
// will not be created for them by URLClassPath.getLoader(int)
// if the same URL occurs later on the main class path. We set
--- 671,681 ----
System.err.println("Opening " + csu);
Thread.dumpStack();
}
jar = getJarFile(csu);
! index = JarIndex.getJarIndex(jar);
if (index != null) {
String[] jarfiles = index.getJarFiles();
// Add all the dependent URLs to the lmap so that loaders
// will not be created for them by URLClassPath.getLoader(int)
// if the same URL occurs later on the main class path. We set
*** 852,867 ****
/*
* Returns the JAR Resource for the specified name.
*/
Resource getResource(final String name, boolean check) {
- if (metaIndex != null) {
- if (!metaIndex.mayContain(name)) {
- return null;
- }
- }
-
try {
ensureOpen();
} catch (IOException e) {
throw new InternalError(e);
}
--- 826,835 ----
*** 1000,1013 ****
URL[] getClassPath() throws IOException {
if (index != null) {
return null;
}
- if (metaIndex != null) {
- return null;
- }
-
ensureOpen();
if (SharedSecrets.javaUtilJarAccess().jarFileHasClassPathAttribute(jar)) { // Only get manifest when necessary
Manifest man = jar.getManifest();
if (man != null) {
--- 968,977 ----
< prev index next >