forked from I2P_Developers/i2p.i2p
routerconsole: type arguments, unused imports
This commit is contained in:
@ -9,8 +9,6 @@ import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -25,7 +23,6 @@ import net.i2p.data.DataHelper;
|
||||
import net.i2p.router.Router;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.RouterVersion;
|
||||
import net.i2p.router.util.RFC822Date;
|
||||
import net.i2p.router.web.ConfigServiceHandler;
|
||||
import net.i2p.router.web.ConfigUpdateHandler;
|
||||
import net.i2p.router.web.Messages;
|
||||
@ -37,7 +34,6 @@ import static net.i2p.update.UpdateMethod.*;
|
||||
import net.i2p.util.ConcurrentHashSet;
|
||||
import net.i2p.util.FileUtil;
|
||||
import net.i2p.util.Log;
|
||||
import net.i2p.util.SimpleScheduler;
|
||||
import net.i2p.util.SimpleTimer;
|
||||
import net.i2p.util.VersionComparator;
|
||||
|
||||
@ -84,13 +80,13 @@ public class ConsoleUpdateManager implements UpdateManager {
|
||||
public ConsoleUpdateManager(RouterContext ctx) {
|
||||
_context = ctx;
|
||||
_log = ctx.logManager().getLog(ConsoleUpdateManager.class);
|
||||
_registeredUpdaters = new ConcurrentHashSet();
|
||||
_registeredCheckers = new ConcurrentHashSet();
|
||||
_activeCheckers = new ConcurrentHashSet();
|
||||
_downloaders = new ConcurrentHashMap();
|
||||
_available = new ConcurrentHashMap();
|
||||
_downloaded = new ConcurrentHashMap();
|
||||
_installed = new ConcurrentHashMap();
|
||||
_registeredUpdaters = new ConcurrentHashSet<RegisteredUpdater>();
|
||||
_registeredCheckers = new ConcurrentHashSet<RegisteredChecker>();
|
||||
_activeCheckers = new ConcurrentHashSet<UpdateTask>();
|
||||
_downloaders = new ConcurrentHashMap<UpdateTask, List<RegisteredUpdater>>();
|
||||
_available = new ConcurrentHashMap<UpdateItem, VersionAvailable>();
|
||||
_downloaded = new ConcurrentHashMap<UpdateItem, Version>();
|
||||
_installed = new ConcurrentHashMap<UpdateItem, Version>();
|
||||
_status = "";
|
||||
// DEBUG slow start for snark updates
|
||||
// For 0.9.4 update, only for dev builds
|
||||
@ -111,7 +107,7 @@ public class ConsoleUpdateManager implements UpdateManager {
|
||||
notifyInstalled(ROUTER_SIGNED_SU3, "", RouterVersion.VERSION);
|
||||
// hack to init from the current news file... do this before we register Updaters
|
||||
// This will not kick off any Updaters as none are yet registered
|
||||
(new NewsFetcher(_context, this, Collections.EMPTY_LIST)).checkForUpdates();
|
||||
(new NewsFetcher(_context, this, Collections.<URI> emptyList())).checkForUpdates();
|
||||
for (String plugin : PluginStarter.getPlugins()) {
|
||||
Properties props = PluginStarter.pluginProperties(_context, plugin);
|
||||
String ver = props.getProperty("version");
|
||||
@ -123,7 +119,7 @@ public class ConsoleUpdateManager implements UpdateManager {
|
||||
DummyHandler dh = new DummyHandler(_context, this);
|
||||
register((Checker)dh, TYPE_DUMMY, METHOD_DUMMY, 0);
|
||||
register((Updater)dh, TYPE_DUMMY, METHOD_DUMMY, 0);
|
||||
VersionAvailable dummyVA = new VersionAvailable("", "", METHOD_DUMMY, Collections.EMPTY_LIST);
|
||||
VersionAvailable dummyVA = new VersionAvailable("", "", METHOD_DUMMY, Collections.<URI> emptyList());
|
||||
_available.put(new UpdateItem(TYPE_DUMMY, ""), dummyVA);
|
||||
// register news before router, so we don't fire off an update
|
||||
// right at instantiation if the news is already indicating a new version
|
||||
@ -526,7 +522,7 @@ public class ConsoleUpdateManager implements UpdateManager {
|
||||
_log.warn("No version available for: " + type + ' ' + id);
|
||||
return false;
|
||||
}
|
||||
List<RegisteredUpdater> sorted = new ArrayList(4);
|
||||
List<RegisteredUpdater> sorted = new ArrayList<RegisteredUpdater>(4);
|
||||
for (RegisteredUpdater ru : _registeredUpdaters) {
|
||||
if (ru.type == type)
|
||||
sorted.add(ru);
|
||||
@ -1069,7 +1065,7 @@ public class ConsoleUpdateManager implements UpdateManager {
|
||||
{ // avoid dup variables in next case
|
||||
String URLs = _context.getProperty(ConfigUpdateHandler.PROP_UPDATE_URL, ConfigUpdateHandler.DEFAULT_UPDATE_URL);
|
||||
StringTokenizer tok = new StringTokenizer(URLs, " ,\r\n");
|
||||
List<URI> rv = new ArrayList();
|
||||
List<URI> rv = new ArrayList<URI>();
|
||||
while (tok.hasMoreTokens()) {
|
||||
try {
|
||||
rv.add(new URI(tok.nextToken().trim()));
|
||||
@ -1083,7 +1079,7 @@ public class ConsoleUpdateManager implements UpdateManager {
|
||||
{
|
||||
String URLs = ConfigUpdateHandler.SU3_UPDATE_URLS;
|
||||
StringTokenizer tok = new StringTokenizer(URLs, " ,\r\n");
|
||||
List<URI> rv = new ArrayList();
|
||||
List<URI> rv = new ArrayList<URI>();
|
||||
while (tok.hasMoreTokens()) {
|
||||
try {
|
||||
rv.add(new URI(tok.nextToken().trim()));
|
||||
@ -1115,7 +1111,7 @@ public class ConsoleUpdateManager implements UpdateManager {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return Collections.EMPTY_LIST;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1494,7 +1490,7 @@ public class ConsoleUpdateManager implements UpdateManager {
|
||||
public VersionAvailable(String version, String min, UpdateMethod method, List<URI> updateSources) {
|
||||
super(version);
|
||||
minVersion = min;
|
||||
sourceMap = new ConcurrentHashMap(4);
|
||||
sourceMap = new ConcurrentHashMap<UpdateMethod, List<URI>>(4);
|
||||
sourceMap.put(method, updateSources);
|
||||
}
|
||||
|
||||
@ -1505,7 +1501,7 @@ public class ConsoleUpdateManager implements UpdateManager {
|
||||
public VersionAvailable(String version, String constraint) {
|
||||
super(version);
|
||||
minVersion = "";
|
||||
sourceMap = new ConcurrentHashMap(4);
|
||||
sourceMap = new ConcurrentHashMap<UpdateMethod, List<URI>>(4);
|
||||
this.constraint = constraint;
|
||||
}
|
||||
|
||||
@ -1539,7 +1535,7 @@ public class ConsoleUpdateManager implements UpdateManager {
|
||||
|
||||
/** debug */
|
||||
private static void toString(StringBuilder buf, Collection col) {
|
||||
List<String> list = new ArrayList(col.size());
|
||||
List<String> list = new ArrayList<String>(col.size());
|
||||
for (Object o : col) {
|
||||
list.add(o.toString());
|
||||
}
|
||||
@ -1551,7 +1547,7 @@ public class ConsoleUpdateManager implements UpdateManager {
|
||||
|
||||
/** debug */
|
||||
private static void toString(StringBuilder buf, Map<?, ?> map) {
|
||||
List<String> list = new ArrayList(map.size());
|
||||
List<String> list = new ArrayList<String>(map.size());
|
||||
for (Map.Entry entry : map.entrySet()) {
|
||||
String key = entry.getKey().toString();
|
||||
String val = entry.getValue().toString();
|
||||
|
@ -48,7 +48,7 @@ class DummyHandler implements Checker, Updater {
|
||||
private final long _delay;
|
||||
|
||||
public DummyRunner(RouterContext ctx, ConsoleUpdateManager mgr, long maxTime) {
|
||||
super(ctx, mgr, UpdateType.TYPE_DUMMY, Collections.EMPTY_LIST);
|
||||
super(ctx, mgr, UpdateType.TYPE_DUMMY, Collections.<URI> emptyList());
|
||||
_delay = maxTime;
|
||||
}
|
||||
|
||||
|
@ -5,10 +5,8 @@ import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@ -17,18 +15,15 @@ import java.util.StringTokenizer;
|
||||
|
||||
import net.i2p.crypto.TrustedUpdate;
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.router.Router;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.RouterVersion;
|
||||
import net.i2p.router.util.RFC822Date;
|
||||
import net.i2p.router.web.ConfigUpdateHandler;
|
||||
import net.i2p.router.web.ConfigUpdateHelper;
|
||||
import net.i2p.router.web.NewsHelper;
|
||||
import net.i2p.update.*;
|
||||
import static net.i2p.update.UpdateType.*;
|
||||
import static net.i2p.update.UpdateMethod.*;
|
||||
import net.i2p.util.EepGet;
|
||||
import net.i2p.util.EepHead;
|
||||
import net.i2p.util.FileUtil;
|
||||
import net.i2p.util.Log;
|
||||
import net.i2p.util.SSLEepGet;
|
||||
@ -177,7 +172,7 @@ class NewsFetcher extends UpdateRunner {
|
||||
// TODO if minversion > our version, continue
|
||||
// and look for a second entry with clearnet URLs
|
||||
// TODO clearnet URLs, notify with HTTP_CLEARNET and/or HTTPS_CLEARNET
|
||||
Map<UpdateMethod, List<URI>> sourceMap = new HashMap(4);
|
||||
Map<UpdateMethod, List<URI>> sourceMap = new HashMap<UpdateMethod, List<URI>>(4);
|
||||
// Must do su3 first
|
||||
if (ConfigUpdateHandler.USE_SU3_UPDATE) {
|
||||
sourceMap.put(HTTP, _mgr.getUpdateURLs(ROUTER_SIGNED_SU3, "", HTTP));
|
||||
@ -231,7 +226,7 @@ class NewsFetcher extends UpdateRunner {
|
||||
* @since 0.9.4
|
||||
*/
|
||||
private static Map<String, String> parseArgs(String args) {
|
||||
Map<String, String> rv = new HashMap(8);
|
||||
Map<String, String> rv = new HashMap<String, String>(8);
|
||||
char data[] = args.toCharArray();
|
||||
StringBuilder buf = new StringBuilder(32);
|
||||
boolean isQuoted = false;
|
||||
@ -290,7 +285,7 @@ class NewsFetcher extends UpdateRunner {
|
||||
|
||||
private static List<URI> tokenize(String URLs) {
|
||||
StringTokenizer tok = new StringTokenizer(URLs, " ,\r\n");
|
||||
List<URI> rv = new ArrayList();
|
||||
List<URI> rv = new ArrayList<URI>();
|
||||
while (tok.hasMoreTokens()) {
|
||||
try {
|
||||
rv.add(new URI(tok.nextToken().trim()));
|
||||
|
@ -38,7 +38,7 @@ class NewsHandler extends UpdateHandler implements Checker {
|
||||
if ((type != ROUTER_SIGNED && type != NEWS) ||
|
||||
method != HTTP)
|
||||
return null;
|
||||
List<URI> updateSources = new ArrayList(2);
|
||||
List<URI> updateSources = new ArrayList<URI>(2);
|
||||
try {
|
||||
updateSources.add(new URI(ConfigUpdateHelper.getNewsURL(_context)));
|
||||
} catch (URISyntaxException use) {}
|
||||
|
@ -1,30 +1,12 @@
|
||||
package net.i2p.router.update;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import net.i2p.crypto.TrustedUpdate;
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.router.Router;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.RouterVersion;
|
||||
import net.i2p.router.web.ConfigUpdateHandler;
|
||||
import net.i2p.router.web.ConfigUpdateHelper;
|
||||
import net.i2p.router.web.NewsHelper;
|
||||
import static net.i2p.update.UpdateType.*;
|
||||
import net.i2p.util.EepGet;
|
||||
import net.i2p.util.EepHead;
|
||||
import net.i2p.util.FileUtil;
|
||||
import net.i2p.util.I2PAppThread;
|
||||
import net.i2p.util.Log;
|
||||
import net.i2p.util.SimpleScheduler;
|
||||
import net.i2p.util.SimpleTimer;
|
||||
|
||||
/**
|
||||
|
@ -1,20 +1,13 @@
|
||||
package net.i2p.router.update;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import net.i2p.crypto.TrustedUpdate;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.web.ConfigUpdateHandler;
|
||||
import net.i2p.update.*;
|
||||
import net.i2p.util.EepGet;
|
||||
import net.i2p.util.I2PAppThread;
|
||||
import net.i2p.util.PartialEepGet;
|
||||
import net.i2p.util.VersionComparator;
|
||||
|
||||
/**
|
||||
* Check for an updated version of a plugin.
|
||||
|
@ -20,13 +20,10 @@ import net.i2p.router.web.PluginStarter;
|
||||
import net.i2p.update.*;
|
||||
import net.i2p.util.EepGet;
|
||||
import net.i2p.util.FileUtil;
|
||||
import net.i2p.util.I2PAppThread;
|
||||
import net.i2p.util.Log;
|
||||
import net.i2p.util.OrderedProperties;
|
||||
import net.i2p.util.SecureDirectory;
|
||||
import net.i2p.util.SecureFile;
|
||||
import net.i2p.util.SimpleScheduler;
|
||||
import net.i2p.util.SimpleTimer;
|
||||
import net.i2p.util.VersionComparator;
|
||||
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package net.i2p.router.update;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
|
||||
@ -9,8 +8,6 @@ import net.i2p.router.util.RFC822Date;
|
||||
import net.i2p.router.web.ConfigUpdateHandler;
|
||||
import net.i2p.update.*;
|
||||
import net.i2p.util.EepHead;
|
||||
import net.i2p.util.I2PAppThread;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
/**
|
||||
* Does a simple EepHead to get the last-modified header.
|
||||
|
@ -1,6 +1,5 @@
|
||||
package net.i2p.router.update;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Collections;
|
||||
|
@ -4,15 +4,11 @@ import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
|
||||
import net.i2p.router.Router;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.util.RFC822Date;
|
||||
import net.i2p.router.web.ConfigUpdateHandler;
|
||||
import net.i2p.update.*;
|
||||
import static net.i2p.update.UpdateType.*;
|
||||
import net.i2p.util.EepGet;
|
||||
import net.i2p.util.FileUtil;
|
||||
import net.i2p.util.I2PAppThread;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
|
||||
|
@ -6,10 +6,7 @@ import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import net.i2p.crypto.TrustedUpdate;
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.RouterVersion;
|
||||
import net.i2p.router.web.ConfigUpdateHandler;
|
||||
|
@ -40,7 +40,7 @@ public class BanlistRenderer {
|
||||
StringBuilder buf = new StringBuilder(1024);
|
||||
// move to the jsp
|
||||
//buf.append("<h2>Banned Peers</h2>");
|
||||
Map<Hash, Banlist.Entry> entries = new TreeMap(new HashComparator());
|
||||
Map<Hash, Banlist.Entry> entries = new TreeMap<Hash, Banlist.Entry>(new HashComparator());
|
||||
|
||||
entries.putAll(_context.banlist().getEntries());
|
||||
if (entries.isEmpty()) {
|
||||
@ -64,7 +64,7 @@ public class BanlistRenderer {
|
||||
buf.append(_("Temporary ban expiring in {0}", expireString));
|
||||
else
|
||||
buf.append(_("Banned until restart or in {0}", expireString));
|
||||
Set transports = entry.transports;
|
||||
Set<String> transports = entry.transports;
|
||||
if ( (transports != null) && (!transports.isEmpty()) )
|
||||
buf.append(" on the following transport: ").append(transports);
|
||||
if (entry.cause != null) {
|
||||
|
@ -11,7 +11,7 @@ import net.i2p.util.RandomSource;
|
||||
*/
|
||||
public class CSSHelper extends HelperBase {
|
||||
|
||||
private static final Map<String, Boolean> _UACache = new ConcurrentHashMap();
|
||||
private static final Map<String, Boolean> _UACache = new ConcurrentHashMap<String, Boolean>();
|
||||
|
||||
public static final String PROP_UNIVERSAL_THEMING = "routerconsole.universal.theme";
|
||||
public static final String PROP_THEME_NAME = "routerconsole.theme";
|
||||
|
@ -40,7 +40,7 @@ public class ConfigAdvancedHandler extends FormHandler {
|
||||
*
|
||||
*/
|
||||
private void saveChanges() {
|
||||
Set<String> unsetKeys = new HashSet(_context.router().getConfigSettings());
|
||||
Set<String> unsetKeys = new HashSet<String>(_context.router().getConfigSettings());
|
||||
if (_config != null) {
|
||||
Properties props = new Properties();
|
||||
try {
|
||||
|
@ -9,7 +9,7 @@ public class ConfigAdvancedHelper extends HelperBase {
|
||||
|
||||
public String getSettings() {
|
||||
StringBuilder buf = new StringBuilder(4*1024);
|
||||
TreeMap<String, String> sorted = new TreeMap();
|
||||
TreeMap<String, String> sorted = new TreeMap<String, String>();
|
||||
sorted.putAll(_context.router().getConfigMap());
|
||||
for (Map.Entry<String, String> e : sorted.entrySet()) {
|
||||
String name = e.getKey();
|
||||
|
@ -16,7 +16,6 @@ import net.i2p.app.ClientAppState;
|
||||
import net.i2p.router.client.ClientManagerFacadeImpl;
|
||||
import net.i2p.router.startup.ClientAppConfig;
|
||||
import net.i2p.router.startup.LoadClientAppsJob;
|
||||
import net.i2p.router.startup.RouterAppManager;
|
||||
import net.i2p.router.update.ConsoleUpdateManager;
|
||||
import static net.i2p.update.UpdateType.*;
|
||||
|
||||
@ -426,7 +425,7 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
* @since 0.8.3
|
||||
*/
|
||||
private void saveInterfaceChanges() {
|
||||
Map<String, String> changes = new HashMap();
|
||||
Map<String, String> changes = new HashMap<String, String>();
|
||||
String port = getJettyString("port");
|
||||
if (port != null)
|
||||
changes.put(ClientManagerFacadeImpl.PROP_CLIENT_PORT, port);
|
||||
|
@ -15,7 +15,6 @@ import net.i2p.data.DataHelper;
|
||||
import net.i2p.router.client.ClientManagerFacadeImpl;
|
||||
import net.i2p.router.startup.ClientAppConfig;
|
||||
import net.i2p.router.startup.LoadClientAppsJob;
|
||||
import net.i2p.router.startup.RouterAppManager;
|
||||
import net.i2p.util.Addresses;
|
||||
|
||||
public class ConfigClientsHelper extends HelperBase {
|
||||
@ -58,7 +57,7 @@ public class ConfigClientsHelper extends HelperBase {
|
||||
|
||||
/** @since 0.8.3 */
|
||||
public String[] intfcAddresses() {
|
||||
ArrayList<String> al = new ArrayList(Addresses.getAllAddresses());
|
||||
ArrayList<String> al = new ArrayList<String>(Addresses.getAllAddresses());
|
||||
return al.toArray(new String[al.size()]);
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ public class ConfigHomeHandler extends FormHandler {
|
||||
addFormNotice(_("Added") + ": " + app.name);
|
||||
} else {
|
||||
// deleting
|
||||
Set<String> toDelete = new HashSet();
|
||||
Set<String> toDelete = new HashSet<String>();
|
||||
for (Object o : _settings.keySet()) {
|
||||
if (!(o instanceof String))
|
||||
continue;
|
||||
|
@ -32,7 +32,7 @@ public class ConfigLoggingHelper extends HelperBase {
|
||||
public String getLogLevelTable() {
|
||||
StringBuilder buf = new StringBuilder(32*1024);
|
||||
Properties limits = _context.logManager().getLimits();
|
||||
TreeSet<String> sortedLogs = new TreeSet();
|
||||
TreeSet<String> sortedLogs = new TreeSet<String>();
|
||||
for (Iterator iter = limits.keySet().iterator(); iter.hasNext(); ) {
|
||||
String prefix = (String)iter.next();
|
||||
sortedLogs.add(prefix);
|
||||
@ -98,7 +98,7 @@ public class ConfigLoggingHelper extends HelperBase {
|
||||
public String getNewClassBox() {
|
||||
List<Log> logs = _context.logManager().getLogs();
|
||||
Set limits = _context.logManager().getLimits().keySet();
|
||||
TreeSet<String> sortedLogs = new TreeSet();
|
||||
TreeSet<String> sortedLogs = new TreeSet<String>();
|
||||
|
||||
for (Log log : logs) {
|
||||
String name = log.getName();
|
||||
|
@ -50,7 +50,7 @@ public class ConfigNetHandler extends FormHandler {
|
||||
private boolean _ratesOnly;
|
||||
private boolean _udpDisabled;
|
||||
private String _ipv6Mode;
|
||||
private final Map<String, String> changes = new HashMap();
|
||||
private final Map<String, String> changes = new HashMap<String, String>();
|
||||
private static final String PROP_HIDDEN = Router.PROP_HIDDEN_HIDDEN; // see Router for other choice
|
||||
|
||||
@Override
|
||||
@ -150,7 +150,7 @@ public class ConfigNetHandler extends FormHandler {
|
||||
private void saveChanges() {
|
||||
boolean restartRequired = false;
|
||||
boolean error = false;
|
||||
List<String> removes = new ArrayList();
|
||||
List<String> removes = new ArrayList<String>();
|
||||
|
||||
if (!_ratesOnly) {
|
||||
// IP Settings
|
||||
@ -162,7 +162,7 @@ public class ConfigNetHandler extends FormHandler {
|
||||
if (_udpAutoIP.equals("fixed")) {
|
||||
if (_settings == null)
|
||||
_settings = Collections.EMPTY_MAP;
|
||||
Set<String> addrs = new TreeSet();
|
||||
Set<String> addrs = new TreeSet<String>();
|
||||
for (Object o : _settings.keySet()) {
|
||||
String k = (String) o;
|
||||
if (k.startsWith("addr_")) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
@ -189,9 +188,9 @@ public class ConfigNetHelper extends HelperBase {
|
||||
Set<String> configs;
|
||||
String cs = getUdphostname();
|
||||
if (cs.length() <= 0) {
|
||||
configs = Collections.EMPTY_SET;
|
||||
configs = Collections.emptySet();
|
||||
} else {
|
||||
configs = new HashSet(4);
|
||||
configs = new HashSet<String>(4);
|
||||
String[] ca = cs.split("[,; \r\n\t]");
|
||||
for (int i = 0; i < ca.length; i++) {
|
||||
String c = ca[i];
|
||||
|
@ -11,8 +11,8 @@ import net.i2p.router.networkdb.reseed.Reseeder;
|
||||
* @since 0.8.3
|
||||
*/
|
||||
public class ConfigReseedHandler extends FormHandler {
|
||||
private final Map<String, String> changes = new HashMap();
|
||||
private final List<String> removes = new ArrayList();
|
||||
private final Map<String, String> changes = new HashMap<String, String>();
|
||||
private final List<String> removes = new ArrayList<String>();
|
||||
|
||||
@Override
|
||||
protected void processForm() {
|
||||
|
@ -89,7 +89,7 @@ public class ConfigReseedHelper extends HelperBase {
|
||||
public String getReseedURL() {
|
||||
String urls = _context.getProperty(Reseeder.PROP_RESEED_URL, Reseeder.DEFAULT_SEED_URL + ',' + Reseeder.DEFAULT_SSL_SEED_URL);
|
||||
StringTokenizer tok = new StringTokenizer(urls, " ,\r\n");
|
||||
List<String> URLList = new ArrayList(16);
|
||||
List<String> URLList = new ArrayList<String>(16);
|
||||
while (tok.hasMoreTokens()) {
|
||||
String s = tok.nextToken().trim();
|
||||
if (s.length() > 0)
|
||||
|
@ -246,10 +246,10 @@ public class ConfigServiceHandler extends FormHandler {
|
||||
}
|
||||
|
||||
private void browseOnStartup(boolean shouldLaunchBrowser) {
|
||||
List clients = ClientAppConfig.getClientApps(_context);
|
||||
List<ClientAppConfig> clients = ClientAppConfig.getClientApps(_context);
|
||||
boolean found = false;
|
||||
for (int cur = 0; cur < clients.size(); cur++) {
|
||||
ClientAppConfig ca = (ClientAppConfig) clients.get(cur);
|
||||
ClientAppConfig ca = clients.get(cur);
|
||||
if (UrlLauncher.class.getName().equals(ca.className)) {
|
||||
ca.disabled = !shouldLaunchBrowser;
|
||||
found = true;
|
||||
|
@ -15,7 +15,7 @@ import net.i2p.stat.StatManager;
|
||||
*/
|
||||
public class ConfigStatsHandler extends FormHandler {
|
||||
private String _filename;
|
||||
private List _stats;
|
||||
private List<String> _stats;
|
||||
private String _graphs;
|
||||
private boolean _explicitFilter;
|
||||
private String _explicitFilterValue;
|
||||
@ -23,7 +23,7 @@ public class ConfigStatsHandler extends FormHandler {
|
||||
|
||||
public ConfigStatsHandler() {
|
||||
super();
|
||||
_stats = new ArrayList();
|
||||
_stats = new ArrayList<String>();
|
||||
_graphs = "";
|
||||
_explicitFilter = false;
|
||||
_isFull = false;
|
||||
@ -75,7 +75,7 @@ public class ConfigStatsHandler extends FormHandler {
|
||||
*
|
||||
*/
|
||||
private void saveChanges() {
|
||||
Map<String, String> changes = new HashMap();
|
||||
Map<String, String> changes = new HashMap<String, String>();
|
||||
if (_filename == null)
|
||||
_filename = StatManager.DEFAULT_STAT_FILE;
|
||||
changes.put(StatManager.PROP_STAT_FILE, _filename);
|
||||
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||
import java.text.Collator;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@ -37,9 +36,9 @@ public class ConfigStatsHelper extends HelperBase {
|
||||
private boolean _currentCanBeGraphed;
|
||||
|
||||
public ConfigStatsHelper() {
|
||||
_stats = new ArrayList();
|
||||
_filters = new HashSet();
|
||||
_graphs = new HashSet();
|
||||
_stats = new ArrayList<String>();
|
||||
_filters = new HashSet<String>();
|
||||
_graphs = new HashSet<String>();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -54,7 +53,7 @@ public class ConfigStatsHelper extends HelperBase {
|
||||
_log = _context.logManager().getLog(ConfigStatsHelper.class);
|
||||
|
||||
Map<String, SortedSet<String>> unsorted = _context.statManager().getStatsByGroup();
|
||||
Map<String, Set<String>> groups = new TreeMap(new AlphaComparator());
|
||||
Map<String, Set<String>> groups = new TreeMap<String, Set<String>>(new AlphaComparator());
|
||||
groups.putAll(unsorted);
|
||||
for (Set<String> stats : groups.values()) {
|
||||
_stats.addAll(stats);
|
||||
|
@ -1,6 +1,5 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
@ -85,7 +84,7 @@ public class ConfigSummaryHandler extends FormHandler {
|
||||
return;
|
||||
}
|
||||
} else if (deleting) {
|
||||
Set<Integer> toDelete = new HashSet();
|
||||
Set<Integer> toDelete = new HashSet<Integer>();
|
||||
for (Object o : _settings.keySet()) {
|
||||
if (!(o instanceof String))
|
||||
continue;
|
||||
|
@ -37,8 +37,8 @@ public class ConfigUIHandler extends FormHandler {
|
||||
private void saveChanges() {
|
||||
if (_config == null)
|
||||
return;
|
||||
Map<String, String> changes = new HashMap();
|
||||
List<String> removes = new ArrayList();
|
||||
Map<String, String> changes = new HashMap<String, String>();
|
||||
List<String> removes = new ArrayList<String>();
|
||||
String oldTheme = _context.getProperty(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME);
|
||||
boolean oldForceMobileConsole = _context.getBooleanProperty(CSSHelper.PROP_FORCE_MOBILE_CONSOLE);
|
||||
if (_config.equals("default")) // obsolete
|
||||
|
@ -44,7 +44,7 @@ public class ConfigUIHelper extends HelperBase {
|
||||
|
||||
/** @return standard and user-installed themes, sorted (untranslated) */
|
||||
private Set<String> themeSet() {
|
||||
Set<String> rv = new TreeSet();
|
||||
Set<String> rv = new TreeSet<String>();
|
||||
// add a failsafe even if we can't find any themes
|
||||
rv.add(CSSHelper.DEFAULT_THEME);
|
||||
File dir = new File(_context.getBaseDir(), "docs/themes/console");
|
||||
@ -57,9 +57,9 @@ public class ConfigUIHelper extends HelperBase {
|
||||
rv.add(name);
|
||||
}
|
||||
// user themes
|
||||
Set props = _context.getPropertyNames();
|
||||
for (Iterator iter = props.iterator(); iter.hasNext(); ) {
|
||||
String prop = (String) iter.next();
|
||||
Set<String> props = _context.getPropertyNames();
|
||||
for (Iterator<String> iter = props.iterator(); iter.hasNext(); ) {
|
||||
String prop = iter.next();
|
||||
if (prop.startsWith(PROP_THEME_PFX) && prop.length() > PROP_THEME_PFX.length())
|
||||
rv.add(prop.substring(PROP_THEME_PFX.length()));
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ public class ConfigUpdateHandler extends FormHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
Map<String, String> changes = new HashMap();
|
||||
Map<String, String> changes = new HashMap<String, String>();
|
||||
|
||||
if ( (_newsURL != null) && (_newsURL.length() > 0) ) {
|
||||
if (_newsURL.startsWith("https"))
|
||||
|
@ -79,7 +79,7 @@ public class ConsolePasswordManager extends RouterPasswordManager {
|
||||
*/
|
||||
public Map<String, String> getMD5(String realm) {
|
||||
String pfx = realm + '.';
|
||||
Map<String, String> rv = new HashMap(4);
|
||||
Map<String, String> rv = new HashMap<String, String>(4);
|
||||
for (Map.Entry<String, String> e : _context.router().getConfigMap().entrySet()) {
|
||||
String prop = e.getKey();
|
||||
if (prop.startsWith(pfx) && prop.endsWith(PROP_MD5)) {
|
||||
@ -105,14 +105,14 @@ public class ConsolePasswordManager extends RouterPasswordManager {
|
||||
// consolePassword
|
||||
String pw = _context.getProperty(PROP_CONSOLE_OLD);
|
||||
if (pw != null) {
|
||||
Map toAdd = new HashMap(2);
|
||||
Map<String, String> toAdd = new HashMap<String, String>(2);
|
||||
if (pw.length() > 0) {
|
||||
saveMD5(RouterConsoleRunner.PROP_CONSOLE_PW, RouterConsoleRunner.JETTY_REALM,
|
||||
CONSOLE_USER, pw);
|
||||
toAdd.put(RouterConsoleRunner.PROP_PW_ENABLE, "true");
|
||||
}
|
||||
toAdd.put(PROP_MIGRATED, "true");
|
||||
List toDel = Collections.singletonList(PROP_CONSOLE_OLD);
|
||||
List<String> toDel = Collections.singletonList(PROP_CONSOLE_OLD);
|
||||
return _context.router().saveConfig(toAdd, toDel);
|
||||
}
|
||||
return true;
|
||||
@ -164,7 +164,7 @@ public class ConsolePasswordManager extends RouterPasswordManager {
|
||||
if (hex == null)
|
||||
return false;
|
||||
Map<String, String> toAdd = Collections.singletonMap(pfx + PROP_MD5, hex);
|
||||
List<String> toDel = new ArrayList(4);
|
||||
List<String> toDel = new ArrayList<String>(4);
|
||||
toDel.add(pfx + PROP_PW);
|
||||
toDel.add(pfx + PROP_B64);
|
||||
toDel.add(pfx + PROP_CRYPT);
|
||||
|
@ -35,7 +35,7 @@ public class FileDumpHelper extends HelperBase {
|
||||
// jars added in wrapper.config
|
||||
URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
|
||||
URL[] urls = urlClassLoader.getURLs();
|
||||
List<File> flist = new ArrayList();
|
||||
List<File> flist = new ArrayList<File>();
|
||||
for (int i = 0; i < urls.length; i++) {
|
||||
String p = urls[i].toString();
|
||||
if (p.startsWith("file:") && p.endsWith(".jar")) {
|
||||
|
@ -30,8 +30,8 @@ public abstract class FormHandler {
|
||||
private boolean _valid;
|
||||
|
||||
public FormHandler() {
|
||||
_errors = new ArrayList();
|
||||
_notices = new ArrayList();
|
||||
_errors = new ArrayList<String>();
|
||||
_notices = new ArrayList<String>();
|
||||
_valid = true;
|
||||
}
|
||||
|
||||
|
@ -137,15 +137,15 @@ public class GraphHelper extends FormHandler {
|
||||
if (StatSummarizer.isDisabled())
|
||||
return "";
|
||||
try {
|
||||
List listeners = StatSummarizer.instance().getListeners();
|
||||
TreeSet ordered = new TreeSet(new AlphaComparator());
|
||||
List<SummaryListener> listeners = StatSummarizer.instance().getListeners();
|
||||
TreeSet<SummaryListener> ordered = new TreeSet<SummaryListener>(new AlphaComparator());
|
||||
ordered.addAll(listeners);
|
||||
|
||||
// go to some trouble to see if we have the data for the combined bw graph
|
||||
boolean hasTx = false;
|
||||
boolean hasRx = false;
|
||||
for (Iterator iter = ordered.iterator(); iter.hasNext(); ) {
|
||||
SummaryListener lsnr = (SummaryListener)iter.next();
|
||||
for (Iterator<SummaryListener> iter = ordered.iterator(); iter.hasNext(); ) {
|
||||
SummaryListener lsnr = iter.next();
|
||||
String title = lsnr.getRate().getRateStat().getName();
|
||||
if (title.equals("bw.sendRate")) hasTx = true;
|
||||
else if (title.equals("bw.recvRate")) hasRx = true;
|
||||
@ -166,8 +166,8 @@ public class GraphHelper extends FormHandler {
|
||||
+ "\" alt=\"" + title + "\" title=\"" + title + "\"></a>\n");
|
||||
}
|
||||
|
||||
for (Iterator iter = ordered.iterator(); iter.hasNext(); ) {
|
||||
SummaryListener lsnr = (SummaryListener)iter.next();
|
||||
for (Iterator<SummaryListener> iter = ordered.iterator(); iter.hasNext(); ) {
|
||||
SummaryListener lsnr = iter.next();
|
||||
Rate r = lsnr.getRate();
|
||||
// e.g. "statname for 60m"
|
||||
String title = _("{0} for {1}", r.getRateStat().getName(), DataHelper.formatDuration2(_periodCount * r.getPeriod()));
|
||||
@ -430,7 +430,7 @@ public class GraphHelper extends FormHandler {
|
||||
_refreshDelaySeconds != _context.getProperty(PROP_REFRESH, DEFAULT_REFRESH) ||
|
||||
_showEvents != _context.getBooleanProperty(PROP_EVENTS) ||
|
||||
_persistent != _context.getBooleanPropertyDefaultTrue(SummaryListener.PROP_PERSISTENT)) {
|
||||
Map<String, String> changes = new HashMap();
|
||||
Map<String, String> changes = new HashMap<String, String>();
|
||||
changes.put(PROP_X, "" + _width);
|
||||
changes.put(PROP_Y, "" + _height);
|
||||
changes.put(PROP_PERIODS, "" + _periodCount);
|
||||
|
@ -127,7 +127,7 @@ public class HomeHelper extends HelperBase {
|
||||
|
||||
static Collection<App> buildApps(RouterContext ctx, String config) {
|
||||
String[] args = config.split("" + S);
|
||||
Set<App> apps = new TreeSet(new AppComparator());
|
||||
Set<App> apps = new TreeSet<App>(new AppComparator());
|
||||
for (int i = 0; i < args.length - 3; i += 4) {
|
||||
String name = Messages.getString(args[i], ctx);
|
||||
String desc = Messages.getString(args[i+1], ctx);
|
||||
@ -140,7 +140,7 @@ public class HomeHelper extends HelperBase {
|
||||
|
||||
static Collection<App> buildSearchApps(String config) {
|
||||
String[] args = config.split("" + S);
|
||||
Set<App> apps = new TreeSet(new AppComparator());
|
||||
Set<App> apps = new TreeSet<App>(new AppComparator());
|
||||
for (int i = 0; i < args.length - 1; i += 2) {
|
||||
String name = args[i];
|
||||
String url = args[i+1];
|
||||
|
@ -39,10 +39,10 @@ public class JobQueueHelper extends HelperBase {
|
||||
* @since 0.8.9
|
||||
*/
|
||||
private void renderStatusHTML(Writer out) throws IOException {
|
||||
List<Job> readyJobs = new ArrayList(8);
|
||||
List<Job> timedJobs = new ArrayList(128);
|
||||
List<Job> activeJobs = new ArrayList(8);
|
||||
List<Job> justFinishedJobs = new ArrayList(8);
|
||||
List<Job> readyJobs = new ArrayList<Job>(8);
|
||||
List<Job> timedJobs = new ArrayList<Job>(128);
|
||||
List<Job> activeJobs = new ArrayList<Job>(8);
|
||||
List<Job> justFinishedJobs = new ArrayList<Job>(8);
|
||||
|
||||
int numRunners = _context.jobQueue().getJobs(readyJobs, timedJobs, activeJobs, justFinishedJobs);
|
||||
|
||||
@ -70,7 +70,7 @@ public class JobQueueHelper extends HelperBase {
|
||||
buf.append("</ol>\n");
|
||||
|
||||
buf.append("<hr><b>").append(_("Ready/waiting jobs")).append(": ").append(readyJobs.size()).append("</b><ol>\n");
|
||||
ObjectCounter<String> counter = new ObjectCounter();
|
||||
ObjectCounter<String> counter = new ObjectCounter<String>();
|
||||
for (int i = 0; i < readyJobs.size(); i++) {
|
||||
Job j = readyJobs.get(i);
|
||||
counter.increment(j.getName());
|
||||
@ -117,7 +117,7 @@ public class JobQueueHelper extends HelperBase {
|
||||
|
||||
/** @since 0.9.5 */
|
||||
private void getJobCounts(StringBuilder buf, ObjectCounter<String> counter) {
|
||||
List<String> names = new ArrayList(counter.objects());
|
||||
List<String> names = new ArrayList<String>(counter.objects());
|
||||
if (names.size() < 4)
|
||||
return;
|
||||
buf.append("<table style=\"width: 30%; margin-left: 100px;\">\n" +
|
||||
@ -153,7 +153,7 @@ public class JobQueueHelper extends HelperBase {
|
||||
long maxPendingTime = -1;
|
||||
long minPendingTime = -1;
|
||||
|
||||
List<JobStats> tstats = new ArrayList(_context.jobQueue().getJobStats());
|
||||
List<JobStats> tstats = new ArrayList<JobStats>(_context.jobQueue().getJobStats());
|
||||
Collections.sort(tstats, new JobStatsComparator());
|
||||
|
||||
for (JobStats stats : tstats) {
|
||||
|
@ -7,10 +7,11 @@ import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.router.web.HomeHelper.App;
|
||||
|
||||
public class NavHelper {
|
||||
private static Map<String, String> _apps = new ConcurrentHashMap(4);
|
||||
private static Map<String, String> _tooltips = new ConcurrentHashMap(4);
|
||||
private static Map<String, String> _apps = new ConcurrentHashMap<String, String>(4);
|
||||
private static Map<String, String> _tooltips = new ConcurrentHashMap<String, String>(4);
|
||||
|
||||
/**
|
||||
* To register a new client application so that it shows up on the router
|
||||
@ -42,7 +43,7 @@ public class NavHelper {
|
||||
if (_apps.isEmpty())
|
||||
return "";
|
||||
StringBuilder buf = new StringBuilder(256);
|
||||
List<String> l = new ArrayList(_apps.keySet());
|
||||
List<String> l = new ArrayList<String>(_apps.keySet());
|
||||
Collections.sort(l);
|
||||
for (String name : l) {
|
||||
String path = _apps.get(name);
|
||||
@ -65,8 +66,8 @@ public class NavHelper {
|
||||
*/
|
||||
static List<HomeHelper.App> getClientApps(I2PAppContext ctx) {
|
||||
if (_apps.isEmpty())
|
||||
return Collections.EMPTY_LIST;
|
||||
List<HomeHelper.App> rv = new ArrayList(_apps.size());
|
||||
return Collections.emptyList();
|
||||
List<HomeHelper.App> rv = new ArrayList<App>(_apps.size());
|
||||
for (Map.Entry<String, String> e : _apps.entrySet()) {
|
||||
String name = e.getKey();
|
||||
String path = e.getValue();
|
||||
|
@ -1,9 +1,6 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
|
||||
import net.i2p.data.DataHelper;
|
||||
|
||||
public class NetDbHelper extends HelperBase {
|
||||
|
@ -108,11 +108,11 @@ public class NetDbRenderer {
|
||||
DecimalFormat fmt;
|
||||
if (debug) {
|
||||
ourRKey = _context.routerHash();
|
||||
leases = new TreeSet(new LeaseSetRoutingKeyComparator(ourRKey));
|
||||
leases = new TreeSet<LeaseSet>(new LeaseSetRoutingKeyComparator(ourRKey));
|
||||
fmt = new DecimalFormat("#0.00");
|
||||
} else {
|
||||
ourRKey = null;
|
||||
leases = new TreeSet(new LeaseSetComparator());
|
||||
leases = new TreeSet<LeaseSet>(new LeaseSetComparator());
|
||||
fmt = null;
|
||||
}
|
||||
leases.addAll(_context.netDb().getLeases());
|
||||
@ -257,11 +257,11 @@ public class NetDbRenderer {
|
||||
buf.setLength(0);
|
||||
}
|
||||
|
||||
ObjectCounter<String> versions = new ObjectCounter();
|
||||
ObjectCounter<String> countries = new ObjectCounter();
|
||||
ObjectCounter<String> versions = new ObjectCounter<String>();
|
||||
ObjectCounter<String> countries = new ObjectCounter<String>();
|
||||
int[] transportCount = new int[TNAMES.length];
|
||||
|
||||
Set<RouterInfo> routers = new TreeSet(new RouterInfoComparator());
|
||||
Set<RouterInfo> routers = new TreeSet<RouterInfo>(new RouterInfoComparator());
|
||||
routers.addAll(_context.netDb().getRouters());
|
||||
for (RouterInfo ri : routers) {
|
||||
Hash key = ri.getIdentity().getHash();
|
||||
@ -292,7 +292,7 @@ public class NetDbRenderer {
|
||||
.append(_("Network Database Router Statistics"))
|
||||
.append("</th></tr><tr><td style=\"vertical-align: top;\">");
|
||||
// versions table
|
||||
List<String> versionList = new ArrayList(versions.objects());
|
||||
List<String> versionList = new ArrayList<String>(versions.objects());
|
||||
if (!versionList.isEmpty()) {
|
||||
Collections.sort(versionList, Collections.reverseOrder(new VersionComparator()));
|
||||
buf.append("<table>\n");
|
||||
@ -324,7 +324,7 @@ public class NetDbRenderer {
|
||||
buf.setLength(0);
|
||||
|
||||
// country table
|
||||
List<String> countryList = new ArrayList(countries.objects());
|
||||
List<String> countryList = new ArrayList<String>(countries.objects());
|
||||
if (!countryList.isEmpty()) {
|
||||
Collections.sort(countryList, new CountryComparator());
|
||||
buf.append("<table>\n");
|
||||
|
@ -57,7 +57,7 @@ public class PluginStarter implements Runnable {
|
||||
private static Map<String, ThreadGroup> pluginThreadGroups = new ConcurrentHashMap<String, ThreadGroup>(); // one thread group per plugin (map key=plugin name)
|
||||
private static Map<String, Collection<SimpleTimer2.TimedEvent>> _pendingPluginClients =
|
||||
new ConcurrentHashMap<String, Collection<SimpleTimer2.TimedEvent>>();
|
||||
private static Map<String, ClassLoader> _clCache = new ConcurrentHashMap();
|
||||
private static Map<String, ClassLoader> _clCache = new ConcurrentHashMap<String, ClassLoader>();
|
||||
private static Map<String, Collection<String>> pluginWars = new ConcurrentHashMap<String, Collection<String>>();
|
||||
|
||||
public PluginStarter(RouterContext ctx) {
|
||||
@ -111,7 +111,7 @@ public class PluginStarter implements Runnable {
|
||||
*/
|
||||
private static void updateAll(RouterContext ctx, boolean delay) {
|
||||
List<String> plugins = getPlugins();
|
||||
Map<String, String> toUpdate = new HashMap();
|
||||
Map<String, String> toUpdate = new HashMap<String, String>();
|
||||
for (String appName : plugins) {
|
||||
Properties props = pluginProperties(ctx, appName);
|
||||
String url = props.getProperty("updateURL");
|
||||
@ -458,8 +458,8 @@ public class PluginStarter implements Runnable {
|
||||
File[] tfiles = dir.listFiles();
|
||||
if (tfiles != null) {
|
||||
String current = ctx.getProperty(CSSHelper.PROP_THEME_NAME);
|
||||
Map<String, String> changes = new HashMap();
|
||||
List<String> removes = new ArrayList();
|
||||
Map<String, String> changes = new HashMap<String, String>();
|
||||
List<String> removes = new ArrayList<String>();
|
||||
for (int i = 0; i < tfiles.length; i++) {
|
||||
String name = tfiles[i].getName();
|
||||
if (tfiles[i].isDirectory() && (!Arrays.asList(STANDARD_THEMES).contains(tfiles[i]))) {
|
||||
@ -544,7 +544,7 @@ public class PluginStarter implements Runnable {
|
||||
* all installed plugins whether enabled or not
|
||||
*/
|
||||
public static List<String> getPlugins() {
|
||||
List<String> rv = new ArrayList();
|
||||
List<String> rv = new ArrayList<String>();
|
||||
File pluginDir = new File(I2PAppContext.getGlobalContext().getConfigDir(), PLUGIN_DIR);
|
||||
File[] files = pluginDir.listFiles();
|
||||
if (files == null)
|
||||
@ -563,7 +563,7 @@ public class PluginStarter implements Runnable {
|
||||
* Last one wins if a dup (installer should prevent dups)
|
||||
*/
|
||||
public static Map<String, String> getPluginKeys(I2PAppContext ctx) {
|
||||
Map<String, String> rv = new HashMap();
|
||||
Map<String, String> rv = new HashMap<String, String>();
|
||||
List<String> names = getPlugins();
|
||||
for (String name : names) {
|
||||
Properties props = pluginProperties(ctx, name);
|
||||
@ -806,7 +806,7 @@ public class PluginStarter implements Runnable {
|
||||
*/
|
||||
private static URL[] classpathToURLArray(String classpath, String clientName, Log log) {
|
||||
StringTokenizer tok = new StringTokenizer(classpath, ",");
|
||||
List<URL> urls = new ArrayList();
|
||||
List<URL> urls = new ArrayList<URL>();
|
||||
while (tok.hasMoreTokens()) {
|
||||
String elem = tok.nextToken().trim();
|
||||
File f = new File(elem);
|
||||
|
@ -42,7 +42,7 @@ class ProfileOrganizerRenderer {
|
||||
long now = _context.clock().now();
|
||||
long hideBefore = now - 90*60*1000;
|
||||
|
||||
Set<PeerProfile> order = new TreeSet(mode == 2 ? new HashComparator() : new ProfileComparator());
|
||||
Set<PeerProfile> order = new TreeSet<PeerProfile>(mode == 2 ? new HashComparator() : new ProfileComparator());
|
||||
int older = 0;
|
||||
int standard = 0;
|
||||
for (Iterator<Hash> iter = peers.iterator(); iter.hasNext();) {
|
||||
|
@ -1,7 +1,6 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
import net.i2p.router.RouterContext;
|
||||
import net.i2p.router.networkdb.reseed.Reseeder;
|
||||
|
||||
/**
|
||||
* Handler to deal with reseed requests.
|
||||
|
@ -9,12 +9,11 @@ import java.net.InetAddress;
|
||||
import java.net.Inet4Address;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.security.KeyStore;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.SynchronousQueue;
|
||||
@ -28,7 +27,6 @@ import net.i2p.app.ClientAppState;
|
||||
import static net.i2p.app.ClientAppState.*;
|
||||
import net.i2p.apps.systray.SysTray;
|
||||
import net.i2p.crypto.KeyStoreUtil;
|
||||
import net.i2p.data.Base32;
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.jetty.I2PLogger;
|
||||
import net.i2p.router.RouterContext;
|
||||
@ -40,12 +38,9 @@ import net.i2p.util.I2PAppThread;
|
||||
import net.i2p.util.PortMapper;
|
||||
import net.i2p.util.SecureDirectory;
|
||||
import net.i2p.util.SystemVersion;
|
||||
import net.i2p.util.VersionComparator;
|
||||
|
||||
import org.eclipse.jetty.security.HashLoginService;
|
||||
import org.eclipse.jetty.security.ConstraintMapping;
|
||||
import org.eclipse.jetty.security.ConstraintSecurityHandler;
|
||||
import org.eclipse.jetty.security.SecurityHandler;
|
||||
import org.eclipse.jetty.security.authentication.DigestAuthenticator;
|
||||
import org.eclipse.jetty.server.AbstractConnector;
|
||||
import org.eclipse.jetty.server.Connector;
|
||||
@ -378,10 +373,10 @@ public class RouterConsoleRunner implements RouterApp {
|
||||
|
||||
HandlerWrapper rootWebApp = null;
|
||||
ServletHandler rootServletHandler = null;
|
||||
List<Connector> connectors = new ArrayList(4);
|
||||
List<Connector> connectors = new ArrayList<Connector>(4);
|
||||
try {
|
||||
int boundAddresses = 0;
|
||||
Set addresses = Addresses.getAllAddresses();
|
||||
SortedSet<String> addresses = Addresses.getAllAddresses();
|
||||
boolean hasIPV4 = addresses.contains("0.0.0.0");
|
||||
boolean hasIPV6 = addresses.contains("0:0:0:0:0:0:0:0");
|
||||
|
||||
@ -587,7 +582,7 @@ public class RouterConsoleRunner implements RouterApp {
|
||||
// so things start faster.
|
||||
// Jetty 6 starts the connector before the router console is ready
|
||||
// This also prevents one webapp from breaking the whole thing
|
||||
List<String> notStarted = new ArrayList();
|
||||
List<String> notStarted = new ArrayList<String>();
|
||||
if (_server.isRunning()) {
|
||||
File dir = new File(_webAppsDir);
|
||||
String fileNames[] = dir.list(WarFilenameFilter.instance());
|
||||
@ -698,7 +693,7 @@ public class RouterConsoleRunner implements RouterApp {
|
||||
success = ks.exists();
|
||||
if (success) {
|
||||
try {
|
||||
Map<String, String> changes = new HashMap();
|
||||
Map<String, String> changes = new HashMap<String, String>();
|
||||
changes.put(PROP_KEYSTORE_PASSWORD, DEFAULT_KEYSTORE_PASSWORD);
|
||||
changes.put(PROP_KEY_PASSWORD, keyPassword);
|
||||
_context.router().saveConfig(changes, null);
|
||||
@ -724,7 +719,7 @@ public class RouterConsoleRunner implements RouterApp {
|
||||
*/
|
||||
static void initialize(RouterContext ctx, WebAppContext context) {
|
||||
ConstraintSecurityHandler sec = new ConstraintSecurityHandler();
|
||||
List<ConstraintMapping> constraints = new ArrayList(4);
|
||||
List<ConstraintMapping> constraints = new ArrayList<ConstraintMapping>(4);
|
||||
ConsolePasswordManager mgr = new ConsolePasswordManager(ctx);
|
||||
boolean enable = ctx.getBooleanProperty(PROP_PW_ENABLE);
|
||||
if (enable) {
|
||||
@ -842,7 +837,7 @@ public class RouterConsoleRunner implements RouterApp {
|
||||
public CustomThreadPoolExecutor() {
|
||||
super(new ThreadPoolExecutor(
|
||||
MIN_THREADS, MAX_THREADS, MAX_IDLE_TIME, TimeUnit.MILLISECONDS,
|
||||
new SynchronousQueue(),
|
||||
new SynchronousQueue<Runnable>(),
|
||||
new CustomThreadFactory(),
|
||||
new ThreadPoolExecutor.CallerRunsPolicy())
|
||||
);
|
||||
|
@ -14,7 +14,7 @@ public class SearchHelper extends HelperBase {
|
||||
|
||||
private String _engine;
|
||||
private String _query;
|
||||
private Map<String, String> _engines = new TreeMap();
|
||||
private Map<String, String> _engines = new TreeMap<String, String>();
|
||||
|
||||
private static final char S = ',';
|
||||
// in case engines need to know where it came from
|
||||
|
@ -46,7 +46,7 @@ public class StatSummarizer implements Runnable {
|
||||
public StatSummarizer() {
|
||||
_context = RouterContext.listContexts().get(0); // only summarize one per jvm
|
||||
_log = _context.logManager().getLog(getClass());
|
||||
_listeners = new CopyOnWriteArrayList();
|
||||
_listeners = new CopyOnWriteArrayList<SummaryListener>();
|
||||
_instance = this;
|
||||
_sem = new Semaphore(MAX_CONCURRENT_PNG, true);
|
||||
_context.addShutdownTask(new Shutdown());
|
||||
@ -311,9 +311,9 @@ public class StatSummarizer implements Runnable {
|
||||
*/
|
||||
Set<Rate> parseSpecs(String specs) {
|
||||
if (specs == null)
|
||||
return Collections.EMPTY_SET;
|
||||
return Collections.emptySet();
|
||||
StringTokenizer tok = new StringTokenizer(specs, ",");
|
||||
Set<Rate> rv = new HashSet();
|
||||
Set<Rate> rv = new HashSet<Rate>();
|
||||
while (tok.hasMoreTokens()) {
|
||||
String spec = tok.nextToken();
|
||||
int split = spec.lastIndexOf('.');
|
||||
|
@ -6,7 +6,6 @@ import java.text.DecimalFormat;
|
||||
import java.text.Collator;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
@ -37,7 +36,7 @@ public class StatsGenerator {
|
||||
buf.setLength(0);
|
||||
|
||||
Map<String, SortedSet<String>> unsorted = _context.statManager().getStatsByGroup();
|
||||
Map<String, Set<String>> groups = new TreeMap(new AlphaComparator());
|
||||
Map<String, Set<String>> groups = new TreeMap<String, Set<String>>(new AlphaComparator());
|
||||
groups.putAll(unsorted);
|
||||
for (String group : groups.keySet()) {
|
||||
buf.append("<option value=\"#").append(group).append("\">");
|
||||
|
@ -409,7 +409,7 @@ public class SummaryHelper extends HelperBase {
|
||||
*/
|
||||
public String getDestinations() {
|
||||
// convert the set to a list so we can sort by name and not lose duplicates
|
||||
List<Destination> clients = new ArrayList(_context.clientManager().listClients());
|
||||
List<Destination> clients = new ArrayList<Destination>(_context.clientManager().listClients());
|
||||
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/i2ptunnelmgr\" target=\"_top\" title=\"").append(_("Add/remove/edit & control your client and server tunnels")).append("\">").append(_("Local Destinations")).append("</a></h3><hr class=\"b\"><div class=\"tunnels\">");
|
||||
@ -837,7 +837,7 @@ public class SummaryHelper extends HelperBase {
|
||||
String[] allSections = SummaryBarRenderer.ALL_SECTIONS;
|
||||
Map<String, String> sectionNames = SummaryBarRenderer.SECTION_NAMES;
|
||||
List<String> sections = getSummaryBarSections("default");
|
||||
TreeSet<String> sortedSections = new TreeSet();
|
||||
TreeSet<String> sortedSections = new TreeSet<String>();
|
||||
|
||||
for (int i = 0; i < allSections.length; i++) {
|
||||
String section = allSections[i];
|
||||
|
@ -23,7 +23,6 @@ import net.i2p.util.SystemVersion;
|
||||
import org.jrobin.core.RrdException;
|
||||
import org.jrobin.graph.RrdGraph;
|
||||
import org.jrobin.graph.RrdGraphDef;
|
||||
import org.jrobin.graph.RrdGraphDefTemplate;
|
||||
|
||||
/**
|
||||
* Generate the RRD graph png images,
|
||||
|
@ -38,7 +38,7 @@ public class TunnelRenderer {
|
||||
List<Hash> destinations = null;
|
||||
Map<Hash, TunnelPool> clientInboundPools = _context.tunnelManager().getInboundClientPools();
|
||||
Map<Hash, TunnelPool> clientOutboundPools = _context.tunnelManager().getOutboundClientPools();
|
||||
destinations = new ArrayList(clientInboundPools.keySet());
|
||||
destinations = new ArrayList<Hash>(clientInboundPools.keySet());
|
||||
boolean debug = _context.getBooleanProperty(HelperBase.PROP_ADVANCED);
|
||||
for (int i = 0; i < destinations.size(); i++) {
|
||||
Hash client = destinations.get(i);
|
||||
@ -64,7 +64,7 @@ public class TunnelRenderer {
|
||||
renderPool(out, in, outPool);
|
||||
}
|
||||
|
||||
List participating = _context.tunnelDispatcher().listParticipatingTunnels();
|
||||
List<HopConfig> participating = _context.tunnelDispatcher().listParticipatingTunnels();
|
||||
Collections.sort(participating, new TunnelComparator());
|
||||
out.write("<h2><a name=\"participating\"></a>" + _("Participating tunnels") + "</h2><table>\n");
|
||||
out.write("<tr><th>" + _("Receive on") + "</th><th>" + _("From") + "</th><th>"
|
||||
@ -142,7 +142,7 @@ public class TunnelRenderer {
|
||||
private void renderPool(Writer out, TunnelPool in, TunnelPool outPool) throws IOException {
|
||||
List<TunnelInfo> tunnels = null;
|
||||
if (in == null)
|
||||
tunnels = new ArrayList();
|
||||
tunnels = new ArrayList<TunnelInfo>();
|
||||
else
|
||||
tunnels = in.listTunnels();
|
||||
if (outPool != null)
|
||||
|
@ -68,7 +68,7 @@ public class WebAppConfiguration implements Configuration {
|
||||
// WebAppContext doesn't provide a remove method, so we must
|
||||
// convert to a list, remove the wildcard entry, add ours, then
|
||||
// add the wildcard back, then reset.
|
||||
List<String> classes = new ArrayList(16);
|
||||
List<String> classes = new ArrayList<String>(16);
|
||||
classes.addAll(Arrays.asList(wac.getServerClasses()));
|
||||
classes.remove("org.eclipse.jetty.");
|
||||
classes.add("-org.eclipse.jetty.http.");
|
||||
@ -152,7 +152,7 @@ public class WebAppConfiguration implements Configuration {
|
||||
private static Set<URL> getSystemClassPath() {
|
||||
URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
|
||||
URL urls[] = urlClassLoader.getURLs();
|
||||
Set<URL> rv = new HashSet(32);
|
||||
Set<URL> rv = new HashSet<URL>(32);
|
||||
for (int i = 0; i < urls.length; i++) {
|
||||
rv.add(urls[i]);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ import org.eclipse.jetty.webapp.WebAppContext;
|
||||
*/
|
||||
public class WebAppStarter {
|
||||
|
||||
private static final Map<String, Long> warModTimes = new ConcurrentHashMap();
|
||||
private static final Map<String, Long> warModTimes = new ConcurrentHashMap<String, Long>();
|
||||
static final Map INIT_PARAMS = new HashMap(4);
|
||||
//static private Log _log;
|
||||
|
||||
|
Reference in New Issue
Block a user