i2ptunnel: type arguments, unused imports

This commit is contained in:
str4d
2013-11-20 23:36:39 +00:00
parent 817f531619
commit e38db5eb44
27 changed files with 75 additions and 92 deletions

View File

@ -52,7 +52,7 @@ class ConnThrottler {
public ConnThrottler(int max, int totalMax, long period,
long throttlePeriod, long totalThrottlePeriod, String action, Log log) {
updateLimits(max, totalMax, period, throttlePeriod, totalThrottlePeriod);
_peers = new HashMap(4);
_peers = new HashMap<Hash, Record>(4);
_action = action;
_log = log;
// for logging
@ -143,7 +143,7 @@ class ConnThrottler {
private long until;
public Record() {
times = new ArrayList(8);
times = new ArrayList<Long>(8);
increment();
}

View File

@ -46,7 +46,6 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.StringTokenizer;
@ -99,10 +98,10 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
private static final String nocli_args[] = { "-nocli", "-die"};
private final List<I2PTunnelTask> tasks = new ArrayList();
private final List<I2PTunnelTask> tasks = new ArrayList<I2PTunnelTask>();
private int next_task_id = 1;
private final Set listeners = new CopyOnWriteArraySet();
private final Set<ConnectionEventListener> listeners = new CopyOnWriteArraySet<ConnectionEventListener>();
public static void main(String[] args) throws IOException {
new I2PTunnel(args);
@ -124,7 +123,7 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
// as of 0.8.4, include context properties
Properties p = _context.getProperties();
_clientOptions = p;
_sessions = new CopyOnWriteArraySet();
_sessions = new CopyOnWriteArraySet<I2PSession>();
addConnectionEventListener(lsnr);
boolean gui = true;
@ -196,7 +195,7 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
/** @return A copy, non-null */
List<I2PSession> getSessions() {
return new ArrayList(_sessions);
return new ArrayList<I2PSession>(_sessions);
}
void addSession(I2PSession session) {
@ -1506,7 +1505,7 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
*
*/
private void purgetasks(Logging l) {
List<I2PTunnelTask> removed = new ArrayList();
List<I2PTunnelTask> removed = new ArrayList<I2PTunnelTask>();
for (I2PTunnelTask t : tasks) {
if (!t.isOpen()) {
_log.debug(getPrefix() + "Purging inactive tunnel: [" + t.getId() + "] " + t.toString());
@ -1668,8 +1667,8 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
*/
void routerDisconnected() {
_log.error(getPrefix() + "Router disconnected - firing notification events");
for (Iterator iter = listeners.iterator(); iter.hasNext();) {
ConnectionEventListener lsnr = (ConnectionEventListener) iter.next();
for (Iterator<ConnectionEventListener> iter = listeners.iterator(); iter.hasNext();) {
ConnectionEventListener lsnr = iter.next();
if (lsnr != null) lsnr.routerDisconnected();
}
}

View File

@ -43,13 +43,13 @@ public class I2PTunnelClient extends I2PTunnelClientBase {
"Standard client on " + tunnel.listenHost + ':' + localPort,
tunnel, pkf);
_addrs = new ArrayList(1);
_addrs = new ArrayList<I2PSocketAddress>(1);
if (waitEventValue("openBaseClientResult").equals("error")) {
notifyEvent("openClientResult", "error");
return;
}
dests = new ArrayList(1);
dests = new ArrayList<Destination>(1);
buildAddresses(destinations);
if (_addrs.isEmpty()) {

View File

@ -48,7 +48,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
protected long _clientId;
protected final Object sockLock = new Object(); // Guards sockMgr and mySockets
protected I2PSocketManager sockMgr; // should be final and use a factory. LINT
protected final List<I2PSocket> mySockets = new ArrayList();
protected final List<I2PSocket> mySockets = new ArrayList<I2PSocket>();
protected boolean _ownDest;
protected Destination dest = null;
@ -678,7 +678,7 @@ public abstract class I2PTunnelClientBase extends I2PTunnelTask implements Runna
private static class CustomThreadPoolExecutor extends ThreadPoolExecutor {
public CustomThreadPoolExecutor() {
super(0, Integer.MAX_VALUE, HANDLER_KEEPALIVE_MS, TimeUnit.MILLISECONDS,
new SynchronousQueue(), new CustomThreadFactory());
new SynchronousQueue<Runnable>(), new CustomThreadFactory());
}
}

View File

@ -3,7 +3,6 @@
*/
package net.i2p.i2ptunnel;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

View File

@ -3,7 +3,6 @@
*/
package net.i2p.i2ptunnel;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@ -70,7 +69,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
* Map of host name to base64 destination for destinations collected
* via address helper links
*/
private final ConcurrentHashMap<String, String> addressHelpers = new ConcurrentHashMap(8);
private final ConcurrentHashMap<String, String> addressHelpers = new ConcurrentHashMap<String, String>(8);
/**
* Used to protect actions via http://proxy.i2p/

View File

@ -94,10 +94,10 @@ public abstract class I2PTunnelHTTPClientBase extends I2PTunnelClientBase implem
EventDispatcher notifyThis, String handlerName,
I2PTunnel tunnel) throws IllegalArgumentException {
super(localPort, ownDest, l, notifyThis, handlerName, tunnel);
_proxyList = new ArrayList(4);
_proxyList = new ArrayList<String>(4);
_proxyNonce = new byte[PROXYNONCE_BYTES];
_context.random().nextBytes(_proxyNonce);
_nonces = new ConcurrentHashMap();
_nonces = new ConcurrentHashMap<String, NonceInfo>();
}
/**
@ -110,10 +110,10 @@ public abstract class I2PTunnelHTTPClientBase extends I2PTunnelClientBase implem
I2PTunnel tunnel, EventDispatcher notifyThis, long clientId )
throws IllegalArgumentException {
super(localPort, l, sktMgr, tunnel, notifyThis, clientId);
_proxyList = new ArrayList(4);
_proxyList = new ArrayList<String>(4);
_proxyNonce = new byte[PROXYNONCE_BYTES];
_context.random().nextBytes(_proxyNonce);
_nonces = new ConcurrentHashMap();
_nonces = new ConcurrentHashMap<String, NonceInfo>();
}
//////// Authorization stuff
@ -409,7 +409,7 @@ public abstract class I2PTunnelHTTPClientBase extends I2PTunnelClientBase implem
* @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;

View File

@ -8,7 +8,6 @@ import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;
import net.i2p.I2PException;
import net.i2p.client.streaming.I2PSocket;
import net.i2p.client.streaming.I2PSocketAddress;
import net.i2p.data.Base32;
@ -60,7 +59,7 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase {
notifyThis,
"IRC Client on " + tunnel.listenHost + ':' + localPort, tunnel, pkf);
_addrs = new ArrayList(4);
_addrs = new ArrayList<I2PSocketAddress>(4);
buildAddresses(destinations);
if (_addrs.isEmpty()) {

View File

@ -27,7 +27,6 @@ import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.ThreadFactory;
import net.i2p.I2PAppContext;
import net.i2p.I2PException;
import net.i2p.client.I2PSessionException;
import net.i2p.client.streaming.I2PServerSocket;
@ -77,7 +76,7 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
protected I2PTunnelTask task;
protected boolean bidir;
private ThreadPoolExecutor _executor;
private final Map<Integer, InetSocketAddress> _socketMap = new ConcurrentHashMap(4);
private final Map<Integer, InetSocketAddress> _socketMap = new ConcurrentHashMap<Integer, InetSocketAddress>(4);
/** unused? port should always be specified */
private int DEFAULT_LOCALPORT = 4488;
@ -321,7 +320,7 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
synchronized (lock) {
if (!forced && sockMgr.listSockets().size() != 0) {
l.log("There are still active connections!");
for (Iterator it = sockMgr.listSockets().iterator(); it.hasNext();) {
for (Iterator<I2PSocket> it = sockMgr.listSockets().iterator(); it.hasNext();) {
l.log("->" + it.next());
}
return false;
@ -473,7 +472,7 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
private static class CustomThreadPoolExecutor extends ThreadPoolExecutor {
public CustomThreadPoolExecutor(int max, String name) {
super(MIN_HANDLERS, max, HANDLER_KEEPALIVE_MS, TimeUnit.MILLISECONDS,
new SynchronousQueue(), new CustomThreadFactory(name));
new SynchronousQueue<Runnable>(), new CustomThreadFactory(name));
}
}

View File

@ -123,7 +123,7 @@ public class I2Ping extends I2PTunnelTask implements Runnable {
} else if (cmd.startsWith("-l ")) { // ping a list of hosts
BufferedReader br = new BufferedReader(new FileReader(cmd.substring(3)));
String line;
List pingHandlers = new ArrayList();
List<PingHandler> pingHandlers = new ArrayList<PingHandler>();
int i = 0;
while ((line = br.readLine()) != null) {
if (line.startsWith("#")) continue; // comments
@ -137,7 +137,7 @@ public class I2Ping extends I2PTunnelTask implements Runnable {
reportTimes = false;
}
br.close();
for (Iterator it = pingHandlers.iterator(); it.hasNext();) {
for (Iterator<PingHandler> it = pingHandlers.iterator(); it.hasNext();) {
Thread t = (Thread) it.next();
t.join();
}

View File

@ -4,13 +4,9 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Random;
import net.i2p.I2PAppContext;
import net.i2p.I2PException;
import net.i2p.client.I2PClient;
@ -70,7 +66,7 @@ public class TunnelController implements Logging {
_tunnel = new I2PTunnel();
_log = I2PAppContext.getGlobalContext().logManager().getLog(TunnelController.class);
setConfig(config, prefix);
_messages = new ArrayList(4);
_messages = new ArrayList<String>(4);
_running = false;
boolean keyOK = true;
if (createKey && (getType().endsWith("server") || getPersistentClientKey()))
@ -741,9 +737,9 @@ public class TunnelController implements Logging {
* @return list of messages pulled off (each is a String, earliest first)
*/
public List<String> clearMessages() {
List rv = null;
List<String> rv = null;
synchronized (this) {
rv = new ArrayList(_messages);
rv = new ArrayList<String>(_messages);
_messages.clear();
}
return rv;

View File

@ -3,7 +3,6 @@ package net.i2p.i2ptunnel;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@ -83,14 +82,14 @@ public class TunnelControllerGroup implements ClientApp {
_context = context;
_mgr = mgr;
_log = _context.logManager().getLog(TunnelControllerGroup.class);
_controllers = new ArrayList();
_controllers = new ArrayList<TunnelController>();
if (args == null || args.length <= 0)
_configFile = DEFAULT_CONFIG_FILE;
else if (args.length == 1)
_configFile = args[0];
else
throw new IllegalArgumentException("Usage: TunnelControllerGroup [filename]");
_sessions = new HashMap(4);
_sessions = new HashMap<I2PSession, Set<TunnelController>>(4);
synchronized (TunnelControllerGroup.class) {
if (_instance == null)
_instance = this;
@ -288,7 +287,7 @@ public class TunnelControllerGroup implements ClientApp {
* @return list of messages from the controller as it is stopped
*/
public synchronized List<String> removeController(TunnelController controller) {
if (controller == null) return new ArrayList();
if (controller == null) return new ArrayList<String>();
controller.stopTunnel();
List<String> msgs = controller.clearMessages();
_controllers.remove(controller);
@ -302,7 +301,7 @@ public class TunnelControllerGroup implements ClientApp {
* @return list of messages the tunnels generate when stopped
*/
public synchronized List<String> stopAllControllers() {
List<String> msgs = new ArrayList();
List<String> msgs = new ArrayList<String>();
for (int i = 0; i < _controllers.size(); i++) {
TunnelController controller = _controllers.get(i);
controller.stopTunnel();
@ -319,7 +318,7 @@ public class TunnelControllerGroup implements ClientApp {
* @return list of messages the tunnels generate when started
*/
public synchronized List<String> startAllControllers() {
List<String> msgs = new ArrayList();
List<String> msgs = new ArrayList<String>();
for (int i = 0; i < _controllers.size(); i++) {
TunnelController controller = _controllers.get(i);
controller.startTunnelBackground();
@ -337,7 +336,7 @@ public class TunnelControllerGroup implements ClientApp {
* @return list of messages the tunnels generate when restarted
*/
public synchronized List<String> restartAllControllers() {
List<String> msgs = new ArrayList();
List<String> msgs = new ArrayList<String>();
for (int i = 0; i < _controllers.size(); i++) {
TunnelController controller = _controllers.get(i);
controller.restartTunnel();
@ -354,7 +353,7 @@ public class TunnelControllerGroup implements ClientApp {
* @return list of messages the tunnels have generated
*/
public synchronized List<String> clearAllMessages() {
List<String> msgs = new ArrayList();
List<String> msgs = new ArrayList<String>();
for (int i = 0; i < _controllers.size(); i++) {
TunnelController controller = _controllers.get(i);
msgs.addAll(controller.clearMessages());
@ -426,7 +425,7 @@ public class TunnelControllerGroup implements ClientApp {
* @return list of TunnelController objects
*/
public synchronized List<TunnelController> getControllers() {
return new ArrayList(_controllers);
return new ArrayList<TunnelController>(_controllers);
}
@ -439,7 +438,7 @@ public class TunnelControllerGroup implements ClientApp {
synchronized (_sessions) {
Set<TunnelController> owners = _sessions.get(session);
if (owners == null) {
owners = new HashSet(2);
owners = new HashSet<TunnelController>(2);
_sessions.put(session, owners);
}
owners.add(controller);

View File

@ -55,9 +55,9 @@ public class DCCClientManager extends EventReceiver {
_dispatch = dispatch;
_tunnel = tunnel;
_log = tunnel.getContext().logManager().getLog(DCCClientManager.class);
_incoming = new ConcurrentHashMap(8);
_active = new ConcurrentHashMap(8);
_complete = new ConcurrentHashMap(8);
_incoming = new ConcurrentHashMap<Integer, I2PTunnelDCCClient>(8);
_active = new ConcurrentHashMap<Integer, I2PTunnelDCCClient>(8);
_complete = new ConcurrentHashMap<Integer, I2PTunnelDCCClient>(8);
}
public boolean close(boolean forced) {

View File

@ -75,10 +75,10 @@ public class I2PTunnelDCCServer extends I2PTunnelServer {
public I2PTunnelDCCServer(I2PSocketManager sktMgr, Logging l,
EventDispatcher notifyThis, I2PTunnel tunnel) {
super(DUMMY, 0, sktMgr, l, notifyThis, tunnel);
_outgoing = new ConcurrentHashMap(8);
_active = new ConcurrentHashMap(8);
_resume = new ConcurrentHashMap(8);
_sockList = new CopyOnWriteArrayList();
_outgoing = new ConcurrentHashMap<Integer, LocalAddress>(8);
_active = new ConcurrentHashMap<Integer, LocalAddress>(8);
_resume = new ConcurrentHashMap<Integer, LocalAddress>(8);
_sockList = new CopyOnWriteArrayList<I2PSocket>();
}
/**

View File

@ -232,7 +232,7 @@ abstract class IRCFilter {
"WALLOPS",
"ZLINE"
};
_allowedOutbound = new HashSet(Arrays.asList(allowedCommands));
_allowedOutbound = new HashSet<String>(Arrays.asList(allowedCommands));
}
/*************************************************************************

View File

@ -17,7 +17,6 @@ import net.i2p.data.DataFormatException;
import net.i2p.data.Destination;
import net.i2p.i2ptunnel.I2PTunnelHTTPClient;
import net.i2p.util.FileUtil;
import net.i2p.util.Log;
import net.i2p.util.Translate;
/**
@ -119,7 +118,7 @@ public abstract class LocalHTTPServer {
// Parameters are url, host, dest, nonce, and master | router | private.
// Do the add and redirect.
if (targetRequest.equals("/add")) {
Map<String, String> opts = new HashMap(8);
Map<String, String> opts = new HashMap<String, String>(8);
// this only works if all keys are followed by =value
StringTokenizer tok = new StringTokenizer(query, "=&;");
while (tok.hasMoreTokens()) {

View File

@ -69,13 +69,13 @@ public class I2PSOCKSTunnel extends I2PTunnelClientBase {
private void parseOptions() {
Properties opts = getTunnel().getClientOptions();
proxies = new HashMap(1);
proxies = new HashMap<String, List<String>>(1);
for (Map.Entry e : opts.entrySet()) {
String prop = (String)e.getKey();
if ((!prop.startsWith(PROP_PROXY_PREFIX)) || prop.length() <= PROP_PROXY_PREFIX.length())
continue;
String port = prop.substring(PROP_PROXY_PREFIX.length());
List proxyList = new ArrayList(1);
List<String> proxyList = new ArrayList<String>(1);
StringTokenizer tok = new StringTokenizer((String)e.getValue(), ", \t");
while (tok.hasMoreTokens()) {
String proxy = tok.nextToken().trim();

View File

@ -10,10 +10,10 @@ import net.i2p.util.Log;
* Sends to one of many Sinks
* @author zzz modded from streamr/MultiSource
*/
public class MultiSink implements Source, Sink {
public class MultiSink<S extends Sink> implements Source, Sink {
private static final Log _log = new Log(MultiSink.class);
public MultiSink(Map cache) {
public MultiSink(Map<Destination, S> cache) {
this.cache = cache;
}
@ -31,5 +31,5 @@ public class MultiSink implements Source, Sink {
s.send(from, data);
}
private Map<Destination, Sink> cache;
private Map<Destination, S> cache;
}

View File

@ -10,10 +10,10 @@ import net.i2p.util.Log;
* Track who the reply goes to
* @author zzz
*/
public class ReplyTracker implements Source, Sink {
public class ReplyTracker<S extends Sink> implements Source, Sink {
private static final Log _log = new Log(MultiSink.class);
public ReplyTracker(Sink reply, Map cache) {
public ReplyTracker(S reply, Map<Destination, S> cache) {
this.reply = reply;
this.cache = cache;
}
@ -29,7 +29,7 @@ public class ReplyTracker implements Source, Sink {
this.sink.send(to, data);
}
private Sink reply;
private Map<Destination, Sink> cache;
private S reply;
private Map<Destination, S> cache;
private Sink sink;
}

View File

@ -597,7 +597,7 @@ public class SOCKS5Server extends SOCKSServer {
* RFC 1928 isn't clear... maybe not.
*/
private void handleUDP(DataInputStream in, DataOutputStream out) throws SOCKSException {
List<Integer> ports = new ArrayList(1);
List<Integer> ports = new ArrayList<Integer>(1);
synchronized (_startLock) {
if (_tunnel == null) {
// tunnel options?

View File

@ -26,10 +26,10 @@ import net.i2p.i2ptunnel.udp.*;
*/
public class SOCKSUDPPort implements Source, Sink {
public SOCKSUDPPort(InetAddress host, int port, Map replyMap) {
public SOCKSUDPPort(InetAddress host, int port, Map<Destination, SOCKSUDPPort> replyMap) {
// this passes the host and port from UDPUnwrapper to UDPWrapper
Map cache = new ConcurrentHashMap(4);
Map<Destination, SOCKSHeader> cache = new ConcurrentHashMap<Destination, SOCKSHeader>(4);
// rcv from I2P and send to a port
this.wrapper = new SOCKSUDPWrapper(cache);
@ -41,7 +41,7 @@ public class SOCKSUDPPort implements Source, Sink {
this.udpsource = new UDPSource(sock);
this.unwrapper = new SOCKSUDPUnwrapper(cache);
this.udpsource.setSink(this.unwrapper);
this.udptracker = new ReplyTracker(this, replyMap);
this.udptracker = new ReplyTracker<SOCKSUDPPort>(this, replyMap);
this.unwrapper.setSink(this.udptracker);
}
@ -73,5 +73,5 @@ public class SOCKSUDPPort implements Source, Sink {
private UDPSource udpsource;
private SOCKSUDPWrapper wrapper;
private SOCKSUDPUnwrapper unwrapper;
private ReplyTracker udptracker;
private ReplyTracker<SOCKSUDPPort> udptracker;
}

View File

@ -4,7 +4,6 @@ import java.net.InetAddress;
import java.util.concurrent.ConcurrentHashMap;
import java.util.Iterator;
import java.util.Map;
import net.i2p.data.Destination;
import net.i2p.i2ptunnel.I2PTunnel;
import net.i2p.i2ptunnel.udpTunnel.I2PTunnelUDPClientBase;
@ -33,9 +32,9 @@ public class SOCKSUDPTunnel extends I2PTunnelUDPClientBase {
public SOCKSUDPTunnel(I2PTunnel tunnel) {
super(null, tunnel, tunnel, tunnel);
this.ports = new ConcurrentHashMap(1);
this.cache = new ConcurrentHashMap(1);
this.demuxer = new MultiSink(this.cache);
this.ports = new ConcurrentHashMap<Integer, SOCKSUDPPort>(1);
this.cache = new ConcurrentHashMap<Destination, SOCKSUDPPort>(1);
this.demuxer = new MultiSink<SOCKSUDPPort>(this.cache);
setSink(this.demuxer);
}
@ -53,8 +52,8 @@ public class SOCKSUDPTunnel extends I2PTunnelUDPClientBase {
SOCKSUDPPort sup = this.ports.remove(port);
if (sup != null)
sup.stop();
for (Iterator iter = cache.entrySet().iterator(); iter.hasNext();) {
Map.Entry<Destination, SOCKSUDPPort> e = (Map.Entry) iter.next();
for (Iterator<Map.Entry<Destination, SOCKSUDPPort>> iter = cache.entrySet().iterator(); iter.hasNext();) {
Map.Entry<Destination, SOCKSUDPPort> e = iter.next();
if (e.getValue() == sup)
iter.remove();
}
@ -89,5 +88,5 @@ public class SOCKSUDPTunnel extends I2PTunnelUDPClientBase {
private Map<Integer, SOCKSUDPPort> ports;
private Map<Destination, SOCKSUDPPort> cache;
private MultiSink demuxer;
private MultiSink<SOCKSUDPPort> demuxer;
}

View File

@ -8,8 +8,6 @@ package net.i2p.i2ptunnel.streamr;
// system
import java.util.Set;
// i2p
import net.i2p.client.I2PSession;
import net.i2p.data.Destination;
import net.i2p.i2ptunnel.udp.*;
import net.i2p.util.ConcurrentHashSet;

View File

@ -32,7 +32,7 @@ public class I2PSource implements Source, Runnable {
this.raw = raw;
// create queue
this.queue = new ArrayBlockingQueue(256);
this.queue = new ArrayBlockingQueue<Integer>(256);
// create listener
this.sess.setSessionListener(new Listener());

View File

@ -5,7 +5,6 @@ package net.i2p.i2ptunnel.udpTunnel;
import java.io.ByteArrayOutputStream;
import java.io.ByteArrayInputStream;
import java.net.ServerSocket;
import java.util.concurrent.atomic.AtomicLong;
import net.i2p.I2PAppContext;

View File

@ -8,11 +8,9 @@ package net.i2p.i2ptunnel.web;
*
*/
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.Set;
import java.util.TreeMap;
@ -43,9 +41,9 @@ public class EditBean extends IndexBean {
TunnelControllerGroup group = TunnelControllerGroup.getInstance();
if (group == null)
return false;
List controllers = group.getControllers();
List<TunnelController> controllers = group.getControllers();
if (controllers.size() > tunnel) {
TunnelController cur = (TunnelController)controllers.get(tunnel);
TunnelController cur = controllers.get(tunnel);
if (cur == null) return false;
return isClient(cur.getType());
} else {
@ -374,7 +372,7 @@ public class EditBean extends IndexBean {
if (opts == null) return "";
boolean isMD5Proxy = "httpclient".equals(tun.getType()) ||
"connectclient".equals(tun.getType());
Map<String, String> sorted = new TreeMap();
Map<String, String> sorted = new TreeMap<String, String>();
for (Map.Entry e : opts.entrySet()) {
String key = (String)e.getKey();
if (_noShowSet.contains(key))

View File

@ -102,7 +102,7 @@ public class IndexBean {
/** 3 wasn't enough for some browsers. They are reloading the page for some reason - maybe HEAD? @since 0.8.1 */
private static final int MAX_NONCES = 8;
/** store nonces in a static FIFO instead of in System Properties @since 0.8.1 */
private static final List<String> _nonces = new ArrayList(MAX_NONCES + 1);
private static final List<String> _nonces = new ArrayList<String>(MAX_NONCES + 1);
static final String CLIENT_NICKNAME = "shared clients";
public static final String PROP_THEME_NAME = "routerconsole.theme";
@ -129,8 +129,8 @@ public class IndexBean {
_tunnel = -1;
_curNonce = "-1";
addNonce();
_booleanOptions = new ConcurrentHashSet(4);
_otherOptions = new ConcurrentHashMap(4);
_booleanOptions = new ConcurrentHashSet<String>(4);
_otherOptions = new ConcurrentHashMap<String, String>(4);
}
/**
@ -1224,8 +1224,8 @@ public class IndexBean {
"proxyUsername", "proxyPassword"
};
protected static final Set _noShowSet = new HashSet(128);
protected static final Set _nonProxyNoShowSet = new HashSet(4);
protected static final Set<String> _noShowSet = new HashSet<String>(128);
protected static final Set<String> _nonProxyNoShowSet = new HashSet<String>(4);
static {
_noShowSet.addAll(Arrays.asList(_noShowOpts));
_noShowSet.addAll(Arrays.asList(_booleanClientOpts));