propagate from branch 'i2p.i2p' (head bd037c8b542fe0f6125aa16fb3bff5d257b4e955)

to branch 'i2p.i2p.str4d.ui' (head 9bd4080121d8ef662d6a2e4dfe7fae1079b32646)
This commit is contained in:
str4d
2017-02-10 16:43:25 +00:00
224 changed files with 4915 additions and 596 deletions

View File

@ -13,7 +13,7 @@ import net.i2p.util.Log;
/**
* Simple form handler base class - does not depend on servlets or jsp,
* but instead the subclasses are populated with javabean properties. e.g.
* <jsp:setProperty name="handler" property="*" />
* &lt;jsp:setProperty name="handler" property="*" /&gt;
*
* The form is "processed" after the properties are set and the first output
* property is retrieved - either getAll(), getNotices() or getErrors().
@ -126,7 +126,7 @@ public abstract class FormHandler {
/**
* Add an error message to display
* Use if it does not include a link.
* Escapes '<' and '>' before queueing
* Escapes '&lt;' and '&gt;' before queueing
*/
protected void addFormError(String errorMsg) {
if (errorMsg == null) return;
@ -136,7 +136,7 @@ public abstract class FormHandler {
/**
* Add a non-error message to display
* Use if it does not include a link.
* Escapes '<' and '>' before queueing
* Escapes '&lt;' and '&gt;' before queueing
*/
protected void addFormNotice(String msg) {
if (msg == null) return;
@ -146,7 +146,7 @@ public abstract class FormHandler {
/**
* Add a non-error message to display
* Use if it includes a link or other formatting.
* Does not escape '<' and '>' before queueing
* Does not escape '&lt;' and '&gt;' before queueing
* @since 0.9.14.1
*/
protected void addFormNoticeNoEscape(String msg) {
@ -157,7 +157,7 @@ public abstract class FormHandler {
/**
* Add an error message to display
* Use if it includes a link or other formatting.
* Does not escape '<' and '>' before queueing
* Does not escape '&lt;' and '&gt;' before queueing
* @since 0.9.19
*/
protected void addFormErrorNoEscape(String msg) {
@ -303,7 +303,7 @@ public abstract class FormHandler {
*
* @param s string to be translated containing {0}
* The {0} will be replaced by the parameter.
* Single quotes must be doubled, i.e. ' -> '' in the string.
* Single quotes must be doubled, i.e. ' -&gt; '' in the string.
* @param o parameter, not translated.
* To translate parameter also, use _t("foo {0} bar", _t("baz"))
* Do not double the single quotes in the parameter.

View File

@ -56,7 +56,7 @@ public class GraphHelper extends FormHandler {
}
/**
* This must be output in the jsp since <meta> must be in the <head>
* This must be output in the jsp since *lt;meta&gt; must be in the &lt;head&gt;
* @since 0.8.7
*/
public String getRefreshMeta() {

View File

@ -68,7 +68,7 @@ public abstract class HelperBase {
*
* @param s string to be translated containing {0}
* The {0} will be replaced by the parameter.
* Single quotes must be doubled, i.e. ' -> '' in the string.
* Single quotes must be doubled, i.e. ' -&gt; '' in the string.
* @param o parameter, not translated.
* To translate parameter also, use _t("foo {0} bar", _t("baz"))
* Do not double the single quotes in the parameter.

View File

@ -22,7 +22,7 @@ public class Messages extends Translate {
*
* @param s string to be translated containing {0}
* The {0} will be replaced by the parameter.
* Single quotes must be doubled, i.e. ' -> '' in the string.
* Single quotes must be doubled, i.e. ' -&gt; '' in the string.
* @param o parameter, not translated.
* To translate parameter also, use _t("foo {0} bar", _t("baz"))
* Do not double the single quotes in the parameter.

View File

@ -263,7 +263,7 @@ public class PluginStarter implements Runnable {
/**
* @return true on success
* @throws just about anything, caller would be wise to catch Throwable
* @throws Exception just about anything, caller would be wise to catch Throwable
*/
@SuppressWarnings("deprecation")
public static boolean startPlugin(RouterContext ctx, String appName) throws Exception {
@ -466,7 +466,7 @@ public class PluginStarter implements Runnable {
/**
* @return true on success
* @throws just about anything, caller would be wise to catch Throwable
* @throws Exception just about anything, caller would be wise to catch Throwable
*/
public static boolean stopPlugin(RouterContext ctx, String appName) throws Exception {
Log log = ctx.logManager().getLog(PluginStarter.class);
@ -702,7 +702,7 @@ public class PluginStarter implements Runnable {
/**
* @param action "start" or "stop" or "uninstall"
* @throws just about anything if an app has a delay less than zero, caller would be wise to catch Throwable
* @throws Exception just about anything if an app has a delay less than zero, caller would be wise to catch Throwable
* If no apps have a delay less than zero, it shouldn't throw anything
*/
private static void runClientApps(RouterContext ctx, File pluginDir, List<ClientAppConfig> apps, String action) throws Exception {

View File

@ -19,6 +19,7 @@ import java.util.Map;
import java.util.Properties;
import java.util.SortedSet;
import java.util.StringTokenizer;
import java.util.Timer;
import java.util.concurrent.LinkedBlockingQueue;
import net.i2p.I2PAppContext;
@ -95,6 +96,7 @@ public class RouterConsoleRunner implements RouterApp {
private final ClientAppManager _mgr;
private volatile ClientAppState _state = UNINITIALIZED;
private static Server _server;
private static Timer _jettyTimer;
private String _listenPort;
private String _listenHost;
private String _sslListenPort;
@ -235,6 +237,12 @@ public class RouterConsoleRunner implements RouterApp {
PortMapper portMapper = _context.portMapper();
portMapper.unregister(PortMapper.SVC_CONSOLE);
portMapper.unregister(PortMapper.SVC_HTTPS_CONSOLE);
synchronized(RouterConsoleRunner.class) {
if (_jettyTimer != null) {
_jettyTimer.cancel();
_jettyTimer = null;
}
}
changeState(STOPPED);
}
@ -273,7 +281,7 @@ public class RouterConsoleRunner implements RouterApp {
private void startTrayApp() {
// if no permissions, don't even try
// isLaunchedAsService() always returns true on Linux
if (SystemVersion.isLinuxService() ||
if (GraphicsEnvironment.isHeadless() || SystemVersion.isLinuxService() ||
(SystemVersion.isWindows() && _context.hasWrapper() && WrapperManager.isLaunchedAsService())) {
// required true for jrobin to work
System.setProperty("java.awt.headless", "true");
@ -285,8 +293,7 @@ public class RouterConsoleRunner implements RouterApp {
boolean desktopguiEnabled = Boolean.parseBoolean(sdtg) ||
(sdtg == null && SystemVersion.isWindows());
if (desktopguiEnabled) {
//Check if we are in a headless environment, set properties accordingly
System.setProperty("java.awt.headless", Boolean.toString(GraphicsEnvironment.isHeadless()));
System.setProperty("java.awt.headless", "false");
net.i2p.desktopgui.Main dtg = new net.i2p.desktopgui.Main(_context, _mgr, null);
dtg.startup();
} else {
@ -847,7 +854,7 @@ public class RouterConsoleRunner implements RouterApp {
Map<String, String> userpw = mgr.getMD5(PROP_CONSOLE_PW);
if (userpw.isEmpty()) {
enable = false;
ctx.router().saveConfig(PROP_CONSOLE_PW, "false");
ctx.router().saveConfig(PROP_PW_ENABLE, "false");
} else {
HashLoginService realm = new CustomHashLoginService(JETTY_REALM, context.getContextPath(),
ctx.logManager().getLog(RouterConsoleRunner.class));
@ -932,8 +939,18 @@ public class RouterConsoleRunner implements RouterApp {
sec.setConstraintMappings(cmarr);
context.setSecurityHandler(sec);
// No, we can't share the ConstraintSecurityHandler across all webapps
// But we can force all webapps to use a single Timer thread
// see HashSessionManager javadoc
synchronized(RouterConsoleRunner.class) {
if (_jettyTimer == null) {
_jettyTimer = new Timer("Console HashSessionScavenger", true);
}
context.getServletContext().setAttribute("org.eclipse.jetty.server.session.timer", _jettyTimer);
}
}
/**
* For logging authentication failures
* @since 0.9.28

View File

@ -38,7 +38,7 @@ public class StatSummarizer implements Runnable {
private final List<SummaryListener> _listeners;
// TODO remove static instance
private static StatSummarizer _instance;
private static final int MAX_CONCURRENT_PNG = 3;
private static final int MAX_CONCURRENT_PNG = SystemVersion.isARM() ? 2 : 3;
private final Semaphore _sem;
private volatile boolean _isRunning = true;
private boolean _isDisabled;

View File

@ -119,6 +119,7 @@ public class SummaryHelper extends HelperBase {
}
**/
/** allowReseed */
public boolean allowReseed() {
return _context.netDb().isInitialized() &&
(_context.netDb().getKnownRouters() < 30) ||

View File

@ -37,7 +37,7 @@ import org.eclipse.jetty.webapp.WebAppContext;
*
* No, wac.addClassPath() does not work. For more info see:
*
* http://servlets.com/archive/servlet/ReadMsg?msgId=511113&listName=jetty-support
* http://servlets.com/archive/servlet/ReadMsg?msgId=511113&amp;listName=jetty-support
*
* @since 0.7.12
* @author zzz

View File

@ -27,7 +27,7 @@ import org.eclipse.jetty.webapp.WebAppContext;
*
* No, wac.addClassPath() does not work. For more info see:
*
* http://servlets.com/archive/servlet/ReadMsg?msgId=511113&listName=jetty-support
* http://servlets.com/archive/servlet/ReadMsg?msgId=511113&amp;listName=jetty-support
*
* @since 0.7.12
* @author zzz
@ -51,7 +51,7 @@ public class WebAppStarter {
* Adds and starts.
* Prior to 0.9.28, was not guaranteed to throw on failure.
*
* @throws just about anything, caller would be wise to catch Throwable
* @throws Exception just about anything, caller would be wise to catch Throwable
*/
static void startWebApp(RouterContext ctx, ContextHandlerCollection server,
String appName, String warPath) throws Exception {
@ -123,8 +123,8 @@ public class WebAppStarter {
}
/**
* stop it and remove the context
* @throws just about anything, caller would be wise to catch Throwable
* Stop it and remove the context.
* Throws just about anything, caller would be wise to catch Throwable
*/
static void stopWebApp(String appName) {
ContextHandler wac = getWebApp(appName);