forked from I2P_Developers/i2p.i2p
findbugs all over
This commit is contained in:
@ -37,8 +37,8 @@ class PeerMonitorTask implements Runnable
|
|||||||
|
|
||||||
private final PeerCoordinator coordinator;
|
private final PeerCoordinator coordinator;
|
||||||
|
|
||||||
private long lastDownloaded = 0;
|
//private long lastDownloaded = 0;
|
||||||
private long lastUploaded = 0;
|
//private long lastUploaded = 0;
|
||||||
|
|
||||||
PeerMonitorTask(PeerCoordinator coordinator)
|
PeerMonitorTask(PeerCoordinator coordinator)
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
/** generally "i2psnark" */
|
/** generally "i2psnark" */
|
||||||
private String _contextName;
|
private String _contextName;
|
||||||
private SnarkManager _manager;
|
private SnarkManager _manager;
|
||||||
private static long _nonce;
|
private long _nonce;
|
||||||
private String _themePath;
|
private String _themePath;
|
||||||
private String _imgPath;
|
private String _imgPath;
|
||||||
private String _lastAnnounceURL;
|
private String _lastAnnounceURL;
|
||||||
|
@ -324,7 +324,7 @@ public class I2PTunnel extends EventDispatcherImpl implements Logging {
|
|||||||
/**
|
/**
|
||||||
* Generic options used for clients and servers.
|
* Generic options used for clients and servers.
|
||||||
* NOT a copy, Do NOT modify for per-connection options, make a copy.
|
* NOT a copy, Do NOT modify for per-connection options, make a copy.
|
||||||
* @return NOT a copy, do NOT modify for per-connection options
|
* @return non-null, NOT a copy, do NOT modify for per-connection options
|
||||||
*/
|
*/
|
||||||
public Properties getClientOptions() { return _clientOptions; }
|
public Properties getClientOptions() { return _clientOptions; }
|
||||||
|
|
||||||
|
@ -608,7 +608,7 @@ public abstract class I2PTunnelHTTPClientBase extends I2PTunnelClientBase implem
|
|||||||
error = usingWWWProxy ? "dnfp" : "dnf";
|
error = usingWWWProxy ? "dnfp" : "dnf";
|
||||||
}
|
}
|
||||||
byte[] header = getErrorPage(error, ERR_DESTINATION_UNKNOWN);
|
byte[] header = getErrorPage(error, ERR_DESTINATION_UNKNOWN);
|
||||||
String message = ise.getLocalizedMessage();
|
String message = ise != null ? ise.getLocalizedMessage() : "unknown error";
|
||||||
try {
|
try {
|
||||||
writeErrorMessage(header, message, out, targetRequest, usingWWWProxy, wwwProxy);
|
writeErrorMessage(header, message, out, targetRequest, usingWWWProxy, wwwProxy);
|
||||||
} catch(IOException ioe) {}
|
} catch(IOException ioe) {}
|
||||||
|
@ -255,7 +255,7 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
|
|||||||
// Port-specific spoofhost
|
// Port-specific spoofhost
|
||||||
String spoofHost;
|
String spoofHost;
|
||||||
int ourPort = socket.getLocalPort();
|
int ourPort = socket.getLocalPort();
|
||||||
if (ourPort != 80 && ourPort > 0 && ourPort <= 65535 && opts != null) {
|
if (ourPort != 80 && ourPort > 0 && ourPort <= 65535) {
|
||||||
String portSpoof = opts.getProperty("spoofedHost." + ourPort);
|
String portSpoof = opts.getProperty("spoofedHost." + ourPort);
|
||||||
if (portSpoof != null)
|
if (portSpoof != null)
|
||||||
spoofHost = portSpoof.trim();
|
spoofHost = portSpoof.trim();
|
||||||
@ -284,11 +284,9 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
|
|||||||
// server, reads the response headers, rewriting to include Content-encoding: x-i2p-gzip
|
// server, reads the response headers, rewriting to include Content-encoding: x-i2p-gzip
|
||||||
// if it was one of the Accept-encoding: values, and gzip the payload
|
// if it was one of the Accept-encoding: values, and gzip the payload
|
||||||
boolean allowGZIP = true;
|
boolean allowGZIP = true;
|
||||||
if (opts != null) {
|
|
||||||
String val = opts.getProperty("i2ptunnel.gzip");
|
String val = opts.getProperty("i2ptunnel.gzip");
|
||||||
if ( (val != null) && (!Boolean.parseBoolean(val)) )
|
if ( (val != null) && (!Boolean.parseBoolean(val)) )
|
||||||
allowGZIP = false;
|
allowGZIP = false;
|
||||||
}
|
|
||||||
if (_log.shouldLog(Log.INFO))
|
if (_log.shouldLog(Log.INFO))
|
||||||
_log.info("HTTP server encoding header: " + enc + "/" + altEnc);
|
_log.info("HTTP server encoding header: " + enc + "/" + altEnc);
|
||||||
boolean alt = (altEnc != null) && (altEnc.indexOf("x-i2p-gzip") >= 0);
|
boolean alt = (altEnc != null) && (altEnc.indexOf("x-i2p-gzip") >= 0);
|
||||||
|
@ -1579,6 +1579,11 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
|||||||
this.constraint = constraint;
|
this.constraint = constraint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
return super.equals(o) && (o instanceof VersionAvailable);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "VersionAvailable \"" + version + "\" " + sourceMap +
|
return "VersionAvailable \"" + version + "\" " + sourceMap +
|
||||||
|
@ -235,11 +235,11 @@ public class PcapWriter {
|
|||||||
seq = 0xffffffff;
|
seq = 0xffffffff;
|
||||||
else
|
else
|
||||||
seq = pkt.getSequenceNum();
|
seq = pkt.getSequenceNum();
|
||||||
|
DataHelper.writeLong(_fos, 4, seq);
|
||||||
long acked = 0;
|
long acked = 0;
|
||||||
if (con != null) {
|
if (con != null) {
|
||||||
acked = getLowestAckedThrough(pkt, con);
|
acked = getLowestAckedThrough(pkt, con);
|
||||||
}
|
}
|
||||||
DataHelper.writeLong(_fos, 4, pkt.getSequenceNum());
|
|
||||||
DataHelper.writeLong(_fos, 4, acked);
|
DataHelper.writeLong(_fos, 4, acked);
|
||||||
|
|
||||||
// offset and flags 2 bytes
|
// offset and flags 2 bytes
|
||||||
|
@ -57,7 +57,7 @@ class Mail {
|
|||||||
private int size;
|
private int size;
|
||||||
public String sender, // as received, trimmed only, not HTML escaped
|
public String sender, // as received, trimmed only, not HTML escaped
|
||||||
reply, subject, dateString,
|
reply, subject, dateString,
|
||||||
formattedSender, // address only, enclosed with <>, not HTML escaped
|
//formattedSender, // address only, enclosed with <>, not HTML escaped
|
||||||
formattedSubject,
|
formattedSubject,
|
||||||
formattedDate, // US Locale, UTC
|
formattedDate, // US Locale, UTC
|
||||||
localFormattedDate, // Current Locale, local time zone
|
localFormattedDate, // Current Locale, local time zone
|
||||||
@ -78,7 +78,7 @@ class Mail {
|
|||||||
|
|
||||||
public Mail(String uidl) {
|
public Mail(String uidl) {
|
||||||
this.uidl = uidl;
|
this.uidl = uidl;
|
||||||
formattedSender = unknown;
|
//formattedSender = unknown;
|
||||||
formattedSubject = unknown;
|
formattedSubject = unknown;
|
||||||
formattedDate = unknown;
|
formattedDate = unknown;
|
||||||
localFormattedDate = unknown;
|
localFormattedDate = unknown;
|
||||||
@ -306,7 +306,7 @@ class Mail {
|
|||||||
|
|
||||||
if( line.startsWith( "From:" ) ) {
|
if( line.startsWith( "From:" ) ) {
|
||||||
sender = line.substring( 5 ).trim();
|
sender = line.substring( 5 ).trim();
|
||||||
formattedSender = getAddress( sender );
|
//formattedSender = getAddress( sender );
|
||||||
shortSender = sender.replace("\"", "").trim();
|
shortSender = sender.replace("\"", "").trim();
|
||||||
int lt = shortSender.indexOf('<');
|
int lt = shortSender.indexOf('<');
|
||||||
if (lt > 0)
|
if (lt > 0)
|
||||||
|
@ -113,9 +113,9 @@ class MailPart {
|
|||||||
str = getHeaderLineAttribute( headerLines[i], "boundary" );
|
str = getHeaderLineAttribute( headerLines[i], "boundary" );
|
||||||
if( str != null )
|
if( str != null )
|
||||||
boundary = str;
|
boundary = str;
|
||||||
if( x_type != null && x_type.startsWith( "multipart" ) && boundary != null )
|
if (x_type.startsWith( "multipart" ) && boundary != null )
|
||||||
x_multipart = true;
|
x_multipart = true;
|
||||||
if( x_type != null && x_type.startsWith( "message" ) )
|
if (x_type.startsWith( "message" ) )
|
||||||
x_message = true;
|
x_message = true;
|
||||||
str = getHeaderLineAttribute( headerLines[i], "name" );
|
str = getHeaderLineAttribute( headerLines[i], "name" );
|
||||||
if( str != null )
|
if( str != null )
|
||||||
|
@ -32,10 +32,10 @@ class BackgroundChecker {
|
|||||||
private static final int MIN_CHECK_MINUTES = 15;
|
private static final int MIN_CHECK_MINUTES = 15;
|
||||||
// short for testing
|
// short for testing
|
||||||
//private static final long MIN_IDLE = 10*60*1000;
|
//private static final long MIN_IDLE = 10*60*1000;
|
||||||
private final long MIN_IDLE = 30*60*1000;
|
private static final long MIN_IDLE = 30*60*1000;
|
||||||
// short for testing
|
// short for testing
|
||||||
//private static final long MIN_SINCE = 10*60*1000;
|
//private static final long MIN_SINCE = 10*60*1000;
|
||||||
private final long MIN_SINCE = 60*60*1000;
|
private static final long MIN_SINCE = 60*60*1000;
|
||||||
|
|
||||||
public BackgroundChecker(POP3MailBox mailbox) {
|
public BackgroundChecker(POP3MailBox mailbox) {
|
||||||
this.mailbox = mailbox;
|
this.mailbox = mailbox;
|
||||||
|
@ -136,7 +136,6 @@ public class POP3MailBox implements NewMailListener {
|
|||||||
*/
|
*/
|
||||||
private ReadBuffer getHeader( int id ) {
|
private ReadBuffer getHeader( int id ) {
|
||||||
Debug.debug(Debug.DEBUG, "getHeader(" + id + ")");
|
Debug.debug(Debug.DEBUG, "getHeader(" + id + ")");
|
||||||
Integer idObj = Integer.valueOf(id);
|
|
||||||
ReadBuffer header = null;
|
ReadBuffer header = null;
|
||||||
if (id >= 1 && id <= mails) {
|
if (id >= 1 && id <= mails) {
|
||||||
/*
|
/*
|
||||||
@ -234,7 +233,6 @@ public class POP3MailBox implements NewMailListener {
|
|||||||
*/
|
*/
|
||||||
private ReadBuffer getBody(int id) {
|
private ReadBuffer getBody(int id) {
|
||||||
Debug.debug(Debug.DEBUG, "getBody(" + id + ")");
|
Debug.debug(Debug.DEBUG, "getBody(" + id + ")");
|
||||||
Integer idObj = Integer.valueOf(id);
|
|
||||||
ReadBuffer body = null;
|
ReadBuffer body = null;
|
||||||
if (id >= 1 && id <= mails) {
|
if (id >= 1 && id <= mails) {
|
||||||
try {
|
try {
|
||||||
|
@ -117,7 +117,7 @@ class RequestLeaseSetMessageHandler extends HandlerImpl {
|
|||||||
_context.random().nextBytes(dummy);
|
_context.random().nextBytes(dummy);
|
||||||
spk = new SigningPrivateKey(dummy);
|
spk = new SigningPrivateKey(dummy);
|
||||||
}
|
}
|
||||||
session.getProducer().createLeaseSet(session, leaseSet, li.getSigningPrivateKey(), li.getPrivateKey());
|
session.getProducer().createLeaseSet(session, leaseSet, spk, li.getPrivateKey());
|
||||||
session.setLeaseSet(leaseSet);
|
session.setLeaseSet(leaseSet);
|
||||||
} catch (DataFormatException dfe) {
|
} catch (DataFormatException dfe) {
|
||||||
session.propogateError("Error signing the leaseSet", dfe);
|
session.propogateError("Error signing the leaseSet", dfe);
|
||||||
|
@ -181,4 +181,9 @@ public class Destination extends KeysAndCert {
|
|||||||
_cache.clear();
|
_cache.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
return super.equals(o) && (o instanceof Destination);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,4 +29,9 @@ public class RouterIdentity extends KeysAndCert {
|
|||||||
public boolean isHidden() {
|
public boolean isHidden() {
|
||||||
return (_certificate != null) && (_certificate.getCertificateType() == Certificate.CERTIFICATE_TYPE_HIDDEN);
|
return (_certificate != null) && (_certificate.getCertificateType() == Certificate.CERTIFICATE_TYPE_HIDDEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
return super.equals(o) && (o instanceof LeaseSet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,6 @@ public class SessionConfig extends DataStructureImpl {
|
|||||||
_signature.writeBytes(out);
|
_signature.writeBytes(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME missing hashCode() method FIXME */
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object object) {
|
public boolean equals(Object object) {
|
||||||
if ((object != null) && (object instanceof SessionConfig)) {
|
if ((object != null) && (object instanceof SessionConfig)) {
|
||||||
@ -217,6 +216,11 @@ public class SessionConfig extends DataStructureImpl {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return _signature != null ? _signature.hashCode() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder buf = new StringBuilder("[SessionConfig: ");
|
StringBuilder buf = new StringBuilder("[SessionConfig: ");
|
||||||
|
@ -80,4 +80,9 @@ class LogRecord {
|
|||||||
((_throwable == null && r._throwable == null) ||
|
((_throwable == null && r._throwable == null) ||
|
||||||
(_throwable != null && r._throwable != null && _throwable.getClass() == r._throwable.getClass()));
|
(_throwable != null && r._throwable != null && _throwable.getClass() == r._throwable.getClass()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return _message != null ? _message.hashCode() : 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -805,4 +805,10 @@ public class NativeBigInteger extends BigInteger {
|
|||||||
// use linux as the default, don't throw exception
|
// use linux as the default, don't throw exception
|
||||||
return "jbigi-linux-";
|
return "jbigi-linux-";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
// for findbugs
|
||||||
|
return super.equals(o);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -260,8 +260,6 @@ class OutboundClientMessageJobHelper {
|
|||||||
// remembering that key+tag so that we can decrypt it later. this means we can do the
|
// remembering that key+tag so that we can decrypt it later. this means we can do the
|
||||||
// garlic encryption without any ElGamal (yay)
|
// garlic encryption without any ElGamal (yay)
|
||||||
MessageWrapper.OneTimeSession sess = MessageWrapper.generateSession(ctx, skm);
|
MessageWrapper.OneTimeSession sess = MessageWrapper.generateSession(ctx, skm);
|
||||||
if (sess == null)
|
|
||||||
return null;
|
|
||||||
GarlicMessage msg = MessageWrapper.wrap(ctx, dsm, sess);
|
GarlicMessage msg = MessageWrapper.wrap(ctx, dsm, sess);
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
@ -187,6 +187,7 @@ public class MessageWrapper {
|
|||||||
* The recipient can then send us an AES-encrypted message,
|
* The recipient can then send us an AES-encrypted message,
|
||||||
* avoiding ElGamal.
|
* avoiding ElGamal.
|
||||||
*
|
*
|
||||||
|
* @return non-null
|
||||||
* @since 0.9.9
|
* @since 0.9.9
|
||||||
*/
|
*/
|
||||||
public static OneTimeSession generateSession(RouterContext ctx, SessionKeyManager skm) {
|
public static OneTimeSession generateSession(RouterContext ctx, SessionKeyManager skm) {
|
||||||
|
Reference in New Issue
Block a user