2009-08-11 sponge
* Code Janitor time! Many fixes and documenting fixes that should be done in the future. for the most part, this is a general code cleanup. * On smaller/embedded systems, the "final" keyword cleanups will have more of an impact than on larger systems. * Document missing hashCode() methods. * Unhide more variables to make code easier to read.
This commit is contained in:
@ -212,6 +212,8 @@ public class HashCash implements Comparable<HashCash> {
|
||||
/**
|
||||
* Two objects are considered equal if they are both of type HashCash and have an identical string representation
|
||||
*/
|
||||
/* FIXME missing hashCode() method FIXME */
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(obj instanceof HashCash)
|
||||
return toString().equals(obj.toString());
|
||||
@ -222,6 +224,7 @@ public class HashCash implements Comparable<HashCash> {
|
||||
/**
|
||||
* Returns the canonical string representation of the HashCash
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return myToken;
|
||||
}
|
||||
|
@ -167,6 +167,7 @@ public class CPUID {
|
||||
public boolean IsC3Compatible() { return false; }
|
||||
}
|
||||
protected static class VIAC3Impl extends CPUIDCPUInfo implements CPUInfo {
|
||||
@Override
|
||||
public boolean IsC3Compatible() { return true; }
|
||||
public String getCPUModelString() { return "VIA C3"; }
|
||||
}
|
||||
|
@ -164,6 +164,7 @@ public abstract class BaseHashStandalone implements IMessageDigestStandalone {
|
||||
|
||||
// methods to be implemented by concrete subclasses ------------------------
|
||||
|
||||
@Override
|
||||
public abstract Object clone();
|
||||
|
||||
public abstract boolean selfTest();
|
||||
|
@ -47,6 +47,7 @@ public class AsyncFortunaStandalone extends FortunaStandalone implements Runnabl
|
||||
}
|
||||
|
||||
/** the seed is only propogated once the prng is started with startup() */
|
||||
@Override
|
||||
public void seed(byte val[]) {
|
||||
Map props = new HashMap(1);
|
||||
props.put(SEED, (Object)val);
|
||||
@ -54,6 +55,7 @@ public class AsyncFortunaStandalone extends FortunaStandalone implements Runnabl
|
||||
//fillBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void allocBuffer() {}
|
||||
|
||||
/**
|
||||
@ -133,6 +135,7 @@ public class AsyncFortunaStandalone extends FortunaStandalone implements Runnabl
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillBlock()
|
||||
{
|
||||
rotateBuffer();
|
||||
|
@ -172,6 +172,7 @@ public abstract class BasePRNGStandalone implements IRandomStandalone {
|
||||
|
||||
// abstract methods to implement by subclasses -----------------------------
|
||||
|
||||
@Override
|
||||
public Object clone() throws CloneNotSupportedException
|
||||
{
|
||||
return super.clone();
|
||||
|
@ -169,6 +169,7 @@ public class FortunaStandalone extends BasePRNGStandalone implements Serializabl
|
||||
System.out.println("Refilling " + (++refillCount) + " after " + diff + " for the PRNG took " + refillTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRandomByte(byte b)
|
||||
{
|
||||
pools[pool].update(b);
|
||||
@ -177,6 +178,7 @@ public class FortunaStandalone extends BasePRNGStandalone implements Serializabl
|
||||
pool = (pool + 1) % NUM_POOLS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addRandomBytes(byte[] buf, int offset, int length)
|
||||
{
|
||||
pools[pool].update(buf, offset, length);
|
||||
@ -244,6 +246,7 @@ public class FortunaStandalone extends BasePRNGStandalone implements Serializabl
|
||||
cryptixKeyBuf = CryptixAESKeyCache.createNew();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final byte nextByte()
|
||||
{
|
||||
byte[] b = new byte[1];
|
||||
@ -251,6 +254,7 @@ public class FortunaStandalone extends BasePRNGStandalone implements Serializabl
|
||||
return b[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void nextBytes(byte[] out, int offset, int length)
|
||||
{
|
||||
if (!seeded)
|
||||
@ -280,11 +284,13 @@ public class FortunaStandalone extends BasePRNGStandalone implements Serializabl
|
||||
ndx = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void addRandomByte(byte b)
|
||||
{
|
||||
addRandomBytes(new byte[] { b });
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void addRandomBytes(byte[] seed, int offset, int length)
|
||||
{
|
||||
hash.update(key, 0, key.length);
|
||||
|
@ -73,7 +73,7 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
||||
/** reader that always searches for messages */
|
||||
protected I2CPMessageReader _reader;
|
||||
/** where we pipe our messages */
|
||||
protected OutputStream _out;
|
||||
protected /* FIXME final FIXME */OutputStream _out;
|
||||
|
||||
/** who we send events to */
|
||||
protected I2PSessionListener _sessionListener;
|
||||
|
@ -33,7 +33,7 @@ import net.i2p.util.Log;
|
||||
class I2PSessionImpl2 extends I2PSessionImpl {
|
||||
|
||||
/** set of MessageState objects, representing all of the messages in the process of being sent */
|
||||
private Set _sendingStates;
|
||||
private /* FIXME final FIXME */ Set _sendingStates;
|
||||
/** max # seconds to wait for confirmation of the message send */
|
||||
private final static long SEND_TIMEOUT = 60 * 1000; // 60 seconds to send
|
||||
/** should we gzip each payload prior to sending it? */
|
||||
|
@ -7,14 +7,11 @@ package net.i2p.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.Socket;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.data.Destination;
|
||||
import net.i2p.data.Hash;
|
||||
import net.i2p.data.i2cp.BandwidthLimitsMessage;
|
||||
@ -23,7 +20,6 @@ import net.i2p.data.i2cp.DestReplyMessage;
|
||||
import net.i2p.data.i2cp.GetBandwidthLimitsMessage;
|
||||
import net.i2p.data.i2cp.I2CPMessageReader;
|
||||
import net.i2p.util.I2PThread;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
/**
|
||||
* Create a new session for doing naming and bandwidth queries only. Do not create a Destination.
|
||||
@ -35,10 +31,10 @@ import net.i2p.util.Log;
|
||||
*/
|
||||
class I2PSimpleSession extends I2PSessionImpl2 {
|
||||
private boolean _destReceived;
|
||||
private Object _destReceivedLock;
|
||||
private /* FIXME final FIXME */ Object _destReceivedLock;
|
||||
private Destination _destination;
|
||||
private boolean _bwReceived;
|
||||
private Object _bwReceivedLock;
|
||||
private /* FIXME final FIXME */ Object _bwReceivedLock;
|
||||
private int[] _bwLimits;
|
||||
|
||||
/**
|
||||
@ -65,6 +61,7 @@ class I2PSimpleSession extends I2PSessionImpl2 {
|
||||
* @throws I2PSessionException if there is a configuration error or the router is
|
||||
* not reachable
|
||||
*/
|
||||
@Override
|
||||
public void connect() throws I2PSessionException {
|
||||
_closed = false;
|
||||
_availabilityNotifier.stopNotifying();
|
||||
@ -109,6 +106,7 @@ class I2PSimpleSession extends I2PSessionImpl2 {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Destination lookupDest(Hash h) throws I2PSessionException {
|
||||
if (_closed)
|
||||
return null;
|
||||
@ -125,6 +123,7 @@ class I2PSimpleSession extends I2PSessionImpl2 {
|
||||
return _destination;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] bandwidthLimits() throws I2PSessionException {
|
||||
if (_closed)
|
||||
return null;
|
||||
|
@ -21,7 +21,7 @@ class MessageState {
|
||||
private long _nonce;
|
||||
private String _prefix;
|
||||
private MessageId _id;
|
||||
private Set _receivedStatus;
|
||||
private final Set _receivedStatus;
|
||||
private SessionKey _key;
|
||||
private SessionKey _newKey;
|
||||
private Set _tags;
|
||||
|
@ -34,7 +34,7 @@ import net.i2p.util.Log;
|
||||
* @author jrandom
|
||||
*/
|
||||
class RequestLeaseSetMessageHandler extends HandlerImpl {
|
||||
private Map _existingLeaseSets;
|
||||
private final Map _existingLeaseSets;
|
||||
|
||||
public RequestLeaseSetMessageHandler(I2PAppContext context) {
|
||||
super(context, RequestLeaseSetMessage.MESSAGE_TYPE);
|
||||
|
@ -36,6 +36,7 @@ public class SessionIdleTimer implements SimpleTimer.TimedEvent {
|
||||
/**
|
||||
* reduce, shutdown, or both must be true
|
||||
*/
|
||||
/* FIXME Exporting non-public type through public API FIXME */
|
||||
public SessionIdleTimer(I2PAppContext context, I2PSessionImpl session, boolean reduce, boolean shutdown) {
|
||||
_context = context;
|
||||
_session = session;
|
||||
|
@ -12,10 +12,8 @@ import net.i2p.client.I2PClient;
|
||||
import net.i2p.client.I2PSession;
|
||||
import net.i2p.client.I2PSimpleClient;
|
||||
import net.i2p.data.Base32;
|
||||
import net.i2p.data.Base64;
|
||||
import net.i2p.data.Destination;
|
||||
import net.i2p.data.Hash;
|
||||
import net.i2p.data.LeaseSet;
|
||||
|
||||
/**
|
||||
* Connect via I2CP and ask the router to look up
|
||||
|
@ -26,7 +26,7 @@ public abstract class NamingService {
|
||||
|
||||
private final static Log _log = new Log(NamingService.class);
|
||||
protected I2PAppContext _context;
|
||||
private HashMap _cache;
|
||||
private /* FIXME final FIXME */ HashMap _cache;
|
||||
|
||||
/** what classname should be used as the naming service impl? */
|
||||
public static final String PROP_IMPL = "i2p.naming.impl";
|
||||
|
@ -23,7 +23,7 @@ import java.util.Set;
|
||||
*/
|
||||
public class PetNameDB {
|
||||
/** name (String) to PetName mapping */
|
||||
private Map _names;
|
||||
private final Map _names;
|
||||
private String _path;
|
||||
|
||||
public PetNameDB() {
|
||||
|
@ -11,7 +11,7 @@ import java.util.List;
|
||||
*
|
||||
*/
|
||||
public final class CryptixAESKeyCache {
|
||||
private List _availableKeys;
|
||||
private final List _availableKeys;
|
||||
|
||||
private static final int KEYSIZE = 32; // 256bit AES
|
||||
private static final int BLOCKSIZE = 16;
|
||||
|
@ -53,6 +53,7 @@ public class DHSessionKeyBuilder {
|
||||
private static int MIN_NUM_BUILDERS = -1;
|
||||
private static int MAX_NUM_BUILDERS = -1;
|
||||
private static int CALC_DELAY = -1;
|
||||
/* FIXME this should be final if you syncronize FIXME */
|
||||
private static volatile List _builders = new ArrayList(50);
|
||||
private static Thread _precalcThread = null;
|
||||
private BigInteger _myPrivateValue;
|
||||
|
@ -22,9 +22,9 @@ import org.bouncycastle.crypto.macs.I2PHMac;
|
||||
public class HMACGenerator {
|
||||
private I2PAppContext _context;
|
||||
/** set of available HMAC instances for calculate */
|
||||
protected List _available;
|
||||
protected final List _available;
|
||||
/** set of available byte[] buffers for verify */
|
||||
private List _availableTmp;
|
||||
private final List _availableTmp;
|
||||
|
||||
public HMACGenerator(I2PAppContext context) {
|
||||
_context = context;
|
||||
|
@ -16,7 +16,7 @@ import net.i2p.data.Hash;
|
||||
*/
|
||||
public final class SHA256Generator {
|
||||
private List _digests;
|
||||
private List _digestsGnu;
|
||||
private final List _digestsGnu;
|
||||
public SHA256Generator(I2PAppContext context) {
|
||||
_digests = new ArrayList(32);
|
||||
_digestsGnu = new ArrayList(32);
|
||||
|
@ -36,9 +36,9 @@ import net.i2p.util.SimpleTimer;
|
||||
public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
private Log _log;
|
||||
/** Map allowing us to go from the targeted PublicKey to the OutboundSession used */
|
||||
private Map<PublicKey, OutboundSession> _outboundSessions;
|
||||
private final Map<PublicKey, OutboundSession> _outboundSessions;
|
||||
/** Map allowing us to go from a SessionTag to the containing TagSet */
|
||||
private Map<SessionTag, TagSet> _inboundTagSets;
|
||||
private final Map<SessionTag, TagSet> _inboundTagSets;
|
||||
protected I2PAppContext _context;
|
||||
private volatile boolean _alive;
|
||||
|
||||
@ -81,6 +81,7 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
}
|
||||
private TransientSessionKeyManager() { this(null); }
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
_alive = false;
|
||||
synchronized (_inboundTagSets) {
|
||||
@ -105,6 +106,7 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
|
||||
|
||||
/** TagSet */
|
||||
/* FIXME Exporting non-public type through public API */
|
||||
protected Set<TagSet> getInboundTagSets() {
|
||||
synchronized (_inboundTagSets) {
|
||||
return new HashSet(_inboundTagSets.values());
|
||||
@ -112,12 +114,14 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
}
|
||||
|
||||
/** OutboundSession */
|
||||
/* FIXME Exporting non-public type through public API */
|
||||
protected Set<OutboundSession> getOutboundSessions() {
|
||||
synchronized (_outboundSessions) {
|
||||
return new HashSet(_outboundSessions.values());
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME Exporting non-public type through public API */
|
||||
protected void setData(Set<TagSet> inboundTagSets, Set<OutboundSession> outboundSessions) {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Loading " + inboundTagSets.size() + " inbound tag sets, and "
|
||||
@ -557,7 +561,7 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
private SessionKey _currentKey;
|
||||
private long _established;
|
||||
private long _lastUsed;
|
||||
private List<TagSet> _tagSets;
|
||||
private /* FIXME final FIXME */ List<TagSet> _tagSets;
|
||||
|
||||
public OutboundSession(PublicKey target) {
|
||||
this(target, null, _context.clock().now(), _context.clock().now(), new ArrayList());
|
||||
|
@ -278,7 +278,7 @@ D8usM7Dxp5yrDrCYZ5AIijc=
|
||||
private static final void showVersionCLI(String signedFile) {
|
||||
String versionString = new TrustedUpdate().getVersionString(new File(signedFile));
|
||||
|
||||
if (versionString == "")
|
||||
if (versionString.equals(""))
|
||||
System.out.println("No version string found in file '" + signedFile + "'");
|
||||
else
|
||||
System.out.println("Version: " + versionString);
|
||||
|
@ -43,6 +43,7 @@ class YKGenerator {
|
||||
private static int MIN_NUM_BUILDERS = -1;
|
||||
private static int MAX_NUM_BUILDERS = -1;
|
||||
private static int CALC_DELAY = -1;
|
||||
/* FIXME final type if you are to syncronize FIXME */
|
||||
private static volatile List _values = new ArrayList(50); // list of BigInteger[] values (y and k)
|
||||
private static Thread _precalcThread = null;
|
||||
|
||||
|
@ -31,7 +31,7 @@ public class Hash extends DataStructureImpl {
|
||||
private byte[] _data;
|
||||
private volatile String _stringified;
|
||||
private volatile String _base64ed;
|
||||
private Map _xorCache;
|
||||
private /* FIXME final FIXME */ Map _xorCache;
|
||||
|
||||
public final static int HASH_LENGTH = 32;
|
||||
public final static Hash FAKE_HASH = new Hash(new byte[HASH_LENGTH]);
|
||||
|
@ -262,6 +262,7 @@ public class PrivateKeyFile {
|
||||
out.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder s = new StringBuilder(128);
|
||||
s.append("Dest: ");
|
||||
|
@ -36,9 +36,9 @@ public class RouterInfo extends DataStructureImpl {
|
||||
private final static Log _log = new Log(RouterInfo.class);
|
||||
private RouterIdentity _identity;
|
||||
private volatile long _published;
|
||||
private Set _addresses;
|
||||
private Set _peers;
|
||||
private Properties _options;
|
||||
private final Set _addresses;
|
||||
private final Set _peers;
|
||||
private /* FIXME final FIXME */ Properties _options;
|
||||
private volatile Signature _signature;
|
||||
private volatile Hash _currentRoutingKey;
|
||||
private volatile byte _routingKeyGenMod[];
|
||||
|
@ -80,6 +80,7 @@ public class BandwidthLimitsMessage extends I2CPMessageImpl {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
||||
/* FIXME missing hashCode() method FIXME */
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object != null) && (object instanceof BandwidthLimitsMessage)) {
|
||||
|
@ -113,6 +113,7 @@ public class CreateLeaseSetMessage extends I2CPMessageImpl {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
||||
/* FIXME missing hashCode() method FIXME */
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object != null) && (object instanceof CreateLeaseSetMessage)) {
|
||||
|
@ -72,6 +72,7 @@ public class CreateSessionMessage extends I2CPMessageImpl {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
||||
/* FIXME missing hashCode() method FIXME */
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object != null) && (object instanceof CreateSessionMessage)) {
|
||||
|
@ -58,6 +58,8 @@ public class DestLookupMessage extends I2CPMessageImpl {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
||||
/* FIXME missing hashCode() method FIXME */
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object != null) && (object instanceof DestLookupMessage)) {
|
||||
DestLookupMessage msg = (DestLookupMessage) object;
|
||||
@ -66,6 +68,7 @@ public class DestLookupMessage extends I2CPMessageImpl {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("[DestLookupMessage: ");
|
||||
|
@ -60,6 +60,8 @@ public class DestReplyMessage extends I2CPMessageImpl {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
||||
/* FIXME missing hashCode() method FIXME */
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object != null) && (object instanceof DestReplyMessage)) {
|
||||
DestReplyMessage msg = (DestReplyMessage) object;
|
||||
@ -68,6 +70,7 @@ public class DestReplyMessage extends I2CPMessageImpl {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("[DestReplyMessage: ");
|
||||
|
@ -78,6 +78,13 @@ public class DestroySessionMessage extends I2CPMessageImpl {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 11 * hash + (this._sessionId != null ? this._sessionId.hashCode() : 0);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
|
@ -64,6 +64,7 @@ public class DisconnectMessage extends I2CPMessageImpl {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
||||
/* FIXME missing hashCode() method FIXME */
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object != null) && (object instanceof DisconnectMessage)) {
|
||||
|
@ -38,6 +38,7 @@ public class GetBandwidthLimitsMessage extends I2CPMessageImpl {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
||||
/* FIXME missing hashCode() method FIXME */
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object != null) && (object instanceof GetBandwidthLimitsMessage)) {
|
||||
|
@ -41,6 +41,7 @@ public class GetDateMessage extends I2CPMessageImpl {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
||||
/* FIXME missing hashCode() method FIXME */
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object != null) && (object instanceof GetDateMessage)) {
|
||||
|
@ -109,6 +109,7 @@ public class MessagePayloadMessage extends I2CPMessageImpl {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
||||
/* FIXME missing hashCode() method FIXME */
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object != null) && (object instanceof MessagePayloadMessage)) {
|
||||
|
@ -154,6 +154,7 @@ public class MessageStatusMessage extends I2CPMessageImpl {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
||||
/* FIXME missing hashCode() method FIXME */
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object != null) && (object instanceof MessageStatusMessage)) {
|
||||
|
@ -89,6 +89,7 @@ public class ReceiveMessageBeginMessage extends I2CPMessageImpl {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
||||
/* FIXME missing hashCode() method FIXME */
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object != null) && (object instanceof ReceiveMessageBeginMessage)) {
|
||||
|
@ -73,6 +73,7 @@ public class ReceiveMessageEndMessage extends I2CPMessageImpl {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
||||
/* FIXME missing hashCode() method FIXME */
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object != null) && (object instanceof ReceiveMessageEndMessage)) {
|
||||
|
@ -80,6 +80,7 @@ public class ReconfigureSessionMessage extends I2CPMessageImpl {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
||||
/* FIXME missing hashCode() method FIXME */
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object != null) && (object instanceof ReconfigureSessionMessage)) {
|
||||
|
@ -110,6 +110,7 @@ public class ReportAbuseMessage extends I2CPMessageImpl {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
||||
/* FIXME missing hashCode() method FIXME */
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object != null) && (object instanceof ReportAbuseMessage)) {
|
||||
|
@ -126,6 +126,7 @@ public class RequestLeaseSetMessage extends I2CPMessageImpl {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
||||
/* FIXME missing hashCode() method FIXME */
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object != null) && (object instanceof RequestLeaseSetMessage)) {
|
||||
|
@ -27,6 +27,7 @@ import net.i2p.util.Log;
|
||||
*/
|
||||
public class SendMessageExpiresMessage extends SendMessageMessage {
|
||||
private final static Log _log = new Log(SendMessageExpiresMessage.class);
|
||||
/* FIXME hides another field FIXME */
|
||||
public final static int MESSAGE_TYPE = 36;
|
||||
private SessionId _sessionId;
|
||||
private Destination _destination;
|
||||
@ -87,10 +88,12 @@ public class SendMessageExpiresMessage extends SendMessageMessage {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
||||
/* FIXME missing hashCode() method FIXME */
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object != null) && (object instanceof SendMessageExpiresMessage)) {
|
||||
|
@ -135,6 +135,7 @@ public class SendMessageMessage extends I2CPMessageImpl {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
||||
/* FIXME missing hashCode() method FIXME */
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object != null) && (object instanceof SendMessageMessage)) {
|
||||
|
@ -203,6 +203,7 @@ public class SessionConfig extends DataStructureImpl {
|
||||
_signature.writeBytes(out);
|
||||
}
|
||||
|
||||
/* FIXME missing hashCode() method FIXME */
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object != null) && (object instanceof SessionConfig)) {
|
||||
|
@ -84,6 +84,7 @@ public class SessionStatusMessage extends I2CPMessageImpl {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
||||
/* FIXME missing hashCode method FIXME */
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object != null) && (object instanceof SessionStatusMessage)) {
|
||||
|
@ -67,6 +67,7 @@ public class SetDateMessage extends I2CPMessageImpl {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
||||
/* FIXME missing hashCode() method */
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if ((object != null) && (object instanceof SetDateMessage)) {
|
||||
|
@ -20,12 +20,12 @@ import net.i2p.util.Log;
|
||||
public class BufferedStatLog implements StatLog {
|
||||
private I2PAppContext _context;
|
||||
private Log _log;
|
||||
private StatEvent _events[];
|
||||
private final StatEvent _events[];
|
||||
private int _eventNext;
|
||||
private int _lastWrite;
|
||||
/** flush stat events to disk after this many events (or 30s)*/
|
||||
private int _flushFrequency;
|
||||
private List _statFilters;
|
||||
private final List _statFilters;
|
||||
private String _lastFilters;
|
||||
private BufferedWriter _out;
|
||||
private String _outFile;
|
||||
@ -125,7 +125,7 @@ public class BufferedStatLog implements StatLog {
|
||||
}
|
||||
|
||||
private class StatLogWriter implements Runnable {
|
||||
private SimpleDateFormat _fmt = new SimpleDateFormat("yyyyMMdd HH:mm:ss.SSS");
|
||||
private final SimpleDateFormat _fmt = new SimpleDateFormat("yyyyMMdd HH:mm:ss.SSS");
|
||||
public void run() {
|
||||
int writeStart = -1;
|
||||
int writeEnd = -1;
|
||||
|
@ -11,7 +11,7 @@ public class Frequency {
|
||||
private long _lastEvent;
|
||||
private long _start = now();
|
||||
private long _count = 0;
|
||||
private Object _lock = this; // new Object(); // in case we want to do fancy sync later
|
||||
private final Object _lock = this; // new Object(); // in case we want to do fancy sync later
|
||||
|
||||
public Frequency(long period) {
|
||||
setPeriod(period);
|
||||
|
@ -58,6 +58,8 @@ public class FrequencyStat {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* FIXME missing equals() method FIXME */
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return _statName.hashCode();
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class Rate {
|
||||
private long _period;
|
||||
|
||||
/** locked during coalesce and addData */
|
||||
private Object _lock = new Object();
|
||||
private final Object _lock = new Object();
|
||||
|
||||
/** in the current (partial) period, what is the total value acrued through all events? */
|
||||
public double getCurrentTotalValue() {
|
||||
@ -452,6 +452,26 @@ public class Rate {
|
||||
&& _lifetimeTotalEventTime == r.getLifetimeTotalEventTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 5;
|
||||
hash = 67 * hash + (int)(Double.doubleToLongBits(this._currentTotalValue) ^ (Double.doubleToLongBits(this._currentTotalValue) >>> 32));
|
||||
hash = 67 * hash + (int)(this._currentEventCount ^ (this._currentEventCount >>> 32));
|
||||
hash = 67 * hash + (int)(this._currentTotalEventTime ^ (this._currentTotalEventTime >>> 32));
|
||||
hash = 67 * hash + (int)(Double.doubleToLongBits(this._lastTotalValue) ^ (Double.doubleToLongBits(this._lastTotalValue) >>> 32));
|
||||
hash = 67 * hash + (int)(this._lastEventCount ^ (this._lastEventCount >>> 32));
|
||||
hash = 67 * hash + (int)(this._lastTotalEventTime ^ (this._lastTotalEventTime >>> 32));
|
||||
hash = 67 * hash + (int)(Double.doubleToLongBits(this._extremeTotalValue) ^ (Double.doubleToLongBits(this._extremeTotalValue) >>> 32));
|
||||
hash = 67 * hash + (int)(this._extremeEventCount ^ (this._extremeEventCount >>> 32));
|
||||
hash = 67 * hash + (int)(this._extremeTotalEventTime ^ (this._extremeTotalEventTime >>> 32));
|
||||
hash = 67 * hash + (int)(Double.doubleToLongBits(this._lifetimeTotalValue) ^ (Double.doubleToLongBits(this._lifetimeTotalValue) >>> 32));
|
||||
hash = 67 * hash + (int)(this._lifetimeEventCount ^ (this._lifetimeEventCount >>> 32));
|
||||
hash = 67 * hash + (int)(this._lifetimeTotalEventTime ^ (this._lifetimeTotalEventTime >>> 32));
|
||||
hash = 67 * hash + (int)(this._creationDate ^ (this._creationDate >>> 32));
|
||||
hash = 67 * hash + (int)(this._period ^ (this._period >>> 32));
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder buf = new StringBuilder(2048);
|
||||
|
@ -25,9 +25,9 @@ public class StatManager {
|
||||
private I2PAppContext _context;
|
||||
|
||||
/** stat name to FrequencyStat */
|
||||
private Map _frequencyStats;
|
||||
private final Map _frequencyStats;
|
||||
/** stat name to RateStat */
|
||||
private Map _rateStats;
|
||||
private final Map _rateStats;
|
||||
private StatLog _statLog;
|
||||
|
||||
public static final String PROP_STAT_FILTER = "stat.logFilters";
|
||||
|
@ -18,9 +18,9 @@ import net.i2p.util.Log;
|
||||
public class Timestamper implements Runnable {
|
||||
private I2PAppContext _context;
|
||||
private Log _log;
|
||||
private List<String> _servers;
|
||||
private final List<String> _servers;
|
||||
private List<String> _priorityServers;
|
||||
private List<UpdateListener> _listeners;
|
||||
private final List<UpdateListener> _listeners;
|
||||
private int _queryFrequency;
|
||||
private int _concurringServers;
|
||||
private volatile boolean _disabled;
|
||||
@ -52,6 +52,9 @@ public class Timestamper implements Runnable {
|
||||
this(ctx, lsnr, true);
|
||||
}
|
||||
public Timestamper(I2PAppContext ctx, UpdateListener lsnr, boolean daemon) {
|
||||
// moved here to prevent problems with synchronized statements.
|
||||
_servers = new ArrayList(3);
|
||||
_listeners = new ArrayList(1);
|
||||
// Don't bother starting a thread if we are disabled.
|
||||
// This means we no longer check every 5 minutes to see if we got enabled,
|
||||
// so the property must be set at startup.
|
||||
@ -65,8 +68,6 @@ public class Timestamper implements Runnable {
|
||||
_daemon = daemon;
|
||||
_initialized = false;
|
||||
_wellSynced = false;
|
||||
_servers = new ArrayList(3);
|
||||
_listeners = new ArrayList(1);
|
||||
if (lsnr != null)
|
||||
_listeners.add(lsnr);
|
||||
updateConfig();
|
||||
|
@ -15,7 +15,7 @@ import net.i2p.data.ByteArray;
|
||||
*
|
||||
*/
|
||||
public final class ByteCache {
|
||||
private static Map _caches = new HashMap(16);
|
||||
private final static Map _caches = new HashMap(16);
|
||||
/**
|
||||
* Get a cache responsible for objects of the given size
|
||||
*
|
||||
@ -36,7 +36,7 @@ public final class ByteCache {
|
||||
}
|
||||
private Log _log;
|
||||
/** list of available and available entries */
|
||||
private List _available;
|
||||
private final List _available;
|
||||
private int _maxCached;
|
||||
private int _entrySize;
|
||||
private long _lastOverflow;
|
||||
|
@ -44,7 +44,7 @@ public class Clock implements Timestamper.UpdateListener {
|
||||
|
||||
protected volatile long _offset;
|
||||
protected boolean _alreadyChanged;
|
||||
private Set _listeners;
|
||||
private final Set _listeners;
|
||||
|
||||
/** if the clock is skewed by 3+ days, fuck 'em */
|
||||
public final static long MAX_OFFSET = 3 * 24 * 60 * 60 * 1000;
|
||||
|
@ -23,22 +23,27 @@ public class ConcurrentHashSet<E> extends AbstractSet<E> implements Set<E> {
|
||||
_map = new ConcurrentHashMap(capacity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean add(E o) {
|
||||
return _map.put(o, DUMMY) == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
_map.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
return _map.containsKey(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return _map.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object o) {
|
||||
return _map.remove(o) != null;
|
||||
}
|
||||
@ -51,6 +56,7 @@ public class ConcurrentHashSet<E> extends AbstractSet<E> implements Set<E> {
|
||||
return _map.keySet().iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addAll(Collection<? extends E> c) {
|
||||
boolean rv = false;
|
||||
for (E e : c)
|
||||
|
@ -43,7 +43,7 @@ public class EepGet {
|
||||
protected String _actualURL;
|
||||
private String _postData;
|
||||
private boolean _allowCaching;
|
||||
protected List _listeners;
|
||||
protected final List _listeners;
|
||||
|
||||
private boolean _keepFetching;
|
||||
private Socket _proxy;
|
||||
@ -256,8 +256,8 @@ public class EepGet {
|
||||
private long _discarded;
|
||||
private long _lastComplete;
|
||||
private boolean _firstTime;
|
||||
private DecimalFormat _pct = new DecimalFormat("00.0%");
|
||||
private DecimalFormat _kbps = new DecimalFormat("###,000.00");
|
||||
private final DecimalFormat _pct = new DecimalFormat("00.0%");
|
||||
private final DecimalFormat _kbps = new DecimalFormat("###,000.00");
|
||||
public CLIStatusListener() {
|
||||
this(1024, 40);
|
||||
}
|
||||
|
@ -35,8 +35,8 @@ public class EventDispatcherImpl implements EventDispatcher {
|
||||
private final static Log _log = new Log(EventDispatcherImpl.class);
|
||||
|
||||
private boolean _ignore = false;
|
||||
private HashMap _events = new HashMap(4);
|
||||
private ArrayList _attached = new ArrayList();
|
||||
private /* FIXME final FIXME */ HashMap _events = new HashMap(4);
|
||||
private final ArrayList _attached = new ArrayList();
|
||||
|
||||
public EventDispatcher getEventDispatcher() {
|
||||
return this;
|
||||
|
@ -7,7 +7,7 @@ import net.i2p.I2PAppContext;
|
||||
class Executor implements Runnable {
|
||||
private I2PAppContext _context;
|
||||
private Log _log;
|
||||
private List _readyEvents;
|
||||
private final List _readyEvents;
|
||||
private SimpleStore runn;
|
||||
|
||||
public Executor(I2PAppContext ctx, Log log, List events, SimpleStore x) {
|
||||
|
@ -43,6 +43,7 @@ public class I2PAppThread extends I2PThread {
|
||||
super(r, name, isDaemon);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fireOOM(OutOfMemoryError oom) {
|
||||
for (Iterator iter = _threadListeners.iterator(); iter.hasNext(); ) {
|
||||
OOMEventListener listener = (OOMEventListener)iter.next();
|
||||
|
@ -11,8 +11,8 @@ import net.i2p.I2PAppContext;
|
||||
*/
|
||||
public class LogConsoleBuffer {
|
||||
private I2PAppContext _context;
|
||||
private List _buffer;
|
||||
private List _critBuffer;
|
||||
private final List _buffer;
|
||||
private final List _critBuffer;
|
||||
|
||||
public LogConsoleBuffer(I2PAppContext context) {
|
||||
_context = context;
|
||||
|
@ -70,11 +70,11 @@ public class LogManager {
|
||||
/** the config file */
|
||||
private File _locationFile;
|
||||
/** Ordered list of LogRecord elements that have not been written out yet */
|
||||
private List _records;
|
||||
private /* FIXME final FIXME */ List _records;
|
||||
/** List of explicit overrides of log levels (LogLimit objects) */
|
||||
private List _limits;
|
||||
private /* FIXME final FIXME */ List _limits;
|
||||
/** String (scope) to Log object */
|
||||
private Map _logs;
|
||||
private /* FIXME final FIXME */ Map _logs;
|
||||
/** who clears and writes our records */
|
||||
private LogWriter _writer;
|
||||
|
||||
|
@ -24,8 +24,6 @@ import freenet.support.CPUInformation.IntelCPUInfo;
|
||||
import freenet.support.CPUInformation.UnknownCPUException;
|
||||
|
||||
import net.i2p.I2PAppContext;
|
||||
import net.i2p.util.FileUtil;
|
||||
import net.i2p.util.Log;
|
||||
|
||||
/**
|
||||
* <p>BigInteger that takes advantage of the jbigi library for the modPow operation,
|
||||
|
@ -40,7 +40,7 @@ public class OrderedProperties extends Properties {
|
||||
private Map _data;
|
||||
|
||||
/** lock this before touching _order or _data */
|
||||
private Object _lock = new Object();
|
||||
private final Object _lock = new Object();
|
||||
|
||||
public OrderedProperties() {
|
||||
super();
|
||||
@ -269,6 +269,7 @@ public class OrderedProperties extends Properties {
|
||||
return -2;
|
||||
}
|
||||
|
||||
/* FIXME missing hashCode() method FIXME */
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == null) return false;
|
||||
|
@ -169,16 +169,16 @@ public class ResettableGZIPInputStream extends InflaterInputStream {
|
||||
// handle flags...
|
||||
if (0 != (flags & (1<<5))) {
|
||||
// extra header, read and ignore
|
||||
int len = 0;
|
||||
int _len = 0;
|
||||
c = in.read();
|
||||
if (c == -1) throw new IOException("EOF reading the extra header");
|
||||
len = c;
|
||||
_len = c;
|
||||
c = in.read();
|
||||
if (c == -1) throw new IOException("EOF reading the extra header");
|
||||
len += (c << 8);
|
||||
_len += (c << 8);
|
||||
|
||||
// now skip that data
|
||||
for (int i = 0; i < len; i++) {
|
||||
for (int i = 0; i < _len; i++) {
|
||||
c = in.read();
|
||||
if (c == -1) throw new IOException("EOF reading the extra header's body");
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import net.i2p.data.DataHelper;
|
||||
*
|
||||
*/
|
||||
public class ReusableGZIPInputStream extends ResettableGZIPInputStream {
|
||||
private static ArrayList _available = new ArrayList(8);
|
||||
private final static ArrayList _available = new ArrayList(8);
|
||||
/**
|
||||
* Pull a cached instance
|
||||
*/
|
||||
|
@ -14,7 +14,7 @@ import net.i2p.data.DataHelper;
|
||||
*
|
||||
*/
|
||||
public class ReusableGZIPOutputStream extends ResettableGZIPOutputStream {
|
||||
private static ArrayList _available = new ArrayList(16);
|
||||
private static final ArrayList _available = new ArrayList(16);
|
||||
/**
|
||||
* Pull a cached instance
|
||||
*/
|
||||
|
@ -51,7 +51,7 @@ public class ShellCommand {
|
||||
*/
|
||||
private class CommandThread extends Thread {
|
||||
|
||||
Object caller;
|
||||
final Object caller;
|
||||
boolean consumeOutput;
|
||||
String shellCommand;
|
||||
|
||||
|
@ -21,10 +21,10 @@ public class SimpleTimer {
|
||||
private I2PAppContext _context;
|
||||
private Log _log;
|
||||
/** event time (Long) to event (TimedEvent) mapping */
|
||||
private TreeMap _events;
|
||||
private final TreeMap _events;
|
||||
/** event (TimedEvent) to event time (Long) mapping */
|
||||
private Map _eventTimes;
|
||||
private List _readyEvents;
|
||||
private final List _readyEvents;
|
||||
private SimpleStore runn;
|
||||
|
||||
protected SimpleTimer() { this("SimpleTimer"); }
|
||||
|
@ -104,6 +104,7 @@ public class MD5Digest
|
||||
/**
|
||||
* reset the chaining variables to the IV values.
|
||||
*/
|
||||
@Override
|
||||
public void reset()
|
||||
{
|
||||
super.reset();
|
||||
|
Reference in New Issue
Block a user