forked from I2P_Developers/i2p.i2p
Console: Java 9 fixes for classloader (ticket #1870)
May not be sufficient for plugins Unlinkify viewmtn links on /jars, site is down
This commit is contained in:
@ -33,22 +33,26 @@ public class FileDumpHelper extends HelperBase {
|
|||||||
"<th>JDK</th><th>Built</th><th>By</th><th>Mods</th></tr>");
|
"<th>JDK</th><th>Built</th><th>By</th><th>Mods</th></tr>");
|
||||||
|
|
||||||
// jars added in wrapper.config
|
// jars added in wrapper.config
|
||||||
URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
|
ClassLoader loader = ClassLoader.getSystemClassLoader();
|
||||||
URL[] urls = urlClassLoader.getURLs();
|
if (loader instanceof URLClassLoader) {
|
||||||
List<File> flist = new ArrayList<File>();
|
// through Java 8, not available in Java 9
|
||||||
for (int i = 0; i < urls.length; i++) {
|
URLClassLoader urlClassLoader = (URLClassLoader) loader;
|
||||||
String p = urls[i].toString();
|
URL[] urls = urlClassLoader.getURLs();
|
||||||
if (p.startsWith("file:") && p.endsWith(".jar")) {
|
List<File> flist = new ArrayList<File>();
|
||||||
p = p.substring(5);
|
for (int i = 0; i < urls.length; i++) {
|
||||||
if (!(p.startsWith(_context.getBaseDir().getAbsolutePath()) ||
|
String p = urls[i].toString();
|
||||||
p.startsWith(_context.getConfigDir().getAbsolutePath()))) {
|
if (p.startsWith("file:") && p.endsWith(".jar")) {
|
||||||
flist.add(new File(p));
|
p = p.substring(5);
|
||||||
|
if (!(p.startsWith(_context.getBaseDir().getAbsolutePath()) ||
|
||||||
|
p.startsWith(_context.getConfigDir().getAbsolutePath()))) {
|
||||||
|
flist.add(new File(p));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
Collections.sort(flist);
|
||||||
Collections.sort(flist);
|
for (File f : flist) {
|
||||||
for (File f : flist) {
|
dumpFile(buf, f);
|
||||||
dumpFile(buf, f);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// our jars
|
// our jars
|
||||||
@ -123,11 +127,13 @@ public class FileDumpHelper extends HelperBase {
|
|||||||
if (s != null && s.length() > 20) {
|
if (s != null && s.length() > 20) {
|
||||||
if (iv != null)
|
if (iv != null)
|
||||||
buf.append("<br>");
|
buf.append("<br>");
|
||||||
buf.append("<a href=\"http://killyourtv.i2p/viewmtn/revision/info/").append(s)
|
// fix and uncomment if a reliable viewmtn host appears
|
||||||
.append("\">" +
|
//buf.append("<a href=\"http://killyourtv.i2p/viewmtn/revision/info/").append(s)
|
||||||
"<tt>").append(s.substring(0, 20)).append("</tt>" +
|
// .append("\">");
|
||||||
|
buf.append("<tt>").append(s.substring(0, 20)).append("</tt>" +
|
||||||
"<br>" +
|
"<br>" +
|
||||||
"<tt>").append(s.substring(20)).append("</tt></a>");
|
"<tt>").append(s.substring(20)).append("</tt>");
|
||||||
|
//buf.append("</tt>");
|
||||||
}
|
}
|
||||||
buf.append("</td><td>");
|
buf.append("</td><td>");
|
||||||
s = getAtt(att, "Created-By");
|
s = getAtt(att, "Created-By");
|
||||||
|
@ -434,8 +434,12 @@ public class PluginStarter implements Runnable {
|
|||||||
if (f.getName().endsWith(".jar")) {
|
if (f.getName().endsWith(".jar")) {
|
||||||
try {
|
try {
|
||||||
addPath(f.toURI().toURL());
|
addPath(f.toURI().toURL());
|
||||||
log.error("INFO: Adding translation plugin to classpath: " + f);
|
log.info("INFO: Adding translation plugin to classpath: " + f);
|
||||||
added = true;
|
added = true;
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
log.logAlways(Log.WARN, "Java version: " + System.getProperty("java.version") +
|
||||||
|
" does not support adding classpath element: " + f +
|
||||||
|
" for plugin " + appName);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
log.error("Plugin " + appName + " bad classpath element: " + f, e);
|
log.error("Plugin " + appName + " bad classpath element: " + f, e);
|
||||||
}
|
}
|
||||||
@ -987,6 +991,8 @@ public class PluginStarter implements Runnable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* http://jimlife.wordpress.com/2007/12/19/java-adding-new-classpath-at-runtime/
|
* http://jimlife.wordpress.com/2007/12/19/java-adding-new-classpath-at-runtime/
|
||||||
|
*
|
||||||
|
* @throws ClassCastException in Java 9
|
||||||
*/
|
*/
|
||||||
private static void addPath(URL u) throws Exception {
|
private static void addPath(URL u) throws Exception {
|
||||||
URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
|
URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
|
||||||
|
@ -110,7 +110,7 @@ public class WebAppConfiguration implements Configuration {
|
|||||||
return;
|
return;
|
||||||
StringTokenizer tok = new StringTokenizer(cp, " ,");
|
StringTokenizer tok = new StringTokenizer(cp, " ,");
|
||||||
StringBuilder buf = new StringBuilder();
|
StringBuilder buf = new StringBuilder();
|
||||||
Set<URI> systemCP = getSystemClassPath();
|
Set<URI> systemCP = getSystemClassPath(i2pContext);
|
||||||
while (tok.hasMoreTokens()) {
|
while (tok.hasMoreTokens()) {
|
||||||
if (buf.length() > 0)
|
if (buf.length() > 0)
|
||||||
buf.append(',');
|
buf.append(',');
|
||||||
@ -159,14 +159,28 @@ public class WebAppConfiguration implements Configuration {
|
|||||||
* but keep findbugs happy.
|
* but keep findbugs happy.
|
||||||
* @since 0.9
|
* @since 0.9
|
||||||
*/
|
*/
|
||||||
private static Set<URI> getSystemClassPath() {
|
private static Set<URI> getSystemClassPath(I2PAppContext ctx) {
|
||||||
URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
|
|
||||||
URL urls[] = urlClassLoader.getURLs();
|
|
||||||
Set<URI> rv = new HashSet<URI>(32);
|
Set<URI> rv = new HashSet<URI>(32);
|
||||||
for (int i = 0; i < urls.length; i++) {
|
ClassLoader loader = ClassLoader.getSystemClassLoader();
|
||||||
try {
|
if (loader instanceof URLClassLoader) {
|
||||||
rv.add(urls[i].toURI());
|
// through Java 8, not available in Java 9
|
||||||
} catch (URISyntaxException use) {}
|
URLClassLoader urlClassLoader = (URLClassLoader) loader;
|
||||||
|
URL urls[] = urlClassLoader.getURLs();
|
||||||
|
for (int i = 0; i < urls.length; i++) {
|
||||||
|
try {
|
||||||
|
rv.add(urls[i].toURI());
|
||||||
|
} catch (URISyntaxException use) {}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Java 9 - assume everything in lib/ is in the classpath
|
||||||
|
File libDir = new File(ctx.getBaseDir(), "lib");
|
||||||
|
File[] files = libDir.listFiles();
|
||||||
|
if (files != null) {
|
||||||
|
for (int i = 0; i < files.length; i++) {
|
||||||
|
if (files[i].getName().endsWith(".jar"))
|
||||||
|
rv.add(files[i].toURI());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
12
history.txt
12
history.txt
@ -1,3 +1,15 @@
|
|||||||
|
2016-10-29 zzz
|
||||||
|
* Console: Java 9 fixes for classloader (ticket #1870)
|
||||||
|
|
||||||
|
2016-10-28 zzz
|
||||||
|
* Build: Fix typo in jcpuid build.sh for Mac (ticket #1865)
|
||||||
|
* Crypto:
|
||||||
|
- Generate more-conforming selfsigned certs (ticket #1853)
|
||||||
|
- Remove deprecated Sha256Standalone as scheduled
|
||||||
|
* Utils:
|
||||||
|
- Fix Java version detection for Java 9 (ticket #1870)
|
||||||
|
- Add Addresses methods for multiple DNS results (ticket #1050)
|
||||||
|
|
||||||
2016-10-26 zzz
|
2016-10-26 zzz
|
||||||
* Build: Mac jbigi/jcpuid improvements and docs (ticket #1865)
|
* Build: Mac jbigi/jcpuid improvements and docs (ticket #1865)
|
||||||
* JRobin 1.6.0-1
|
* JRobin 1.6.0-1
|
||||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
|||||||
/** deprecated */
|
/** deprecated */
|
||||||
public final static String ID = "Monotone";
|
public final static String ID = "Monotone";
|
||||||
public final static String VERSION = CoreVersion.VERSION;
|
public final static String VERSION = CoreVersion.VERSION;
|
||||||
public final static long BUILD = 5;
|
public final static long BUILD = 6;
|
||||||
|
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "";
|
public final static String EXTRA = "";
|
||||||
|
Reference in New Issue
Block a user