Patch by Stefan Matthias Aust:

Handle case where Helma classes are not packed in jar file.
This commit is contained in:
hns 2003-07-09 15:15:28 +00:00
parent 672153dbfe
commit b8dea83bce

View file

@ -87,18 +87,20 @@ public final class TypeManager {
zipfiles = new HashMap(); zipfiles = new HashMap();
jarfiles = new HashSet(); jarfiles = new HashSet();
URL helmajar = TypeManager.class.getResource("/");
if (helmajar == null) {
// Helma classes are in jar file, get helma.jar URL
URL[] urls = ((URLClassLoader) TypeManager.class.getClassLoader()).getURLs(); URL[] urls = ((URLClassLoader) TypeManager.class.getClassLoader()).getURLs();
URL helmajar = null;
for (int i = 0; i < urls.length; i++) { for (int i = 0; i < urls.length; i++) {
String url = urls[i].toString().toLowerCase(); String url = urls[i].toString().toLowerCase();
if (url.endsWith("helma.jar")) { if (url.endsWith("helma.jar")) {
helmajar = urls[i]; helmajar = urls[i];
break; break;
} }
} }
}
if (helmajar == null) { if (helmajar == null) {
throw new RuntimeException("helma.jar not found in embedding classpath"); throw new RuntimeException("helma.jar not found in embedding classpath");