findbugs all over

This commit is contained in:
zzz
2017-08-09 21:24:02 +00:00
parent 24414845d0
commit 3d385228f0
14 changed files with 15 additions and 16 deletions

View File

@ -45,7 +45,7 @@ public class MUXlisten implements Runnable {
private ThreadGroup tg; private ThreadGroup tg;
private final String N; private final String N;
private ServerSocket listener; private ServerSocket listener;
private final int backlog = 50; // should this be more? less? private static final int backlog = 50; // should this be more? less?
private final boolean go_out; private final boolean go_out;
private final boolean come_in; private final boolean come_in;
private final AtomicBoolean lock; private final AtomicBoolean lock;

View File

@ -846,6 +846,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
* @param nInfo who to send it to * @param nInfo who to send it to
* @return success * @return success
*/ */
/****
private boolean sendError(NodeInfo nInfo, MsgID msgID, int err, String msg) { private boolean sendError(NodeInfo nInfo, MsgID msgID, int err, String msg) {
if (_log.shouldLog(Log.INFO)) if (_log.shouldLog(Log.INFO))
_log.info("Sending error " + msg + " to: " + nInfo); _log.info("Sending error " + msg + " to: " + nInfo);
@ -856,6 +857,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
map.put("e", error); map.put("e", error);
return sendError(nInfo, msgID, map); return sendError(nInfo, msgID, map);
} }
****/
// Low-level send methods // Low-level send methods

View File

@ -245,7 +245,7 @@ public class RandomArt {
if (mod != 0) { if (mod != 0) {
//base += mod * 16; //base += mod * 16;
//base += mod * 16 * 256; //base += mod * 16 * 256;
base += mod * 5 * 256 * 256; base += mod * (5 * 256 * 256L);
} }
if (base > 0xffffff || base < 0) if (base > 0xffffff || base < 0)
base &= 0xffffff; base &= 0xffffff;

View File

@ -190,7 +190,6 @@ public class NewsManager implements ClientApp {
} }
private List<NewsEntry> parseInitialNews() { private List<NewsEntry> parseInitialNews() {
NewsEntry entry = new NewsEntry();
File file = new File(_context.getBaseDir(), "docs/initialNews/initialNews.xml"); File file = new File(_context.getBaseDir(), "docs/initialNews/initialNews.xml");
Reader reader = null; Reader reader = null;
try { try {

View File

@ -146,7 +146,7 @@ class ProfileOrganizerRenderer {
buf.append("<td align=\"right\"><i>").append(_t("unknown")).append("</i></td>"); buf.append("<td align=\"right\"><i>").append(_t("unknown")).append("</i></td>");
} }
buf.append("<td align=\"right\">"); buf.append("<td align=\"right\">");
String v = info.getOption("router.version"); String v = info != null ? info.getOption("router.version") : null;
if (v != null) if (v != null)
buf.append(DataHelper.stripHTML(v)); buf.append(DataHelper.stripHTML(v));
buf.append("</td><td align=\"right\">").append(num(prof.getSpeedValue())); buf.append("</td><td align=\"right\">").append(num(prof.getSpeedValue()));

View File

@ -233,7 +233,7 @@ class SybilRenderer {
buf.append("<h3 id=\"dest\" class=\"sybils\">Floodfills Close to Our Destinations</h3>"); buf.append("<h3 id=\"dest\" class=\"sybils\">Floodfills Close to Our Destinations</h3>");
Map<Hash, TunnelPool> clientInboundPools = _context.tunnelManager().getInboundClientPools(); Map<Hash, TunnelPool> clientInboundPools = _context.tunnelManager().getInboundClientPools();
List<Hash> destinations = new ArrayList<Hash>(clientInboundPools.keySet()); List<Hash> destinations = new ArrayList<Hash>(clientInboundPools.keySet());
boolean debug = _context.getBooleanProperty(HelperBase.PROP_ADVANCED); //boolean debug = _context.getBooleanProperty(HelperBase.PROP_ADVANCED);
for (Hash client : destinations) { for (Hash client : destinations) {
boolean isLocal = _context.clientManager().isLocal(client); boolean isLocal = _context.clientManager().isLocal(client);
if (!isLocal) if (!isLocal)
@ -318,7 +318,7 @@ class SybilRenderer {
} }
} }
double avg = total / (sz * sz / 2); double avg = total / (sz * sz / 2d);
buf.append("<h3 class=\"sybils\">Average Floodfill Distance is ").append(fmt.format(avg)).append("</h3>"); buf.append("<h3 class=\"sybils\">Average Floodfill Distance is ").append(fmt.format(avg)).append("</h3>");
buf.append("<h3 id=\"pairs\" class=\"sybils\">Closest Floodfill Pairs by Hash</h3>"); buf.append("<h3 id=\"pairs\" class=\"sybils\">Closest Floodfill Pairs by Hash</h3>");

View File

@ -173,8 +173,6 @@ class SAMv3Handler extends SAMv1Handler
try { try {
Socket socket = getClientSocket().socket(); Socket socket = getClientSocket().socket();
InputStream in = socket.getInputStream();
StringBuilder buf = new StringBuilder(1024); StringBuilder buf = new StringBuilder(1024);
boolean gotFirstLine = false; boolean gotFirstLine = false;
while (true) { while (true) {

View File

@ -2049,7 +2049,7 @@ public class WebMail extends HttpServlet
ok = false; ok = false;
sessionObject.error += e.getMessage(); sessionObject.error += e.getMessage();
} }
String boundary = "_="+(int)(Math.random()*Integer.MAX_VALUE)+""+(int)(Math.random()*Integer.MAX_VALUE); String boundary = "_=" + I2PAppContext.getGlobalContext().random().nextLong();
boolean multipart = false; boolean multipart = false;
if( sessionObject.attachments != null && !sessionObject.attachments.isEmpty() ) { if( sessionObject.attachments != null && !sessionObject.attachments.isEmpty() ) {
multipart = true; multipart = true;

View File

@ -599,10 +599,10 @@ public final class KeyStoreUtil {
throw new IOException("Can't create directory " + dir); throw new IOException("Can't create directory " + dir);
} }
Object[] rv = SelfSignedGenerator.generate(cname, ou, null, "I2P Anonymous Network", null, null, validDays, type); Object[] rv = SelfSignedGenerator.generate(cname, ou, null, "I2P Anonymous Network", null, null, validDays, type);
PublicKey jpub = (PublicKey) rv[0]; //PublicKey jpub = (PublicKey) rv[0];
PrivateKey jpriv = (PrivateKey) rv[1]; PrivateKey jpriv = (PrivateKey) rv[1];
X509Certificate cert = (X509Certificate) rv[2]; X509Certificate cert = (X509Certificate) rv[2];
X509CRL crl = (X509CRL) rv[3]; //X509CRL crl = (X509CRL) rv[3];
List<X509Certificate> certs = Collections.singletonList(cert); List<X509Certificate> certs = Collections.singletonList(cert);
storePrivateKey(ks, ksPW, alias, keyPW, jpriv, certs); storePrivateKey(ks, ksPW, alias, keyPW, jpriv, certs);
return rv; return rv;

View File

@ -713,7 +713,7 @@ public final class SelfSignedGenerator {
private static final void test(String name, SigType type) throws Exception { private static final void test(String name, SigType type) throws Exception {
Object[] rv = generate("cname@example.com", "ou", "o", null, "st", "c", 3652, type); Object[] rv = generate("cname@example.com", "ou", "o", null, "st", "c", 3652, type);
PublicKey jpub = (PublicKey) rv[0]; //PublicKey jpub = (PublicKey) rv[0];
PrivateKey jpriv = (PrivateKey) rv[1]; PrivateKey jpriv = (PrivateKey) rv[1];
X509Certificate cert = (X509Certificate) rv[2]; X509Certificate cert = (X509Certificate) rv[2];
X509CRL crl = (X509CRL) rv[3]; X509CRL crl = (X509CRL) rv[3];

View File

@ -1396,7 +1396,8 @@ public class EepGet {
if ( /* (!_shouldProxy) && */ if ( /* (!_shouldProxy) && */
// This is kindof a hack, but if we are downloading a gzip file // This is kindof a hack, but if we are downloading a gzip file
// we don't want to transparently gunzip it and save it as a .gz file. // we don't want to transparently gunzip it and save it as a .gz file.
(!path.endsWith(".gz")) && (!path.endsWith(".tgz"))) path == null ||
(!path.endsWith(".gz") && !path.endsWith(".tgz")))
buf.append("gzip"); buf.append("gzip");
buf.append("\r\n"); buf.append("\r\n");
if(!uaOverridden) if(!uaOverridden)

View File

@ -228,7 +228,7 @@ public class RouterKeyGenerator extends RoutingKeyGenerator {
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
int st = 0; int st = 0;
if (args.length > 1 && (args[0].startsWith("+") || args[0].startsWith("-"))) { if (args.length > 1 && (args[0].startsWith("+") || args[0].startsWith("-"))) {
now += Integer.parseInt(args[0]) * 24*60*60*1000L; now += Integer.parseInt(args[0]) * (24*60*60*1000L);
st++; st++;
} }
RouterKeyGenerator rkg = new RouterKeyGenerator(I2PAppContext.getGlobalContext()); RouterKeyGenerator rkg = new RouterKeyGenerator(I2PAppContext.getGlobalContext());

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 0; public final static long BUILD = 1;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "";

View File

@ -462,7 +462,6 @@ public class WorkingDir {
if (!src.exists()) return false; if (!src.exists()) return false;
boolean rv = true; boolean rv = true;
byte buf[] = new byte[4096];
FileInputStream in = null; FileInputStream in = null;
FileOutputStream out = null; FileOutputStream out = null;
try { try {