diff --git a/core/java/src/net/i2p/I2PException.java b/core/java/src/net/i2p/I2PException.java index 5eb38012806eb0722a2771a1d45e0d8f7feaca9a..d263766ef3ebe873df70390d3b0f5f4c412cba4f 100644 --- a/core/java/src/net/i2p/I2PException.java +++ b/core/java/src/net/i2p/I2PException.java @@ -32,17 +32,20 @@ public class I2PException extends Exception { super(msg); _source = source; } - + + @Override public void printStackTrace() { if (_source != null) _source.printStackTrace(); super.printStackTrace(); } - + + @Override public void printStackTrace(PrintStream ps) { if (_source != null) _source.printStackTrace(ps); super.printStackTrace(ps); } + @Override public void printStackTrace(PrintWriter pw) { if (_source != null) _source.printStackTrace(pw); super.printStackTrace(pw); diff --git a/core/java/src/net/i2p/client/ATalk.java b/core/java/src/net/i2p/client/ATalk.java index a517e995c17497d5a0d61b33fe193953e4f9d607..f93e9f09c312c26d629da18f7cac1dde17c0bf02 100644 --- a/core/java/src/net/i2p/client/ATalk.java +++ b/core/java/src/net/i2p/client/ATalk.java @@ -131,6 +131,7 @@ public class ATalk implements I2PSessionListener, Runnable { * application is complete. * */ + @Override public void run() { try { connect(); @@ -241,6 +242,7 @@ 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 { @@ -351,16 +353,19 @@ 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); } diff --git a/core/java/src/net/i2p/client/DisconnectMessageHandler.java b/core/java/src/net/i2p/client/DisconnectMessageHandler.java index dd3c6ea59643049aab79f2687bcf8b3777cc2c23..3234c401bbd14bd0d61fbb47c51f81b2837cda41 100644 --- a/core/java/src/net/i2p/client/DisconnectMessageHandler.java +++ b/core/java/src/net/i2p/client/DisconnectMessageHandler.java @@ -22,7 +22,8 @@ class DisconnectMessageHandler extends HandlerImpl { public DisconnectMessageHandler(I2PAppContext context) { super(context, DisconnectMessage.MESSAGE_TYPE); } - + + @Override public void handleMessage(I2CPMessage message, I2PSessionImpl session) { _log.debug("Handle message " + message); session.destroySession(false); diff --git a/core/java/src/net/i2p/client/HandlerImpl.java b/core/java/src/net/i2p/client/HandlerImpl.java index d2951bc94a4e10bab87ecc373436037e609f258c..3009201ac60f759fdae60b1314b6289800b57845 100644 --- a/core/java/src/net/i2p/client/HandlerImpl.java +++ b/core/java/src/net/i2p/client/HandlerImpl.java @@ -27,7 +27,8 @@ abstract class HandlerImpl implements I2CPMessageHandler { _type = type; _log = new Log(getClass()); } - + + @Override public int getType() { return _type; } diff --git a/core/java/src/net/i2p/client/I2PClientImpl.java b/core/java/src/net/i2p/client/I2PClientImpl.java index 4783458a3a6379768c9ea9760653cb11627e293b..48325d573f537bd8a19355c045441f12dc916b27 100644 --- a/core/java/src/net/i2p/client/I2PClientImpl.java +++ b/core/java/src/net/i2p/client/I2PClientImpl.java @@ -33,6 +33,7 @@ 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); @@ -45,6 +46,7 @@ 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); @@ -69,6 +71,7 @@ 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); } diff --git a/core/java/src/net/i2p/client/I2PSessionImpl.java b/core/java/src/net/i2p/client/I2PSessionImpl.java index 9d4d17733c42301cba971444688e48b55326c89a..984e3c739e1f1cd5c5887857e46e8e0fad608b48 100644 --- a/core/java/src/net/i2p/client/I2PSessionImpl.java +++ b/core/java/src/net/i2p/client/I2PSessionImpl.java @@ -231,6 +231,7 @@ 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(); @@ -303,6 +304,7 @@ 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; @@ -321,6 +323,7 @@ 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); @@ -332,8 +335,10 @@ 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; @@ -374,6 +379,8 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa private class VerifyUsage implements SimpleTimer.TimedEvent { private Long _msgId; public VerifyUsage(Long id) { _msgId = id; } + + @Override public void timeReached() { MessagePayloadMessage removed = null; int remaining = 0; @@ -412,6 +419,7 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa AvailabilityNotifier.this.notifyAll(); } } + @Override public void run() { _alive = true; while (_alive) { @@ -453,6 +461,7 @@ 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) { @@ -471,6 +480,7 @@ 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(); @@ -479,16 +489,19 @@ 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; } /** @@ -508,9 +521,11 @@ 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; } /** @@ -560,6 +575,7 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa /** * Tear down the session, and do NOT reconnect */ + @Override public void destroySession() { destroySession(true); } @@ -607,6 +623,7 @@ 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(); diff --git a/core/java/src/net/i2p/client/I2PSessionImpl2.java b/core/java/src/net/i2p/client/I2PSessionImpl2.java index f0307a341d3fe21522efa8d825990313f2523684..c08b16fa395f82a231a93ab02c68d94700a785b3 100644 --- a/core/java/src/net/i2p/client/I2PSessionImpl2.java +++ b/core/java/src/net/i2p/client/I2PSessionImpl2.java @@ -69,22 +69,27 @@ class I2PSessionImpl2 extends I2PSessionImpl { protected long getTimeout() { return SEND_TIMEOUT; } - + + @Override public void destroySession(boolean sendDisconnect) { clearStates(); super.destroySession(sendDisconnect); } - + + @Override 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)); } - + + @Override 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"); @@ -97,6 +102,7 @@ class I2PSessionImpl2 extends I2PSessionImpl { /** * pull the unencrypted AND DECOMPRESSED data */ + @Override public byte[] receiveMessage(int msgId) throws I2PSessionException { byte compressed[] = super.receiveMessage(msgId); if (compressed == null) { @@ -266,7 +272,8 @@ class I2PSessionImpl2 extends I2PSessionImpl { } return found; } - + + @Override public void receiveStatus(int msgId, long nonce, int status) { if (_log.shouldLog(Log.DEBUG)) _log.debug(getPrefix() + "Received status " + status + " for msgId " + msgId + " / " + nonce); MessageState state = null; @@ -335,6 +342,7 @@ class I2PSessionImpl2 extends I2PSessionImpl { * to override this to clear out the message state * */ + @Override protected boolean reconnect() { // even if we succeed in reconnecting, we want to clear the old states, // since this will be a new sessionId diff --git a/core/java/src/net/i2p/client/MessagePayloadMessageHandler.java b/core/java/src/net/i2p/client/MessagePayloadMessageHandler.java index 36121e67a1b9ec7e8430882a008ea4363fb51ee2..309c83810950d86e82e2a6301196663a608a58ba 100644 --- a/core/java/src/net/i2p/client/MessagePayloadMessageHandler.java +++ b/core/java/src/net/i2p/client/MessagePayloadMessageHandler.java @@ -28,7 +28,8 @@ class MessagePayloadMessageHandler extends HandlerImpl { public MessagePayloadMessageHandler(I2PAppContext context) { super(context, MessagePayloadMessage.MESSAGE_TYPE); } - + + @Override public void handleMessage(I2CPMessage message, I2PSessionImpl session) { if (_log.shouldLog(Log.DEBUG)) _log.debug("Handle message " + message); diff --git a/core/java/src/net/i2p/client/MessageStatusMessageHandler.java b/core/java/src/net/i2p/client/MessageStatusMessageHandler.java index a18be3286ae854a796140887a2c80171c9355088..ef1adff36f6d4496c4e6e7316311f59cc7be535a 100644 --- a/core/java/src/net/i2p/client/MessageStatusMessageHandler.java +++ b/core/java/src/net/i2p/client/MessageStatusMessageHandler.java @@ -25,7 +25,8 @@ class MessageStatusMessageHandler extends HandlerImpl { public MessageStatusMessageHandler(I2PAppContext context) { super(context, MessageStatusMessage.MESSAGE_TYPE); } - + + @Override public void handleMessage(I2CPMessage message, I2PSessionImpl session) { boolean skipStatus = true; if (_log.shouldLog(Log.DEBUG)) diff --git a/core/java/src/net/i2p/client/RequestLeaseSetMessageHandler.java b/core/java/src/net/i2p/client/RequestLeaseSetMessageHandler.java index 41e9f118b2005e339d87951ab6fec7e0c56caaf4..6cbce8161e8bae1cbf2c3e2579e5afc0b64fb644 100644 --- a/core/java/src/net/i2p/client/RequestLeaseSetMessageHandler.java +++ b/core/java/src/net/i2p/client/RequestLeaseSetMessageHandler.java @@ -39,7 +39,8 @@ class RequestLeaseSetMessageHandler extends HandlerImpl { super(context, RequestLeaseSetMessage.MESSAGE_TYPE); _existingLeaseSets = new HashMap(32); } - + + @Override public void handleMessage(I2CPMessage message, I2PSessionImpl session) { if (_log.shouldLog(Log.DEBUG)) _log.debug("Handle message " + message); @@ -121,12 +122,14 @@ class RequestLeaseSetMessageHandler extends HandlerImpl { public SigningPrivateKey getSigningPrivateKey() { return _signingPrivKey; } - + + @Override public int hashCode() { return DataHelper.hashCode(_pubKey) + 7 * DataHelper.hashCode(_privKey) + 7 * 7 * DataHelper.hashCode(_signingPubKey) + 7 * 7 * 7 * DataHelper.hashCode(_signingPrivKey); } - + + @Override public boolean equals(Object obj) { if ((obj == null) || !(obj instanceof LeaseInfo)) return false; LeaseInfo li = (LeaseInfo) obj; diff --git a/core/java/src/net/i2p/client/SessionStatusMessageHandler.java b/core/java/src/net/i2p/client/SessionStatusMessageHandler.java index 9fc688651440f6a1676cd291f2ad811530038778..65c3299215bf2ac57b529806a7b5efe7709e7fe8 100644 --- a/core/java/src/net/i2p/client/SessionStatusMessageHandler.java +++ b/core/java/src/net/i2p/client/SessionStatusMessageHandler.java @@ -23,7 +23,8 @@ class SessionStatusMessageHandler extends HandlerImpl { public SessionStatusMessageHandler(I2PAppContext context) { super(context, SessionStatusMessage.MESSAGE_TYPE); } - + + @Override public void handleMessage(I2CPMessage message, I2PSessionImpl session) { _log.debug("Handle message " + message); SessionStatusMessage msg = (SessionStatusMessage) message; diff --git a/core/java/src/net/i2p/client/SetDateMessageHandler.java b/core/java/src/net/i2p/client/SetDateMessageHandler.java index a204660d60b4fc14e3302a27503fa447bc6f825e..5783a8cfb7474b16ccf80fd167a666d7404f2f00 100644 --- a/core/java/src/net/i2p/client/SetDateMessageHandler.java +++ b/core/java/src/net/i2p/client/SetDateMessageHandler.java @@ -23,7 +23,8 @@ class SetDateMessageHandler extends HandlerImpl { public SetDateMessageHandler(I2PAppContext ctx) { super(ctx, SetDateMessage.MESSAGE_TYPE); } - + + @Override public void handleMessage(I2CPMessage message, I2PSessionImpl session) { _log.debug("Handle message " + message); SetDateMessage msg = (SetDateMessage) message; diff --git a/core/java/src/net/i2p/client/naming/AddressDBNamingService.java b/core/java/src/net/i2p/client/naming/AddressDBNamingService.java index 72cee3cdab1fffb3cf17ffc82f136fa6df748af3..4dc65a10d2a4fe01bfa384625df1b2dc0a6c1f61 100644 --- a/core/java/src/net/i2p/client/naming/AddressDBNamingService.java +++ b/core/java/src/net/i2p/client/naming/AddressDBNamingService.java @@ -18,7 +18,8 @@ public class AddressDBNamingService extends NamingService { private AddressDBNamingService() { super(null); } - + + @Override public Destination lookup(String hostname) { Address addr = _addressdb.get(hostname); if (addr != null) { @@ -28,7 +29,8 @@ public class AddressDBNamingService extends NamingService { return lookupBase64(hostname); } } - + + @Override public String reverseLookup(Destination dest) { Iterator iter = _addressdb.hostnames().iterator(); while (iter.hasNext()) { diff --git a/core/java/src/net/i2p/client/naming/DummyAddressDB.java b/core/java/src/net/i2p/client/naming/DummyAddressDB.java index 3d151b587afe18806d81836474c0bae715097839..d7ee9bac1593e1b6dcafda901290960188d68243 100644 --- a/core/java/src/net/i2p/client/naming/DummyAddressDB.java +++ b/core/java/src/net/i2p/client/naming/DummyAddressDB.java @@ -10,31 +10,38 @@ public class DummyAddressDB extends AddressDB { public DummyAddressDB(I2PAppContext context) { super(context); } - + + @Override public Address get(String hostname) { return null; } - + + @Override public Address put(Address address) { return null; } - + + @Override public Address remove(String hostname) { return null; } - + + @Override public Address remove(Address address) { return null; } - + + @Override public boolean contains(Address address) { return false; } - + + @Override public boolean contains(String hostname) { return false; } + @Override public Collection hostnames() { return null; } diff --git a/core/java/src/net/i2p/client/naming/DummyNamingService.java b/core/java/src/net/i2p/client/naming/DummyNamingService.java index e956dfc8de08a2c8258260a63af5aa46b800c240..dddd5915b3abc3a3d42b5e8e6232c64be0348f3d 100644 --- a/core/java/src/net/i2p/client/naming/DummyNamingService.java +++ b/core/java/src/net/i2p/client/naming/DummyNamingService.java @@ -23,10 +23,12 @@ class DummyNamingService extends NamingService { protected DummyNamingService(I2PAppContext context) { super(context); } private DummyNamingService() { super(null); } + @Override public Destination lookup(String hostname) { return lookupBase64(hostname); } - + + @Override public String reverseLookup(Destination dest) { return null; } diff --git a/core/java/src/net/i2p/client/naming/EepGetNamingService.java b/core/java/src/net/i2p/client/naming/EepGetNamingService.java index a90b53d4dc5a64b19f6d86cd717fb0cb57ebcf75..897d645ba9e690fdb0d29536e21042daa246fdc3 100644 --- a/core/java/src/net/i2p/client/naming/EepGetNamingService.java +++ b/core/java/src/net/i2p/client/naming/EepGetNamingService.java @@ -57,7 +57,8 @@ public class EepGetNamingService extends NamingService { rv.add(tok.nextToken()); return rv; } - + + @Override public Destination lookup(String hostname) { // If it's long, assume it's a key. if (hostname.length() >= DEST_SIZE) @@ -135,7 +136,8 @@ public class EepGetNamingService extends NamingService { _log.error("Caught from: " + url + hostname); return null; } - + + @Override public String reverseLookup(Destination dest) { return null; } diff --git a/core/java/src/net/i2p/client/naming/ExecNamingService.java b/core/java/src/net/i2p/client/naming/ExecNamingService.java index b5dd44246542a215d87c309022dad7f300a1a775..86b808f78ebfb364d1641d751ea04254aabd698b 100644 --- a/core/java/src/net/i2p/client/naming/ExecNamingService.java +++ b/core/java/src/net/i2p/client/naming/ExecNamingService.java @@ -57,7 +57,8 @@ public class ExecNamingService extends NamingService { public ExecNamingService(I2PAppContext context) { super(context); } - + + @Override public Destination lookup(String hostname) { // If it's long, assume it's a key. if (hostname.length() >= DEST_SIZE) @@ -125,7 +126,8 @@ public class ExecNamingService extends NamingService { } return null; } - + + @Override public String reverseLookup(Destination dest) { return null; } diff --git a/core/java/src/net/i2p/client/naming/FilesystemAddressDB.java b/core/java/src/net/i2p/client/naming/FilesystemAddressDB.java index f644674609a10410cc254ac8661fb65d90c6c500..cefbf5eea6d0048c7813946dfd9065470514555e 100644 --- a/core/java/src/net/i2p/client/naming/FilesystemAddressDB.java +++ b/core/java/src/net/i2p/client/naming/FilesystemAddressDB.java @@ -50,7 +50,8 @@ public class FilesystemAddressDB extends AddressDB { } } } - + + @Override public Address get(String hostname) { String dir = _context.getProperty(PROP_ADDRESS_DIR, DEFAULT_ADDRESS_DIR); File f = new File(dir, hostname); @@ -73,7 +74,8 @@ public class FilesystemAddressDB extends AddressDB { return null; } } - + + @Override public Address put(Address address) { Address previous = get(address.getHostname()); @@ -86,7 +88,8 @@ public class FilesystemAddressDB extends AddressDB { } return previous; } - + + @Override public Address remove(String hostname) { Address previous = get(hostname); @@ -95,7 +98,8 @@ public class FilesystemAddressDB extends AddressDB { f.delete(); return previous; } - + + @Override public Address remove(Address address) { if (contains(address)) { return remove(address.getHostname()); @@ -103,16 +107,19 @@ public class FilesystemAddressDB extends AddressDB { return null; } } - + + @Override public boolean contains(Address address) { Address inDb = get(address.getHostname()); return inDb.equals(address); } - + + @Override public boolean contains(String hostname) { return hostnames().contains(hostname); } - + + @Override public Collection hostnames() { String dir = _context.getProperty(PROP_ADDRESS_DIR, DEFAULT_ADDRESS_DIR); File f = new File(dir); diff --git a/core/java/src/net/i2p/client/naming/HostsTxtNamingService.java b/core/java/src/net/i2p/client/naming/HostsTxtNamingService.java index 2307816be8875ecbc7cd2d91ef67a326e67f0e2c..d4ee7e3458b0d6d3e57ef23044e57e0b60db085b 100644 --- a/core/java/src/net/i2p/client/naming/HostsTxtNamingService.java +++ b/core/java/src/net/i2p/client/naming/HostsTxtNamingService.java @@ -54,7 +54,8 @@ public class HostsTxtNamingService extends NamingService { rv.add(tok.nextToken()); return rv; } - + + @Override public Destination lookup(String hostname) { Destination d = getCache(hostname); if (d != null) @@ -94,7 +95,8 @@ public class HostsTxtNamingService extends NamingService { } return null; } - + + @Override public String reverseLookup(Destination dest) { String destkey = dest.toBase64(); List filenames = getFilenames(); diff --git a/core/java/src/net/i2p/client/naming/MetaNamingService.java b/core/java/src/net/i2p/client/naming/MetaNamingService.java index 753b50f153631d6d5b2153782cbf6b4f7a4ab2f8..8f98532c607a410b0afe5f432fa3675d1dd9138d 100644 --- a/core/java/src/net/i2p/client/naming/MetaNamingService.java +++ b/core/java/src/net/i2p/client/naming/MetaNamingService.java @@ -33,6 +33,7 @@ public class MetaNamingService extends NamingService { } } + @Override public Destination lookup(String hostname) { Iterator iter = _services.iterator(); while (iter.hasNext()) { @@ -44,7 +45,8 @@ public class MetaNamingService extends NamingService { } return lookupBase64(hostname); } - + + @Override public String reverseLookup(Destination dest) { Iterator iter = _services.iterator(); while (iter.hasNext()) { diff --git a/core/java/src/net/i2p/client/naming/PetName.java b/core/java/src/net/i2p/client/naming/PetName.java index 3642fd14e214bf17404b748a4e4747a8ec8c91f4..128fb9811da05b53bb9270535ce0370050ba7cd6 100644 --- a/core/java/src/net/i2p/client/naming/PetName.java +++ b/core/java/src/net/i2p/client/naming/PetName.java @@ -122,6 +122,7 @@ public class PetName { return false; } + @Override public String toString() { StringBuffer buf = new StringBuffer(256); if (_name != null) buf.append(_name.trim()); @@ -142,6 +143,7 @@ public class PetName { return buf.toString(); } + @Override public boolean equals(Object obj) { if ( (obj == null) || !(obj instanceof PetName) ) return false; PetName pn = (PetName)obj; @@ -150,6 +152,7 @@ public class PetName { DataHelper.eq(_network, pn._network) && DataHelper.eq(_protocol, pn._protocol); } + @Override public int hashCode() { int rv = 0; rv += DataHelper.hashCode(_name); diff --git a/core/java/src/net/i2p/client/naming/PetNameNamingService.java b/core/java/src/net/i2p/client/naming/PetNameNamingService.java index 1d0294a251d57ebbdb91a75d600ce62c4a20cf1a..ec59249a7ee832002df55f006859457f26f08850 100644 --- a/core/java/src/net/i2p/client/naming/PetNameNamingService.java +++ b/core/java/src/net/i2p/client/naming/PetNameNamingService.java @@ -45,7 +45,8 @@ public class PetNameNamingService extends NamingService { } catch (IOException ioe) { } } - + + @Override public Destination lookup(String hostname) { PetName name = _petnameDb.getByName(hostname); if (name != null && name.getNetwork().equalsIgnoreCase("i2p")) { @@ -54,7 +55,8 @@ public class PetNameNamingService extends NamingService { return lookupBase64(hostname); } } - + + @Override public String reverseLookup(Destination dest) { return _petnameDb.getByLocation(dest.toBase64()).getName(); }