forked from I2P_Developers/i2p.i2p
propagate from branch 'i2p.i2p.str4d.cleanup' (head 736423cc308e964bab55068e625f8a1852932ec5)
to branch 'i2p.i2p' (head 0ac335d5dc4ccaeb113af4fb5c0e993a6f42fdbe)
This commit is contained in:
@ -121,6 +121,7 @@ public class I2PAppContext {
|
||||
private final File _logDir;
|
||||
private final File _appDir;
|
||||
private volatile File _tmpDir;
|
||||
private final Random _tmpDirRand = new Random();
|
||||
// split up big lock on this to avoid deadlocks
|
||||
private final Object _lock1 = new Object(), _lock2 = new Object(), _lock3 = new Object(), _lock4 = new Object(),
|
||||
_lock5 = new Object(), _lock6 = new Object(), _lock7 = new Object(), _lock8 = new Object(),
|
||||
@ -403,7 +404,7 @@ public class I2PAppContext {
|
||||
String d = getProperty("i2p.dir.temp", System.getProperty("java.io.tmpdir"));
|
||||
// our random() probably isn't warmed up yet
|
||||
byte[] rand = new byte[6];
|
||||
(new Random()).nextBytes(rand);
|
||||
_tmpDirRand.nextBytes(rand);
|
||||
String f = "i2p-" + Base64.encode(rand) + ".tmp";
|
||||
_tmpDir = new SecureDirectory(d, f);
|
||||
if (_tmpDir.exists()) {
|
||||
@ -535,11 +536,12 @@ public class I2PAppContext {
|
||||
*
|
||||
* @return set of Strings containing the names of defined system properties
|
||||
*/
|
||||
public Set<String> getPropertyNames() {
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public Set<String> getPropertyNames() {
|
||||
// clone to avoid ConcurrentModificationException
|
||||
Set names = new HashSet(((Properties) System.getProperties().clone()).keySet());
|
||||
Set<String> names = new HashSet<String>((Set<String>) (Set) ((Properties) System.getProperties().clone()).keySet()); // TODO-Java6: s/keySet()/stringPropertyNames()/
|
||||
if (_overrideProps != null)
|
||||
names.addAll(_overrideProps.keySet());
|
||||
names.addAll((Set<String>) (Set) _overrideProps.keySet()); // TODO-Java6: s/keySet()/stringPropertyNames()/
|
||||
return names;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,6 @@ import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
@ -288,8 +287,8 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
||||
/** save some memory, don't pass along the pointless properties */
|
||||
private Properties filter(Properties options) {
|
||||
Properties rv = new Properties();
|
||||
for (Iterator iter = options.keySet().iterator(); iter.hasNext();) {
|
||||
String key = (String) iter.next();
|
||||
for (Object oKey : options.keySet()) { // TODO-Java6: s/keySet()/stringPropertyNames()/
|
||||
String key = (String) oKey;
|
||||
if (key.startsWith("java.") ||
|
||||
key.startsWith("user.") ||
|
||||
key.startsWith("os.") ||
|
||||
|
@ -38,8 +38,8 @@ public class MetaNamingService extends DummyNamingService {
|
||||
_services = new CopyOnWriteArrayList<NamingService>();
|
||||
while (tok.hasMoreTokens()) {
|
||||
try {
|
||||
Class cls = Class.forName(tok.nextToken());
|
||||
Constructor con = cls.getConstructor(new Class[] { I2PAppContext.class });
|
||||
Class<?> cls = Class.forName(tok.nextToken());
|
||||
Constructor<?> con = cls.getConstructor(new Class[] { I2PAppContext.class });
|
||||
addNamingService((NamingService)con.newInstance(new Object[] { context }), false);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
|
@ -462,8 +462,8 @@ public abstract class NamingService {
|
||||
NamingService instance = null;
|
||||
String impl = context.getProperty(PROP_IMPL, DEFAULT_IMPL);
|
||||
try {
|
||||
Class cls = Class.forName(impl);
|
||||
Constructor con = cls.getConstructor(new Class[] { I2PAppContext.class });
|
||||
Class<?> cls = Class.forName(impl);
|
||||
Constructor<?> con = cls.getConstructor(new Class[] { I2PAppContext.class });
|
||||
instance = (NamingService)con.newInstance(new Object[] { context });
|
||||
} catch (Exception ex) {
|
||||
Log log = context.logManager().getLog(NamingService.class);
|
||||
|
@ -41,8 +41,8 @@ class ECConstants {
|
||||
boolean loaded;
|
||||
if (Security.getProvider("BC") == null) {
|
||||
try {
|
||||
Class cls = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
|
||||
Constructor con = cls.getConstructor(new Class[0]);
|
||||
Class<?> cls = Class.forName("org.bouncycastle.jce.provider.BouncyCastleProvider");
|
||||
Constructor<?> con = cls.getConstructor(new Class[0]);
|
||||
Provider bc = (Provider)con.newInstance(new Object[0]);
|
||||
Security.addProvider(bc);
|
||||
log("Added BC provider");
|
||||
|
@ -541,12 +541,10 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
if (old != null) {
|
||||
// drop both old and tagSet tags
|
||||
synchronized (_inboundTagSets) {
|
||||
for (Iterator<SessionTag> iter = old.getTags().iterator(); iter.hasNext(); ) {
|
||||
SessionTag tag = iter.next();
|
||||
for (SessionTag tag : old.getTags()) {
|
||||
_inboundTagSets.remove(tag);
|
||||
}
|
||||
for (Iterator<SessionTag> iter = sessionTags.iterator(); iter.hasNext(); ) {
|
||||
SessionTag tag = iter.next();
|
||||
for (SessionTag tag : sessionTags) {
|
||||
_inboundTagSets.remove(tag);
|
||||
}
|
||||
}
|
||||
@ -734,8 +732,7 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
buf.append("<tr><td><b>Session key</b>: ").append(skey.toBase64()).append("</td>" +
|
||||
"<td><b># Sets:</b> ").append(sets.size()).append("</td></tr>" +
|
||||
"<tr><td colspan=\"2\"><ul>");
|
||||
for (Iterator<TagSet> siter = sets.iterator(); siter.hasNext();) {
|
||||
TagSet ts = siter.next();
|
||||
for (TagSet ts : sets) {
|
||||
int size = ts.getTags().size();
|
||||
total += size;
|
||||
buf.append("<li><b>ID: ").append(ts.getID());
|
||||
@ -1050,8 +1047,7 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
public long getLastExpirationDate() {
|
||||
long last = 0;
|
||||
synchronized (_tagSets) {
|
||||
for (Iterator<TagSet> iter = _tagSets.iterator(); iter.hasNext();) {
|
||||
TagSet set = iter.next();
|
||||
for (TagSet set : _tagSets) {
|
||||
if ( (set.getDate() > last) && (!set.getTags().isEmpty()) )
|
||||
last = set.getDate();
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ public class DataHelper {
|
||||
p = props;
|
||||
}
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream(p.size() * 64);
|
||||
for (Map.Entry entry : p.entrySet()) {
|
||||
for (Map.Entry<Object, Object> entry : p.entrySet()) {
|
||||
String key = (String) entry.getKey();
|
||||
String val = (String) entry.getValue();
|
||||
if (utf8)
|
||||
@ -273,7 +273,7 @@ public class DataHelper {
|
||||
OrderedProperties p = new OrderedProperties();
|
||||
p.putAll(props);
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream(p.size() * 64);
|
||||
for (Map.Entry entry : p.entrySet()) {
|
||||
for (Map.Entry<Object, Object> entry : p.entrySet()) {
|
||||
String key = (String) entry.getKey();
|
||||
String val = (String) entry.getValue();
|
||||
writeStringUTF8(baos, key);
|
||||
@ -367,7 +367,7 @@ public class DataHelper {
|
||||
* (unless the options param is an OrderedProperties)
|
||||
*/
|
||||
public static String toString(Properties options) {
|
||||
return toString((Map) options);
|
||||
return toString((Map<?, ?>) options);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -378,7 +378,7 @@ public class DataHelper {
|
||||
public static String toString(Map<?, ?> options) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
if (options != null) {
|
||||
for (Map.Entry entry : options.entrySet()) {
|
||||
for (Map.Entry<?, ?> entry : options.entrySet()) {
|
||||
String key = (String) entry.getKey();
|
||||
String val = (String) entry.getValue();
|
||||
buf.append("[").append(key).append("] = [").append(val).append("]");
|
||||
@ -470,7 +470,7 @@ public class DataHelper {
|
||||
try {
|
||||
out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new SecureFileOutputStream(file), "UTF-8")));
|
||||
out.println("# NOTE: This I2P config file must use UTF-8 encoding");
|
||||
for (Map.Entry entry : props.entrySet()) {
|
||||
for (Map.Entry<Object, Object> entry : props.entrySet()) {
|
||||
String name = (String) entry.getKey();
|
||||
String val = (String) entry.getValue();
|
||||
if (name.contains("#") ||
|
||||
@ -497,10 +497,10 @@ public class DataHelper {
|
||||
* Pretty print the collection
|
||||
*
|
||||
*/
|
||||
public static String toString(Collection col) {
|
||||
public static String toString(Collection<?> col) {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
if (col != null) {
|
||||
for (Iterator iter = col.iterator(); iter.hasNext();) {
|
||||
for (Iterator<?> iter = col.iterator(); iter.hasNext();) {
|
||||
Object o = iter.next();
|
||||
buf.append("[").append(o).append("]");
|
||||
if (iter.hasNext()) buf.append(", ");
|
||||
@ -964,12 +964,12 @@ public class DataHelper {
|
||||
* based on the value of each at each step along the way.
|
||||
*
|
||||
*/
|
||||
public final static boolean eq(Collection lhs, Collection rhs) {
|
||||
public final static boolean eq(Collection<?> lhs, Collection<?> rhs) {
|
||||
if ((lhs == null) && (rhs == null)) return true;
|
||||
if ((lhs == null) || (rhs == null)) return false;
|
||||
if (lhs.size() != rhs.size()) return false;
|
||||
Iterator liter = lhs.iterator();
|
||||
Iterator riter = rhs.iterator();
|
||||
Iterator<?> liter = lhs.iterator();
|
||||
Iterator<?> riter = rhs.iterator();
|
||||
while ((liter.hasNext()) && (riter.hasNext()))
|
||||
if (!(eq(liter.next(), riter.next()))) return false;
|
||||
return true;
|
||||
@ -1132,10 +1132,10 @@ public class DataHelper {
|
||||
* Calculate the hashcode of the collection, using 0 for null
|
||||
*
|
||||
*/
|
||||
public static int hashCode(Collection col) {
|
||||
public static int hashCode(Collection<?> col) {
|
||||
if (col == null) return 0;
|
||||
int c = 0;
|
||||
for (Iterator iter = col.iterator(); iter.hasNext();)
|
||||
for (Iterator<?> iter = col.iterator(); iter.hasNext();)
|
||||
c = 7 * c + hashCode(iter.next());
|
||||
return c;
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
@ -402,8 +401,7 @@ public class PrivateKeyFile {
|
||||
System.out.println("Attempting to verify using " + sz + " hosts, this may take a while");
|
||||
}
|
||||
|
||||
for (Iterator iter = hosts.entrySet().iterator(); iter.hasNext(); ) {
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
for (Map.Entry<Object, Object> entry : hosts.entrySet()) {
|
||||
String s = (String) entry.getValue();
|
||||
Destination signer = new Destination(s);
|
||||
// make it go faster if we have the signerHash hint
|
||||
|
@ -157,7 +157,7 @@ public class RouterAddress extends DataStructureImpl {
|
||||
* @return an unmodifiable view, non-null, sorted
|
||||
* @since 0.8.13
|
||||
*/
|
||||
public Map getOptionsMap() {
|
||||
public Map<Object, Object> getOptionsMap() {
|
||||
return Collections.unmodifiableMap(_options);
|
||||
}
|
||||
|
||||
@ -324,7 +324,7 @@ public class RouterAddress extends DataStructureImpl {
|
||||
buf.append("\n\tCost: ").append(_cost);
|
||||
//buf.append("\n\tExpiration: ").append(_expiration);
|
||||
buf.append("\n\tOptions (").append(_options.size()).append("):");
|
||||
for (Map.Entry e : _options.entrySet()) {
|
||||
for (Map.Entry<Object, Object> e : _options.entrySet()) {
|
||||
String key = (String) e.getKey();
|
||||
String val = (String) e.getValue();
|
||||
buf.append("\n\t\t[").append(key).append("] = [").append(val).append("]");
|
||||
|
@ -244,7 +244,7 @@ public class RouterInfo extends DatabaseEntry {
|
||||
* @return an unmodifiable view, non-null, sorted
|
||||
* @since 0.8.13
|
||||
*/
|
||||
public Map getOptionsMap() {
|
||||
public Map<Object, Object> getOptionsMap() {
|
||||
return Collections.unmodifiableMap(_options);
|
||||
}
|
||||
|
||||
@ -626,7 +626,7 @@ public class RouterInfo extends DatabaseEntry {
|
||||
}
|
||||
}
|
||||
buf.append("\n\tOptions (").append(_options.size()).append("):");
|
||||
for (Map.Entry e : _options.entrySet()) {
|
||||
for (Map.Entry<Object, Object> e : _options.entrySet()) {
|
||||
String key = (String) e.getKey();
|
||||
String val = (String) e.getValue();
|
||||
buf.append("\n\t\t[").append(key).append("] = [").append(val).append("]");
|
||||
|
@ -225,7 +225,7 @@ public class SessionConfig extends DataStructureImpl {
|
||||
buf.append("\n\tOptions: #: ").append(_options.size());
|
||||
Properties sorted = new OrderedProperties();
|
||||
sorted.putAll(_options);
|
||||
for (Map.Entry e : sorted.entrySet()) {
|
||||
for (Map.Entry<Object, Object> e : sorted.entrySet()) {
|
||||
String key = (String) e.getKey();
|
||||
String val = (String) e.getValue();
|
||||
buf.append("\n\t\t[").append(key).append("] = [").append(val).append("]");
|
||||
|
@ -2,7 +2,6 @@ package net.i2p.stat;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.SortedSet;
|
||||
@ -63,8 +62,7 @@ public class StatManager {
|
||||
public StatLog getStatLog() { return _statLog; }
|
||||
public void setStatLog(StatLog log) {
|
||||
_statLog = log;
|
||||
for (Iterator<RateStat> iter = _rateStats.values().iterator(); iter.hasNext(); ) {
|
||||
RateStat rs = iter.next();
|
||||
for (RateStat rs : _rateStats.values()) {
|
||||
rs.setStatLog(log);
|
||||
}
|
||||
}
|
||||
@ -168,8 +166,7 @@ public class StatManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Iterator<RateStat> iter = _rateStats.values().iterator(); iter.hasNext();) {
|
||||
RateStat stat = iter.next();
|
||||
for (RateStat stat : _rateStats.values()) {
|
||||
if (stat != null) {
|
||||
stat.coalesceStats();
|
||||
}
|
||||
|
@ -68,7 +68,6 @@ public class Clock implements Timestamper.UpdateListener {
|
||||
* @param offsetMs the delta from System.currentTimeMillis() (NOT the delta from now())
|
||||
*/
|
||||
public synchronized void setOffset(long offsetMs, boolean force) {
|
||||
if (false) return;
|
||||
long delta = offsetMs - _offset;
|
||||
if (!force) {
|
||||
if ((offsetMs > MAX_OFFSET) || (offsetMs < 0 - MAX_OFFSET)) {
|
||||
@ -113,7 +112,7 @@ public class Clock implements Timestamper.UpdateListener {
|
||||
/*
|
||||
* @return the current delta from System.currentTimeMillis() in milliseconds
|
||||
*/
|
||||
public long getOffset() {
|
||||
public synchronized long getOffset() {
|
||||
return _offset;
|
||||
}
|
||||
|
||||
|
@ -384,6 +384,7 @@ public class EepGet {
|
||||
fmt.format("%7.2f", Double.valueOf(lifetimeKBps));
|
||||
buf.append(" KBps");
|
||||
System.out.println(buf.toString());
|
||||
fmt.close();
|
||||
}
|
||||
_lastComplete = now;
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ public class FileUtil {
|
||||
//Pack200.newUnpacker().unpack(in, out);
|
||||
if (!_failedOracle) {
|
||||
try {
|
||||
Class p200 = Class.forName("java.util.jar.Pack200", true, ClassLoader.getSystemClassLoader());
|
||||
Class<?> p200 = Class.forName("java.util.jar.Pack200", true, ClassLoader.getSystemClassLoader());
|
||||
Method newUnpacker = p200.getMethod("newUnpacker", (Class[]) null);
|
||||
Object unpacker = newUnpacker.invoke(null,(Object[]) null);
|
||||
Method unpack = unpacker.getClass().getMethod("unpack", new Class[] {InputStream.class, JarOutputStream.class});
|
||||
@ -316,8 +316,8 @@ public class FileUtil {
|
||||
//(new Archive(in, out)).unpack();
|
||||
if (!_failedApache) {
|
||||
try {
|
||||
Class p200 = Class.forName("org.apache.harmony.unpack200.Archive", true, ClassLoader.getSystemClassLoader());
|
||||
Constructor newUnpacker = p200.getConstructor(new Class[] {InputStream.class, JarOutputStream.class});
|
||||
Class<?> p200 = Class.forName("org.apache.harmony.unpack200.Archive", true, ClassLoader.getSystemClassLoader());
|
||||
Constructor<?> newUnpacker = p200.getConstructor(new Class[] {InputStream.class, JarOutputStream.class});
|
||||
Object unpacker = newUnpacker.newInstance(new Object[] {in, out});
|
||||
Method unpack = unpacker.getClass().getMethod("unpack", (Class[]) null);
|
||||
// throws IOException or Pack200Exception
|
||||
|
@ -25,7 +25,7 @@ import net.i2p.I2PAppContext;
|
||||
* @author jrandom
|
||||
*/
|
||||
public class Log {
|
||||
private final Class _class;
|
||||
private final Class<?> _class;
|
||||
private final String _className;
|
||||
private final String _name;
|
||||
private int _minPriority;
|
||||
@ -75,7 +75,7 @@ public class Log {
|
||||
* Warning - not recommended.
|
||||
* Use I2PAppContext.getGlobalContext().logManager().getLog(cls)
|
||||
*/
|
||||
public Log(Class cls) {
|
||||
public Log(Class<?> cls) {
|
||||
this(I2PAppContext.getGlobalContext().logManager(), cls, null);
|
||||
_manager.addLog(this);
|
||||
}
|
||||
@ -89,7 +89,7 @@ public class Log {
|
||||
_manager.addLog(this);
|
||||
}
|
||||
|
||||
Log(LogManager manager, Class cls) {
|
||||
Log(LogManager manager, Class<?> cls) {
|
||||
this(manager, cls, null);
|
||||
}
|
||||
|
||||
@ -97,7 +97,7 @@ public class Log {
|
||||
this(manager, null, name);
|
||||
}
|
||||
|
||||
Log(LogManager manager, Class cls, String name) {
|
||||
Log(LogManager manager, Class<?> cls, String name) {
|
||||
_manager = manager;
|
||||
_class = cls;
|
||||
_className = cls != null ? cls.getName() : null;
|
||||
@ -229,7 +229,7 @@ public class Log {
|
||||
/** @return the LogScope (private class) */
|
||||
public Object getScope() { return _scope; }
|
||||
|
||||
static String getScope(String name, Class cls) {
|
||||
static String getScope(String name, Class<?> cls) {
|
||||
if ( (name == null) && (cls == null) ) return "f00";
|
||||
if (cls == null) return name;
|
||||
if (name == null) return cls.getName();
|
||||
@ -239,7 +239,7 @@ public class Log {
|
||||
private static final class LogScope {
|
||||
private final String _scopeCache;
|
||||
|
||||
public LogScope(String name, Class cls) {
|
||||
public LogScope(String name, Class<?> cls) {
|
||||
_scopeCache = getScope(name, cls);
|
||||
}
|
||||
|
||||
|
@ -166,9 +166,9 @@ public class LogManager {
|
||||
t.start();
|
||||
}
|
||||
|
||||
public Log getLog(Class cls) { return getLog(cls, null); }
|
||||
public Log getLog(Class<?> cls) { return getLog(cls, null); }
|
||||
public Log getLog(String name) { return getLog(null, name); }
|
||||
public Log getLog(Class cls, String name) {
|
||||
public Log getLog(Class<?> cls, String name) {
|
||||
String scope = Log.getScope(name, cls);
|
||||
boolean isNew = false;
|
||||
Log rv = _logs.get(scope);
|
||||
@ -186,7 +186,7 @@ public class LogManager {
|
||||
|
||||
/** now used by ConfigLogingHelper */
|
||||
public List<Log> getLogs() {
|
||||
return new ArrayList(_logs.values());
|
||||
return new ArrayList<Log>(_logs.values());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -407,7 +407,7 @@ public class LogManager {
|
||||
private void parseLimits(Properties config, String recordPrefix) {
|
||||
_limits.clear();
|
||||
if (config != null) {
|
||||
for (Map.Entry e : config.entrySet()) {
|
||||
for (Map.Entry<Object, Object> e : config.entrySet()) {
|
||||
String key = (String) e.getKey();
|
||||
|
||||
// if we're filtering the records (e.g. logger.record.*) then
|
||||
|
@ -15,14 +15,14 @@ package net.i2p.util;
|
||||
*/
|
||||
class LogRecord {
|
||||
private final long _date;
|
||||
private final Class _source;
|
||||
private final Class<?> _source;
|
||||
private final String _name;
|
||||
private final String _threadName;
|
||||
private final int _priority;
|
||||
private final String _message;
|
||||
private final Throwable _throwable;
|
||||
|
||||
public LogRecord(Class src, String name, String threadName, int priority, String msg, Throwable t) {
|
||||
public LogRecord(Class<?> src, String name, String threadName, int priority, String msg, Throwable t) {
|
||||
_date = Clock.getInstance().now();
|
||||
_source = src;
|
||||
_name = name;
|
||||
@ -36,7 +36,7 @@ class LogRecord {
|
||||
return _date;
|
||||
}
|
||||
|
||||
public Class getSource() {
|
||||
public Class<?> getSource() {
|
||||
return _source;
|
||||
}
|
||||
|
||||
|
@ -35,19 +35,19 @@ public class OrderedProperties extends Properties {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set keySet() {
|
||||
return Collections.unmodifiableSortedSet(new TreeSet(super.keySet()));
|
||||
public Set<Object> keySet() {
|
||||
return Collections.unmodifiableSortedSet(new TreeSet<Object>(super.keySet()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Map.Entry<Object, Object>> entrySet() {
|
||||
TreeSet<Map.Entry<Object, Object>> rv = new TreeSet(new EntryComparator());
|
||||
TreeSet<Map.Entry<Object, Object>> rv = new TreeSet<Map.Entry<Object, Object>>(new EntryComparator());
|
||||
rv.addAll(super.entrySet());
|
||||
return Collections.unmodifiableSortedSet(rv);
|
||||
}
|
||||
|
||||
private static class EntryComparator implements Comparator<Map.Entry> {
|
||||
public int compare(Map.Entry l, Map.Entry r) {
|
||||
private static class EntryComparator implements Comparator<Map.Entry<Object, Object>> {
|
||||
public int compare(Map.Entry<Object, Object> l, Map.Entry<Object, Object> r) {
|
||||
return ((String)l.getKey()).compareTo(((String)r.getKey()));
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ package net.i2p.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
@ -155,8 +154,7 @@ public class SimpleTimer {
|
||||
|
||||
if ( (_events.size() != _eventTimes.size()) ) {
|
||||
_log.error("Skewed events: " + _events.size() + " for " + _eventTimes.size());
|
||||
for (Iterator<TimedEvent> iter = _eventTimes.keySet().iterator(); iter.hasNext(); ) {
|
||||
TimedEvent evt = iter.next();
|
||||
for (TimedEvent evt : _eventTimes.keySet()) {
|
||||
Long when = _eventTimes.get(evt);
|
||||
TimedEvent cur = _events.get(when);
|
||||
if (cur != evt) {
|
||||
|
@ -47,7 +47,7 @@ public abstract class SystemVersion {
|
||||
int sdk = 0;
|
||||
if (_isAndroid) {
|
||||
try {
|
||||
Class ver = Class.forName("android.os.Build.VERSION", true, ClassLoader.getSystemClassLoader());
|
||||
Class<?> ver = Class.forName("android.os.Build.VERSION", true, ClassLoader.getSystemClassLoader());
|
||||
Field field = ver.getField("SDK_INT");
|
||||
sdk = field.getInt(null);
|
||||
} catch (Exception e) {}
|
||||
|
Reference in New Issue
Block a user