Changeset 0cea3e0


Ignore:
Timestamp:
Mar 6, 2012 2:04:04 PM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
175e464c
Parents:
de2b204
Message:
  • Webapp class loader: Fix dup classes in classpath caused by last checkin (symptom: i2psnark in wrong directory)
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/WebAppConfiguration.java

    rde2b204 r0cea3e0  
    22
    33import java.io.File;
     4import java.net.URL;
     5import java.net.URLClassLoader;
     6import java.util.HashSet;
    47import java.util.Properties;
     8import java.util.Set;
    59import java.util.StringTokenizer;
    610
     
    8488        StringTokenizer tok = new StringTokenizer(cp, " ,");
    8589        StringBuilder buf = new StringBuilder();
     90        Set<URL> systemCP = getSystemClassPath();
    8691        while (tok.hasMoreTokens()) {
    8792            if (buf.length() > 0)
     
    95100            else
    96101                path = dir.getAbsolutePath() + '/' + elem;
     102            // As of Jetty 6, we can't add dups to the class path, or
     103            // else it screws up statics
     104            File jfile = new File(path);
     105            File jdir = jfile.getParentFile();
     106            if (systemCP.contains(jfile.toURI().toURL()) ||
     107                (jdir != null && systemCP.contains(jdir.toURI().toURL()))) {
     108                //System.err.println("Not adding " + path + " to classpath for " + appName + ", already in system classpath");
     109                continue;
     110            }
    97111            System.err.println("Adding " + path + " to classpath for " + appName);
    98112            buf.append(path);
    99113        }
     114        if (buf.length() <= 0)
     115            return;
    100116        ClassLoader cl = _wac.getClassLoader();
    101117        if (cl != null && cl instanceof WebAppClassLoader) {
     
    108124            _wac.setExtraClasspath(buf.toString());
    109125        }
     126    }
     127
     128    /** @since 0.9 */
     129    private static Set<URL> getSystemClassPath() {
     130        URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
     131        URL urls[] = urlClassLoader.getURLs();
     132        Set<URL> rv = new HashSet(32);
     133        for (int i = 0; i < urls.length; i++) {
     134            rv.add(urls[i]);
     135        }
     136        return rv;
    110137    }
    111138
  • history.txt

    rde2b204 r0cea3e0  
     12012-03-06 zzz
     2  * i2psnark: Fix NPE on magnet link addition
     3  * Jetty logger: Fix stack trace logging
     4  * viewstat.jsp: Properly close the ImageOutputStream to fix
     5    NPEs in the finalizer, probably was the root cause of
     6    what we blamed on Jetty
     7  * Webapp class loader: Fix dup classes in classpath
     8    caused by last checkin (symptom: i2psnark in wrong directory)
     9
    1102012-03-05 zzz
    211  * Build: Make windows and non-windows installers for release
  • router/java/src/net/i2p/router/RouterVersion.java

    rde2b204 r0cea3e0  
    1919    public final static String ID = "Monotone";
    2020    public final static String VERSION = CoreVersion.VERSION;
    21     public final static long BUILD = 5;
     21    public final static long BUILD = 6;
    2222
    2323    /** for example "-test" */
Note: See TracChangeset for help on using the changeset viewer.