forked from I2P_Developers/i2p.i2p
* Webapp class loader: Fix dup classes in classpath
caused by last checkin (symptom: i2psnark in wrong directory)
This commit is contained in:
@ -1,7 +1,11 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.HashSet;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
@ -83,6 +87,7 @@ public class WebAppConfiguration implements Configuration {
|
||||
return;
|
||||
StringTokenizer tok = new StringTokenizer(cp, " ,");
|
||||
StringBuilder buf = new StringBuilder();
|
||||
Set<URL> systemCP = getSystemClassPath();
|
||||
while (tok.hasMoreTokens()) {
|
||||
if (buf.length() > 0)
|
||||
buf.append(',');
|
||||
@ -94,9 +99,20 @@ public class WebAppConfiguration implements Configuration {
|
||||
path = dir.getAbsolutePath() + elem.substring(7);
|
||||
else
|
||||
path = dir.getAbsolutePath() + '/' + elem;
|
||||
// As of Jetty 6, we can't add dups to the class path, or
|
||||
// else it screws up statics
|
||||
File jfile = new File(path);
|
||||
File jdir = jfile.getParentFile();
|
||||
if (systemCP.contains(jfile.toURI().toURL()) ||
|
||||
(jdir != null && systemCP.contains(jdir.toURI().toURL()))) {
|
||||
//System.err.println("Not adding " + path + " to classpath for " + appName + ", already in system classpath");
|
||||
continue;
|
||||
}
|
||||
System.err.println("Adding " + path + " to classpath for " + appName);
|
||||
buf.append(path);
|
||||
}
|
||||
if (buf.length() <= 0)
|
||||
return;
|
||||
ClassLoader cl = _wac.getClassLoader();
|
||||
if (cl != null && cl instanceof WebAppClassLoader) {
|
||||
WebAppClassLoader wacl = (WebAppClassLoader) cl;
|
||||
@ -109,6 +125,17 @@ public class WebAppConfiguration implements Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
/** @since 0.9 */
|
||||
private static Set<URL> getSystemClassPath() {
|
||||
URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
|
||||
URL urls[] = urlClassLoader.getURLs();
|
||||
Set<URL> rv = new HashSet(32);
|
||||
for (int i = 0; i < urls.length; i++) {
|
||||
rv.add(urls[i]);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
public void configureDefaults() {}
|
||||
public void configureWebApp() {}
|
||||
|
||||
|
@ -1,3 +1,12 @@
|
||||
2012-03-06 zzz
|
||||
* i2psnark: Fix NPE on magnet link addition
|
||||
* Jetty logger: Fix stack trace logging
|
||||
* viewstat.jsp: Properly close the ImageOutputStream to fix
|
||||
NPEs in the finalizer, probably was the root cause of
|
||||
what we blamed on Jetty
|
||||
* Webapp class loader: Fix dup classes in classpath
|
||||
caused by last checkin (symptom: i2psnark in wrong directory)
|
||||
|
||||
2012-03-05 zzz
|
||||
* Build: Make windows and non-windows installers for release
|
||||
* configclients: Tweaks
|
||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Monotone";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 5;
|
||||
public final static long BUILD = 6;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "";
|
||||
|
Reference in New Issue
Block a user