forked from I2P_Developers/i2p.i2p
Findbugs all over
This commit is contained in:
@ -30,16 +30,15 @@ import net.i2p.client.streaming.I2PSocketManager;
|
||||
*/
|
||||
public class I2Plistener implements Runnable {
|
||||
|
||||
private NamedDB info, database;
|
||||
private Logger _log;
|
||||
public I2PSocketManager socketManager;
|
||||
public I2PServerSocket serverSocket;
|
||||
private AtomicBoolean lives;
|
||||
private final NamedDB info, database;
|
||||
private final Logger _log;
|
||||
private final I2PServerSocket serverSocket;
|
||||
private final AtomicBoolean lives;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param SS
|
||||
* @param S
|
||||
* @param S unused
|
||||
* @param info
|
||||
* @param database
|
||||
* @param _log
|
||||
@ -48,7 +47,6 @@ public class I2Plistener implements Runnable {
|
||||
this.database = database;
|
||||
this.info = info;
|
||||
this._log = _log;
|
||||
this.socketManager = S;
|
||||
this.serverSocket = SS;
|
||||
this.lives = lives;
|
||||
}
|
||||
|
@ -30,12 +30,11 @@ import net.i2p.client.streaming.I2PSocketManager;
|
||||
*/
|
||||
public class TCPlistener implements Runnable {
|
||||
|
||||
private NamedDB info, database;
|
||||
private Logger _log;
|
||||
public I2PSocketManager socketManager;
|
||||
public I2PServerSocket serverSocket;
|
||||
private ServerSocket listener;
|
||||
private AtomicBoolean lives;
|
||||
private final NamedDB info, database;
|
||||
private final Logger _log;
|
||||
private final I2PSocketManager socketManager;
|
||||
private final ServerSocket listener;
|
||||
private final AtomicBoolean lives;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -34,15 +34,17 @@ import net.i2p.util.Log;
|
||||
* The skeletal frame is here, just needs to be finished.
|
||||
*
|
||||
* @author sponge
|
||||
* @deprecated incomplete, unused
|
||||
*/
|
||||
public class UDPIOthread implements I2PSessionListener, Runnable {
|
||||
|
||||
private NamedDB info;
|
||||
private Log _log;
|
||||
private Socket socket;
|
||||
private final NamedDB info;
|
||||
private final Log _log;
|
||||
private final Socket socket;
|
||||
private DataInputStream in;
|
||||
private DataOutputStream out;
|
||||
private I2PSession _session;
|
||||
private final I2PSession _session;
|
||||
// FIXME never set
|
||||
private Destination _peerDestination;
|
||||
private boolean up;
|
||||
|
||||
@ -58,7 +60,6 @@ public class UDPIOthread implements I2PSessionListener, Runnable {
|
||||
this._log = _log;
|
||||
this.socket = socket;
|
||||
this._session = _session;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,7 +27,6 @@ import net.i2p.util.Log;
|
||||
public class I2PSOCKSTunnel extends I2PTunnelClientBase {
|
||||
|
||||
private HashMap<String, List<String>> proxies = null; // port# + "" or "default" -> hostname list
|
||||
protected Destination outProxyDest = null;
|
||||
|
||||
//public I2PSOCKSTunnel(int localPort, Logging l, boolean ownDest) {
|
||||
// I2PSOCKSTunnel(localPort, l, ownDest, (EventDispatcher)null);
|
||||
|
@ -52,8 +52,6 @@ import net.i2p.util.EventDispatcher;
|
||||
private static final AtomicLong __clientId = new AtomicLong();
|
||||
protected long _clientId;
|
||||
|
||||
protected Destination dest;
|
||||
|
||||
private final Object startLock = new Object();
|
||||
|
||||
private final I2PSession _session;
|
||||
@ -98,6 +96,7 @@ import net.i2p.util.EventDispatcher;
|
||||
// create a session
|
||||
try {
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(key);
|
||||
// FIXME this may not pick up non-default I2CP host/port settings from tunnel
|
||||
_session = client.createSession(in, tunnel.getClientOptions());
|
||||
connected(_session);
|
||||
} catch(Exception exc) {
|
||||
|
@ -87,19 +87,12 @@ public class I2PTunnelUDPServerBase extends I2PTunnelTask implements Source, Sin
|
||||
|
||||
private void init(boolean verify, InputStream privData, String privkeyname, Logging l) {
|
||||
this.l = l;
|
||||
int portNum = 7654;
|
||||
if (getTunnel().port != null) {
|
||||
try {
|
||||
portNum = Integer.parseInt(getTunnel().port);
|
||||
} catch (NumberFormatException nfe) {
|
||||
_log.log(Log.CRIT, "Invalid port specified [" + getTunnel().port + "], reverting to " + portNum);
|
||||
}
|
||||
}
|
||||
|
||||
// create i2pclient
|
||||
I2PClient client = I2PClientFactory.createClient();
|
||||
|
||||
try {
|
||||
// FIXME this may not pick up non-default I2CP host/port settings from tunnel
|
||||
_session = client.createSession(privData, getTunnel().getClientOptions());
|
||||
connected(_session);
|
||||
} catch(I2PSessionException exc) {
|
||||
|
@ -1,6 +1,8 @@
|
||||
package net.i2p.router.news;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.util.VersionComparator;
|
||||
|
||||
/**
|
||||
@ -16,7 +18,7 @@ public class NewsMetadata {
|
||||
public String feedID;
|
||||
public long feedUpdated;
|
||||
|
||||
// I2P metadata
|
||||
/** I2P metadata */
|
||||
public List<Release> releases;
|
||||
|
||||
public static class Release implements Comparable<Release> {
|
||||
@ -31,6 +33,31 @@ public class NewsMetadata {
|
||||
// Sort latest version first.
|
||||
return VersionComparator.comp(other.i2pVersion, i2pVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
* For findbugs.
|
||||
* Warning, not a complete comparison.
|
||||
* Must be enhanced before using in a Map or Set.
|
||||
* @since 0.9.21
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == null)
|
||||
return false;
|
||||
if (!(o instanceof Release))
|
||||
return false;
|
||||
Release r = (Release) o;
|
||||
return DataHelper.eq(i2pVersion, r.i2pVersion);
|
||||
}
|
||||
|
||||
/**
|
||||
* For findbugs.
|
||||
* @since 0.9.21
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return DataHelper.hashCode(i2pVersion);
|
||||
}
|
||||
}
|
||||
|
||||
public static class Update implements Comparable<Update> {
|
||||
@ -44,6 +71,7 @@ public class NewsMetadata {
|
||||
return getTypeOrder() - other.getTypeOrder();
|
||||
}
|
||||
|
||||
/** lower is preferred */
|
||||
protected int getTypeOrder() {
|
||||
if ("su3".equalsIgnoreCase(type))
|
||||
return 1;
|
||||
@ -52,5 +80,30 @@ public class NewsMetadata {
|
||||
else
|
||||
return 3;
|
||||
}
|
||||
|
||||
/**
|
||||
* For findbugs.
|
||||
* Warning, not a complete comparison.
|
||||
* Must be enhanced before using in a Map or Set.
|
||||
* @since 0.9.21
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o == null)
|
||||
return false;
|
||||
if (!(o instanceof Update))
|
||||
return false;
|
||||
Update u = (Update) o;
|
||||
return getTypeOrder() == u.getTypeOrder();
|
||||
}
|
||||
|
||||
/**
|
||||
* For findbugs.
|
||||
* @since 0.9.21
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getTypeOrder();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package net.i2p.router.web;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.Arrays;
|
||||
@ -108,7 +110,7 @@ public class WebAppConfiguration implements Configuration {
|
||||
return;
|
||||
StringTokenizer tok = new StringTokenizer(cp, " ,");
|
||||
StringBuilder buf = new StringBuilder();
|
||||
Set<URL> systemCP = getSystemClassPath();
|
||||
Set<URI> systemCP = getSystemClassPath();
|
||||
while (tok.hasMoreTokens()) {
|
||||
if (buf.length() > 0)
|
||||
buf.append(',');
|
||||
@ -127,8 +129,8 @@ public class WebAppConfiguration implements Configuration {
|
||||
// TODO: Add a classpath to the command line in i2pstandalone.xml?
|
||||
File jfile = new File(path);
|
||||
File jdir = jfile.getParentFile();
|
||||
if (systemCP.contains(jfile.toURI().toURL()) ||
|
||||
(jdir != null && systemCP.contains(jdir.toURI().toURL()))) {
|
||||
if (systemCP.contains(jfile.toURI()) ||
|
||||
(jdir != null && systemCP.contains(jdir.toURI()))) {
|
||||
//System.err.println("Not adding " + path + " to classpath for " + appName + ", already in system classpath");
|
||||
// Ticket #957... don't know why...
|
||||
if (!ctxPath.equals("/susimail"))
|
||||
@ -151,13 +153,20 @@ public class WebAppConfiguration implements Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
/** @since 0.9 */
|
||||
private static Set<URL> getSystemClassPath() {
|
||||
/**
|
||||
* Convert URL to URI so there's no blocking equals(),
|
||||
* not that there's really any hostnames in here,
|
||||
* but keep findbugs happy.
|
||||
* @since 0.9
|
||||
*/
|
||||
private static Set<URI> getSystemClassPath() {
|
||||
URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
|
||||
URL urls[] = urlClassLoader.getURLs();
|
||||
Set<URL> rv = new HashSet<URL>(32);
|
||||
Set<URI> rv = new HashSet<URI>(32);
|
||||
for (int i = 0; i < urls.length; i++) {
|
||||
rv.add(urls[i]);
|
||||
try {
|
||||
rv.add(urls[i].toURI());
|
||||
} catch (URISyntaxException use) {}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public class HeaderLine implements Encoding {
|
||||
boolean quoting = false;
|
||||
boolean quote = false;
|
||||
boolean linebreak = false;
|
||||
String quotedSequence = null;
|
||||
StringBuilder quotedSequence = null;
|
||||
int rest = in.length;
|
||||
int index = 0;
|
||||
while( true ) {
|
||||
@ -102,14 +102,15 @@ public class HeaderLine implements Encoding {
|
||||
}
|
||||
if( quote ) {
|
||||
if( ! quoting ) {
|
||||
quotedSequence = "=?utf-8?Q?";
|
||||
quotedSequence = new StringBuilder(64);
|
||||
quotedSequence.append("=?utf-8?Q?");
|
||||
quoting = true;
|
||||
}
|
||||
quotedSequence += HexTable.table[ c < 0 ? 256 + c : c ];
|
||||
quotedSequence.append(HexTable.table[ c < 0 ? 256 + c : c ]);
|
||||
}
|
||||
else {
|
||||
if( quoting ) {
|
||||
quotedSequence += "?=";
|
||||
quotedSequence.append("?=");
|
||||
int sl = quotedSequence.length();
|
||||
if( l + sl > 76 ) {
|
||||
/*
|
||||
@ -138,7 +139,7 @@ public class HeaderLine implements Encoding {
|
||||
}
|
||||
}
|
||||
if( quoting ) {
|
||||
quotedSequence += "?=";
|
||||
quotedSequence.append("?=");
|
||||
int sl = quotedSequence.length();
|
||||
if( l + sl > 76 ) {
|
||||
/*
|
||||
|
@ -1,11 +1,15 @@
|
||||
package net.i2p.crypto.eddsa.math;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @since 0.9.15
|
||||
*
|
||||
*/
|
||||
public abstract class FieldElement {
|
||||
public abstract class FieldElement implements Serializable {
|
||||
private static final long serialVersionUID = 1239527465875676L;
|
||||
|
||||
protected final Field f;
|
||||
|
||||
public FieldElement(Field f) {
|
||||
|
16
history.txt
16
history.txt
@ -1,3 +1,15 @@
|
||||
2015-07-12 zzz
|
||||
* Findbugs all over
|
||||
|
||||
2015-07-08 zzz
|
||||
* Tunnels: New Bloom filter size, increase bandwidth limit (ticket #1505)
|
||||
|
||||
2015-07-07 zzz
|
||||
* Crypto: Check for error return from sign()
|
||||
* i2psnark: Tweak dest display in footer
|
||||
* Streaming: New config to add to DSA-only list
|
||||
* Updates: New news URL
|
||||
|
||||
2015-07-05 zzz
|
||||
* SSU: Compete better with NTCP for outbound bandwidth allocations
|
||||
* Transport: Adjust thread priorities to prevent I/O stalling
|
||||
@ -26,8 +38,8 @@
|
||||
raise class L/M boundary to match so defaulted routers are still L
|
||||
|
||||
2015-06-22 dg
|
||||
* NetDB: Partially revert last NetDB change: flood because we don't want to create a hole in the DHT
|
||||
before publisher resends to somebody else.
|
||||
* NetDB: Partially revert last NetDB change: flood because we don't want
|
||||
to create a hole in the DHT before publisher resends to somebody else.
|
||||
|
||||
2015-06-20 dg
|
||||
* I2PSnark: Auto-start now only starts torrents which were running at shutdown (#766)
|
||||
|
@ -52,6 +52,8 @@ public class RouterKeyGenerator extends RoutingKeyGenerator {
|
||||
public RouterKeyGenerator(I2PAppContext context) {
|
||||
_log = context.logManager().getLog(RoutingKeyGenerator.class);
|
||||
_context = context;
|
||||
// make sure GMT is set, azi2phelper Vuze plugin is disabling static JVM TZ setting in Router.java
|
||||
_fmt.setCalendar(_cal);
|
||||
// ensure non-null mod data
|
||||
generateDateBasedModData();
|
||||
}
|
||||
@ -61,14 +63,10 @@ public class RouterKeyGenerator extends RoutingKeyGenerator {
|
||||
private volatile long _nextMidnight;
|
||||
private volatile long _lastChanged;
|
||||
|
||||
private final static Calendar _cal = GregorianCalendar.getInstance(TimeZone.getTimeZone("GMT"));
|
||||
private final Calendar _cal = GregorianCalendar.getInstance(TimeZone.getTimeZone("GMT"));
|
||||
private static final String FORMAT = "yyyyMMdd";
|
||||
private static final int LENGTH = FORMAT.length();
|
||||
private final static SimpleDateFormat _fmt = new SimpleDateFormat(FORMAT, Locale.US);
|
||||
static {
|
||||
// make sure GMT is set, azi2phelper Vuze plugin is disabling static JVM TZ setting in Router.java
|
||||
_fmt.setCalendar(_cal);
|
||||
}
|
||||
private final SimpleDateFormat _fmt = new SimpleDateFormat(FORMAT, Locale.US);
|
||||
|
||||
/**
|
||||
* The current (today's) mod data.
|
||||
|
@ -113,7 +113,7 @@ class BloomFilterIVValidator implements IVValidator {
|
||||
path = _context.getBaseDir().toString();
|
||||
}
|
||||
String msg =
|
||||
"Configured for " + DataHelper.formatSize(KBps *1024) +
|
||||
"Configured for " + DataHelper.formatSize(KBps *1024L) +
|
||||
"Bps share bandwidth but only " +
|
||||
DataHelper.formatSize(maxMemory) + "B available memory." +
|
||||
" Recommend increasing wrapper.java.maxmemory in " +
|
||||
@ -121,7 +121,7 @@ class BloomFilterIVValidator implements IVValidator {
|
||||
// getMaxMemory() returns significantly lower than wrapper config, so add 10%
|
||||
" to at least " + (recMaxMem * 11 / 10 / (1024*1024)) + " (MB)" +
|
||||
" if the actual share bandwidth exceeds " +
|
||||
DataHelper.formatSize(threshKBps * 1024) + "Bps.";
|
||||
DataHelper.formatSize(threshKBps * 1024L) + "Bps.";
|
||||
System.out.println("WARN: " + msg);
|
||||
_context.logManager().getLog(BloomFilterIVValidator.class).logAlways(Log.WARN, msg);
|
||||
}
|
||||
|
Reference in New Issue
Block a user