64 |
if (pathComponent.exists() && !pathComponent.isDirectory()) { |
if (pathComponent.exists() && !pathComponent.isDirectory()) { |
65 |
List subComponents = tryGetJarFileClassPathComponents(pathComponent); |
List subComponents = tryGetJarFileClassPathComponents(pathComponent); |
66 |
if (null != subComponents) { |
if (null != subComponents) { |
|
System.err.println("have subComponents: " + subComponents); |
|
67 |
components.addAll(subComponents); |
components.addAll(subComponents); |
68 |
} |
} |
69 |
} |
} |
102 |
|
|
103 |
public URL findResource(String name) |
public URL findResource(String name) |
104 |
{ |
{ |
|
System.err.println("FileSystemClassLoader.findResource called with " + name); |
|
105 |
StreamInfo streamInfo = getResourceStream(name); |
StreamInfo streamInfo = getResourceStream(name); |
106 |
if (null == streamInfo) { |
if (null == streamInfo) { |
107 |
return super.findResource(name); |
return super.findResource(name); |
108 |
} |
} |
109 |
else { |
else { |
110 |
try { |
try { |
|
//System.err.println("found resource at " + streamInfo.getURL()); |
|
111 |
return streamInfo.getURL(); |
return streamInfo.getURL(); |
112 |
} |
} |
113 |
catch (MalformedURLException e) { |
catch (MalformedURLException e) { |
258 |
throw new ClassNotFoundException(className); |
throw new ClassNotFoundException(className); |
259 |
} |
} |
260 |
|
|
|
/* |
|
|
try { |
|
|
String classFileName = className.replace('.', File.separatorChar) + ".class"; |
|
|
|
|
|
for (int i = 0; i < pathComponents.length; ++i) { |
|
|
try { |
|
|
File parent = pathComponents[i]; |
|
|
if (parent.isDirectory()) { |
|
|
File file = new File(parent, classFileName); |
|
|
if (file.exists()) { |
|
|
return readFromStream(new FileInputStream(file), file.length()); |
|
|
} |
|
|
} |
|
|
else { |
|
|
JarFile jarFile = new JarFile(parent, false, JarFile.OPEN_READ); |
|
|
JarEntry jarEntry = jarFile.getJarEntry(classFileName); |
|
|
if (null != jarEntry) { |
|
|
return readFromStream(jarFile.getInputStream(jarEntry), |
|
|
jarEntry.getSize()); |
|
|
} |
|
|
else { |
|
|
Manifest manifest = jarFile.getManifest(); |
|
|
Attributes classpathAttributes = manifest.getAttributes("Class-Path"); |
|
|
if (null != classpathAttributes) { |
|
|
System.err.println("classpathAttributes: " + classpathAttributes); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
catch (FileNotFoundException ignore) { |
|
|
} |
|
|
} |
|
|
} |
|
|
catch (IOException ignore_) { |
|
|
} |
|
|
throw new ClassNotFoundException(className); |
|
|
} |
|
|
*/ |
|
|
|
|
261 |
private static List tryGetJarFileClassPathComponents(File file) |
private static List tryGetJarFileClassPathComponents(File file) |
262 |
{ |
{ |
263 |
try { |
try { |