diff --git a/core/java/src/net/i2p/I2PAppContext.java b/core/java/src/net/i2p/I2PAppContext.java index 5760948b39df99f42b8c448ceb84b7007a1e10b5..9a45598f4b9dc8ace33c732aa800a1c492b9481c 100644 --- a/core/java/src/net/i2p/I2PAppContext.java +++ b/core/java/src/net/i2p/I2PAppContext.java @@ -201,7 +201,7 @@ public class I2PAppContext { _overrideProps = new I2PProperties(); if (envProps != null) _overrideProps.putAll(envProps); - _shutdownTasks = new ConcurrentHashSet(32); + _shutdownTasks = new ConcurrentHashSet<Runnable>(32); _portMapper = new PortMapper(this); /* @@ -535,7 +535,7 @@ public class I2PAppContext { * * @return set of Strings containing the names of defined system properties */ - public Set getPropertyNames() { + public Set<String> getPropertyNames() { // clone to avoid ConcurrentModificationException Set names = new HashSet(((Properties) System.getProperties().clone()).keySet()); if (_overrideProps != null) diff --git a/core/java/src/net/i2p/app/ClientApp.java b/core/java/src/net/i2p/app/ClientApp.java index 545659917f80f8b4babe511091bed468ee23204d..3f611454d3be96077a713939e17d615f38469051 100644 --- a/core/java/src/net/i2p/app/ClientApp.java +++ b/core/java/src/net/i2p/app/ClientApp.java @@ -1,7 +1,5 @@ package net.i2p.app; -import net.i2p.I2PAppContext; - /** * If a class started via clients.config implements this interface, * it will be used to manage the client, instead of starting with main() diff --git a/core/java/src/net/i2p/client/ClientWriterRunner.java b/core/java/src/net/i2p/client/ClientWriterRunner.java index 9edf52f543aa538a20e91eeb44332457086555df..d25f741c5cf10b2f1308f48015b3aa1e6c20cf71 100644 --- a/core/java/src/net/i2p/client/ClientWriterRunner.java +++ b/core/java/src/net/i2p/client/ClientWriterRunner.java @@ -33,7 +33,7 @@ class ClientWriterRunner implements Runnable { public ClientWriterRunner(OutputStream out, I2PSessionImpl session) { _out = new BufferedOutputStream(out); _session = session; - _messagesToWrite = new LinkedBlockingQueue(MAX_QUEUE_SIZE); + _messagesToWrite = new LinkedBlockingQueue<I2CPMessage>(MAX_QUEUE_SIZE); Thread t = new I2PAppThread(this, "I2CP Client Writer " + __Id.incrementAndGet(), true); t.start(); } diff --git a/core/java/src/net/i2p/client/I2PSessionDemultiplexer.java b/core/java/src/net/i2p/client/I2PSessionDemultiplexer.java index a132a1ac3df824a3a9e291e747aa47e4b2649b79..1f07a32fc947d4c1ca9ef5db2f8d4deb25c76951 100644 --- a/core/java/src/net/i2p/client/I2PSessionDemultiplexer.java +++ b/core/java/src/net/i2p/client/I2PSessionDemultiplexer.java @@ -27,7 +27,7 @@ public class I2PSessionDemultiplexer implements I2PSessionMuxedListener { public I2PSessionDemultiplexer(I2PAppContext ctx) { _log = ctx.logManager().getLog(I2PSessionDemultiplexer.class); - _listeners = new ConcurrentHashMap(); + _listeners = new ConcurrentHashMap<Integer, I2PSessionMuxedListener>(); } /** unused */ diff --git a/core/java/src/net/i2p/client/I2PSessionImpl.java b/core/java/src/net/i2p/client/I2PSessionImpl.java index 2d88ce6542d68e3f94add2fa3da53424d94bdcfa..465ff8a69ac585b8d551ee464e9344999a2fdca9 100644 --- a/core/java/src/net/i2p/client/I2PSessionImpl.java +++ b/core/java/src/net/i2p/client/I2PSessionImpl.java @@ -47,7 +47,6 @@ import net.i2p.util.I2PAppThread; import net.i2p.util.I2PSSLSocketFactory; import net.i2p.util.LHMCache; import net.i2p.util.Log; -import net.i2p.util.SimpleScheduler; import net.i2p.util.SimpleTimer; import net.i2p.util.VersionComparator; @@ -99,7 +98,7 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa protected Map<Long, MessagePayloadMessage> _availableMessages; /** hashes of lookups we are waiting for */ - protected final LinkedBlockingQueue<LookupWaiter> _pendingLookups = new LinkedBlockingQueue(); + protected final LinkedBlockingQueue<LookupWaiter> _pendingLookups = new LinkedBlockingQueue<LookupWaiter>(); protected final Object _bwReceivedLock = new Object(); protected volatile int[] _bwLimits; @@ -145,7 +144,7 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa /** * @since 0.8.9 */ - private static final Map<Hash, Destination> _lookupCache = new LHMCache(16); + private static final Map<Hash, Destination> _lookupCache = new LHMCache<Hash, Destination>(16); /** SSL interface (only) @since 0.8.3 */ protected static final String PROP_ENABLE_SSL = "i2cp.SSL"; @@ -196,7 +195,7 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa _fastReceive = Boolean.parseBoolean(_options.getProperty(I2PClient.PROP_FAST_RECEIVE)); if (hasDest) { _producer = new I2CPMessageProducer(context); - _availableMessages = new ConcurrentHashMap(); + _availableMessages = new ConcurrentHashMap<Long, MessagePayloadMessage>(); _myDestination = new Destination(); _privateKey = new PrivateKey(); _signingPrivateKey = new SigningPrivateKey(); @@ -593,7 +592,7 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa * message. Just copy all unclaimed ones and check 30 seconds later. */ private class VerifyUsage implements SimpleTimer.TimedEvent { - private final List<Long> toCheck = new ArrayList(); + private final List<Long> toCheck = new ArrayList<Long>(); public void timeReached() { if (isClosed()) @@ -623,8 +622,8 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa private volatile boolean _alive; public AvailabilityNotifier() { - _pendingIds = new ArrayList(2); - _pendingSizes = new ArrayList(2); + _pendingIds = new ArrayList<Long>(2); + _pendingSizes = new ArrayList<Integer>(2); } public void stopNotifying() { diff --git a/core/java/src/net/i2p/client/I2PSessionImpl2.java b/core/java/src/net/i2p/client/I2PSessionImpl2.java index eb537815edaf3b2f65e20b037889ffd02d549353..487d53e279d433e96f656f13049ad93c814b23b3 100644 --- a/core/java/src/net/i2p/client/I2PSessionImpl2.java +++ b/core/java/src/net/i2p/client/I2PSessionImpl2.java @@ -63,7 +63,7 @@ class I2PSessionImpl2 extends I2PSessionImpl { */ public I2PSessionImpl2(I2PAppContext ctx, InputStream destKeyStream, Properties options) throws I2PSessionException { super(ctx, destKeyStream, options); - _sendingStates = new HashSet(32); + _sendingStates = new HashSet<MessageState>(32); // default is BestEffort _noEffort = "none".equals(getOptions().getProperty(I2PClient.PROP_RELIABILITY, "").toLowerCase(Locale.US)); @@ -449,8 +449,8 @@ class I2PSessionImpl2 extends I2PSessionImpl { long inSync = 0; synchronized (_sendingStates) { inSync = _context.clock().now(); - for (Iterator iter = _sendingStates.iterator(); iter.hasNext();) { - state = (MessageState) iter.next(); + for (Iterator<MessageState> iter = _sendingStates.iterator(); iter.hasNext();) { + state = iter.next(); if (_log.shouldLog(Log.DEBUG)) _log.debug(getPrefix() + "State " + state.getMessageId() + " / " + state.getNonce()); if (state.getNonce() == nonce) { if (_log.shouldLog(Log.DEBUG)) _log.debug(getPrefix() + "Found a matching state"); @@ -523,8 +523,8 @@ class I2PSessionImpl2 extends I2PSessionImpl { if (_sendingStates == null) // only null if overridden by I2PSimpleSession return; synchronized (_sendingStates) { - for (Iterator iter = _sendingStates.iterator(); iter.hasNext();) { - MessageState state = (MessageState) iter.next(); + for (Iterator<MessageState> iter = _sendingStates.iterator(); iter.hasNext();) { + MessageState state = iter.next(); state.cancel(); } if (_log.shouldLog(Log.INFO)) _log.info(getPrefix() + "Disconnecting " + _sendingStates.size() + " states"); diff --git a/core/java/src/net/i2p/client/I2PSessionMuxedImpl.java b/core/java/src/net/i2p/client/I2PSessionMuxedImpl.java index 383a59b81752cf692328cef3f005b145874337f3..89a9161b0f0697fd0b531097d5b0e364048f86cf 100644 --- a/core/java/src/net/i2p/client/I2PSessionMuxedImpl.java +++ b/core/java/src/net/i2p/client/I2PSessionMuxedImpl.java @@ -16,7 +16,6 @@ import net.i2p.data.Destination; import net.i2p.data.SessionKey; import net.i2p.data.i2cp.MessagePayloadMessage; import net.i2p.util.Log; -import net.i2p.util.SimpleScheduler; /** * I2PSession with protocol and ports @@ -297,7 +296,7 @@ class I2PSessionMuxedImpl extends I2PSessionImpl2 { private final AtomicBoolean stopping = new AtomicBoolean(false); public MuxedAvailabilityNotifier() { - _msgs = new LinkedBlockingQueue(); + _msgs = new LinkedBlockingQueue<MsgData>(); } @Override diff --git a/core/java/src/net/i2p/client/MessageState.java b/core/java/src/net/i2p/client/MessageState.java index 326fec9898f2614734b8041936f08fa74ab3ddf3..7425ed56dd0ceddec7ab87c3ef9cf19c93d98c98 100644 --- a/core/java/src/net/i2p/client/MessageState.java +++ b/core/java/src/net/i2p/client/MessageState.java @@ -41,7 +41,7 @@ class MessageState { _log = ctx.logManager().getLog(MessageState.class); _nonce = nonce; _prefix = prefix + "[" + _stateId + "]: "; - _receivedStatus = new HashSet(); + _receivedStatus = new HashSet<Integer>(); _created = ctx.clock().now(); //ctx.statManager().createRateStat("i2cp.checkStatusTime", "how long it takes to go through the states", "i2cp", new long[] { 60*1000 }); } @@ -150,8 +150,8 @@ class MessageState { if (_log.shouldLog(Log.DEBUG)) _log.debug(_prefix + "isSuccess(" + wantedStatus + "): " + _receivedStatus); - for (Iterator iter = _receivedStatus.iterator(); iter.hasNext();) { - Integer val = (Integer) iter.next(); + for (Iterator<Integer> iter = _receivedStatus.iterator(); iter.hasNext();) { + Integer val = iter.next(); int recv = val.intValue(); switch (recv) { case MessageStatusMessage.STATUS_SEND_BEST_EFFORT_FAILURE: @@ -210,8 +210,8 @@ class MessageState { if (_log.shouldLog(Log.DEBUG)) _log.debug(_prefix + "isFailure(" + wantedStatus + "): " + _receivedStatus); - for (Iterator iter = _receivedStatus.iterator(); iter.hasNext();) { - Integer val = (Integer) iter.next(); + for (Iterator<Integer> iter = _receivedStatus.iterator(); iter.hasNext();) { + Integer val = iter.next(); int recv = val.intValue(); switch (recv) { case MessageStatusMessage.STATUS_SEND_BEST_EFFORT_FAILURE: diff --git a/core/java/src/net/i2p/client/RequestLeaseSetMessageHandler.java b/core/java/src/net/i2p/client/RequestLeaseSetMessageHandler.java index eea6d294d5662d5fb4b1a7dc5b9860aaea0394f3..620f571f4d328604b50127df06224858754d8c30 100644 --- a/core/java/src/net/i2p/client/RequestLeaseSetMessageHandler.java +++ b/core/java/src/net/i2p/client/RequestLeaseSetMessageHandler.java @@ -48,7 +48,7 @@ class RequestLeaseSetMessageHandler extends HandlerImpl { protected RequestLeaseSetMessageHandler(I2PAppContext context, int messageType) { super(context, messageType); // not clear why there would ever be more than one - _existingLeaseSets = new ConcurrentHashMap(4); + _existingLeaseSets = new ConcurrentHashMap<Destination, LeaseInfo>(4); } public void handleMessage(I2CPMessage message, I2PSessionImpl session) { diff --git a/core/java/src/net/i2p/client/SessionIdleTimer.java b/core/java/src/net/i2p/client/SessionIdleTimer.java index cf5c8c02915c217aff90191c4b3621a08f24399e..d01273f930a32bb9872e2a8b845077a9fed81ffe 100644 --- a/core/java/src/net/i2p/client/SessionIdleTimer.java +++ b/core/java/src/net/i2p/client/SessionIdleTimer.java @@ -10,7 +10,6 @@ import java.util.Properties; import net.i2p.I2PAppContext; import net.i2p.data.DataHelper; import net.i2p.util.Log; -import net.i2p.util.SimpleScheduler; import net.i2p.util.SimpleTimer; /** diff --git a/core/java/src/net/i2p/client/naming/BlockfileNamingService.java b/core/java/src/net/i2p/client/naming/BlockfileNamingService.java index d1fd7530a3054bae6e35f03c70fd00f199da4371..9194d81aa160df4e245ccd250ac06f603e320fbb 100644 --- a/core/java/src/net/i2p/client/naming/BlockfileNamingService.java +++ b/core/java/src/net/i2p/client/naming/BlockfileNamingService.java @@ -133,9 +133,9 @@ public class BlockfileNamingService extends DummyNamingService { */ public BlockfileNamingService(I2PAppContext context) { super(context); - _lists = new ArrayList(); - _invalid = new ArrayList(); - _negativeCache = new LHMCache(NEGATIVE_CACHE_SIZE); + _lists = new ArrayList<String>(); + _invalid = new ArrayList<InvalidEntry>(); + _negativeCache = new LHMCache<String, String>(NEGATIVE_CACHE_SIZE); BlockFile bf = null; RAIFile raf = null; boolean readOnly = false; @@ -468,7 +468,7 @@ public class BlockfileNamingService extends DummyNamingService { private static List<String> getFilenames(String list) { StringTokenizer tok = new StringTokenizer(list, ","); - List<String> rv = new ArrayList(tok.countTokens()); + List<String> rv = new ArrayList<String>(tok.countTokens()); while (tok.hasMoreTokens()) rv.add(tok.nextToken()); return rv; @@ -847,20 +847,20 @@ public class BlockfileNamingService extends DummyNamingService { " limit=" + limit + " skip=" + skip); synchronized(_bf) { if (_isClosed) - return Collections.EMPTY_MAP; + return Collections.emptyMap(); try { SkipList sl = _bf.getIndex(listname, _stringSerializer, _destSerializer); if (sl == null) { if (_log.shouldLog(Log.WARN)) _log.warn("No skiplist found for lookup in " + listname); - return Collections.EMPTY_MAP; + return Collections.emptyMap(); } SkipIterator iter; if (beginWith != null) iter = sl.find(beginWith); else iter = sl.iterator(); - Map<String, Destination> rv = new HashMap(); + Map<String, Destination> rv = new HashMap<String, Destination>(); for (int i = 0; i < skip && iter.hasNext(); i++) { // don't bother validating here iter.next(); @@ -886,10 +886,10 @@ public class BlockfileNamingService extends DummyNamingService { return rv; } catch (IOException ioe) { _log.error("DB lookup error", ioe); - return Collections.EMPTY_MAP; + return Collections.emptyMap(); } catch (RuntimeException re) { _log.error("DB lookup error", re); - return Collections.EMPTY_MAP; + return Collections.emptyMap(); } finally { deleteInvalid(); } diff --git a/core/java/src/net/i2p/client/naming/DummyNamingService.java b/core/java/src/net/i2p/client/naming/DummyNamingService.java index 62695d9ed15fe2964e07a9f96239eba65a04b756..e3279ab96392c42b3a0f22e89c13eb58519bd47d 100644 --- a/core/java/src/net/i2p/client/naming/DummyNamingService.java +++ b/core/java/src/net/i2p/client/naming/DummyNamingService.java @@ -31,7 +31,7 @@ class DummyNamingService extends NamingService { * Classes should take care to call removeCache() for any entries that * are invalidated. */ - private static final Map<String, Destination> _cache = new LHMCache(CACHE_MAX_SIZE); + private static final Map<String, Destination> _cache = new LHMCache<String, Destination>(CACHE_MAX_SIZE); /** * The naming service should only be constructed and accessed through the diff --git a/core/java/src/net/i2p/client/naming/EepGetNamingService.java b/core/java/src/net/i2p/client/naming/EepGetNamingService.java index 2bb4c18305fd688e9a4d4acd70338852a2f15c59..69af4e5ca1482801eb5adb20dfc2a36e293fb3c7 100644 --- a/core/java/src/net/i2p/client/naming/EepGetNamingService.java +++ b/core/java/src/net/i2p/client/naming/EepGetNamingService.java @@ -50,10 +50,10 @@ public class EepGetNamingService extends DummyNamingService { super(context); } - private List getURLs() { + private List<String> getURLs() { String list = _context.getProperty(PROP_EEPGET_LIST, DEFAULT_EEPGET_LIST); StringTokenizer tok = new StringTokenizer(list, ","); - List rv = new ArrayList(tok.countTokens()); + List<String> rv = new ArrayList<String>(tok.countTokens()); while (tok.hasMoreTokens()) rv.add(tok.nextToken()); return rv; @@ -70,13 +70,13 @@ public class EepGetNamingService extends DummyNamingService { if (hostname.length() == BASE32_HASH_LENGTH + 8 && hostname.endsWith(".b32.i2p")) return null; - List URLs = getURLs(); + List<String> URLs = getURLs(); if (URLs.isEmpty()) return null; // prevent lookup loops - this cannot be the only lookup service for (int i = 0; i < URLs.size(); i++) { - String url = (String)URLs.get(i); + String url = URLs.get(i); if (url.startsWith("http://" + hostname + "/")) { _log.error("Lookup loop: " + hostname); return null; diff --git a/core/java/src/net/i2p/client/naming/HostsTxtNamingService.java b/core/java/src/net/i2p/client/naming/HostsTxtNamingService.java index baa371e7664ef242e6614b8da5c721e5662e8106..7887e4acaeabfadc0019755be7a27bcd1337c0e7 100644 --- a/core/java/src/net/i2p/client/naming/HostsTxtNamingService.java +++ b/core/java/src/net/i2p/client/naming/HostsTxtNamingService.java @@ -52,7 +52,7 @@ public class HostsTxtNamingService extends MetaNamingService { private List<String> getFilenames() { String list = _context.getProperty(PROP_HOSTS_FILE, DEFAULT_HOSTS_FILE); StringTokenizer tok = new StringTokenizer(list, ","); - List<String> rv = new ArrayList(tok.countTokens()); + List<String> rv = new ArrayList<String>(tok.countTokens()); while (tok.hasMoreTokens()) rv.add(tok.nextToken()); return rv; @@ -97,6 +97,6 @@ public class HostsTxtNamingService extends MetaNamingService { if (name.equals(file) || name.endsWith('/' + file) || name.endsWith('\\' + file)) return ns.getNames(options); } - return new HashSet(0); + return new HashSet<String>(0); } } diff --git a/core/java/src/net/i2p/client/naming/MetaNamingService.java b/core/java/src/net/i2p/client/naming/MetaNamingService.java index 86e7775b586f6733fe84a33fbe29127e67081927..03e0ef7f9bc959e593de9ab2bd13562c108c1be4 100644 --- a/core/java/src/net/i2p/client/naming/MetaNamingService.java +++ b/core/java/src/net/i2p/client/naming/MetaNamingService.java @@ -35,7 +35,7 @@ public class MetaNamingService extends DummyNamingService { super(context); String list = _context.getProperty(PROP_NAME_SERVICES, DEFAULT_NAME_SERVICES); StringTokenizer tok = new StringTokenizer(list, ","); - _services = new CopyOnWriteArrayList(); + _services = new CopyOnWriteArrayList<NamingService>(); while (tok.hasMoreTokens()) { try { Class cls = Class.forName(tok.nextToken()); @@ -53,7 +53,7 @@ public class MetaNamingService extends DummyNamingService { */ public MetaNamingService(I2PAppContext context, List<NamingService> services) { super(context); - _services = new CopyOnWriteArrayList(); + _services = new CopyOnWriteArrayList<NamingService>(); if (services != null) { for (NamingService ns : services) { addNamingService(ns, false); @@ -172,7 +172,7 @@ public class MetaNamingService extends DummyNamingService { */ @Override public Map<String, Destination> getEntries(Properties options) { - Map<String, Destination> rv = new HashMap(); + Map<String, Destination> rv = new HashMap<String, Destination>(); for (NamingService ns : _services) { rv.putAll(ns.getEntries(options)); } @@ -184,7 +184,7 @@ public class MetaNamingService extends DummyNamingService { */ @Override public Set<String> getNames(Properties options) { - Set<String> rv = new HashSet(); + Set<String> rv = new HashSet<String>(); for (NamingService ns : _services) { rv.addAll(ns.getNames(options)); } diff --git a/core/java/src/net/i2p/client/naming/NamingService.java b/core/java/src/net/i2p/client/naming/NamingService.java index d5c4200e2f981ddd5dab58d09f4ab7b777d25db6..ceade7e317cebf6a9112edb0e3e3ff23baa3440f 100644 --- a/core/java/src/net/i2p/client/naming/NamingService.java +++ b/core/java/src/net/i2p/client/naming/NamingService.java @@ -45,8 +45,8 @@ public abstract class NamingService { protected NamingService(I2PAppContext context) { _context = context; _log = context.logManager().getLog(getClass()); - _listeners = new CopyOnWriteArraySet(); - _updaters = new CopyOnWriteArraySet(); + _listeners = new CopyOnWriteArraySet<NamingServiceListener>(); + _updaters = new CopyOnWriteArraySet<NamingServiceUpdater>(); } /** @@ -226,7 +226,7 @@ public abstract class NamingService { * @since 0.8.7 */ public Map<String, Destination> getEntries(Properties options) { - return Collections.EMPTY_MAP; + return Collections.emptyMap(); } /** @@ -242,7 +242,7 @@ public abstract class NamingService { * @since 0.8.7 */ public Map<String, String> getBase64Entries(Properties options) { - return Collections.EMPTY_MAP; + return Collections.emptyMap(); } /** @@ -263,7 +263,7 @@ public abstract class NamingService { * @since 0.8.7 */ public Set<String> getNames(Properties options) { - return Collections.EMPTY_SET; + return Collections.emptySet(); } /** diff --git a/core/java/src/net/i2p/client/naming/SingleFileNamingService.java b/core/java/src/net/i2p/client/naming/SingleFileNamingService.java index 8a8acdaec98c248bfba186206017baf3195e2153..58a2d1a95c8d3cc86c175e27d29477367a6c7e3c 100644 --- a/core/java/src/net/i2p/client/naming/SingleFileNamingService.java +++ b/core/java/src/net/i2p/client/naming/SingleFileNamingService.java @@ -308,7 +308,7 @@ public class SingleFileNamingService extends NamingService { @Override public Map<String, Destination> getEntries(Properties options) { if (!_file.exists()) - return Collections.EMPTY_MAP; + return Collections.emptyMap(); String searchOpt = null; String startsWith = null; if (options != null) { @@ -322,7 +322,7 @@ public class SingleFileNamingService extends NamingService { try { in = new BufferedReader(new InputStreamReader(new FileInputStream(_file), "UTF-8"), 16*1024); String line = null; - Map<String, Destination> rv = new HashMap(); + Map<String, Destination> rv = new HashMap<String, Destination>(); while ( (line = in.readLine()) != null) { if (line.length() <= 0) continue; @@ -357,7 +357,7 @@ public class SingleFileNamingService extends NamingService { return rv; } catch (IOException ioe) { _log.error("getEntries error", ioe); - return Collections.EMPTY_MAP; + return Collections.emptyMap(); } finally { if (in != null) try { in.close(); } catch (IOException ioe) {} releaseReadLock(); @@ -370,13 +370,13 @@ public class SingleFileNamingService extends NamingService { */ public Set<String> getNames(Properties options) { if (!_file.exists()) - return Collections.EMPTY_SET; + return Collections.emptySet(); BufferedReader in = null; getReadLock(); try { in = new BufferedReader(new InputStreamReader(new FileInputStream(_file), "UTF-8"), 16*1024); String line = null; - Set<String> rv = new HashSet(); + Set<String> rv = new HashSet<String>(); while ( (line = in.readLine()) != null) { if (line.length() <= 0) continue; @@ -391,7 +391,7 @@ public class SingleFileNamingService extends NamingService { return rv; } catch (IOException ioe) { _log.error("getNames error", ioe); - return Collections.EMPTY_SET; + return Collections.emptySet(); } finally { if (in != null) try { in.close(); } catch (IOException ioe) {} releaseReadLock(); diff --git a/core/java/src/net/i2p/crypto/CertUtil.java b/core/java/src/net/i2p/crypto/CertUtil.java index 27ca116f58394de5d8476fac9114f0ed963ccd8d..55d04a0864ebb4cfc9194608da5b2f37894c8291 100644 --- a/core/java/src/net/i2p/crypto/CertUtil.java +++ b/core/java/src/net/i2p/crypto/CertUtil.java @@ -4,11 +4,8 @@ import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.io.PrintWriter; -import java.security.GeneralSecurityException; import java.security.cert.Certificate; -import java.security.cert.CertificateException; import java.security.cert.CertificateEncodingException; -import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.util.Locale; diff --git a/core/java/src/net/i2p/crypto/CryptixAESEngine.java b/core/java/src/net/i2p/crypto/CryptixAESEngine.java index 18902adea1407f02ae8f525fe808830c20ed86df..35a2d37e61ed5d3137e96a4f364d7e70310b631b 100644 --- a/core/java/src/net/i2p/crypto/CryptixAESEngine.java +++ b/core/java/src/net/i2p/crypto/CryptixAESEngine.java @@ -18,7 +18,6 @@ import java.security.InvalidKeyException; //import javax.crypto.spec.SecretKeySpec; import net.i2p.I2PAppContext; -import net.i2p.data.ByteArray; import net.i2p.data.DataHelper; import net.i2p.data.SessionKey; import net.i2p.util.Log; diff --git a/core/java/src/net/i2p/crypto/CryptixAESKeyCache.java b/core/java/src/net/i2p/crypto/CryptixAESKeyCache.java index 63b6dcfbaed0789dd137d897d54b0005af2f15b5..ae9d8970906804b11d60a0267687e6531c945b0d 100644 --- a/core/java/src/net/i2p/crypto/CryptixAESKeyCache.java +++ b/core/java/src/net/i2p/crypto/CryptixAESKeyCache.java @@ -26,7 +26,7 @@ public final class CryptixAESKeyCache { * @deprecated unused, keys are now cached in the SessionKey objects */ public CryptixAESKeyCache() { - _availableKeys = new LinkedBlockingQueue(MAX_KEYS); + _availableKeys = new LinkedBlockingQueue<KeyCacheEntry>(MAX_KEYS); } /** diff --git a/core/java/src/net/i2p/crypto/DSAEngine.java b/core/java/src/net/i2p/crypto/DSAEngine.java index 1a5638ce9ef8368117f9ebf7726397a4e22a688a..dce8843e624b80004ccc8dde4123dc9ae3db1135 100644 --- a/core/java/src/net/i2p/crypto/DSAEngine.java +++ b/core/java/src/net/i2p/crypto/DSAEngine.java @@ -29,13 +29,11 @@ package net.i2p.crypto; * POSSIBILITY OF SUCH DAMAGE. */ -import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.math.BigInteger; import java.security.GeneralSecurityException; import java.security.Key; -import java.security.KeyFactory; import java.security.MessageDigest; import java.security.PrivateKey; import java.security.PublicKey; diff --git a/core/java/src/net/i2p/crypto/ECConstants.java b/core/java/src/net/i2p/crypto/ECConstants.java index 925291cdc5b50479a1d690450fa36fef16b4eb9b..2e9de224d8d612195d8c80e61d0e1ad758e64246 100644 --- a/core/java/src/net/i2p/crypto/ECConstants.java +++ b/core/java/src/net/i2p/crypto/ECConstants.java @@ -3,11 +3,8 @@ package net.i2p.crypto; import java.lang.reflect.Constructor; import java.math.BigInteger; import java.security.AlgorithmParameters; -import java.security.AlgorithmParameterGenerator; -import java.security.GeneralSecurityException; import java.security.Provider; import java.security.Security; -import java.security.spec.AlgorithmParameterSpec; import java.security.spec.ECField; import java.security.spec.ECFieldFp; import java.security.spec.ECGenParameterSpec; diff --git a/core/java/src/net/i2p/crypto/ElGamalAESEngine.java b/core/java/src/net/i2p/crypto/ElGamalAESEngine.java index c5fe757781e5483346b820281a346ab3a72f2f26..849fd1600660a152a01dfff9f33a3002a4152ffa 100644 --- a/core/java/src/net/i2p/crypto/ElGamalAESEngine.java +++ b/core/java/src/net/i2p/crypto/ElGamalAESEngine.java @@ -17,7 +17,6 @@ import java.util.List; import java.util.Set; import net.i2p.I2PAppContext; -import net.i2p.data.Base64; import net.i2p.data.DataFormatException; import net.i2p.data.DataHelper; import net.i2p.data.Hash; @@ -100,7 +99,7 @@ public class ElGamalAESEngine { SessionKey key = keyManager.consumeTag(st); SessionKey foundKey = new SessionKey(); SessionKey usedKey = new SessionKey(); - Set foundTags = new HashSet(); + Set<SessionTag> foundTags = new HashSet<SessionTag>(); byte decrypted[] = null; boolean wasExisting = false; if (key != null) { @@ -170,7 +169,7 @@ public class ElGamalAESEngine { * * @return null if decryption fails */ - private byte[] decryptNewSession(byte data[], PrivateKey targetPrivateKey, Set foundTags, SessionKey usedKey, + private byte[] decryptNewSession(byte data[], PrivateKey targetPrivateKey, Set<SessionTag> foundTags, SessionKey usedKey, SessionKey foundKey) throws DataFormatException { if (data == null) { //if (_log.shouldLog(Log.WARN)) _log.warn("Data is null, unable to decrypt new session"); @@ -246,7 +245,7 @@ public class ElGamalAESEngine { * @return decrypted data or null on failure * */ - private byte[] decryptExistingSession(byte data[], SessionKey key, PrivateKey targetPrivateKey, Set foundTags, + private byte[] decryptExistingSession(byte data[], SessionKey key, PrivateKey targetPrivateKey, Set<SessionTag> foundTags, SessionKey usedKey, SessionKey foundKey) throws DataFormatException { byte preIV[] = SimpleByteCache.acquire(32); System.arraycopy(data, 0, preIV, 0, 32); @@ -315,7 +314,7 @@ public class ElGamalAESEngine { * Note: package private for ElGamalTest.testAES() */ byte[] decryptAESBlock(byte encrypted[], int offset, int encryptedLen, SessionKey key, byte iv[], - byte sentTag[], Set foundTags, SessionKey foundKey) throws DataFormatException { + byte sentTag[], Set<SessionTag> foundTags, SessionKey foundKey) throws DataFormatException { //_log.debug("iv for decryption: " + DataHelper.toString(iv, 16)); //_log.debug("decrypting AES block. encr.length = " + (encrypted == null? -1 : encrypted.length) + " sentTag: " + DataHelper.toString(sentTag, 32)); byte decrypted[] = new byte[encryptedLen]; @@ -324,13 +323,13 @@ public class ElGamalAESEngine { //_log.debug("Hash of entire aes block after decryption: \n" + DataHelper.toString(h.getData(), 32)); try { SessionKey newKey = null; - List tags = null; + List<SessionTag> tags = null; //ByteArrayInputStream bais = new ByteArrayInputStream(decrypted); int cur = 0; long numTags = DataHelper.fromLong(decrypted, cur, 2); if ((numTags < 0) || (numTags > MAX_TAGS_RECEIVED)) throw new Exception("Invalid number of session tags"); - if (numTags > 0) tags = new ArrayList((int)numTags); + if (numTags > 0) tags = new ArrayList<SessionTag>((int)numTags); cur += 2; //_log.debug("# tags: " + numTags); if (numTags * SessionTag.BYTE_LENGTH > decrypted.length - 2) { @@ -404,7 +403,7 @@ public class ElGamalAESEngine { * * Unused externally, only called by below (i.e. newKey is always null) */ - public byte[] encrypt(byte data[], PublicKey target, SessionKey key, Set tagsForDelivery, + public byte[] encrypt(byte data[], PublicKey target, SessionKey key, Set<SessionTag> tagsForDelivery, SessionTag currentTag, SessionKey newKey, long paddedSize) { if (currentTag == null) { if (_log.shouldLog(Log.INFO)) @@ -450,7 +449,7 @@ public class ElGamalAESEngine { * body's real size, no bytes are appended but the body is not truncated) * */ - public byte[] encrypt(byte data[], PublicKey target, SessionKey key, Set tagsForDelivery, + public byte[] encrypt(byte data[], PublicKey target, SessionKey key, Set<SessionTag> tagsForDelivery, SessionTag currentTag, long paddedSize) { return encrypt(data, target, key, tagsForDelivery, currentTag, null, paddedSize); } @@ -464,7 +463,7 @@ public class ElGamalAESEngine { * 200 max enforced at receiver * @deprecated unused */ - public byte[] encrypt(byte data[], PublicKey target, SessionKey key, Set tagsForDelivery, long paddedSize) { + public byte[] encrypt(byte data[], PublicKey target, SessionKey key, Set<SessionTag> tagsForDelivery, long paddedSize) { return encrypt(data, target, key, tagsForDelivery, null, null, paddedSize); } @@ -502,7 +501,7 @@ public class ElGamalAESEngine { * @param tagsForDelivery session tags to be associated with the key or null; * 200 max enforced at receiver */ - private byte[] encryptNewSession(byte data[], PublicKey target, SessionKey key, Set tagsForDelivery, + private byte[] encryptNewSession(byte data[], PublicKey target, SessionKey key, Set<SessionTag> tagsForDelivery, SessionKey newKey, long paddedSize) { //_log.debug("Encrypting to a NEW session"); byte elgSrcData[] = new byte[SessionKey.KEYSIZE_BYTES+32+158]; @@ -571,7 +570,7 @@ public class ElGamalAESEngine { * @param tagsForDelivery session tags to be associated with the key or null; * 200 max enforced at receiver */ - private byte[] encryptExistingSession(byte data[], PublicKey target, SessionKey key, Set tagsForDelivery, + private byte[] encryptExistingSession(byte data[], PublicKey target, SessionKey key, Set<SessionTag> tagsForDelivery, SessionTag currentTag, SessionKey newKey, long paddedSize) { //_log.debug("Encrypting to an EXISTING session"); byte rawTag[] = currentTag.getData(); @@ -629,7 +628,7 @@ public class ElGamalAESEngine { * @param tagsForDelivery session tags to be associated with the key or null; * 200 max enforced at receiver */ - final byte[] encryptAESBlock(byte data[], SessionKey key, byte[] iv, Set tagsForDelivery, SessionKey newKey, + final byte[] encryptAESBlock(byte data[], SessionKey key, byte[] iv, Set<SessionTag> tagsForDelivery, SessionKey newKey, long paddedSize) { return encryptAESBlock(data, key, iv, tagsForDelivery, newKey, paddedSize, 0); } @@ -639,11 +638,11 @@ public class ElGamalAESEngine { * @param tagsForDelivery session tags to be associated with the key or null; * 200 max enforced at receiver */ - private final byte[] encryptAESBlock(byte data[], SessionKey key, byte[] iv, Set tagsForDelivery, SessionKey newKey, + private final byte[] encryptAESBlock(byte data[], SessionKey key, byte[] iv, Set<SessionTag> tagsForDelivery, SessionKey newKey, long paddedSize, int prefixBytes) { //_log.debug("iv for encryption: " + DataHelper.toString(iv, 16)); //_log.debug("Encrypting AES"); - if (tagsForDelivery == null) tagsForDelivery = Collections.EMPTY_SET; + if (tagsForDelivery == null) tagsForDelivery = Collections.emptySet(); int size = 2 // sizeof(tags) + SessionTag.BYTE_LENGTH*tagsForDelivery.size() + 4 // payload length @@ -657,8 +656,8 @@ public class ElGamalAESEngine { int cur = prefixBytes; DataHelper.toLong(aesData, cur, 2, tagsForDelivery.size()); cur += 2; - for (Iterator iter = tagsForDelivery.iterator(); iter.hasNext();) { - SessionTag tag = (SessionTag) iter.next(); + for (Iterator<SessionTag> iter = tagsForDelivery.iterator(); iter.hasNext();) { + SessionTag tag = iter.next(); System.arraycopy(tag.getData(), 0, aesData, cur, SessionTag.BYTE_LENGTH); cur += SessionTag.BYTE_LENGTH; } diff --git a/core/java/src/net/i2p/crypto/HMACGenerator.java b/core/java/src/net/i2p/crypto/HMACGenerator.java index b6f13b1e3da7b8b58ed20c2cfdc484f1b109eecd..f5643ca1b9b401c46238dee79c044eea37c288cf 100644 --- a/core/java/src/net/i2p/crypto/HMACGenerator.java +++ b/core/java/src/net/i2p/crypto/HMACGenerator.java @@ -49,7 +49,7 @@ public class HMACGenerator { * @param context unused */ public HMACGenerator(I2PAppContext context) { - _available = new LinkedBlockingQueue(32); + _available = new LinkedBlockingQueue<I2PHMac>(32); } /** diff --git a/core/java/src/net/i2p/crypto/KeyStoreUtil.java b/core/java/src/net/i2p/crypto/KeyStoreUtil.java index 665f9c907c5ccd31aab03dea2bd1e4cd9bad3b06..81179ae8f46195c9bd3ab9dcebca1b3cc6275bac 100644 --- a/core/java/src/net/i2p/crypto/KeyStoreUtil.java +++ b/core/java/src/net/i2p/crypto/KeyStoreUtil.java @@ -9,8 +9,6 @@ import java.security.GeneralSecurityException; import java.security.KeyStore; import java.security.PrivateKey; import java.security.cert.Certificate; -import java.security.cert.CertificateException; -import java.security.cert.CertificateEncodingException; import java.security.cert.CertificateExpiredException; import java.security.cert.CertificateNotYetValidException; import java.security.cert.CertificateFactory; @@ -20,7 +18,6 @@ import java.util.Locale; import net.i2p.I2PAppContext; import net.i2p.data.Base32; -import net.i2p.data.DataHelper; import net.i2p.util.Log; import net.i2p.util.SecureDirectory; import net.i2p.util.SecureFileOutputStream; diff --git a/core/java/src/net/i2p/crypto/SHA256Generator.java b/core/java/src/net/i2p/crypto/SHA256Generator.java index d46488fe91559282b864567c5298d64eb2847d03..162b9d0c16c6645cce76e6f869d80662383c3031 100644 --- a/core/java/src/net/i2p/crypto/SHA256Generator.java +++ b/core/java/src/net/i2p/crypto/SHA256Generator.java @@ -35,7 +35,7 @@ public final class SHA256Generator { * @param context unused */ public SHA256Generator(I2PAppContext context) { - _digests = new LinkedBlockingQueue(32); + _digests = new LinkedBlockingQueue<MessageDigest>(32); } public static final SHA256Generator getInstance() { diff --git a/core/java/src/net/i2p/crypto/SU3File.java b/core/java/src/net/i2p/crypto/SU3File.java index c68192d7fa2aca90da6013c2167e7fa13213e3a3..dd23ad05abf9418f8888bf7711e851b61ca2e856 100644 --- a/core/java/src/net/i2p/crypto/SU3File.java +++ b/core/java/src/net/i2p/crypto/SU3File.java @@ -30,11 +30,7 @@ import net.i2p.I2PAppContext; import net.i2p.data.DataFormatException; import net.i2p.data.DataHelper; import net.i2p.data.Signature; -import net.i2p.data.SigningPrivateKey; -import net.i2p.data.SigningPublicKey; import net.i2p.data.SimpleDataStructure; -import net.i2p.util.HexDump; -import net.i2p.util.SecureFileOutputStream; /** * Succesor to the ".sud" format used in TrustedUpdate. @@ -441,7 +437,7 @@ public class SU3File { */ public static void main(String[] args) { boolean ok = false; - List<String> a = new ArrayList(Arrays.asList(args)); + List<String> a = new ArrayList<String>(Arrays.asList(args)); try { // defaults String stype = null; diff --git a/core/java/src/net/i2p/crypto/SigUtil.java b/core/java/src/net/i2p/crypto/SigUtil.java index da2fa363e521892ac46f215f894b1d2e3bfaeff0..52ca857e6236024c558b57f7002ae816c929ac5b 100644 --- a/core/java/src/net/i2p/crypto/SigUtil.java +++ b/core/java/src/net/i2p/crypto/SigUtil.java @@ -21,14 +21,10 @@ import java.security.interfaces.RSAPrivateKey; import java.security.interfaces.RSAPublicKey; import java.security.spec.DSAPrivateKeySpec; import java.security.spec.DSAPublicKeySpec; -import java.security.spec.ECField; -import java.security.spec.ECFieldFp; -import java.security.spec.ECGenParameterSpec; import java.security.spec.ECParameterSpec; import java.security.spec.ECPrivateKeySpec; import java.security.spec.ECPublicKeySpec; import java.security.spec.ECPoint; -import java.security.spec.EllipticCurve; import java.security.spec.KeySpec; import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.RSAKeyGenParameterSpec; @@ -51,8 +47,8 @@ import net.i2p.util.NativeBigInteger; */ class SigUtil { - private static final Map<SigningPublicKey, ECPublicKey> _pubkeyCache = new LHMCache(64); - private static final Map<SigningPrivateKey, ECPrivateKey> _privkeyCache = new LHMCache(16); + private static final Map<SigningPublicKey, ECPublicKey> _pubkeyCache = new LHMCache<SigningPublicKey, ECPublicKey>(64); + private static final Map<SigningPrivateKey, ECPrivateKey> _privkeyCache = new LHMCache<SigningPrivateKey, ECPrivateKey>(16); private SigUtil() {} diff --git a/core/java/src/net/i2p/crypto/TransientSessionKeyManager.java b/core/java/src/net/i2p/crypto/TransientSessionKeyManager.java index dbe17366a473005c790b7cfdc01eec29b1812cb9..8ebfdbf9030d98f902662004860778baab421eaf 100644 --- a/core/java/src/net/i2p/crypto/TransientSessionKeyManager.java +++ b/core/java/src/net/i2p/crypto/TransientSessionKeyManager.java @@ -19,7 +19,6 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.NoSuchElementException; import java.util.Set; import java.util.TreeSet; import java.util.concurrent.atomic.AtomicInteger; @@ -30,7 +29,6 @@ import net.i2p.data.PublicKey; import net.i2p.data.SessionKey; import net.i2p.data.SessionTag; import net.i2p.util.Log; -import net.i2p.util.SimpleScheduler; import net.i2p.util.SimpleTimer; /** @@ -177,8 +175,8 @@ public class TransientSessionKeyManager extends SessionKeyManager { _lowThreshold = lowThreshold; _log = context.logManager().getLog(TransientSessionKeyManager.class); _context = context; - _outboundSessions = new HashMap(64); - _inboundTagSets = new HashMap(128); + _outboundSessions = new HashMap<PublicKey, OutboundSession>(64); + _inboundTagSets = new HashMap<SessionTag, TagSet>(128); context.statManager().createRateStat("crypto.sessionTagsExpired", "How many tags/sessions are expired?", "Encryption", new long[] { 10*60*1000, 60*60*1000, 3*60*60*1000 }); context.statManager().createRateStat("crypto.sessionTagsRemaining", "How many tags/sessions are remaining after a cleanup?", "Encryption", new long[] { 10*60*1000, 60*60*1000, 3*60*60*1000 }); _alive = true; @@ -212,14 +210,14 @@ public class TransientSessionKeyManager extends SessionKeyManager { /** TagSet - used only by HTML */ private Set<TagSet> getInboundTagSets() { synchronized (_inboundTagSets) { - return new HashSet(_inboundTagSets.values()); + return new HashSet<TagSet>(_inboundTagSets.values()); } } /** OutboundSession - used only by HTML */ private Set<OutboundSession> getOutboundSessions() { synchronized (_outboundSessions) { - return new HashSet(_outboundSessions.values()); + return new HashSet<OutboundSession>(_outboundSessions.values()); } } @@ -586,7 +584,7 @@ public class TransientSessionKeyManager extends SessionKeyManager { int tags = 0; int toRemove = overage * 2; _log.log(Log.CRIT, "TOO MANY SESSION TAGS! Starting cleanup, overage = " + overage); - List<TagSet> removed = new ArrayList(toRemove); + List<TagSet> removed = new ArrayList<TagSet>(toRemove); synchronized (_inboundTagSets) { for (TagSet set : _inboundTagSets.values()) { int size = set.getTags().size(); @@ -717,12 +715,12 @@ public class TransientSessionKeyManager extends SessionKeyManager { buf.append("<h2>Inbound sessions</h2>" + "<table>"); Set<TagSet> inbound = getInboundTagSets(); - Map<SessionKey, Set<TagSet>> inboundSets = new HashMap(inbound.size()); + Map<SessionKey, Set<TagSet>> inboundSets = new HashMap<SessionKey, Set<TagSet>>(inbound.size()); // Build a map of the inbound tag sets, grouped by SessionKey for (TagSet ts : inbound) { Set<TagSet> sets = inboundSets.get(ts.getAssociatedKey()); if (sets == null) { - sets = new HashSet(); + sets = new HashSet<TagSet>(); inboundSets.put(ts.getAssociatedKey(), sets); } sets.add(ts); @@ -731,7 +729,7 @@ public class TransientSessionKeyManager extends SessionKeyManager { long now = _context.clock().now(); for (Map.Entry<SessionKey, Set<TagSet>> e : inboundSets.entrySet()) { SessionKey skey = e.getKey(); - Set<TagSet> sets = new TreeSet(new TagSetComparator()); + Set<TagSet> sets = new TreeSet<TagSet>(new TagSetComparator()); sets.addAll(e.getValue()); buf.append("<tr><td><b>Session key</b>: ").append(skey.toBase64()).append("</td>" + "<td><b># Sets:</b> ").append(sets.size()).append("</td></tr>" + @@ -761,7 +759,7 @@ public class TransientSessionKeyManager extends SessionKeyManager { Set<OutboundSession> outbound = getOutboundSessions(); for (Iterator<OutboundSession> iter = outbound.iterator(); iter.hasNext();) { OutboundSession sess = iter.next(); - Set<TagSet> sets = new TreeSet(new TagSetComparator()); + Set<TagSet> sets = new TreeSet<TagSet>(new TagSetComparator()); sets.addAll(sess.getTagSets()); buf.append("<tr><td><b>Target public key:</b> ").append(toString(sess.getTarget())).append("<br>" + "<b>Established:</b> ").append(DataHelper.formatDuration2(now - sess.getEstablishedDate())).append(" ago<br>" + @@ -850,7 +848,7 @@ public class TransientSessionKeyManager extends SessionKeyManager { private static final int MAX_FAILS = 2; public OutboundSession(I2PAppContext ctx, Log log, PublicKey target) { - this(ctx, log, target, null, ctx.clock().now(), ctx.clock().now(), new ArrayList()); + this(ctx, log, target, null, ctx.clock().now(), ctx.clock().now(), new ArrayList<TagSet>()); } OutboundSession(I2PAppContext ctx, Log log, PublicKey target, SessionKey curKey, @@ -862,7 +860,7 @@ public class TransientSessionKeyManager extends SessionKeyManager { _established = established; _lastUsed = lastUsed; _unackedTagSets = tagSets; - _tagSets = new ArrayList(); + _tagSets = new ArrayList<TagSet>(); } /** @@ -873,7 +871,7 @@ public class TransientSessionKeyManager extends SessionKeyManager { List<TagSet> getTagSets() { List<TagSet> rv; synchronized (_tagSets) { - rv = new ArrayList(_unackedTagSets); + rv = new ArrayList<TagSet>(_unackedTagSets); rv.addAll(_tagSets); } return rv; diff --git a/core/java/src/net/i2p/crypto/TrustedUpdate.java b/core/java/src/net/i2p/crypto/TrustedUpdate.java index ad9524c459962bc21823c76a500a877055dbb5f6..e248818360ff331e393c101693c2cdb519224e34 100644 --- a/core/java/src/net/i2p/crypto/TrustedUpdate.java +++ b/core/java/src/net/i2p/crypto/TrustedUpdate.java @@ -161,7 +161,7 @@ riCe6OlAEiNpcc6mMyIYYWFICbrDFTrDR3wXqwc/Jkcx6L5VVWoagpSzbo3yGhc= /** 172 */ private static final int KEYSIZE_B64_BYTES = 2 + (SigningPublicKey.KEYSIZE_BYTES * 4 / 3); - private static final Map<String, String> DEFAULT_KEYS = new HashMap(4); + private static final Map<String, String> DEFAULT_KEYS = new HashMap<String, String>(4); static { //DEFAULT_KEYS.put(DEFAULT_TRUSTED_KEY, "jrandom@mail.i2p"); DEFAULT_KEYS.put(DEFAULT_TRUSTED_KEY2, "zzz@mail.i2p"); @@ -187,7 +187,7 @@ riCe6OlAEiNpcc6mMyIYYWFICbrDFTrDR3wXqwc/Jkcx6L5VVWoagpSzbo3yGhc= public TrustedUpdate(I2PAppContext context) { _context = context; _log = _context.logManager().getLog(TrustedUpdate.class); - _trustedKeys = new HashMap(4); + _trustedKeys = new HashMap<SigningPublicKey, String>(4); String propertyTrustedKeys = context.getProperty(PROP_TRUSTED_KEYS); diff --git a/core/java/src/net/i2p/crypto/YKGenerator.java b/core/java/src/net/i2p/crypto/YKGenerator.java index 2832f3c9261548f5c39edfdb333d46302305f51e..f78b780eef70460b7f1e1b631ec4ff08116fbce2 100644 --- a/core/java/src/net/i2p/crypto/YKGenerator.java +++ b/core/java/src/net/i2p/crypto/YKGenerator.java @@ -64,7 +64,7 @@ class YKGenerator { MAX_NUM_BUILDERS = ctx.getProperty(PROP_YK_PRECALC_MAX, defaultMax); CALC_DELAY = ctx.getProperty(PROP_YK_PRECALC_DELAY, DEFAULT_YK_PRECALC_DELAY); - _values = new LinkedBlockingQueue(MAX_NUM_BUILDERS); + _values = new LinkedBlockingQueue<BigInteger[]>(MAX_NUM_BUILDERS); //if (_log.shouldLog(Log.DEBUG)) // _log.debug("ElGamal YK Precalc (minimum: " + MIN_NUM_BUILDERS + " max: " + MAX_NUM_BUILDERS + ", delay: " diff --git a/core/java/src/net/i2p/data/DataHelper.java b/core/java/src/net/i2p/data/DataHelper.java index 36b36a068e0427c661ac5b75f3ed63bc7b5ad796..83fe675ffff9799514f992cc3140ef869e7a931d 100644 --- a/core/java/src/net/i2p/data/DataHelper.java +++ b/core/java/src/net/i2p/data/DataHelper.java @@ -92,7 +92,7 @@ public class DataHelper { "version", "created", "upgraded", "lists", "a", "s", }; - _propertiesKeyCache = new HashMap(keys.length); + _propertiesKeyCache = new HashMap<String, String>(keys.length); for (int i = 0; i < keys.length; i++) { _propertiesKeyCache.put(keys[i], keys[i]); } @@ -1394,7 +1394,7 @@ public class DataHelper { * @return a new list */ public static List<? extends DataStructure> sortStructures(Collection<? extends DataStructure> dataStructures) { - if (dataStructures == null) return Collections.EMPTY_LIST; + if (dataStructures == null) return Collections.emptyList(); // This used to use Hash.toString(), which is insane, since a change to toString() // would break the whole network. Now use Hash.toBase64(). @@ -1409,7 +1409,7 @@ public class DataHelper { //for (DataStructure struct : tm.values()) { // rv.add(struct); //} - ArrayList<DataStructure> rv = new ArrayList(dataStructures); + ArrayList<DataStructure> rv = new ArrayList<DataStructure>(dataStructures); sortStructureList(rv); return rv; } diff --git a/core/java/src/net/i2p/data/Destination.java b/core/java/src/net/i2p/data/Destination.java index 1eab390bbb09925fa1bd73a153adcc2b2c91844a..ad21985e39f61a1c9fb11ceef4074290a10014a1 100644 --- a/core/java/src/net/i2p/data/Destination.java +++ b/core/java/src/net/i2p/data/Destination.java @@ -13,7 +13,6 @@ import java.io.InputStream; import java.io.IOException; import java.util.Map; -import net.i2p.I2PAppContext; import net.i2p.util.LHMCache; import net.i2p.util.SystemVersion; @@ -48,7 +47,7 @@ public class Destination extends KeysAndCert { // I2PAppContext.getGlobalContext().statManager().createRateStat("DestCache", "Hit rate", "Router", new long[] { 10*60*1000 }); } - private static final Map<SigningPublicKey, Destination> _cache = new LHMCache(CACHE_SIZE); + private static final Map<SigningPublicKey, Destination> _cache = new LHMCache<SigningPublicKey, Destination>(CACHE_SIZE); /** * Pull from cache or return new diff --git a/core/java/src/net/i2p/data/Hash.java b/core/java/src/net/i2p/data/Hash.java index add8235a6aa8a9456c4b67b62e06e724898109c2..627f02c396bb16b05763cb2787c79aeb210e9256 100644 --- a/core/java/src/net/i2p/data/Hash.java +++ b/core/java/src/net/i2p/data/Hash.java @@ -26,7 +26,7 @@ public class Hash extends SimpleDataStructure { public final static Hash FAKE_HASH = new Hash(new byte[HASH_LENGTH]); private static final int CACHE_SIZE = 2048; - private static final SDSCache<Hash> _cache = new SDSCache(Hash.class, HASH_LENGTH, CACHE_SIZE); + private static final SDSCache<Hash> _cache = new SDSCache<Hash>(Hash.class, HASH_LENGTH, CACHE_SIZE); /** * Pull from cache or return new diff --git a/core/java/src/net/i2p/data/LeaseSet.java b/core/java/src/net/i2p/data/LeaseSet.java index e497a1e08ec09373d0fd60bc86dc939396de8359..45c6978aed395e608be7c5e4e1c8ae4c19427ff0 100644 --- a/core/java/src/net/i2p/data/LeaseSet.java +++ b/core/java/src/net/i2p/data/LeaseSet.java @@ -93,7 +93,7 @@ public class LeaseSet extends DatabaseEntry { private static final int OLD_MAX_LEASES = 6; public LeaseSet() { - _leases = new ArrayList(OLD_MAX_LEASES); + _leases = new ArrayList<Lease>(OLD_MAX_LEASES); _firstExpiration = Long.MAX_VALUE; } @@ -290,8 +290,8 @@ public class LeaseSet extends DatabaseEntry { _signingKey.writeBytes(out); DataHelper.writeLong(out, 1, _leases.size()); //DataHelper.writeLong(out, 4, _version); - for (Iterator iter = _leases.iterator(); iter.hasNext();) { - Lease lease = (Lease) iter.next(); + for (Iterator<Lease> iter = _leases.iterator(); iter.hasNext();) { + Lease lease = iter.next(); lease.writeBytes(out); } } catch (IOException ioe) { @@ -339,8 +339,8 @@ public class LeaseSet extends DatabaseEntry { _signingKey.writeBytes(out); DataHelper.writeLong(out, 1, _leases.size()); //DataHelper.writeLong(out, 4, _version); - for (Iterator iter = _leases.iterator(); iter.hasNext();) { - Lease lease = (Lease) iter.next(); + for (Iterator<Lease> iter = _leases.iterator(); iter.hasNext();) { + Lease lease = iter.next(); lease.writeBytes(out); } _signature.writeBytes(out); @@ -494,7 +494,7 @@ public class LeaseSet extends DatabaseEntry { byte[] dec = new byte[enclen]; I2PAppContext.getGlobalContext().aes().decrypt(enc, 0, dec, 0, key, iv, enclen); ByteArrayInputStream bais = new ByteArrayInputStream(dec); - _decryptedLeases = new ArrayList(size - 1); + _decryptedLeases = new ArrayList<Lease>(size - 1); for (int i = 0; i < size-1; i++) { Lease l = new Lease(); Hash h = new Hash(); diff --git a/core/java/src/net/i2p/data/PublicKey.java b/core/java/src/net/i2p/data/PublicKey.java index 2a719ffc55c8833c8daff6be9fd515ee45be5603..ae5179ae42b33ea08638912524bbc34e1cd73eec 100644 --- a/core/java/src/net/i2p/data/PublicKey.java +++ b/core/java/src/net/i2p/data/PublicKey.java @@ -23,7 +23,7 @@ public class PublicKey extends SimpleDataStructure { public final static int KEYSIZE_BYTES = 256; private static final int CACHE_SIZE = 1024; - private static final SDSCache<PublicKey> _cache = new SDSCache(PublicKey.class, KEYSIZE_BYTES, CACHE_SIZE); + private static final SDSCache<PublicKey> _cache = new SDSCache<PublicKey>(PublicKey.class, KEYSIZE_BYTES, CACHE_SIZE); /** * Pull from cache or return new. diff --git a/core/java/src/net/i2p/data/RouterInfo.java b/core/java/src/net/i2p/data/RouterInfo.java index 4199d0ee93674b817b824b877a9871ce07313e3b..72b54b8a96ec8a5002e5c4f9f72b28e90ace6926 100644 --- a/core/java/src/net/i2p/data/RouterInfo.java +++ b/core/java/src/net/i2p/data/RouterInfo.java @@ -202,7 +202,7 @@ public class RouterInfo extends DatabaseEntry { */ public Set<Hash> getPeers() { if (_peers == null) - return Collections.EMPTY_SET; + return Collections.emptySet(); return _peers; } @@ -221,7 +221,7 @@ public class RouterInfo extends DatabaseEntry { return; } if (_peers == null) - _peers = new HashSet(2); + _peers = new HashSet<Hash>(2); synchronized (_peers) { _peers.clear(); _peers.addAll(peers); @@ -546,7 +546,7 @@ public class RouterInfo extends DatabaseEntry { if (numPeers == 0) { _peers = null; } else { - _peers = new HashSet(numPeers); + _peers = new HashSet<Hash>(numPeers); for (int i = 0; i < numPeers; i++) { Hash peerIdentityHash = new Hash(); peerIdentityHash.readBytes(din); diff --git a/core/java/src/net/i2p/data/SDSCache.java b/core/java/src/net/i2p/data/SDSCache.java index 464ca7f971032c4a9e6909a262e92872798dfb46..4bd0f212294a8ee1f67e66b5287731807fb5b060 100644 --- a/core/java/src/net/i2p/data/SDSCache.java +++ b/core/java/src/net/i2p/data/SDSCache.java @@ -70,7 +70,7 @@ public class SDSCache<V extends SimpleDataStructure> { */ public SDSCache(Class<V> rvClass, int len, int max) { int size = (int) (max * FACTOR); - _cache = new LHMCache(size); + _cache = new LHMCache<Integer, WeakReference<V>>(size); _datalen = len; try { _rvCon = rvClass.getConstructor(conArg); @@ -135,7 +135,7 @@ public class SDSCache<V extends SimpleDataStructure> { } catch (InvocationTargetException e) { throw new RuntimeException("SDSCache error", e); } - _cache.put(key, new WeakReference(rv)); + _cache.put(key, new WeakReference<V>(rv)); found = 0; } } diff --git a/core/java/src/net/i2p/data/SigningPublicKey.java b/core/java/src/net/i2p/data/SigningPublicKey.java index d1c1a4687f627e4c617e28e239ed0d023f71c983..e01d6ec39294a510371cf16a9bc8862a3600ee38 100644 --- a/core/java/src/net/i2p/data/SigningPublicKey.java +++ b/core/java/src/net/i2p/data/SigningPublicKey.java @@ -27,7 +27,7 @@ public class SigningPublicKey extends SimpleDataStructure { public final static int KEYSIZE_BYTES = DEF_TYPE.getPubkeyLen(); private static final int CACHE_SIZE = 1024; - private static final SDSCache<SigningPublicKey> _cache = new SDSCache(SigningPublicKey.class, KEYSIZE_BYTES, CACHE_SIZE); + private static final SDSCache<SigningPublicKey> _cache = new SDSCache<SigningPublicKey>(SigningPublicKey.class, KEYSIZE_BYTES, CACHE_SIZE); private final SigType _type; diff --git a/core/java/src/net/i2p/data/i2cp/CreateLeaseSetMessage.java b/core/java/src/net/i2p/data/i2cp/CreateLeaseSetMessage.java index cfed39f1802ce6aa5cc885adedefb268718302de..b57af1f8da89573253470f706dd65c3817238f0a 100644 --- a/core/java/src/net/i2p/data/i2cp/CreateLeaseSetMessage.java +++ b/core/java/src/net/i2p/data/i2cp/CreateLeaseSetMessage.java @@ -14,7 +14,6 @@ import java.io.IOException; import java.io.InputStream; import net.i2p.data.DataFormatException; -import net.i2p.data.DataHelper; import net.i2p.data.LeaseSet; import net.i2p.data.PrivateKey; import net.i2p.data.SigningPrivateKey; diff --git a/core/java/src/net/i2p/data/i2cp/CreateSessionMessage.java b/core/java/src/net/i2p/data/i2cp/CreateSessionMessage.java index e2efacee86371a7d125e0530c420d30e04cd133f..0df5f99fed9f100b9e3ee6e640a9cfeb4e47761a 100644 --- a/core/java/src/net/i2p/data/i2cp/CreateSessionMessage.java +++ b/core/java/src/net/i2p/data/i2cp/CreateSessionMessage.java @@ -14,7 +14,6 @@ import java.io.IOException; import java.io.InputStream; import net.i2p.data.DataFormatException; -import net.i2p.data.DataHelper; /** * Defines the message a client sends to a router when establishing a new diff --git a/core/java/src/net/i2p/data/i2cp/DestLookupMessage.java b/core/java/src/net/i2p/data/i2cp/DestLookupMessage.java index f6613bc6150e9787ad31241470417b9105360c80..2493898b78b3257e1ca8444c4861126ede77abf2 100644 --- a/core/java/src/net/i2p/data/i2cp/DestLookupMessage.java +++ b/core/java/src/net/i2p/data/i2cp/DestLookupMessage.java @@ -10,7 +10,6 @@ import java.io.IOException; import java.io.InputStream; import net.i2p.data.DataFormatException; -import net.i2p.data.DataHelper; import net.i2p.data.Hash; /** diff --git a/core/java/src/net/i2p/data/i2cp/DestReplyMessage.java b/core/java/src/net/i2p/data/i2cp/DestReplyMessage.java index ac5d43af61fdaf3976038426acbc4a3d04b44cac..d13cf658c911039a64b5b8b12bf89eca8b8bbdaa 100644 --- a/core/java/src/net/i2p/data/i2cp/DestReplyMessage.java +++ b/core/java/src/net/i2p/data/i2cp/DestReplyMessage.java @@ -11,7 +11,6 @@ import java.io.IOException; import java.io.InputStream; import net.i2p.data.DataFormatException; -import net.i2p.data.DataHelper; import net.i2p.data.Destination; import net.i2p.data.Hash; diff --git a/core/java/src/net/i2p/data/i2cp/DestroySessionMessage.java b/core/java/src/net/i2p/data/i2cp/DestroySessionMessage.java index 4a12eb2544769f4b3cb163891c370a8f639d8fe8..b67f5fa6f0fbfe14717d7b9d3c2ab94059bd250c 100644 --- a/core/java/src/net/i2p/data/i2cp/DestroySessionMessage.java +++ b/core/java/src/net/i2p/data/i2cp/DestroySessionMessage.java @@ -14,7 +14,6 @@ import java.io.IOException; import java.io.InputStream; import net.i2p.data.DataFormatException; -import net.i2p.data.DataHelper; /** * Defines the message a client sends to a router when destroying diff --git a/core/java/src/net/i2p/data/i2cp/ReconfigureSessionMessage.java b/core/java/src/net/i2p/data/i2cp/ReconfigureSessionMessage.java index dd6558f39dae99d15a078f29faee0f0cc5e32892..01130670ab0a04829b0a7d370c9c324c0bf52f8d 100644 --- a/core/java/src/net/i2p/data/i2cp/ReconfigureSessionMessage.java +++ b/core/java/src/net/i2p/data/i2cp/ReconfigureSessionMessage.java @@ -14,7 +14,6 @@ import java.io.IOException; import java.io.InputStream; import net.i2p.data.DataFormatException; -import net.i2p.data.DataHelper; /** * Defines the message a client sends to a router when diff --git a/core/java/src/net/i2p/data/i2cp/ReportAbuseMessage.java b/core/java/src/net/i2p/data/i2cp/ReportAbuseMessage.java index 60870621b719452855d8333445f6a28cae1f1629..76311ae6e5958a0111a74468b0c27ad1c7c7f002 100644 --- a/core/java/src/net/i2p/data/i2cp/ReportAbuseMessage.java +++ b/core/java/src/net/i2p/data/i2cp/ReportAbuseMessage.java @@ -14,7 +14,6 @@ import java.io.IOException; import java.io.InputStream; import net.i2p.data.DataFormatException; -import net.i2p.data.DataHelper; /** * Defines the message a client sends to a router when asking the diff --git a/core/java/src/net/i2p/data/i2cp/RequestLeaseSetMessage.java b/core/java/src/net/i2p/data/i2cp/RequestLeaseSetMessage.java index 2c177cc858aa8d149e49249ac945aaf91480d804..d9744662a5a1de26ab075f67ebe7669c578860de 100644 --- a/core/java/src/net/i2p/data/i2cp/RequestLeaseSetMessage.java +++ b/core/java/src/net/i2p/data/i2cp/RequestLeaseSetMessage.java @@ -34,7 +34,7 @@ public class RequestLeaseSetMessage extends I2CPMessageImpl { private Date _end; public RequestLeaseSetMessage() { - _endpoints = new ArrayList(); + _endpoints = new ArrayList<TunnelEndpoint>(); } public SessionId getSessionId() { diff --git a/core/java/src/net/i2p/data/i2cp/RequestVariableLeaseSetMessage.java b/core/java/src/net/i2p/data/i2cp/RequestVariableLeaseSetMessage.java index b29603755e9ae83472334c5bb323ca6a72fd1d49..160e193dcbb8f9e1fda08742cdb4067d035c879e 100644 --- a/core/java/src/net/i2p/data/i2cp/RequestVariableLeaseSetMessage.java +++ b/core/java/src/net/i2p/data/i2cp/RequestVariableLeaseSetMessage.java @@ -37,7 +37,7 @@ public class RequestVariableLeaseSetMessage extends I2CPMessageImpl { private static final String MIN_VERSION = "0.9.7"; public RequestVariableLeaseSetMessage() { - _endpoints = new ArrayList(); + _endpoints = new ArrayList<Lease>(); } /** diff --git a/core/java/src/net/i2p/stat/BufferedStatLog.java b/core/java/src/net/i2p/stat/BufferedStatLog.java index ae8a5b67aa640559b91208ad0ad3016b9bd08f25..20b6a2a498d1f3396f8a1b182b3b755d8c594496 100644 --- a/core/java/src/net/i2p/stat/BufferedStatLog.java +++ b/core/java/src/net/i2p/stat/BufferedStatLog.java @@ -26,7 +26,7 @@ public class BufferedStatLog implements StatLog { private int _lastWrite; /** flush stat events to disk after this many events (or 30s)*/ private int _flushFrequency; - private final List _statFilters; + private final List<String> _statFilters; private String _lastFilters; private BufferedWriter _out; private String _outFile; @@ -45,7 +45,7 @@ public class BufferedStatLog implements StatLog { _events[i] = new StatEvent(); _eventNext = 0; _lastWrite = _events.length-1; - _statFilters = new ArrayList(10); + _statFilters = new ArrayList<String>(10); _flushFrequency = 500; updateFilters(); I2PThread writer = new I2PThread(new StatLogWriter(), "StatLogWriter"); diff --git a/core/java/src/net/i2p/update/Checker.java b/core/java/src/net/i2p/update/Checker.java index f4ff70f332dafdd1b6436895468bdcbd5c7d07d6..aa5675c98dcaaae967eaedf04556dc513ca8eee7 100644 --- a/core/java/src/net/i2p/update/Checker.java +++ b/core/java/src/net/i2p/update/Checker.java @@ -1,8 +1,5 @@ package net.i2p.update; -import java.net.URI; -import java.util.List; - /** * Controls one or more types of updates. * This must be registered with the UpdateManager. diff --git a/core/java/src/net/i2p/util/Addresses.java b/core/java/src/net/i2p/util/Addresses.java index 03974441707c75b55cff6c3adbdd87a9de840a3c..d522167f446bb1782972244b020a4b96f2e6876a 100644 --- a/core/java/src/net/i2p/util/Addresses.java +++ b/core/java/src/net/i2p/util/Addresses.java @@ -83,7 +83,7 @@ public abstract class Addresses { boolean includeIPv6) { boolean haveIPv4 = false; boolean haveIPv6 = false; - SortedSet<String> rv = new TreeSet(); + SortedSet<String> rv = new TreeSet<String>(); try { InetAddress localhost = InetAddress.getLocalHost(); InetAddress[] allMyIps = InetAddress.getAllByName(localhost.getCanonicalHostName()); @@ -236,7 +236,7 @@ public abstract class Addresses { } else { size = 32; } - _IPAddress = new LHMCache(size); + _IPAddress = new LHMCache<String, byte[]>(size); } /** diff --git a/core/java/src/net/i2p/util/ByteCache.java b/core/java/src/net/i2p/util/ByteCache.java index 459b2fce4d462fd9592edfe7a2bcecad64f735ba..303ebb20eb1ea042ffbea78b6dee9a7d989b6ce7 100644 --- a/core/java/src/net/i2p/util/ByteCache.java +++ b/core/java/src/net/i2p/util/ByteCache.java @@ -52,7 +52,7 @@ import net.i2p.data.ByteArray; public final class ByteCache { //private static final Log _log = I2PAppContext.getGlobalContext().logManager().getLog(ByteCache.class); - private static final Map<Integer, ByteCache> _caches = new ConcurrentHashMap(16); + private static final Map<Integer, ByteCache> _caches = new ConcurrentHashMap<Integer, ByteCache>(16); /** * max size in bytes of each cache @@ -119,7 +119,7 @@ public final class ByteCache { private ByteCache(int maxCachedEntries, int entrySize) { if (_cache) - _available = new LinkedBlockingQueue(maxCachedEntries); + _available = new LinkedBlockingQueue<ByteArray>(maxCachedEntries); _maxCached = maxCachedEntries; _entrySize = entrySize; _lastOverflow = -1; @@ -131,7 +131,7 @@ public final class ByteCache { if (_maxCached >= maxCachedEntries) return; _maxCached = maxCachedEntries; // make a bigger one, move the cached items over - Queue<ByteArray> newLBQ = new LinkedBlockingQueue(maxCachedEntries); + Queue<ByteArray> newLBQ = new LinkedBlockingQueue<ByteArray>(maxCachedEntries); ByteArray ba; while ((ba = _available.poll()) != null) newLBQ.offer(ba); diff --git a/core/java/src/net/i2p/util/Clock.java b/core/java/src/net/i2p/util/Clock.java index c8587f48eb4ffe3259e021e89216bf71b42495ff..3efbbb7d69f1c45e72be6f3da2f4ae80b4d82a9c 100644 --- a/core/java/src/net/i2p/util/Clock.java +++ b/core/java/src/net/i2p/util/Clock.java @@ -27,7 +27,7 @@ public class Clock implements Timestamper.UpdateListener { public Clock(I2PAppContext context) { _context = context; - _listeners = new CopyOnWriteArraySet(); + _listeners = new CopyOnWriteArraySet<ClockUpdateListener>(); _startedOn = System.currentTimeMillis(); } diff --git a/core/java/src/net/i2p/util/ConcurrentHashSet.java b/core/java/src/net/i2p/util/ConcurrentHashSet.java index 6c6d8bfb675e1f63bc8b3aefeb0d9079b5f90806..bea627119d5eb52cadd817a564fb2c716baf2b23 100644 --- a/core/java/src/net/i2p/util/ConcurrentHashSet.java +++ b/core/java/src/net/i2p/util/ConcurrentHashSet.java @@ -17,10 +17,10 @@ public class ConcurrentHashSet<E> extends AbstractSet<E> implements Set<E> { private final Map<E, Object> _map; public ConcurrentHashSet() { - _map = new ConcurrentHashMap(); + _map = new ConcurrentHashMap<E, Object>(); } public ConcurrentHashSet(int capacity) { - _map = new ConcurrentHashMap(capacity); + _map = new ConcurrentHashMap<E, Object>(capacity); } @Override diff --git a/core/java/src/net/i2p/util/EepGet.java b/core/java/src/net/i2p/util/EepGet.java index 2fadef1db753af9006b38ff1999a93205e3db72b..45dc5a2c6fba66bae16137c2738f6d2ad07475ec 100644 --- a/core/java/src/net/i2p/util/EepGet.java +++ b/core/java/src/net/i2p/util/EepGet.java @@ -143,7 +143,7 @@ public class EepGet { _postData = postData; _bytesRemaining = -1; _fetchHeaderTimeout = CONNECT_TIMEOUT; - _listeners = new ArrayList(1); + _listeners = new ArrayList<StatusListener>(1); _etag = etag; _lastModified = lastModified; _etagOrig = etag; @@ -190,7 +190,7 @@ public class EepGet { lineLen = Integer.parseInt(args[++i]); } else if (args[i].equals("-h")) { if (extra == null) - extra = new ArrayList(2); + extra = new ArrayList<String>(2); extra.add(args[++i]); extra.add(args[++i]); } else if (args[i].equals("-u")) { @@ -1241,7 +1241,7 @@ public class EepGet { */ public void addHeader(String name, String value) { if (_extraHeaders == null) - _extraHeaders = new ArrayList(); + _extraHeaders = new ArrayList<String>(); _extraHeaders.add(name + ": " + value); } diff --git a/core/java/src/net/i2p/util/EventDispatcher.java b/core/java/src/net/i2p/util/EventDispatcher.java index 8f74beae7b977f87fa2232ed7aca7e27dc5e8c7e..04e3731b6cec0901d9b0898eba93759eb439e1de 100644 --- a/core/java/src/net/i2p/util/EventDispatcher.java +++ b/core/java/src/net/i2p/util/EventDispatcher.java @@ -82,7 +82,7 @@ public interface EventDispatcher { * * @return A set of event names */ - public Set getEvents(); + public Set<String> getEvents(); /** * Ignore further event notifications diff --git a/core/java/src/net/i2p/util/EventDispatcherImpl.java b/core/java/src/net/i2p/util/EventDispatcherImpl.java index 700cf8e0f58cf907b973fdf99ba6e67f5e4fc010..82b613e7554d241cb342a3839899001e4d6c2e9e 100644 --- a/core/java/src/net/i2p/util/EventDispatcherImpl.java +++ b/core/java/src/net/i2p/util/EventDispatcherImpl.java @@ -35,8 +35,8 @@ import java.util.concurrent.CopyOnWriteArrayList; public class EventDispatcherImpl implements EventDispatcher { private boolean _ignore = false; - private final Map<String, Object> _events = new ConcurrentHashMap(4); - private final List<EventDispatcher> _attached = new CopyOnWriteArrayList(); + private final Map<String, Object> _events = new ConcurrentHashMap<String, Object>(4); + private final List<EventDispatcher> _attached = new CopyOnWriteArrayList<EventDispatcher>(); public EventDispatcher getEventDispatcher() { return this; @@ -72,8 +72,8 @@ public class EventDispatcherImpl implements EventDispatcher { } public Set<String> getEvents() { - if (_ignore) return Collections.EMPTY_SET; - return new HashSet(_events.keySet()); + if (_ignore) return Collections.emptySet(); + return new HashSet<String>(_events.keySet()); } public void ignoreEvents() { diff --git a/core/java/src/net/i2p/util/FileUtil.java b/core/java/src/net/i2p/util/FileUtil.java index 2a71805470250c06757b6f014276b55b17a59b30..382be5441616521b46ae62664cb04fec18061bc9 100644 --- a/core/java/src/net/i2p/util/FileUtil.java +++ b/core/java/src/net/i2p/util/FileUtil.java @@ -106,7 +106,7 @@ public class FileUtil { try { byte buf[] = new byte[16*1024]; zip = new ZipFile(zipfile); - Enumeration entries = zip.entries(); + Enumeration<? extends ZipEntry> entries = zip.entries(); while (entries.hasMoreElements()) { ZipEntry entry = (ZipEntry)entries.nextElement(); if (entry.getName().indexOf("..") != -1) { @@ -215,7 +215,7 @@ public class FileUtil { try { byte buf[] = new byte[16*1024]; zip = new ZipFile(zipfile); - Enumeration entries = zip.entries(); + Enumeration<? extends ZipEntry> entries = zip.entries(); boolean p200TestRequired = true; while (entries.hasMoreElements()) { ZipEntry entry = (ZipEntry)entries.nextElement(); @@ -358,7 +358,7 @@ public class FileUtil { try { fis = new FileInputStream(f); BufferedReader in = new BufferedReader(new InputStreamReader(fis, "UTF-8")); - List lines = new ArrayList(maxNumLines > 0 ? maxNumLines : 64); + List<String> lines = new ArrayList<String>(maxNumLines > 0 ? maxNumLines : 64); String line = null; while ( (line = in.readLine()) != null) { lines.add(line); diff --git a/core/java/src/net/i2p/util/I2PAppThread.java b/core/java/src/net/i2p/util/I2PAppThread.java index 8111083551d93cfb1c6e75d5d93477a2a8aa204d..bf117ab83da8010d8be90fc708a1d9a09cfea8f8 100644 --- a/core/java/src/net/i2p/util/I2PAppThread.java +++ b/core/java/src/net/i2p/util/I2PAppThread.java @@ -22,7 +22,7 @@ import java.util.concurrent.CopyOnWriteArraySet; */ public class I2PAppThread extends I2PThread { - private final Set _threadListeners = new CopyOnWriteArraySet(); + private final Set<OOMEventListener> _threadListeners = new CopyOnWriteArraySet<OOMEventListener>(); public I2PAppThread() { super(); @@ -45,8 +45,8 @@ public class I2PAppThread extends I2PThread { @Override protected void fireOOM(OutOfMemoryError oom) { - for (Iterator iter = _threadListeners.iterator(); iter.hasNext(); ) { - OOMEventListener listener = (OOMEventListener)iter.next(); + for (Iterator<OOMEventListener> iter = _threadListeners.iterator(); iter.hasNext(); ) { + OOMEventListener listener = iter.next(); listener.outOfMemory(oom); } } diff --git a/core/java/src/net/i2p/util/I2PSSLSocketFactory.java b/core/java/src/net/i2p/util/I2PSSLSocketFactory.java index f7f5b260644340e1d89c14f1e942170cc7ef4544..fffbb4f809febf9a01c44d8f6c8faa8c16183609 100644 --- a/core/java/src/net/i2p/util/I2PSSLSocketFactory.java +++ b/core/java/src/net/i2p/util/I2PSSLSocketFactory.java @@ -1,9 +1,7 @@ package net.i2p.util; import java.io.File; -import java.io.FileInputStream; import java.io.IOException; -import java.io.InputStream; import java.net.InetAddress; import java.net.Socket; import java.security.KeyStore; diff --git a/core/java/src/net/i2p/util/I2PThread.java b/core/java/src/net/i2p/util/I2PThread.java index ac52b96d601620405bc1b48c6ce55499031d6f23..47ce953c676df9193ef761aeadadd798a5afd37e 100644 --- a/core/java/src/net/i2p/util/I2PThread.java +++ b/core/java/src/net/i2p/util/I2PThread.java @@ -26,7 +26,7 @@ public class I2PThread extends Thread { * Logging removed, too much trouble with extra contexts */ //private volatile Log _log; - private static final Set _listeners = new CopyOnWriteArraySet(); + private static final Set<OOMEventListener> _listeners = new CopyOnWriteArraySet<OOMEventListener>(); //private String _name; //private Exception _createdBy; @@ -112,8 +112,8 @@ public class I2PThread extends Thread { ****/ protected void fireOOM(OutOfMemoryError oom) { - for (Iterator iter = _listeners.iterator(); iter.hasNext(); ) { - OOMEventListener listener = (OOMEventListener)iter.next(); + for (Iterator<OOMEventListener> iter = _listeners.iterator(); iter.hasNext(); ) { + OOMEventListener listener = iter.next(); listener.outOfMemory(oom); } } diff --git a/core/java/src/net/i2p/util/InternalServerSocket.java b/core/java/src/net/i2p/util/InternalServerSocket.java index a5b1230631645951e7e2bb93ecee6eaef547b192..792a6b4d42b1f8191407970f563ae4fcd72aa980 100644 --- a/core/java/src/net/i2p/util/InternalServerSocket.java +++ b/core/java/src/net/i2p/util/InternalServerSocket.java @@ -24,7 +24,7 @@ import java.util.concurrent.LinkedBlockingQueue; * @since 0.7.9 */ public class InternalServerSocket extends ServerSocket { - private static final ConcurrentHashMap<Integer, InternalServerSocket> _sockets = new ConcurrentHashMap(4); + private static final ConcurrentHashMap<Integer, InternalServerSocket> _sockets = new ConcurrentHashMap<Integer, InternalServerSocket>(4); private final BlockingQueue<InternalSocket> _acceptQueue; private final Integer _port; private volatile boolean _running; @@ -41,7 +41,7 @@ public class InternalServerSocket extends ServerSocket { if (previous != null) throw new IOException("Internal port in use: " + port); _running = true; - _acceptQueue = new LinkedBlockingQueue(); + _acceptQueue = new LinkedBlockingQueue<InternalSocket>(); //if (_log.shouldLog(Log.DEBUG)) // _log.debug("Registered " + _port); } diff --git a/core/java/src/net/i2p/util/LogConsoleBuffer.java b/core/java/src/net/i2p/util/LogConsoleBuffer.java index 6149c24da99b415fddbe46c6f0061527ba63051a..18d7cfdf81fe626af4be23f54d21ad985e186d9d 100644 --- a/core/java/src/net/i2p/util/LogConsoleBuffer.java +++ b/core/java/src/net/i2p/util/LogConsoleBuffer.java @@ -36,8 +36,8 @@ public class LogConsoleBuffer { lim = Math.max(limit, 4); // Add some extra room to minimize the chance of losing a message, // since we are doing offer() below. - _buffer = new LinkedBlockingQueue(lim + 4); - _critBuffer = new LinkedBlockingQueue(lim + 4); + _buffer = new LinkedBlockingQueue<String>(lim + 4); + _critBuffer = new LinkedBlockingQueue<String>(lim + 4); } void add(String msg) { @@ -64,7 +64,7 @@ public class LogConsoleBuffer { * @return oldest first */ public List<String> getMostRecentMessages() { - return new ArrayList(_buffer); + return new ArrayList<String>(_buffer); } /** @@ -75,7 +75,7 @@ public class LogConsoleBuffer { * @return oldest first */ public List<String> getMostRecentCriticalMessages() { - return new ArrayList(_critBuffer); + return new ArrayList<String>(_critBuffer); } /** diff --git a/core/java/src/net/i2p/util/LogManager.java b/core/java/src/net/i2p/util/LogManager.java index e919f236ee574b43378152e34025133b96db7559..bb348229ded56bce5c78b5e7497dd424dcb2babc 100644 --- a/core/java/src/net/i2p/util/LogManager.java +++ b/core/java/src/net/i2p/util/LogManager.java @@ -131,14 +131,14 @@ public class LogManager { public LogManager(I2PAppContext context) { _displayOnScreen = true; _alreadyNoticedMissingConfig = false; - _limits = new ConcurrentHashSet(); - _logs = new ConcurrentHashMap(128); + _limits = new ConcurrentHashSet<LogLimit>(); + _logs = new ConcurrentHashMap<Object, Log>(128); _defaultLimit = Log.ERROR; _context = context; _log = getLog(LogManager.class); String location = context.getProperty(CONFIG_LOCATION_PROP, CONFIG_LOCATION_DEFAULT); setConfig(location); - _records = new LinkedBlockingQueue(_logBufferSize); + _records = new LinkedBlockingQueue<LogRecord>(_logBufferSize); _consoleBuffer = new LogConsoleBuffer(_consoleBufferSize); // If we aren't in the router context, delay creating the LogWriter until required, // so it doesn't create a log directory and log files unless there is output. @@ -582,7 +582,7 @@ public class LogManager { for (LogLimit limit : _limits) { if (limit.matches(log)) { if (limits == null) - limits = new ArrayList(4); + limits = new ArrayList<LogLimit>(4); limits.add(limit); } } diff --git a/core/java/src/net/i2p/util/NativeBigInteger.java b/core/java/src/net/i2p/util/NativeBigInteger.java index 99850c066804cdc774129377a7ee32b78ca0ab04..954a8f61912de0e6ba4dec871820f2d1bc064a66 100644 --- a/core/java/src/net/i2p/util/NativeBigInteger.java +++ b/core/java/src/net/i2p/util/NativeBigInteger.java @@ -35,7 +35,6 @@ import freenet.support.CPUInformation.UnknownCPUException; import net.i2p.I2PAppContext; import net.i2p.crypto.CryptoConstants; -import net.i2p.data.DataHelper; /** * <p>BigInteger that takes advantage of the jbigi library for the modPow operation, @@ -627,8 +626,8 @@ public class NativeBigInteger extends BigInteger { */ private static List<String> getResourceList() { if (_isAndroid) - return Collections.EMPTY_LIST; - List<String> rv = new ArrayList(8); + return Collections.emptyList(); + List<String> rv = new ArrayList<String>(8); String primary = getMiddleName2(true); if (primary != null) { if (_is64) { @@ -708,7 +707,7 @@ public class NativeBigInteger extends BigInteger { * @since 0.9.1 */ private static Map<String, String> getCPUInfo() { - Map<String, String> rv = new HashMap(32); + Map<String, String> rv = new HashMap<String, String>(32); BufferedReader in = null; try { in = new BufferedReader(new InputStreamReader(new FileInputStream("/proc/cpuinfo"), "ISO-8859-1"), 4096); diff --git a/core/java/src/net/i2p/util/PortMapper.java b/core/java/src/net/i2p/util/PortMapper.java index 0efd58989702b3c584a2a625428fa5935e1c7dd7..ff626961b17da6404aa6b7e364f9542be51a64a8 100644 --- a/core/java/src/net/i2p/util/PortMapper.java +++ b/core/java/src/net/i2p/util/PortMapper.java @@ -32,7 +32,7 @@ public class PortMapper { * @param context unused for now */ public PortMapper(I2PAppContext context) { - _dir = new ConcurrentHashMap(8); + _dir = new ConcurrentHashMap<String, Integer>(8); } /** diff --git a/core/java/src/net/i2p/util/ReusableGZIPInputStream.java b/core/java/src/net/i2p/util/ReusableGZIPInputStream.java index 5ef5b7801f88002a6bf2cb1edc705139bad7a34d..4a0b392bac6f49010362b51b71d108101c3f766a 100644 --- a/core/java/src/net/i2p/util/ReusableGZIPInputStream.java +++ b/core/java/src/net/i2p/util/ReusableGZIPInputStream.java @@ -14,7 +14,7 @@ public class ReusableGZIPInputStream extends ResettableGZIPInputStream { private static final LinkedBlockingQueue<ReusableGZIPInputStream> _available; static { if (ENABLE_CACHING) - _available = new LinkedBlockingQueue(8); + _available = new LinkedBlockingQueue<ReusableGZIPInputStream>(8); else _available = null; } diff --git a/core/java/src/net/i2p/util/ReusableGZIPOutputStream.java b/core/java/src/net/i2p/util/ReusableGZIPOutputStream.java index 3cbf1dd3356c6d4fb30b8210ad097ddc3d33e318..3c239ffc7d5de1dc968ed411c95293c9f1f9f86a 100644 --- a/core/java/src/net/i2p/util/ReusableGZIPOutputStream.java +++ b/core/java/src/net/i2p/util/ReusableGZIPOutputStream.java @@ -25,7 +25,7 @@ public class ReusableGZIPOutputStream extends ResettableGZIPOutputStream { private static final LinkedBlockingQueue<ReusableGZIPOutputStream> _available; static { if (ENABLE_CACHING) - _available = new LinkedBlockingQueue(16); + _available = new LinkedBlockingQueue<ReusableGZIPOutputStream>(16); else _available = null; } diff --git a/core/java/src/net/i2p/util/SSLEepGet.java b/core/java/src/net/i2p/util/SSLEepGet.java index 311219fe6c3b7f9aff95c5dcad22e00ac094ec75..81b728b57262706d97260314c6c33cc3c20d6fbf 100644 --- a/core/java/src/net/i2p/util/SSLEepGet.java +++ b/core/java/src/net/i2p/util/SSLEepGet.java @@ -39,10 +39,8 @@ package net.i2p.util; import java.io.BufferedInputStream; import java.io.File; -import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; -import java.io.InputStream; import java.io.OutputStream; import java.io.PipedInputStream; import java.io.PipedOutputStream; @@ -50,8 +48,6 @@ import java.net.MalformedURLException; import java.net.URL; import java.security.KeyStore; import java.security.GeneralSecurityException; -import java.security.cert.Certificate; -import java.security.cert.CertificateEncodingException; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; import java.util.Locale; diff --git a/core/java/src/net/i2p/util/SimpleByteCache.java b/core/java/src/net/i2p/util/SimpleByteCache.java index 1623fcb14840359f0ee1f818dcadb2a27f4541fe..4b21334b0f651ffb599b643fcb08acb6428f1902 100644 --- a/core/java/src/net/i2p/util/SimpleByteCache.java +++ b/core/java/src/net/i2p/util/SimpleByteCache.java @@ -1,6 +1,5 @@ package net.i2p.util; -import java.util.Map; import java.util.Queue; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.ConcurrentHashMap; @@ -16,7 +15,7 @@ import java.util.concurrent.LinkedBlockingQueue; */ public final class SimpleByteCache { - private static final ConcurrentHashMap<Integer, SimpleByteCache> _caches = new ConcurrentHashMap(8); + private static final ConcurrentHashMap<Integer, SimpleByteCache> _caches = new ConcurrentHashMap<Integer, SimpleByteCache>(8); private static final int DEFAULT_SIZE = 64; @@ -89,8 +88,8 @@ public final class SimpleByteCache { */ private Queue<byte[]> createQueue() { if (_entrySize <= MAX_FOR_ABQ) - return new ArrayBlockingQueue(_maxCached); - return new LinkedBlockingQueue(_maxCached); + return new ArrayBlockingQueue<byte[]>(_maxCached); + return new LinkedBlockingQueue<byte[]>(_maxCached); } /** diff --git a/core/java/src/net/i2p/util/SimpleTimer.java b/core/java/src/net/i2p/util/SimpleTimer.java index 48de1ebbf284f7ac6a9c8bea80b790462c829e7e..d4b537e584e9dba18c20369b467fb8c5061e4936 100644 --- a/core/java/src/net/i2p/util/SimpleTimer.java +++ b/core/java/src/net/i2p/util/SimpleTimer.java @@ -54,9 +54,9 @@ public class SimpleTimer { private SimpleTimer(I2PAppContext context, String name) { runn = new SimpleStore(true); _log = context.logManager().getLog(SimpleTimer.class); - _events = new TreeMap(); - _eventTimes = new HashMap(256); - _readyEvents = new ArrayList(4); + _events = new TreeMap<Long, TimedEvent>(); + _eventTimes = new HashMap<TimedEvent, Long>(256); + _readyEvents = new ArrayList<TimedEvent>(4); I2PThread runner = new I2PThread(new SimpleTimerRunner()); runner.setName(name); runner.setDaemon(true); @@ -155,8 +155,8 @@ public class SimpleTimer { if ( (_events.size() != _eventTimes.size()) ) { _log.error("Skewed events: " + _events.size() + " for " + _eventTimes.size()); - for (Iterator iter = _eventTimes.keySet().iterator(); iter.hasNext(); ) { - TimedEvent evt = (TimedEvent)iter.next(); + for (Iterator<TimedEvent> iter = _eventTimes.keySet().iterator(); iter.hasNext(); ) { + TimedEvent evt = iter.next(); Long when = _eventTimes.get(evt); TimedEvent cur = _events.get(when); if (cur != evt) { @@ -209,7 +209,7 @@ public class SimpleTimer { // private TimedEvent _recentEvents[] = new TimedEvent[5]; private class SimpleTimerRunner implements Runnable { public void run() { - List<TimedEvent> eventsToFire = new ArrayList(1); + List<TimedEvent> eventsToFire = new ArrayList<TimedEvent>(1); while(runn.getAnswer()) { try { synchronized (_events) { diff --git a/core/java/src/net/i2p/util/Translate.java b/core/java/src/net/i2p/util/Translate.java index 3139787db08c110bcebd96af50452ef30670aa05..86e9c4e6e7564eee3cda0371b7ef67858e3b8304 100644 --- a/core/java/src/net/i2p/util/Translate.java +++ b/core/java/src/net/i2p/util/Translate.java @@ -26,8 +26,8 @@ import net.i2p.util.ConcurrentHashSet; public abstract class Translate { public static final String PROP_LANG = "routerconsole.lang"; private static final String _localeLang = Locale.getDefault().getLanguage(); - private static final Map<String, ResourceBundle> _bundles = new ConcurrentHashMap(16); - private static final Set<String> _missing = new ConcurrentHashSet(16); + private static final Map<String, ResourceBundle> _bundles = new ConcurrentHashMap<String, ResourceBundle>(16); + private static final Set<String> _missing = new ConcurrentHashSet<String>(16); /** use to look for untagged strings */ private static final String TEST_LANG = "xx"; private static final String TEST_STRING = "XXXX"; diff --git a/core/java/src/net/i2p/util/TranslateReader.java b/core/java/src/net/i2p/util/TranslateReader.java index f9b89429f5547e33c8774bfae3b0f406a647b58e..dd1e910b5a99ac28f9c12c348aeef0f5e0fe62e2 100644 --- a/core/java/src/net/i2p/util/TranslateReader.java +++ b/core/java/src/net/i2p/util/TranslateReader.java @@ -71,7 +71,7 @@ public class TranslateReader extends FilterReader { super(new BufferedReader(new InputStreamReader(in, "UTF-8"))); _ctx = ctx; _bundle = bundle; - _args = new ArrayList(4); + _args = new ArrayList<String>(4); _inBuf = new StringBuilder(64); _outBuf = new StringBuilder(64); _argBuf = new StringBuilder(64); @@ -415,7 +415,7 @@ public class TranslateReader extends FilterReader { File[] listing = dir.listFiles(); if (listing == null) throw new IOException(); - filelist = new ArrayList(listing.length); + filelist = new ArrayList<String>(listing.length); for (int i = 0; i < listing.length; i++) { File f = listing[i]; if (!f.isDirectory()) diff --git a/core/java/src/net/metanotion/io/block/BlockFile.java b/core/java/src/net/metanotion/io/block/BlockFile.java index 6a386852dbc1a931415db0f2678dcb5c2ca27c5f..a73c922521bf82126627dce590fe4efff3e499dc 100644 --- a/core/java/src/net/metanotion/io/block/BlockFile.java +++ b/core/java/src/net/metanotion/io/block/BlockFile.java @@ -94,7 +94,7 @@ public class BlockFile { private boolean _isClosed; /** cached list of free pages, only valid if freListStart > 0 */ private FreeListBlock flb; - private final HashMap openIndices = new HashMap(); + private final HashMap<String, BSkipList> openIndices = new HashMap<String, BSkipList>(); private void mount() throws IOException { file.seek(BlockFile.OFFSET_MOUNTED); @@ -481,12 +481,12 @@ public class BlockFile { _isClosed = true; metaIndex.close(); - Set oi = openIndices.keySet(); - Iterator i = oi.iterator(); + Set<String> oi = openIndices.keySet(); + Iterator<String> i = oi.iterator(); Object k; while(i.hasNext()) { k = i.next(); - BSkipList bsl = (BSkipList) openIndices.get(k); + BSkipList bsl = openIndices.get(k); bsl.close(); } diff --git a/core/java/src/net/metanotion/io/block/index/BSkipLevels.java b/core/java/src/net/metanotion/io/block/index/BSkipLevels.java index d0e056dd9ee545f8495e90a6ed2c77981ddf03ef..e983de3cd826f62dd61f7d780d720f205a316240 100644 --- a/core/java/src/net/metanotion/io/block/index/BSkipLevels.java +++ b/core/java/src/net/metanotion/io/block/index/BSkipLevels.java @@ -226,7 +226,7 @@ public class BSkipLevels extends SkipLevels { * @since 0.8.8 */ private boolean blvlfix() { - TreeSet<SkipLevels> lvls = new TreeSet(new LevelComparator()); + TreeSet<SkipLevels> lvls = new TreeSet<SkipLevels>(new LevelComparator()); if (bf.log.shouldLog(Log.DEBUG)) bf.log.debug("Starting level search"); getAllLevels(this, lvls); @@ -284,7 +284,7 @@ public class BSkipLevels extends SkipLevels { * @param lvlSet out parameter, the result * @since 0.8.8 */ - private void getAllLevels(SkipLevels l, Set lvlSet) { + private void getAllLevels(SkipLevels l, Set<SkipLevels> lvlSet) { if (bf.log.shouldLog(Log.DEBUG)) bf.log.debug("GAL " + l.print()); // Do level 0 without recursion, on the assumption everything is findable diff --git a/core/java/src/net/metanotion/io/block/index/BSkipList.java b/core/java/src/net/metanotion/io/block/index/BSkipList.java index eccd63c405f04a0f22c8679213314588fb2e7745..9ecb11d973d32eb0354ff32885ba35d65240d8e8 100644 --- a/core/java/src/net/metanotion/io/block/index/BSkipList.java +++ b/core/java/src/net/metanotion/io/block/index/BSkipList.java @@ -58,8 +58,8 @@ public class BSkipList extends SkipList { public final BlockFile bf; private boolean isClosed; - final HashMap<Integer, BSkipSpan> spanHash = new HashMap(); - final HashMap<Integer, SkipLevels> levelHash = new HashMap(); + final HashMap<Integer, BSkipSpan> spanHash = new HashMap<Integer, BSkipSpan>(); + final HashMap<Integer, SkipLevels> levelHash = new HashMap<Integer, SkipLevels>(); private final boolean fileOnly;