should compile on 1.5 again now
This commit is contained in:
@ -131,7 +131,6 @@ public class ATalk implements I2PSessionListener, Runnable {
|
||||
* application is complete.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
connect();
|
||||
@ -242,7 +241,6 @@ public class ATalk implements I2PSessionListener, Runnable {
|
||||
* message to the user.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void messageAvailable(I2PSession session, int msgId, long size) {
|
||||
_log.debug("Message available: id = " + msgId + " size = " + size);
|
||||
try {
|
||||
@ -353,19 +351,16 @@ public class ATalk implements I2PSessionListener, Runnable {
|
||||
}
|
||||
|
||||
/** required by {@link I2PSessionListener I2PSessionListener} to notify of disconnect */
|
||||
@Override
|
||||
public void disconnected(I2PSession session) {
|
||||
_log.debug("Disconnected");
|
||||
}
|
||||
|
||||
/** required by {@link I2PSessionListener I2PSessionListener} to notify of error */
|
||||
@Override
|
||||
public void errorOccurred(I2PSession session, String message, Throwable error) {
|
||||
_log.debug("Error occurred: " + message, error);
|
||||
}
|
||||
|
||||
/** required by {@link I2PSessionListener I2PSessionListener} to notify of abuse */
|
||||
@Override
|
||||
public void reportAbuse(I2PSession session, int severity) {
|
||||
_log.debug("Abuse reported of severity " + severity);
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ class DisconnectMessageHandler extends HandlerImpl {
|
||||
super(context, DisconnectMessage.MESSAGE_TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
||||
_log.debug("Handle message " + message);
|
||||
session.destroySession(false);
|
||||
|
@ -28,7 +28,6 @@ abstract class HandlerImpl implements I2CPMessageHandler {
|
||||
_log = new Log(getClass());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return _type;
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ class I2PClientImpl implements I2PClient {
|
||||
/**
|
||||
* Create the destination with a null payload
|
||||
*/
|
||||
@Override
|
||||
public Destination createDestination(OutputStream destKeyStream) throws I2PException, IOException {
|
||||
Certificate cert = new Certificate();
|
||||
cert.setCertificateType(Certificate.CERTIFICATE_TYPE_NULL);
|
||||
@ -46,7 +45,6 @@ class I2PClientImpl implements I2PClient {
|
||||
* the PrivateKey and SigningPrivateKey to the destKeyStream
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public Destination createDestination(OutputStream destKeyStream, Certificate cert) throws I2PException, IOException {
|
||||
Destination d = new Destination();
|
||||
d.setCertificate(cert);
|
||||
@ -71,7 +69,6 @@ class I2PClientImpl implements I2PClient {
|
||||
* Create a new session (though do not connect it yet)
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public I2PSession createSession(InputStream destKeyStream, Properties options) throws I2PSessionException {
|
||||
return createSession(I2PAppContext.getGlobalContext(), destKeyStream, options);
|
||||
}
|
||||
|
@ -231,7 +231,6 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
||||
* @throws I2PSessionException if there is a configuration error or the router is
|
||||
* not reachable
|
||||
*/
|
||||
@Override
|
||||
public void connect() throws I2PSessionException {
|
||||
_closed = false;
|
||||
_availabilityNotifier.stopNotifying();
|
||||
@ -304,7 +303,6 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
||||
* notified the user that its available.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public byte[] receiveMessage(int msgId) throws I2PSessionException {
|
||||
int remaining = 0;
|
||||
MessagePayloadMessage msg = null;
|
||||
@ -323,7 +321,6 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
||||
/**
|
||||
* Report abuse with regards to the given messageId
|
||||
*/
|
||||
@Override
|
||||
public void reportAbuse(int msgId, int severity) throws I2PSessionException {
|
||||
if (isClosed()) throw new I2PSessionException(getPrefix() + "Already closed");
|
||||
_producer.reportAbuse(this, msgId, severity);
|
||||
@ -335,10 +332,8 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
||||
* delivered successfully. make this wait for at least ACCEPTED
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public abstract boolean sendMessage(Destination dest, byte[] payload) throws I2PSessionException;
|
||||
|
||||
@Override
|
||||
public abstract boolean sendMessage(Destination dest, byte[] payload, SessionKey keyUsed,
|
||||
Set tagsSent) throws I2PSessionException;
|
||||
|
||||
@ -380,7 +375,6 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
||||
private Long _msgId;
|
||||
public VerifyUsage(Long id) { _msgId = id; }
|
||||
|
||||
@Override
|
||||
public void timeReached() {
|
||||
MessagePayloadMessage removed = null;
|
||||
int remaining = 0;
|
||||
@ -419,7 +413,6 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
||||
AvailabilityNotifier.this.notifyAll();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
_alive = true;
|
||||
while (_alive) {
|
||||
@ -461,7 +454,6 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
||||
* Recieve notification of some I2CP message and handle it if possible
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void messageReceived(I2CPMessageReader reader, I2CPMessage message) {
|
||||
I2CPMessageHandler handler = _handlerMap.getHandler(message.getType());
|
||||
if (handler == null) {
|
||||
@ -480,7 +472,6 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
||||
* Recieve notifiation of an error reading the I2CP stream
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void readError(I2CPMessageReader reader, Exception error) {
|
||||
propogateError("There was an error reading data", error);
|
||||
disconnect();
|
||||
@ -489,19 +480,16 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
||||
/**
|
||||
* Retrieve the destination of the session
|
||||
*/
|
||||
@Override
|
||||
public Destination getMyDestination() { return _myDestination; }
|
||||
|
||||
/**
|
||||
* Retrieve the decryption PrivateKey
|
||||
*/
|
||||
@Override
|
||||
public PrivateKey getDecryptionKey() { return _privateKey; }
|
||||
|
||||
/**
|
||||
* Retrieve the signing SigningPrivateKey
|
||||
*/
|
||||
@Override
|
||||
public SigningPrivateKey getPrivateKey() { return _signingPrivateKey; }
|
||||
|
||||
/**
|
||||
@ -521,11 +509,9 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
||||
void setSessionId(SessionId id) { _sessionId = id; }
|
||||
|
||||
/** configure the listener */
|
||||
@Override
|
||||
public void setSessionListener(I2PSessionListener lsnr) { _sessionListener = lsnr; }
|
||||
|
||||
/** has the session been closed (or not yet connected)? */
|
||||
@Override
|
||||
public boolean isClosed() { return _closed; }
|
||||
|
||||
/**
|
||||
@ -575,7 +561,6 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
||||
/**
|
||||
* Tear down the session, and do NOT reconnect
|
||||
*/
|
||||
@Override
|
||||
public void destroySession() {
|
||||
destroySession(true);
|
||||
}
|
||||
@ -623,7 +608,6 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
||||
/**
|
||||
* Recieve notification that the I2CP connection was disconnected
|
||||
*/
|
||||
@Override
|
||||
public void disconnected(I2CPMessageReader reader) {
|
||||
if (_log.shouldLog(Log.DEBUG)) _log.debug(getPrefix() + "Disconnected", new Exception("Disconnected"));
|
||||
disconnect();
|
||||
|
@ -80,7 +80,6 @@ class I2PSessionImpl2 extends I2PSessionImpl {
|
||||
public boolean sendMessage(Destination dest, byte[] payload) throws I2PSessionException {
|
||||
return sendMessage(dest, payload, 0, payload.length);
|
||||
}
|
||||
@Override
|
||||
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size) throws I2PSessionException {
|
||||
return sendMessage(dest, payload, offset, size, new SessionKey(), new HashSet(64));
|
||||
}
|
||||
@ -89,7 +88,6 @@ class I2PSessionImpl2 extends I2PSessionImpl {
|
||||
public boolean sendMessage(Destination dest, byte[] payload, SessionKey keyUsed, Set tagsSent) throws I2PSessionException {
|
||||
return sendMessage(dest, payload, 0, payload.length, keyUsed, tagsSent);
|
||||
}
|
||||
@Override
|
||||
public boolean sendMessage(Destination dest, byte[] payload, int offset, int size, SessionKey keyUsed, Set tagsSent)
|
||||
throws I2PSessionException {
|
||||
if (_log.shouldLog(Log.DEBUG)) _log.debug("sending message");
|
||||
|
@ -29,7 +29,6 @@ class MessagePayloadMessageHandler extends HandlerImpl {
|
||||
super(context, MessagePayloadMessage.MESSAGE_TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Handle message " + message);
|
||||
|
@ -26,7 +26,6 @@ class MessageStatusMessageHandler extends HandlerImpl {
|
||||
super(context, MessageStatusMessage.MESSAGE_TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
||||
boolean skipStatus = true;
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
|
@ -40,7 +40,6 @@ class RequestLeaseSetMessageHandler extends HandlerImpl {
|
||||
_existingLeaseSets = new HashMap(32);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Handle message " + message);
|
||||
|
@ -24,7 +24,6 @@ class SessionStatusMessageHandler extends HandlerImpl {
|
||||
super(context, SessionStatusMessage.MESSAGE_TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
||||
_log.debug("Handle message " + message);
|
||||
SessionStatusMessage msg = (SessionStatusMessage) message;
|
||||
|
@ -24,7 +24,6 @@ class SetDateMessageHandler extends HandlerImpl {
|
||||
super(ctx, SetDateMessage.MESSAGE_TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(I2CPMessage message, I2PSessionImpl session) {
|
||||
_log.debug("Handle message " + message);
|
||||
SetDateMessage msg = (SetDateMessage) message;
|
||||
|
@ -42,7 +42,6 @@ public class Address extends DataStructureImpl {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException,
|
||||
IOException {
|
||||
_hostname = DataHelper.readString(in);
|
||||
@ -50,7 +49,6 @@ public class Address extends DataStructureImpl {
|
||||
_destination.readBytes(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException,
|
||||
IOException {
|
||||
if ((_hostname == null) || (_destination == null))
|
||||
|
@ -74,7 +74,6 @@ public class ByteArray implements Serializable, Comparable {
|
||||
return (llen == rlen) && DataHelper.eq(lhs, loff, rhs, roff, llen);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int compareTo(Object obj) {
|
||||
if (obj.getClass() != getClass()) throw new ClassCastException("invalid object: " + obj);
|
||||
return DataHelper.compareTo(_data, ((ByteArray)obj).getData());
|
||||
|
@ -67,7 +67,6 @@ public class Certificate extends DataStructureImpl {
|
||||
_payload = payload;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_type = (int) DataHelper.readLong(in, 1);
|
||||
int length = (int) DataHelper.readLong(in, 2);
|
||||
@ -80,7 +79,6 @@ public class Certificate extends DataStructureImpl {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_type < 0) throw new DataFormatException("Invalid certificate type: " + _type);
|
||||
//if ((_type != 0) && (_payload == null)) throw new DataFormatException("Payload is required for non null type");
|
||||
|
@ -25,7 +25,6 @@ import net.i2p.util.Log;
|
||||
public abstract class DataStructureImpl implements DataStructure {
|
||||
private final static Log _log = new Log(DataStructureImpl.class);
|
||||
|
||||
@Override
|
||||
public String toBase64() {
|
||||
byte data[] = toByteArray();
|
||||
if (data == null)
|
||||
@ -33,19 +32,16 @@ public abstract class DataStructureImpl implements DataStructure {
|
||||
|
||||
return Base64.encode(data);
|
||||
}
|
||||
@Override
|
||||
public void fromBase64(String data) throws DataFormatException {
|
||||
if (data == null) throw new DataFormatException("Null data passed in");
|
||||
byte bytes[] = Base64.decode(data);
|
||||
fromByteArray(bytes);
|
||||
}
|
||||
@Override
|
||||
public Hash calculateHash() {
|
||||
byte data[] = toByteArray();
|
||||
if (data != null) return SHA256Generator.getInstance().calculateHash(data);
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public byte[] toByteArray() {
|
||||
try {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream(512);
|
||||
@ -59,7 +55,6 @@ public abstract class DataStructureImpl implements DataStructure {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void fromByteArray(byte data[]) throws DataFormatException {
|
||||
if (data == null) throw new DataFormatException("Null data passed in");
|
||||
try {
|
||||
|
@ -72,7 +72,6 @@ public class Destination extends DataStructureImpl {
|
||||
__calculatedHash = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_publicKey = new PublicKey();
|
||||
_publicKey.readBytes(in);
|
||||
@ -83,7 +82,6 @@ public class Destination extends DataStructureImpl {
|
||||
__calculatedHash = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if ((_certificate == null) || (_publicKey == null) || (_signingKey == null))
|
||||
throw new DataFormatException("Not enough data to format the destination");
|
||||
|
@ -127,7 +127,6 @@ public class Hash extends DataStructureImpl {
|
||||
_xorCache = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_data = new byte[HASH_LENGTH];
|
||||
_stringified = null;
|
||||
@ -136,7 +135,6 @@ public class Hash extends DataStructureImpl {
|
||||
if (read != HASH_LENGTH) throw new DataFormatException("Not enough bytes to read the hash");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_data == null) throw new DataFormatException("No data in the hash to write out");
|
||||
if (_data.length != HASH_LENGTH) throw new DataFormatException("Invalid size of data in the private key");
|
||||
|
@ -112,7 +112,6 @@ public class Lease extends DataStructureImpl {
|
||||
return _end.getTime() < Clock.getInstance().now() - fudgeFactor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_gateway = new Hash();
|
||||
_gateway.readBytes(in);
|
||||
@ -121,7 +120,6 @@ public class Lease extends DataStructureImpl {
|
||||
_end = DataHelper.readDate(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if ((_gateway == null) || (_tunnelId == null))
|
||||
throw new DataFormatException("Not enough data to write out a Lease");
|
||||
|
@ -253,7 +253,6 @@ public class LeaseSet extends DataStructureImpl {
|
||||
return rv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_destination = new Destination();
|
||||
_destination.readBytes(in);
|
||||
@ -275,7 +274,6 @@ public class LeaseSet extends DataStructureImpl {
|
||||
_signature.readBytes(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if ((_destination == null) || (_encryptionKey == null) || (_signingKey == null) || (_leases == null)
|
||||
|| (_signature == null)) throw new DataFormatException("Not enough data to write out a LeaseSet");
|
||||
|
@ -67,7 +67,6 @@ public class Payload extends DataStructureImpl {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
int size = (int) DataHelper.readLong(in, 4);
|
||||
if (size < 0) throw new DataFormatException("payload size out of range (" + size + ")");
|
||||
@ -78,7 +77,6 @@ public class Payload extends DataStructureImpl {
|
||||
_log.debug("read payload: " + read + " bytes");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_encryptedData == null) throw new DataFormatException("Not yet encrypted. Please set the encrypted data");
|
||||
DataHelper.writeLong(out, 4, _encryptedData.length);
|
||||
|
@ -51,14 +51,12 @@ public class PrivateKey extends DataStructureImpl {
|
||||
_data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_data = new byte[KEYSIZE_BYTES];
|
||||
int read = read(in, _data);
|
||||
if (read != KEYSIZE_BYTES) throw new DataFormatException("Not enough bytes to read the private key");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_data == null) throw new DataFormatException("No data in the private key to write out");
|
||||
if (_data.length != KEYSIZE_BYTES)
|
||||
|
@ -54,14 +54,12 @@ public class PublicKey extends DataStructureImpl {
|
||||
_data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_data = new byte[KEYSIZE_BYTES];
|
||||
int read = read(in, _data);
|
||||
if (read != KEYSIZE_BYTES) throw new DataFormatException("Not enough bytes to read the public key");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_data == null) throw new DataFormatException("No data in the public key to write out");
|
||||
if (_data.length != KEYSIZE_BYTES) throw new DataFormatException("Invalid size of data in the public key");
|
||||
|
@ -105,7 +105,6 @@ public class RouterAddress extends DataStructureImpl {
|
||||
_options = options;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_cost = (int) DataHelper.readLong(in, 1);
|
||||
_expiration = DataHelper.readDate(in);
|
||||
@ -113,7 +112,6 @@ public class RouterAddress extends DataStructureImpl {
|
||||
_options = DataHelper.readProperties(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if ((_cost < 0) || (_transportStyle == null) || (_options == null))
|
||||
throw new DataFormatException("Not enough data to write a router address");
|
||||
|
@ -74,7 +74,6 @@ public class RouterIdentity extends DataStructureImpl {
|
||||
return (_certificate != null) && (_certificate.getCertificateType() == Certificate.CERTIFICATE_TYPE_HIDDEN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_publicKey = new PublicKey();
|
||||
_publicKey.readBytes(in);
|
||||
@ -85,7 +84,6 @@ public class RouterIdentity extends DataStructureImpl {
|
||||
__calculatedHash = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if ((_certificate == null) || (_publicKey == null) || (_signingKey == null))
|
||||
throw new DataFormatException("Not enough data to format the router identity");
|
||||
|
@ -487,7 +487,6 @@ public class RouterInfo extends DataStructureImpl {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_identity = new RouterIdentity();
|
||||
_identity.readBytes(in);
|
||||
@ -517,7 +516,6 @@ public class RouterInfo extends DataStructureImpl {
|
||||
//_log.debug("Read routerInfo: " + toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_identity == null) throw new DataFormatException("Missing identity");
|
||||
if (_published < 0) throw new DataFormatException("Invalid published date: " + _published);
|
||||
|
@ -58,14 +58,12 @@ public class SessionKey extends DataStructureImpl {
|
||||
public Object getPreparedKey() { return _preparedKey; }
|
||||
public void setPreparedKey(Object obj) { _preparedKey = obj; }
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_data = new byte[KEYSIZE_BYTES];
|
||||
int read = read(in, _data);
|
||||
if (read != KEYSIZE_BYTES) throw new DataFormatException("Not enough bytes to read the session key");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_data == null) throw new DataFormatException("No data in the session key to write out");
|
||||
if (_data.length != KEYSIZE_BYTES) throw new DataFormatException("Invalid size of data in the private key");
|
||||
|
@ -44,14 +44,12 @@ public class Signature extends DataStructureImpl {
|
||||
_data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_data = new byte[SIGNATURE_BYTES];
|
||||
int read = read(in, _data);
|
||||
if (read != SIGNATURE_BYTES) throw new DataFormatException("Not enough bytes to read the signature");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_data == null) throw new DataFormatException("No data in the signature to write out");
|
||||
if (_data.length != SIGNATURE_BYTES) throw new DataFormatException("Invalid size of data in the private key");
|
||||
|
@ -50,14 +50,12 @@ public class SigningPrivateKey extends DataStructureImpl {
|
||||
_data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_data = new byte[KEYSIZE_BYTES];
|
||||
int read = read(in, _data);
|
||||
if (read != KEYSIZE_BYTES) throw new DataFormatException("Not enough bytes to read the private key");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_data == null) throw new DataFormatException("No data in the private key to write out");
|
||||
if (_data.length != KEYSIZE_BYTES) throw new DataFormatException("Invalid size of data in the private key");
|
||||
|
@ -49,14 +49,12 @@ public class SigningPublicKey extends DataStructureImpl {
|
||||
_data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_data = new byte[KEYSIZE_BYTES];
|
||||
int read = read(in, _data);
|
||||
if (read != KEYSIZE_BYTES) throw new DataFormatException("Not enough bytes to read the public key");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_data == null) throw new DataFormatException("No data in the public key to write out");
|
||||
if (_data.length != KEYSIZE_BYTES) throw new DataFormatException("Invalid size of data in the public key");
|
||||
|
@ -68,12 +68,10 @@ public class TunnelId extends DataStructureImpl {
|
||||
public int getType() { return _type; }
|
||||
public void setType(int type) { _type = type; }
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_tunnelId = DataHelper.readLong(in, 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_tunnelId < 0) throw new DataFormatException("Invalid tunnel ID: " + _tunnelId);
|
||||
DataHelper.writeLong(out, 4, _tunnelId);
|
||||
|
@ -40,12 +40,10 @@ public class AbuseReason extends DataStructureImpl {
|
||||
_reason = reason;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_reason = DataHelper.readString(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_reason == null) throw new DataFormatException("Invalid abuse reason");
|
||||
DataHelper.writeString(out, _reason);
|
||||
|
@ -41,12 +41,10 @@ public class AbuseSeverity extends DataStructureImpl {
|
||||
_severityId = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_severityId = (int) DataHelper.readLong(in, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_severityId < 0) throw new DataFormatException("Invalid abuse severity: " + _severityId);
|
||||
DataHelper.writeLong(out, 1, _severityId);
|
||||
|
@ -109,7 +109,6 @@ public class CreateLeaseSetMessage extends I2CPMessageImpl {
|
||||
return os.toByteArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
@ -68,7 +68,6 @@ public class CreateSessionMessage extends I2CPMessageImpl {
|
||||
return os.toByteArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
@ -60,7 +60,6 @@ public class DisconnectMessage extends I2CPMessageImpl {
|
||||
return os.toByteArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
@ -37,7 +37,6 @@ public class GetDateMessage extends I2CPMessageImpl {
|
||||
return rv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
@ -34,7 +34,6 @@ public abstract class I2CPMessageImpl extends DataStructureImpl implements I2CPM
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
@Override
|
||||
public void readMessage(InputStream in) throws I2CPMessageException, IOException {
|
||||
int length = 0;
|
||||
try {
|
||||
@ -58,7 +57,6 @@ public abstract class I2CPMessageImpl extends DataStructureImpl implements I2CPM
|
||||
* @param length number of bytes in the message payload
|
||||
* @throws IOException
|
||||
*/
|
||||
@Override
|
||||
public void readMessage(InputStream in, int length, int type) throws I2CPMessageException, IOException {
|
||||
if (type != getType())
|
||||
throw new I2CPMessageException("Invalid message type (found: " + type + " supported: " + getType()
|
||||
@ -105,7 +103,6 @@ public abstract class I2CPMessageImpl extends DataStructureImpl implements I2CPM
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
@Override
|
||||
public void writeMessage(OutputStream out) throws I2CPMessageException, IOException {
|
||||
byte[] data = doWriteMessage();
|
||||
try {
|
||||
@ -117,7 +114,6 @@ public abstract class I2CPMessageImpl extends DataStructureImpl implements I2CPM
|
||||
out.write(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
try {
|
||||
readMessage(in);
|
||||
@ -126,7 +122,6 @@ public abstract class I2CPMessageImpl extends DataStructureImpl implements I2CPM
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
try {
|
||||
writeMessage(out);
|
||||
|
@ -144,7 +144,6 @@ public class I2CPMessageReader {
|
||||
_stream = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while (_stayAlive) {
|
||||
while (_doRun) {
|
||||
|
@ -43,12 +43,10 @@ public class MessageId extends DataStructureImpl {
|
||||
_messageId = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_messageId = DataHelper.readLong(in, 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_messageId < 0) throw new DataFormatException("Invalid message ID: " + _messageId);
|
||||
DataHelper.writeLong(out, 4, _messageId);
|
||||
|
@ -106,7 +106,6 @@ public class MessagePayloadMessage extends I2CPMessageImpl {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
@ -150,7 +150,6 @@ public class MessageStatusMessage extends I2CPMessageImpl {
|
||||
throw new UnsupportedOperationException("This shouldn't be called... use writeMessage(out)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
@ -85,7 +85,6 @@ public class ReceiveMessageBeginMessage extends I2CPMessageImpl {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
@ -69,7 +69,6 @@ public class ReceiveMessageEndMessage extends I2CPMessageImpl {
|
||||
return rv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
@ -106,7 +106,6 @@ public class ReportAbuseMessage extends I2CPMessageImpl {
|
||||
return os.toByteArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
@ -122,7 +122,6 @@ public class RequestLeaseSetMessage extends I2CPMessageImpl {
|
||||
return os.toByteArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
@ -131,7 +131,6 @@ public class SendMessageMessage extends I2CPMessageImpl {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
@ -185,7 +185,6 @@ public class SessionConfig extends DataStructureImpl {
|
||||
return out.toByteArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream rawConfig) throws DataFormatException, IOException {
|
||||
_destination = new Destination();
|
||||
_destination.readBytes(rawConfig);
|
||||
@ -195,7 +194,6 @@ public class SessionConfig extends DataStructureImpl {
|
||||
_signature.readBytes(rawConfig);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if ((_destination == null) || (_options == null) || (_signature == null) || (_creationDate == null))
|
||||
throw new DataFormatException("Not enough data to create the session config");
|
||||
|
@ -40,12 +40,10 @@ public class SessionId extends DataStructureImpl {
|
||||
_sessionId = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readBytes(InputStream in) throws DataFormatException, IOException {
|
||||
_sessionId = (int) DataHelper.readLong(in, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeBytes(OutputStream out) throws DataFormatException, IOException {
|
||||
if (_sessionId < 0) throw new DataFormatException("Invalid session ID: " + _sessionId);
|
||||
DataHelper.writeLong(out, 2, _sessionId);
|
||||
|
@ -79,8 +79,7 @@ public class SessionStatusMessage extends I2CPMessageImpl {
|
||||
}
|
||||
return os.toByteArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public int getType() {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
@ -62,8 +62,7 @@ public class SetDateMessage extends I2CPMessageImpl {
|
||||
}
|
||||
return os.toByteArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public int getType() {
|
||||
return MESSAGE_TYPE;
|
||||
}
|
||||
|
@ -51,7 +51,6 @@ public class BufferedStatLog implements StatLog {
|
||||
writer.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addData(String scope, String stat, long value, long duration) {
|
||||
if (DISABLE_LOGGING) return;
|
||||
if (!shouldLog(stat)) return;
|
||||
@ -123,7 +122,6 @@ public class BufferedStatLog implements StatLog {
|
||||
|
||||
private class StatLogWriter implements Runnable {
|
||||
private SimpleDateFormat _fmt = new SimpleDateFormat("yyyyMMdd HH:mm:ss.SSS");
|
||||
@Override
|
||||
public void run() {
|
||||
int writeStart = -1;
|
||||
int writeEnd = -1;
|
||||
|
@ -110,7 +110,6 @@ public class Timestamper implements Runnable {
|
||||
} catch (InterruptedException ie) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try { Thread.sleep(1000); } catch (InterruptedException ie) {}
|
||||
_log = _context.logManager().getLog(Timestamper.class);
|
||||
|
@ -108,7 +108,6 @@ public final class ByteCache {
|
||||
}
|
||||
|
||||
private class Cleanup implements SimpleTimer.TimedEvent {
|
||||
@Override
|
||||
public void timeReached() {
|
||||
if (System.currentTimeMillis() - _lastOverflow > EXPIRE_PERIOD) {
|
||||
// we haven't exceeded the cache size in a few minutes, so lets
|
||||
|
@ -110,7 +110,7 @@ public class Clock implements Timestamper.UpdateListener {
|
||||
|
||||
public boolean getUpdatedSuccessfully() { return _alreadyChanged; }
|
||||
|
||||
@Override
|
||||
|
||||
public void setNow(long realTime) {
|
||||
long diff = realTime - System.currentTimeMillis();
|
||||
setOffset(diff);
|
||||
|
@ -206,7 +206,6 @@ public class DecayingBloomFilter {
|
||||
}
|
||||
|
||||
private class DecayEvent implements SimpleTimer.TimedEvent {
|
||||
@Override
|
||||
public void timeReached() {
|
||||
if (_keepDecaying) {
|
||||
decay();
|
||||
|
@ -262,7 +262,6 @@ public class EepGet {
|
||||
_startedOn = _lastComplete;
|
||||
_firstTime = true;
|
||||
}
|
||||
@Override
|
||||
public void bytesTransferred(long alreadyTransferred, int currentWrite, long bytesTransferred, long bytesRemaining, String url) {
|
||||
if (_firstTime) {
|
||||
if (alreadyTransferred > 0) {
|
||||
@ -319,7 +318,6 @@ public class EepGet {
|
||||
}
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void transferComplete(long alreadyTransferred, long bytesTransferred, long bytesRemaining, String url, String outputFile, boolean notModified) {
|
||||
long transferred;
|
||||
if (_firstTime)
|
||||
@ -358,7 +356,6 @@ public class EepGet {
|
||||
System.out.println(buf.toString());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void attemptFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt, int numRetries, Exception cause) {
|
||||
System.out.println();
|
||||
System.out.println("** " + new Date());
|
||||
@ -369,7 +366,6 @@ public class EepGet {
|
||||
_previousWritten += _written;
|
||||
_written = 0;
|
||||
}
|
||||
@Override
|
||||
public void transferFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt) {
|
||||
System.out.println("== " + new Date());
|
||||
System.out.println("== Transfer of " + url + " failed after " + currentAttempt + " attempts");
|
||||
@ -386,9 +382,7 @@ public class EepGet {
|
||||
buf.append("KBps");
|
||||
System.out.println(buf.toString());
|
||||
}
|
||||
@Override
|
||||
public void attempting(String url) {}
|
||||
@Override
|
||||
public void headerReceived(String url, int currentAttempt, String key, String val) {}
|
||||
}
|
||||
|
||||
@ -424,7 +418,6 @@ public class EepGet {
|
||||
timeout = new SocketTimeout(_fetchHeaderTimeout);
|
||||
final SocketTimeout stimeout = timeout; // ugly
|
||||
timeout.setTimeoutCommand(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("timeout reached on " + _url + ": " + stimeout);
|
||||
|
@ -30,7 +30,6 @@ public class EepGetScheduler implements EepGet.StatusListener {
|
||||
|
||||
public void fetch() {
|
||||
I2PThread t = new I2PThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
fetchNext();
|
||||
}
|
||||
@ -67,30 +66,24 @@ public class EepGetScheduler implements EepGet.StatusListener {
|
||||
get.fetch();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attemptFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt, int numRetries, Exception cause) {
|
||||
_listener.attemptFailed(url, bytesTransferred, bytesRemaining, currentAttempt, numRetries, cause);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bytesTransferred(long alreadyTransferred, int currentWrite, long bytesTransferred, long bytesRemaining, String url) {
|
||||
_listener.bytesTransferred(alreadyTransferred, currentWrite, bytesTransferred, bytesRemaining, url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transferComplete(long alreadyTransferred, long bytesTransferred, long bytesRemaining, String url, String outputFile, boolean notModified) {
|
||||
_listener.transferComplete(alreadyTransferred, bytesTransferred, bytesRemaining, url, outputFile, notModified);
|
||||
fetchNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transferFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt) {
|
||||
_listener.transferFailed(url, bytesTransferred, bytesRemaining, currentAttempt);
|
||||
fetchNext();
|
||||
}
|
||||
@Override
|
||||
public void attempting(String url) { _listener.attempting(url); }
|
||||
|
||||
@Override
|
||||
public void headerReceived(String url, int attemptNum, String key, String val) {}
|
||||
}
|
||||
|
@ -73,7 +73,6 @@ public class EepPost {
|
||||
_fields = fields;
|
||||
_onCompletion = onCompletion;
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
if (_log.shouldLog(Log.DEBUG)) _log.debug("Running the post task");
|
||||
Socket s = null;
|
||||
|
@ -38,12 +38,10 @@ public class EventDispatcherImpl implements EventDispatcher {
|
||||
private HashMap _events = new HashMap(4);
|
||||
private ArrayList _attached = new ArrayList();
|
||||
|
||||
@Override
|
||||
public EventDispatcher getEventDispatcher() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachEventDispatcher(EventDispatcher ev) {
|
||||
if (ev == null) return;
|
||||
synchronized (_attached) {
|
||||
@ -52,7 +50,6 @@ public class EventDispatcherImpl implements EventDispatcher {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detachEventDispatcher(EventDispatcher ev) {
|
||||
if (ev == null) return;
|
||||
synchronized (_attached) {
|
||||
@ -66,7 +63,6 @@ public class EventDispatcherImpl implements EventDispatcher {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyEvent(String eventName, Object args) {
|
||||
if (_ignore) return;
|
||||
if (args == null) {
|
||||
@ -89,7 +85,6 @@ public class EventDispatcherImpl implements EventDispatcher {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getEventValue(String name) {
|
||||
if (_ignore) return null;
|
||||
Object val;
|
||||
@ -112,7 +107,6 @@ public class EventDispatcherImpl implements EventDispatcher {
|
||||
return set;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ignoreEvents() {
|
||||
_ignore = true;
|
||||
synchronized (_events) {
|
||||
@ -121,12 +115,10 @@ public class EventDispatcherImpl implements EventDispatcher {
|
||||
_events = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unIgnoreEvents() {
|
||||
_ignore = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object waitEventValue(String name) {
|
||||
if (_ignore) return null;
|
||||
Object val;
|
||||
|
@ -16,7 +16,6 @@ class Executor implements Runnable {
|
||||
runn = x;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while(runn.getAnswer()) {
|
||||
SimpleTimer.TimedEvent evt = null;
|
||||
|
@ -111,7 +111,6 @@ public class I2PThread extends Thread {
|
||||
|
||||
public static void main(String args[]) {
|
||||
I2PThread t = new I2PThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
throw new NullPointerException("blah");
|
||||
}
|
||||
|
@ -44,7 +44,6 @@ class LogWriter implements Runnable {
|
||||
_write = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
_write = true;
|
||||
try {
|
||||
|
@ -248,24 +248,20 @@ public class OrderedProperties extends Properties {
|
||||
_value = val;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getKey() {
|
||||
return _key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue() {
|
||||
return _value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object setValue(Object value) {
|
||||
Object old = _value;
|
||||
_value = value;
|
||||
return old;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Object o) {
|
||||
if (o == null) return -1;
|
||||
if (o instanceof StringMapEntry) return ((String) getKey()).compareTo((String)((StringMapEntry) o).getKey());
|
||||
@ -359,7 +355,6 @@ public class OrderedProperties extends Properties {
|
||||
_props = props;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
int numRuns = 1000;
|
||||
_log.debug("Begin thrashing " + numRuns + " times");
|
||||
|
@ -114,13 +114,11 @@ public class RandomSource extends SecureRandom implements EntropyHarvester {
|
||||
|
||||
public EntropyHarvester harvester() { return _entropyHarvester; }
|
||||
|
||||
@Override
|
||||
public void feedEntropy(String source, long data, int bitoffset, int bits) {
|
||||
if (bitoffset == 0)
|
||||
setSeed(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void feedEntropy(String source, byte[] data, int offset, int len) {
|
||||
if ( (offset == 0) && (len == data.length) ) {
|
||||
setSeed(data);
|
||||
|
Reference in New Issue
Block a user