forked from I2P_Developers/i2p.i2p
lint console,streaming
This commit is contained in:
@ -256,9 +256,9 @@ public class I2PSocketManagerFactory {
|
|||||||
Class<?> cls = Class.forName(classname);
|
Class<?> cls = Class.forName(classname);
|
||||||
if (!I2PSocketManager.class.isAssignableFrom(cls))
|
if (!I2PSocketManager.class.isAssignableFrom(cls))
|
||||||
throw new IllegalArgumentException(classname + " is not an I2PSocketManager");
|
throw new IllegalArgumentException(classname + " is not an I2PSocketManager");
|
||||||
Constructor<I2PSocketManager> con = (Constructor<I2PSocketManager>)
|
Constructor<?> con =
|
||||||
cls.getConstructor(new Class[] {I2PAppContext.class, I2PSession.class, Properties.class, String.class});
|
cls.getConstructor(I2PAppContext.class, I2PSession.class, Properties.class, String.class);
|
||||||
I2PSocketManager mgr = con.newInstance(new Object[] {context, session, opts, name});
|
I2PSocketManager mgr = (I2PSocketManager) con.newInstance(new Object[] {context, session, opts, name});
|
||||||
return mgr;
|
return mgr;
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
getLog().log(Log.CRIT, "Error loading " + classname, t);
|
getLog().log(Log.CRIT, "Error loading " + classname, t);
|
||||||
|
@ -64,7 +64,7 @@ public class NewsManager implements RouterApp {
|
|||||||
*/
|
*/
|
||||||
public synchronized List<NewsEntry> getEntries() {
|
public synchronized List<NewsEntry> getEntries() {
|
||||||
if (!_currentNews.isEmpty())
|
if (!_currentNews.isEmpty())
|
||||||
return new ArrayList(_currentNews);
|
return new ArrayList<NewsEntry>(_currentNews);
|
||||||
// load old news.xml
|
// load old news.xml
|
||||||
if (_log.shouldWarn())
|
if (_log.shouldWarn())
|
||||||
_log.warn("no real XML, falling back to news.xml");
|
_log.warn("no real XML, falling back to news.xml");
|
||||||
|
@ -4,6 +4,8 @@ import java.io.ByteArrayInputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import net.i2p.util.LogManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler to deal with form submissions from the logging config form and act
|
* Handler to deal with form submissions from the logging config form and act
|
||||||
* upon the values.
|
* upon the values.
|
||||||
@ -113,7 +115,7 @@ public class ConfigLoggingHandler extends FormHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_fileSize != null) {
|
if (_fileSize != null) {
|
||||||
int newBytes = _context.logManager().getFileSize(_fileSize);
|
int newBytes = LogManager.getFileSize(_fileSize);
|
||||||
int oldBytes = _context.logManager().getFileSize();
|
int oldBytes = _context.logManager().getFileSize();
|
||||||
if (newBytes > 0) {
|
if (newBytes > 0) {
|
||||||
if (oldBytes != newBytes) {
|
if (oldBytes != newBytes) {
|
||||||
|
@ -23,6 +23,7 @@ public abstract class FormHandler {
|
|||||||
protected RouterContext _context;
|
protected RouterContext _context;
|
||||||
protected Log _log;
|
protected Log _log;
|
||||||
/** Not for multipart/form-data, will be null */
|
/** Not for multipart/form-data, will be null */
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
protected Map _settings;
|
protected Map _settings;
|
||||||
/** Only for multipart/form-data. Warning, parameters are NOT XSS filtered */
|
/** Only for multipart/form-data. Warning, parameters are NOT XSS filtered */
|
||||||
protected RequestWrapper _requestWrapper;
|
protected RequestWrapper _requestWrapper;
|
||||||
@ -63,6 +64,7 @@ public abstract class FormHandler {
|
|||||||
*
|
*
|
||||||
* @since 0.9.4 consolidated from numerous FormHandlers
|
* @since 0.9.4 consolidated from numerous FormHandlers
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
public void setSettings(Map settings) { _settings = new HashMap(settings); }
|
public void setSettings(Map settings) { _settings = new HashMap(settings); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,6 +83,7 @@ public class LocaleWebAppHandler extends HandlerWrapper
|
|||||||
if (lang != null && lang.length() > 0 && !lang.equals("en")) {
|
if (lang != null && lang.length() > 0 && !lang.equals("en")) {
|
||||||
String testPath = pathInContext.substring(0, len - 4) + '_' + lang + ".jsp";
|
String testPath = pathInContext.substring(0, len - 4) + '_' + lang + ".jsp";
|
||||||
// Do we have a servlet for the new path that isn't the catchall *.jsp?
|
// Do we have a servlet for the new path that isn't the catchall *.jsp?
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
Map.Entry servlet = _wac.getServletHandler().getHolderEntry(testPath);
|
Map.Entry servlet = _wac.getServletHandler().getHolderEntry(testPath);
|
||||||
if (servlet != null) {
|
if (servlet != null) {
|
||||||
String servletPath = (String) servlet.getKey();
|
String servletPath = (String) servlet.getKey();
|
||||||
@ -130,7 +131,7 @@ public class LocaleWebAppHandler extends HandlerWrapper
|
|||||||
/**
|
/**
|
||||||
* Mysteriously removed from Jetty 7
|
* Mysteriously removed from Jetty 7
|
||||||
*/
|
*/
|
||||||
private void setInitParams(Map params) {
|
private void setInitParams(Map<?,?> params) {
|
||||||
setInitParams(_wac, params);
|
setInitParams(_wac, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,7 +139,7 @@ public class LocaleWebAppHandler extends HandlerWrapper
|
|||||||
* @since Jetty 7
|
* @since Jetty 7
|
||||||
*/
|
*/
|
||||||
public static void setInitParams(WebAppContext context, Map<?,?> params) {
|
public static void setInitParams(WebAppContext context, Map<?,?> params) {
|
||||||
for (Map.Entry e : params.entrySet()) {
|
for (Map.Entry<?,?> e : params.entrySet()) {
|
||||||
context.setInitParameter((String)e.getKey(), (String)e.getValue());
|
context.setInitParameter((String)e.getKey(), (String)e.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -264,6 +264,7 @@ public class PluginStarter implements Runnable {
|
|||||||
* @return true on success
|
* @return true on success
|
||||||
* @throws just about anything, caller would be wise to catch Throwable
|
* @throws just about anything, caller would be wise to catch Throwable
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public static boolean startPlugin(RouterContext ctx, String appName) throws Exception {
|
public static boolean startPlugin(RouterContext ctx, String appName) throws Exception {
|
||||||
Log log = ctx.logManager().getLog(PluginStarter.class);
|
Log log = ctx.logManager().getLog(PluginStarter.class);
|
||||||
File pluginDir = new File(ctx.getConfigDir(), PLUGIN_DIR + '/' + appName);
|
File pluginDir = new File(ctx.getConfigDir(), PLUGIN_DIR + '/' + appName);
|
||||||
@ -344,9 +345,11 @@ public class PluginStarter implements Runnable {
|
|||||||
if (tfiles != null) {
|
if (tfiles != null) {
|
||||||
for (int i = 0; i < tfiles.length; i++) {
|
for (int i = 0; i < tfiles.length; i++) {
|
||||||
String name = tfiles[i].getName();
|
String name = tfiles[i].getName();
|
||||||
if (tfiles[i].isDirectory() && (!Arrays.asList(STANDARD_THEMES).contains(tfiles[i])))
|
if (tfiles[i].isDirectory() && (!Arrays.asList(STANDARD_THEMES).contains(tfiles[i]))) {
|
||||||
|
// deprecated
|
||||||
ctx.router().setConfigSetting(ConfigUIHelper.PROP_THEME_PFX + name, tfiles[i].getAbsolutePath());
|
ctx.router().setConfigSetting(ConfigUIHelper.PROP_THEME_PFX + name, tfiles[i].getAbsolutePath());
|
||||||
// we don't need to save
|
// we don't need to save
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -543,7 +546,7 @@ public class PluginStarter implements Runnable {
|
|||||||
|
|
||||||
boolean deleted = FileUtil.rmdir(pluginDir, false);
|
boolean deleted = FileUtil.rmdir(pluginDir, false);
|
||||||
Properties props = pluginProperties();
|
Properties props = pluginProperties();
|
||||||
for (Iterator iter = props.keySet().iterator(); iter.hasNext(); ) {
|
for (Iterator<?> iter = props.keySet().iterator(); iter.hasNext(); ) {
|
||||||
String name = (String)iter.next();
|
String name = (String)iter.next();
|
||||||
if (name.startsWith(PREFIX + appName + '.'))
|
if (name.startsWith(PREFIX + appName + '.'))
|
||||||
iter.remove();
|
iter.remove();
|
||||||
@ -973,7 +976,7 @@ public class PluginStarter implements Runnable {
|
|||||||
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();
|
||||||
Class<URLClassLoader> urlClass = URLClassLoader.class;
|
Class<URLClassLoader> urlClass = URLClassLoader.class;
|
||||||
Method method = urlClass.getDeclaredMethod("addURL", new Class[]{URL.class});
|
Method method = urlClass.getDeclaredMethod("addURL", URL.class);
|
||||||
method.setAccessible(true);
|
method.setAccessible(true);
|
||||||
method.invoke(urlClassLoader, new Object[]{u});
|
method.invoke(urlClassLoader, new Object[]{u});
|
||||||
}
|
}
|
||||||
|
@ -212,14 +212,16 @@ public class TunnelRenderer {
|
|||||||
}
|
}
|
||||||
out.write("</table>\n");
|
out.write("</table>\n");
|
||||||
if (in != null) {
|
if (in != null) {
|
||||||
List pending = in.listPending();
|
// PooledTunnelCreatorConfig
|
||||||
|
List<?> pending = in.listPending();
|
||||||
if (!pending.isEmpty()) {
|
if (!pending.isEmpty()) {
|
||||||
out.write("<div class=\"statusnotes\"><center><b>" + _t("Build in progress") + ": " + pending.size() + " " + _t("inbound") + "</b></center></div>\n");
|
out.write("<div class=\"statusnotes\"><center><b>" + _t("Build in progress") + ": " + pending.size() + " " + _t("inbound") + "</b></center></div>\n");
|
||||||
live += pending.size();
|
live += pending.size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (outPool != null) {
|
if (outPool != null) {
|
||||||
List pending = outPool.listPending();
|
// PooledTunnelCreatorConfig
|
||||||
|
List<?> pending = outPool.listPending();
|
||||||
if (!pending.isEmpty()) {
|
if (!pending.isEmpty()) {
|
||||||
out.write("<div class=\"statusnotes\"><center><b>" + _t("Build in progress") + ": " + pending.size() + " " + _t("outbound") + "</b></center></div>\n");
|
out.write("<div class=\"statusnotes\"><center><b>" + _t("Build in progress") + ": " + pending.size() + " " + _t("outbound") + "</b></center></div>\n");
|
||||||
live += pending.size();
|
live += pending.size();
|
||||||
|
Reference in New Issue
Block a user