More findbugs cleanup
This commit is contained in:
@ -120,6 +120,8 @@ public class ConnectionAcceptor implements Runnable
|
||||
if (serverSocket == null)
|
||||
try { Thread.sleep(10*1000); } catch (InterruptedException ie) {}
|
||||
}
|
||||
if(stop)
|
||||
break;
|
||||
try
|
||||
{
|
||||
I2PSocket socket = serverSocket.accept();
|
||||
|
@ -185,7 +185,8 @@ public class I2PSnarkUtil {
|
||||
out = File.createTempFile("i2psnark", "url", new File("."));
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
out.delete();
|
||||
if (out != null)
|
||||
out.delete();
|
||||
return null;
|
||||
}
|
||||
String fetchURL = url;
|
||||
|
@ -408,7 +408,7 @@ public class MetaInfo
|
||||
info.put("name", name);
|
||||
if (name_utf8 != null)
|
||||
info.put("name.utf-8", name_utf8);
|
||||
info.put("piece length", new Integer(piece_length));
|
||||
info.put("piece length", Integer.valueOf(piece_length));
|
||||
info.put("pieces", piece_hashes);
|
||||
if (files == null)
|
||||
info.put("length", new Long(length));
|
||||
@ -434,9 +434,10 @@ public class MetaInfo
|
||||
Map info = createInfoMap();
|
||||
StringBuffer buf = new StringBuffer(128);
|
||||
buf.append("info: ");
|
||||
for (Iterator iter = info.keySet().iterator(); iter.hasNext(); ) {
|
||||
String key = (String)iter.next();
|
||||
Object val = info.get(key);
|
||||
for (Iterator iter = info.entrySet().iterator(); iter.hasNext(); ) {
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
String key = (String)entry.getKey();
|
||||
Object val = entry.getValue();
|
||||
buf.append(key).append('=');
|
||||
if (val instanceof byte[])
|
||||
buf.append(Base64.encode((byte[])val, true));
|
||||
|
@ -30,7 +30,7 @@ import java.util.TimerTask;
|
||||
class PeerMonitorTask extends TimerTask
|
||||
{
|
||||
final static long MONITOR_PERIOD = 10 * 1000; // Ten seconds.
|
||||
private final long KILOPERSECOND = 1024 * (MONITOR_PERIOD / 1000);
|
||||
private static final long KILOPERSECOND = 1024 * (MONITOR_PERIOD / 1000);
|
||||
|
||||
private final PeerCoordinator coordinator;
|
||||
|
||||
|
@ -255,8 +255,8 @@ public class Snark
|
||||
if (slistener == null)
|
||||
slistener = this;
|
||||
|
||||
if (clistener == null)
|
||||
clistener = this;
|
||||
//if (clistener == null)
|
||||
// clistener = this;
|
||||
|
||||
this.torrent = torrent;
|
||||
this.rootDataDir = rootDir;
|
||||
@ -312,9 +312,9 @@ public class Snark
|
||||
// Figure out what the torrent argument represents.
|
||||
meta = null;
|
||||
File f = null;
|
||||
InputStream in = null;
|
||||
try
|
||||
{
|
||||
InputStream in = null;
|
||||
f = new File(torrent);
|
||||
if (f.exists())
|
||||
in = new FileInputStream(f);
|
||||
@ -364,8 +364,11 @@ public class Snark
|
||||
*/
|
||||
else
|
||||
fatal("Cannot open '" + torrent + "'", ioe);
|
||||
}
|
||||
|
||||
} finally {
|
||||
if (in != null)
|
||||
try { in.close(); } catch (IOException ioe) {}
|
||||
}
|
||||
|
||||
debug(meta.toString(), INFO);
|
||||
|
||||
// When the metainfo torrent was created from an existing file/dir
|
||||
@ -721,7 +724,7 @@ public class Snark
|
||||
{
|
||||
// Use the MetaInfo from the storage since our own might not
|
||||
// yet be setup correctly.
|
||||
MetaInfo meta = storage.getMetaInfo();
|
||||
//MetaInfo meta = storage.getMetaInfo();
|
||||
//if (meta != null)
|
||||
// System.out.print("Checking existing "
|
||||
// + meta.getPieces()
|
||||
|
@ -90,9 +90,10 @@ public class I2PSnarkServlet extends HttpServlet {
|
||||
out.write("<tr><td><a href=\"http://codevoid.i2p/forums/5\" class=\"snarkRefresh\">Wishlist</a>\n");
|
||||
int count = 1;
|
||||
Map trackers = _manager.getTrackers();
|
||||
for (Iterator iter = trackers.keySet().iterator(); iter.hasNext(); ) {
|
||||
String name = (String)iter.next();
|
||||
String baseURL = (String)trackers.get(name);
|
||||
for (Iterator iter = trackers.entrySet().iterator(); iter.hasNext(); ) {
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
String name = (String)entry.getKey();
|
||||
String baseURL = (String)entry.getValue();
|
||||
int e = baseURL.indexOf('=');
|
||||
if (e < 0)
|
||||
continue;
|
||||
@ -496,9 +497,10 @@ public class I2PSnarkServlet extends HttpServlet {
|
||||
String announce = snark.meta.getAnnounce();
|
||||
if (announce.startsWith("http://YRgrgTLG") || announce.startsWith("http://8EoJZIKr")) {
|
||||
Map trackers = _manager.getTrackers();
|
||||
for (Iterator iter = trackers.keySet().iterator(); iter.hasNext(); ) {
|
||||
String name = (String)iter.next();
|
||||
String baseURL = (String)trackers.get(name);
|
||||
for (Iterator iter = trackers.entrySet().iterator(); iter.hasNext(); ) {
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
String name = (String)entry.getKey();
|
||||
String baseURL = (String)entry.getValue();
|
||||
if (!baseURL.startsWith(announce))
|
||||
continue;
|
||||
int e = baseURL.indexOf('=');
|
||||
@ -668,9 +670,10 @@ public class I2PSnarkServlet extends HttpServlet {
|
||||
+ "\" title=\"File to seed (must be within the specified path)\" /><br />\n");
|
||||
out.write("Tracker: <select name=\"announceURL\"><option value=\"\">Select a tracker</option>\n");
|
||||
Map trackers = _manager.getTrackers();
|
||||
for (Iterator iter = trackers.keySet().iterator(); iter.hasNext(); ) {
|
||||
String name = (String)iter.next();
|
||||
String announceURL = (String)trackers.get(name);
|
||||
for (Iterator iter = trackers.entrySet().iterator(); iter.hasNext(); ) {
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
String name = (String)entry.getKey();
|
||||
String announceURL = (String)entry.getValue();
|
||||
int e = announceURL.indexOf('=');
|
||||
if (e > 0)
|
||||
announceURL = announceURL.substring(0, e);
|
||||
@ -741,9 +744,10 @@ public class I2PSnarkServlet extends HttpServlet {
|
||||
+ I2PSnarkUtil.instance().getI2CPPort() + "\" size=\"5\" maxlength=\"5\" /> <br />\n");
|
||||
StringBuffer opts = new StringBuffer(64);
|
||||
Map options = new TreeMap(I2PSnarkUtil.instance().getI2CPOptions());
|
||||
for (Iterator iter = options.keySet().iterator(); iter.hasNext(); ) {
|
||||
String key = (String)iter.next();
|
||||
String val = (String)options.get(key);
|
||||
for (Iterator iter = options.entrySet().iterator(); iter.hasNext(); ) {
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
String key = (String)entry.getKey();
|
||||
String val = (String)entry.getValue();
|
||||
opts.append(key).append('=').append(val).append(' ');
|
||||
}
|
||||
out.write("I2CP opts: <input type=\"text\" name=\"i2cpOpts\" size=\"80\" value=\""
|
||||
|
@ -584,9 +584,10 @@ public class LogManager {
|
||||
limits.put(lim.getRootName(), Log.toLevelString(lim.getLimit()));
|
||||
}
|
||||
}
|
||||
for (Iterator iter = limits.keySet().iterator(); iter.hasNext(); ) {
|
||||
String path = (String)iter.next();
|
||||
String lim = (String)limits.get(path);
|
||||
for (Iterator iter = limits.entrySet().iterator(); iter.hasNext(); ) {
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
String path = (String)entry.getKey();
|
||||
String lim = (String)entry.getValue();
|
||||
buf.append(PROP_RECORD_PREFIX).append(path);
|
||||
buf.append('=').append(lim).append('\n');
|
||||
}
|
||||
@ -659,4 +660,4 @@ public class LogManager {
|
||||
shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -120,9 +120,10 @@ public class OrderedProperties extends Properties {
|
||||
|
||||
public void putAll(Map data) {
|
||||
if (data == null) return;
|
||||
for (Iterator iter = data.keySet().iterator(); iter.hasNext();) {
|
||||
Object key = iter.next();
|
||||
Object val = data.get(key);
|
||||
for (Iterator iter = data.entrySet().iterator(); iter.hasNext();) {
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
Object key = entry.getKey();
|
||||
Object val = entry.getValue();
|
||||
put(key, val);
|
||||
}
|
||||
}
|
||||
@ -348,4 +349,4 @@ public class OrderedProperties extends Properties {
|
||||
_log.debug("Done thrashing " + numRuns + " times");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
38
history.txt
38
history.txt
@ -1,3 +1,41 @@
|
||||
2008-10-27 zzz
|
||||
* config.jsp: Add more help
|
||||
* peers.jsp: Clean up 'Listening on' formatting
|
||||
* profiles.jsp: Don't override locale number format
|
||||
* netdb.jsp: Indicate if hidden
|
||||
* summary.jsp: Indicate if hidden
|
||||
* i2ptunnel/edit.jsp: Disable word wrap in textarea
|
||||
* Blocklist: Change logging from ERROR to WARN
|
||||
* FloodfillMonitor:
|
||||
- Fix ff count (we forgot ourselves)
|
||||
- Don't become ff if hidden
|
||||
* HandleFloodfillDatabaseLookupMessageJob:
|
||||
Send back your routerinfo with the DSRM if not ff to
|
||||
spread the word that you aren't ff anymore
|
||||
* I2Ping:
|
||||
- Add -n count option
|
||||
- Add rtt output
|
||||
- Enhance help
|
||||
- Fix option handling
|
||||
* More findbugs cleanups
|
||||
* NetDb:
|
||||
- Fix behavior when router.isHidden=true
|
||||
- Delay StartExplorersJob for 10m at startup
|
||||
- Update dbLookup profile stats in FloodOnlySearchJob
|
||||
and FloodfillVerifyStoreJob
|
||||
- Fix response time store in profile in SearchJob
|
||||
* Stats:
|
||||
- Remove unused tunnel.buildSuccess and tunnel.buildFailure
|
||||
- Remove tunnel.buildRequestTime and 5m rate stats from
|
||||
netDb, effective in next release
|
||||
* UDP:
|
||||
- Don't do peer tests when hidden
|
||||
- Don't offer to introduce when hidden
|
||||
- Don't continually rebuild routerInfo when hidden
|
||||
- Don't continually rebuild routerInfo when
|
||||
i2np.udp.internalPort is set but i2np.udp.port is not
|
||||
- Remove some unused functions
|
||||
|
||||
2008-10-20 zzz
|
||||
* configclients.jsp: Handle clients with no args
|
||||
* index.jsp: Add readme_nl.html (thanks mathiasdm!),
|
||||
|
@ -17,7 +17,7 @@ import net.i2p.CoreVersion;
|
||||
public class RouterVersion {
|
||||
public final static String ID = "$Revision: 1.548 $ $Date: 2008-06-07 23:00:00 $";
|
||||
public final static String VERSION = "0.6.4";
|
||||
public final static long BUILD = 6;
|
||||
public final static long BUILD = 7;
|
||||
public static void main(String args[]) {
|
||||
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
||||
System.out.println("Router ID: " + RouterVersion.ID);
|
||||
|
@ -276,9 +276,10 @@ public class Shitlist {
|
||||
}
|
||||
buf.append("<ul>");
|
||||
|
||||
for (Iterator iter = entries.keySet().iterator(); iter.hasNext(); ) {
|
||||
Hash key = (Hash)iter.next();
|
||||
Entry entry = (Entry)entries.get(key);
|
||||
for (Iterator iter = entries.entrySet().iterator(); iter.hasNext(); ) {
|
||||
Map.Entry mentry = (Map.Entry)iter.next();
|
||||
Hash key = (Hash)mentry.getKey();
|
||||
Entry entry = (Entry)mentry.getValue();
|
||||
buf.append("<li><b>").append(key.toBase64()).append("</b>");
|
||||
buf.append(" (<a href=\"netdb.jsp?r=").append(key.toBase64().substring(0, 6)).append("\">netdb</a>)");
|
||||
buf.append(" expiring in ");
|
||||
|
@ -36,9 +36,10 @@ public class StatsGenerator {
|
||||
buf.setLength(0);
|
||||
|
||||
Map groups = _context.statManager().getStatsByGroup();
|
||||
for (Iterator iter = groups.keySet().iterator(); iter.hasNext(); ) {
|
||||
String group = (String)iter.next();
|
||||
Set stats = (Set)groups.get(group);
|
||||
for (Iterator iter = groups.entrySet().iterator(); iter.hasNext(); ) {
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
String group = (String)entry.getKey();
|
||||
Set stats = (Set)entry.getValue();
|
||||
buf.append("<option value=\"/oldstats.jsp#").append(group).append("\">");
|
||||
buf.append(group).append("</option>\n");
|
||||
for (Iterator statIter = stats.iterator(); statIter.hasNext(); ) {
|
||||
|
@ -6,6 +6,7 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
@ -632,9 +633,10 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
private void cleanLeaseSetCache(HashMap tc) {
|
||||
long now = getContext().clock().now();
|
||||
List deleteList = new ArrayList();
|
||||
for (Iterator iter = tc.keySet().iterator(); iter.hasNext(); ) {
|
||||
String k = (String) iter.next();
|
||||
LeaseSet l = (LeaseSet) tc.get(k);
|
||||
for (Iterator iter = tc.entrySet().iterator(); iter.hasNext(); ) {
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
String k = (String) entry.getKey();
|
||||
LeaseSet l = (LeaseSet) entry.getValue();
|
||||
if (l.getEarliestLeaseDate() < now)
|
||||
deleteList.add(k);
|
||||
}
|
||||
@ -650,9 +652,10 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
*/
|
||||
private void cleanLeaseCache(HashMap tc) {
|
||||
List deleteList = new ArrayList();
|
||||
for (Iterator iter = tc.keySet().iterator(); iter.hasNext(); ) {
|
||||
String k = (String) iter.next();
|
||||
Lease l = (Lease) tc.get(k);
|
||||
for (Iterator iter = tc.entrySet().iterator(); iter.hasNext(); ) {
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
String k = (String) entry.getKey();
|
||||
Lease l = (Lease) entry.getValue();
|
||||
if (l.isExpired(Router.CLOCK_FUDGE_FACTOR))
|
||||
deleteList.add(k);
|
||||
}
|
||||
@ -668,9 +671,10 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
||||
*/
|
||||
private void cleanTunnelCache(HashMap tc) {
|
||||
List deleteList = new ArrayList();
|
||||
for (Iterator iter = tc.keySet().iterator(); iter.hasNext(); ) {
|
||||
String k = (String) iter.next();
|
||||
TunnelInfo tunnel = (TunnelInfo) tc.get(k);
|
||||
for (Iterator iter = tc.entrySet().iterator(); iter.hasNext(); ) {
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
String k = (String) entry.getKey();
|
||||
TunnelInfo tunnel = (TunnelInfo) entry.getValue();
|
||||
if (!getContext().tunnelManager().isValidTunnel(sourceFromHashPair(k), tunnel))
|
||||
deleteList.add(k);
|
||||
}
|
||||
|
Reference in New Issue
Block a user