forked from I2P_Developers/i2p.i2p
More findbugs cleanup
This commit is contained in:
@ -120,6 +120,8 @@ public class ConnectionAcceptor implements Runnable
|
|||||||
if (serverSocket == null)
|
if (serverSocket == null)
|
||||||
try { Thread.sleep(10*1000); } catch (InterruptedException ie) {}
|
try { Thread.sleep(10*1000); } catch (InterruptedException ie) {}
|
||||||
}
|
}
|
||||||
|
if(stop)
|
||||||
|
break;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
I2PSocket socket = serverSocket.accept();
|
I2PSocket socket = serverSocket.accept();
|
||||||
|
@ -185,6 +185,7 @@ public class I2PSnarkUtil {
|
|||||||
out = File.createTempFile("i2psnark", "url", new File("."));
|
out = File.createTempFile("i2psnark", "url", new File("."));
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
ioe.printStackTrace();
|
ioe.printStackTrace();
|
||||||
|
if (out != null)
|
||||||
out.delete();
|
out.delete();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -408,7 +408,7 @@ public class MetaInfo
|
|||||||
info.put("name", name);
|
info.put("name", name);
|
||||||
if (name_utf8 != null)
|
if (name_utf8 != null)
|
||||||
info.put("name.utf-8", name_utf8);
|
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);
|
info.put("pieces", piece_hashes);
|
||||||
if (files == null)
|
if (files == null)
|
||||||
info.put("length", new Long(length));
|
info.put("length", new Long(length));
|
||||||
@ -434,9 +434,10 @@ public class MetaInfo
|
|||||||
Map info = createInfoMap();
|
Map info = createInfoMap();
|
||||||
StringBuffer buf = new StringBuffer(128);
|
StringBuffer buf = new StringBuffer(128);
|
||||||
buf.append("info: ");
|
buf.append("info: ");
|
||||||
for (Iterator iter = info.keySet().iterator(); iter.hasNext(); ) {
|
for (Iterator iter = info.entrySet().iterator(); iter.hasNext(); ) {
|
||||||
String key = (String)iter.next();
|
Map.Entry entry = (Map.Entry)iter.next();
|
||||||
Object val = info.get(key);
|
String key = (String)entry.getKey();
|
||||||
|
Object val = entry.getValue();
|
||||||
buf.append(key).append('=');
|
buf.append(key).append('=');
|
||||||
if (val instanceof byte[])
|
if (val instanceof byte[])
|
||||||
buf.append(Base64.encode((byte[])val, true));
|
buf.append(Base64.encode((byte[])val, true));
|
||||||
|
@ -30,7 +30,7 @@ import java.util.TimerTask;
|
|||||||
class PeerMonitorTask extends TimerTask
|
class PeerMonitorTask extends TimerTask
|
||||||
{
|
{
|
||||||
final static long MONITOR_PERIOD = 10 * 1000; // Ten seconds.
|
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;
|
private final PeerCoordinator coordinator;
|
||||||
|
|
||||||
|
@ -255,8 +255,8 @@ public class Snark
|
|||||||
if (slistener == null)
|
if (slistener == null)
|
||||||
slistener = this;
|
slistener = this;
|
||||||
|
|
||||||
if (clistener == null)
|
//if (clistener == null)
|
||||||
clistener = this;
|
// clistener = this;
|
||||||
|
|
||||||
this.torrent = torrent;
|
this.torrent = torrent;
|
||||||
this.rootDataDir = rootDir;
|
this.rootDataDir = rootDir;
|
||||||
@ -312,9 +312,9 @@ public class Snark
|
|||||||
// Figure out what the torrent argument represents.
|
// Figure out what the torrent argument represents.
|
||||||
meta = null;
|
meta = null;
|
||||||
File f = null;
|
File f = null;
|
||||||
|
InputStream in = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
InputStream in = null;
|
|
||||||
f = new File(torrent);
|
f = new File(torrent);
|
||||||
if (f.exists())
|
if (f.exists())
|
||||||
in = new FileInputStream(f);
|
in = new FileInputStream(f);
|
||||||
@ -364,6 +364,9 @@ public class Snark
|
|||||||
*/
|
*/
|
||||||
else
|
else
|
||||||
fatal("Cannot open '" + torrent + "'", ioe);
|
fatal("Cannot open '" + torrent + "'", ioe);
|
||||||
|
} finally {
|
||||||
|
if (in != null)
|
||||||
|
try { in.close(); } catch (IOException ioe) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
debug(meta.toString(), INFO);
|
debug(meta.toString(), INFO);
|
||||||
@ -721,7 +724,7 @@ public class Snark
|
|||||||
{
|
{
|
||||||
// Use the MetaInfo from the storage since our own might not
|
// Use the MetaInfo from the storage since our own might not
|
||||||
// yet be setup correctly.
|
// yet be setup correctly.
|
||||||
MetaInfo meta = storage.getMetaInfo();
|
//MetaInfo meta = storage.getMetaInfo();
|
||||||
//if (meta != null)
|
//if (meta != null)
|
||||||
// System.out.print("Checking existing "
|
// System.out.print("Checking existing "
|
||||||
// + meta.getPieces()
|
// + 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");
|
out.write("<tr><td><a href=\"http://codevoid.i2p/forums/5\" class=\"snarkRefresh\">Wishlist</a>\n");
|
||||||
int count = 1;
|
int count = 1;
|
||||||
Map trackers = _manager.getTrackers();
|
Map trackers = _manager.getTrackers();
|
||||||
for (Iterator iter = trackers.keySet().iterator(); iter.hasNext(); ) {
|
for (Iterator iter = trackers.entrySet().iterator(); iter.hasNext(); ) {
|
||||||
String name = (String)iter.next();
|
Map.Entry entry = (Map.Entry)iter.next();
|
||||||
String baseURL = (String)trackers.get(name);
|
String name = (String)entry.getKey();
|
||||||
|
String baseURL = (String)entry.getValue();
|
||||||
int e = baseURL.indexOf('=');
|
int e = baseURL.indexOf('=');
|
||||||
if (e < 0)
|
if (e < 0)
|
||||||
continue;
|
continue;
|
||||||
@ -496,9 +497,10 @@ public class I2PSnarkServlet extends HttpServlet {
|
|||||||
String announce = snark.meta.getAnnounce();
|
String announce = snark.meta.getAnnounce();
|
||||||
if (announce.startsWith("http://YRgrgTLG") || announce.startsWith("http://8EoJZIKr")) {
|
if (announce.startsWith("http://YRgrgTLG") || announce.startsWith("http://8EoJZIKr")) {
|
||||||
Map trackers = _manager.getTrackers();
|
Map trackers = _manager.getTrackers();
|
||||||
for (Iterator iter = trackers.keySet().iterator(); iter.hasNext(); ) {
|
for (Iterator iter = trackers.entrySet().iterator(); iter.hasNext(); ) {
|
||||||
String name = (String)iter.next();
|
Map.Entry entry = (Map.Entry)iter.next();
|
||||||
String baseURL = (String)trackers.get(name);
|
String name = (String)entry.getKey();
|
||||||
|
String baseURL = (String)entry.getValue();
|
||||||
if (!baseURL.startsWith(announce))
|
if (!baseURL.startsWith(announce))
|
||||||
continue;
|
continue;
|
||||||
int e = baseURL.indexOf('=');
|
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");
|
+ "\" 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");
|
out.write("Tracker: <select name=\"announceURL\"><option value=\"\">Select a tracker</option>\n");
|
||||||
Map trackers = _manager.getTrackers();
|
Map trackers = _manager.getTrackers();
|
||||||
for (Iterator iter = trackers.keySet().iterator(); iter.hasNext(); ) {
|
for (Iterator iter = trackers.entrySet().iterator(); iter.hasNext(); ) {
|
||||||
String name = (String)iter.next();
|
Map.Entry entry = (Map.Entry)iter.next();
|
||||||
String announceURL = (String)trackers.get(name);
|
String name = (String)entry.getKey();
|
||||||
|
String announceURL = (String)entry.getValue();
|
||||||
int e = announceURL.indexOf('=');
|
int e = announceURL.indexOf('=');
|
||||||
if (e > 0)
|
if (e > 0)
|
||||||
announceURL = announceURL.substring(0, e);
|
announceURL = announceURL.substring(0, e);
|
||||||
@ -741,9 +744,10 @@ public class I2PSnarkServlet extends HttpServlet {
|
|||||||
+ I2PSnarkUtil.instance().getI2CPPort() + "\" size=\"5\" maxlength=\"5\" /> <br />\n");
|
+ I2PSnarkUtil.instance().getI2CPPort() + "\" size=\"5\" maxlength=\"5\" /> <br />\n");
|
||||||
StringBuffer opts = new StringBuffer(64);
|
StringBuffer opts = new StringBuffer(64);
|
||||||
Map options = new TreeMap(I2PSnarkUtil.instance().getI2CPOptions());
|
Map options = new TreeMap(I2PSnarkUtil.instance().getI2CPOptions());
|
||||||
for (Iterator iter = options.keySet().iterator(); iter.hasNext(); ) {
|
for (Iterator iter = options.entrySet().iterator(); iter.hasNext(); ) {
|
||||||
String key = (String)iter.next();
|
Map.Entry entry = (Map.Entry)iter.next();
|
||||||
String val = (String)options.get(key);
|
String key = (String)entry.getKey();
|
||||||
|
String val = (String)entry.getValue();
|
||||||
opts.append(key).append('=').append(val).append(' ');
|
opts.append(key).append('=').append(val).append(' ');
|
||||||
}
|
}
|
||||||
out.write("I2CP opts: <input type=\"text\" name=\"i2cpOpts\" size=\"80\" value=\""
|
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()));
|
limits.put(lim.getRootName(), Log.toLevelString(lim.getLimit()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Iterator iter = limits.keySet().iterator(); iter.hasNext(); ) {
|
for (Iterator iter = limits.entrySet().iterator(); iter.hasNext(); ) {
|
||||||
String path = (String)iter.next();
|
Map.Entry entry = (Map.Entry)iter.next();
|
||||||
String lim = (String)limits.get(path);
|
String path = (String)entry.getKey();
|
||||||
|
String lim = (String)entry.getValue();
|
||||||
buf.append(PROP_RECORD_PREFIX).append(path);
|
buf.append(PROP_RECORD_PREFIX).append(path);
|
||||||
buf.append('=').append(lim).append('\n');
|
buf.append('=').append(lim).append('\n');
|
||||||
}
|
}
|
||||||
|
@ -120,9 +120,10 @@ public class OrderedProperties extends Properties {
|
|||||||
|
|
||||||
public void putAll(Map data) {
|
public void putAll(Map data) {
|
||||||
if (data == null) return;
|
if (data == null) return;
|
||||||
for (Iterator iter = data.keySet().iterator(); iter.hasNext();) {
|
for (Iterator iter = data.entrySet().iterator(); iter.hasNext();) {
|
||||||
Object key = iter.next();
|
Map.Entry entry = (Map.Entry)iter.next();
|
||||||
Object val = data.get(key);
|
Object key = entry.getKey();
|
||||||
|
Object val = entry.getValue();
|
||||||
put(key, val);
|
put(key, val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
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
|
2008-10-20 zzz
|
||||||
* configclients.jsp: Handle clients with no args
|
* configclients.jsp: Handle clients with no args
|
||||||
* index.jsp: Add readme_nl.html (thanks mathiasdm!),
|
* index.jsp: Add readme_nl.html (thanks mathiasdm!),
|
||||||
|
@ -17,7 +17,7 @@ import net.i2p.CoreVersion;
|
|||||||
public class RouterVersion {
|
public class RouterVersion {
|
||||||
public final static String ID = "$Revision: 1.548 $ $Date: 2008-06-07 23:00:00 $";
|
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 String VERSION = "0.6.4";
|
||||||
public final static long BUILD = 6;
|
public final static long BUILD = 7;
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
||||||
System.out.println("Router ID: " + RouterVersion.ID);
|
System.out.println("Router ID: " + RouterVersion.ID);
|
||||||
|
@ -276,9 +276,10 @@ public class Shitlist {
|
|||||||
}
|
}
|
||||||
buf.append("<ul>");
|
buf.append("<ul>");
|
||||||
|
|
||||||
for (Iterator iter = entries.keySet().iterator(); iter.hasNext(); ) {
|
for (Iterator iter = entries.entrySet().iterator(); iter.hasNext(); ) {
|
||||||
Hash key = (Hash)iter.next();
|
Map.Entry mentry = (Map.Entry)iter.next();
|
||||||
Entry entry = (Entry)entries.get(key);
|
Hash key = (Hash)mentry.getKey();
|
||||||
|
Entry entry = (Entry)mentry.getValue();
|
||||||
buf.append("<li><b>").append(key.toBase64()).append("</b>");
|
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(" (<a href=\"netdb.jsp?r=").append(key.toBase64().substring(0, 6)).append("\">netdb</a>)");
|
||||||
buf.append(" expiring in ");
|
buf.append(" expiring in ");
|
||||||
|
@ -36,9 +36,10 @@ public class StatsGenerator {
|
|||||||
buf.setLength(0);
|
buf.setLength(0);
|
||||||
|
|
||||||
Map groups = _context.statManager().getStatsByGroup();
|
Map groups = _context.statManager().getStatsByGroup();
|
||||||
for (Iterator iter = groups.keySet().iterator(); iter.hasNext(); ) {
|
for (Iterator iter = groups.entrySet().iterator(); iter.hasNext(); ) {
|
||||||
String group = (String)iter.next();
|
Map.Entry entry = (Map.Entry)iter.next();
|
||||||
Set stats = (Set)groups.get(group);
|
String group = (String)entry.getKey();
|
||||||
|
Set stats = (Set)entry.getValue();
|
||||||
buf.append("<option value=\"/oldstats.jsp#").append(group).append("\">");
|
buf.append("<option value=\"/oldstats.jsp#").append(group).append("\">");
|
||||||
buf.append(group).append("</option>\n");
|
buf.append(group).append("</option>\n");
|
||||||
for (Iterator statIter = stats.iterator(); statIter.hasNext(); ) {
|
for (Iterator statIter = stats.iterator(); statIter.hasNext(); ) {
|
||||||
|
@ -6,6 +6,7 @@ import java.util.HashMap;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -632,9 +633,10 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
|||||||
private void cleanLeaseSetCache(HashMap tc) {
|
private void cleanLeaseSetCache(HashMap tc) {
|
||||||
long now = getContext().clock().now();
|
long now = getContext().clock().now();
|
||||||
List deleteList = new ArrayList();
|
List deleteList = new ArrayList();
|
||||||
for (Iterator iter = tc.keySet().iterator(); iter.hasNext(); ) {
|
for (Iterator iter = tc.entrySet().iterator(); iter.hasNext(); ) {
|
||||||
String k = (String) iter.next();
|
Map.Entry entry = (Map.Entry)iter.next();
|
||||||
LeaseSet l = (LeaseSet) tc.get(k);
|
String k = (String) entry.getKey();
|
||||||
|
LeaseSet l = (LeaseSet) entry.getValue();
|
||||||
if (l.getEarliestLeaseDate() < now)
|
if (l.getEarliestLeaseDate() < now)
|
||||||
deleteList.add(k);
|
deleteList.add(k);
|
||||||
}
|
}
|
||||||
@ -650,9 +652,10 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
|||||||
*/
|
*/
|
||||||
private void cleanLeaseCache(HashMap tc) {
|
private void cleanLeaseCache(HashMap tc) {
|
||||||
List deleteList = new ArrayList();
|
List deleteList = new ArrayList();
|
||||||
for (Iterator iter = tc.keySet().iterator(); iter.hasNext(); ) {
|
for (Iterator iter = tc.entrySet().iterator(); iter.hasNext(); ) {
|
||||||
String k = (String) iter.next();
|
Map.Entry entry = (Map.Entry)iter.next();
|
||||||
Lease l = (Lease) tc.get(k);
|
String k = (String) entry.getKey();
|
||||||
|
Lease l = (Lease) entry.getValue();
|
||||||
if (l.isExpired(Router.CLOCK_FUDGE_FACTOR))
|
if (l.isExpired(Router.CLOCK_FUDGE_FACTOR))
|
||||||
deleteList.add(k);
|
deleteList.add(k);
|
||||||
}
|
}
|
||||||
@ -668,9 +671,10 @@ public class OutboundClientMessageOneShotJob extends JobImpl {
|
|||||||
*/
|
*/
|
||||||
private void cleanTunnelCache(HashMap tc) {
|
private void cleanTunnelCache(HashMap tc) {
|
||||||
List deleteList = new ArrayList();
|
List deleteList = new ArrayList();
|
||||||
for (Iterator iter = tc.keySet().iterator(); iter.hasNext(); ) {
|
for (Iterator iter = tc.entrySet().iterator(); iter.hasNext(); ) {
|
||||||
String k = (String) iter.next();
|
Map.Entry entry = (Map.Entry)iter.next();
|
||||||
TunnelInfo tunnel = (TunnelInfo) tc.get(k);
|
String k = (String) entry.getKey();
|
||||||
|
TunnelInfo tunnel = (TunnelInfo) entry.getValue();
|
||||||
if (!getContext().tunnelManager().isValidTunnel(sourceFromHashPair(k), tunnel))
|
if (!getContext().tunnelManager().isValidTunnel(sourceFromHashPair(k), tunnel))
|
||||||
deleteList.add(k);
|
deleteList.add(k);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user