forked from I2P_Developers/i2p.i2p
lint redundant cast all over
This commit is contained in:
@ -78,7 +78,7 @@ public class ConfigurationManager {
|
||||
* @return The value of a configuration: true if found, defaultValue if not found.
|
||||
*/
|
||||
public boolean getBooleanConfiguration(String arg, boolean defaultValue) {
|
||||
Boolean value = ((Boolean) booleanConfigurations.get("startWithI2P"));
|
||||
Boolean value = booleanConfigurations.get("startWithI2P");
|
||||
System.out.println(value);
|
||||
if(value != null) {
|
||||
return value;
|
||||
|
@ -194,9 +194,8 @@ public class Peer implements Comparable<Peer>
|
||||
* Compares the PeerIDs.
|
||||
* @deprecated unused?
|
||||
*/
|
||||
public int compareTo(Peer o)
|
||||
public int compareTo(Peer p)
|
||||
{
|
||||
Peer p = (Peer)o;
|
||||
int rv = peerID.compareTo(p.peerID);
|
||||
if (rv == 0) {
|
||||
if (_id > p._id) return 1;
|
||||
|
@ -62,7 +62,7 @@ class TrackerInfo
|
||||
private TrackerInfo(Map<String, BEValue> m, byte[] my_id, byte[] infohash, MetaInfo metainfo, I2PSnarkUtil util)
|
||||
throws IOException
|
||||
{
|
||||
BEValue reason = (BEValue)m.get("failure reason");
|
||||
BEValue reason = m.get("failure reason");
|
||||
if (reason != null)
|
||||
{
|
||||
failure_reason = reason.getString();
|
||||
@ -72,13 +72,13 @@ class TrackerInfo
|
||||
else
|
||||
{
|
||||
failure_reason = null;
|
||||
BEValue beInterval = (BEValue)m.get("interval");
|
||||
BEValue beInterval = m.get("interval");
|
||||
if (beInterval == null)
|
||||
throw new InvalidBEncodingException("No interval given");
|
||||
else
|
||||
interval = beInterval.getInt();
|
||||
|
||||
BEValue bePeers = (BEValue)m.get("peers");
|
||||
BEValue bePeers = m.get("peers");
|
||||
if (bePeers == null) {
|
||||
peers = Collections.emptySet();
|
||||
} else {
|
||||
@ -93,14 +93,14 @@ class TrackerInfo
|
||||
peers = p;
|
||||
}
|
||||
|
||||
BEValue bev = (BEValue)m.get("complete");
|
||||
BEValue bev = m.get("complete");
|
||||
if (bev != null) try {
|
||||
complete = bev.getInt();
|
||||
if (complete < 0)
|
||||
complete = 0;
|
||||
} catch (InvalidBEncodingException ibe) {}
|
||||
|
||||
bev = (BEValue)m.get("incomplete");
|
||||
bev = m.get("incomplete");
|
||||
if (bev != null) try {
|
||||
incomplete = bev.getInt();
|
||||
if (incomplete < 0)
|
||||
|
@ -204,8 +204,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
resp.sendError(404);
|
||||
} else {
|
||||
String base = addPaths(req.getRequestURI(), "/");
|
||||
@SuppressWarnings("unchecked") // TODO-Java6: Remove cast, return type is correct
|
||||
String listing = getListHTML(resource, base, true, method.equals("POST") ? (Map<String, String[]>) req.getParameterMap() : null);
|
||||
String listing = getListHTML(resource, base, true, method.equals("POST") ? req.getParameterMap() : null);
|
||||
if (method.equals("POST")) {
|
||||
// P-R-G
|
||||
sendRedirect(req, resp, "");
|
||||
@ -547,7 +546,7 @@ public class I2PSnarkServlet extends BasicServlet {
|
||||
|
||||
String stParamStr = stParam == null ? "" : "&st=" + stParam;
|
||||
for (int i = 0; i < total; i++) {
|
||||
Snark snark = (Snark)snarks.get(i);
|
||||
Snark snark = snarks.get(i);
|
||||
boolean showPeers = showDebug || "1".equals(peerParam) || Base64.encode(snark.getInfoHash()).equals(peerParam);
|
||||
boolean hide = i < start || i >= start + pageSize;
|
||||
displaySnark(out, snark, uri, i, stats, showPeers, isDegraded, noThinsp, showDebug, hide, stParamStr);
|
||||
|
@ -78,7 +78,7 @@ public class TunnelRenderer {
|
||||
int inactive = 0;
|
||||
int displayed = 0;
|
||||
for (int i = 0; i < participating.size(); i++) {
|
||||
HopConfig cfg = (HopConfig)participating.get(i);
|
||||
HopConfig cfg = participating.get(i);
|
||||
long count = cfg.getProcessedMessagesCount();
|
||||
if (count <= 0) {
|
||||
inactive++;
|
||||
|
@ -216,7 +216,7 @@ class PacketQueue implements SendMessageStatusListener {
|
||||
_connectionManager.getPacketHandler().displayPacket(packet, "SEND", suffix);
|
||||
if (I2PSocketManagerFull.pcapWriter != null &&
|
||||
_context.getBooleanProperty(I2PSocketManagerFull.PROP_PCAP))
|
||||
((PacketLocal)packet).logTCPDump();
|
||||
packet.logTCPDump();
|
||||
}
|
||||
|
||||
if ( (packet.getSequenceNum() == 0) && (!packet.isFlagSet(Packet.FLAG_SYNCHRONIZE)) ) {
|
||||
|
@ -154,7 +154,7 @@ class RequestWrapper {
|
||||
{
|
||||
String result = defaultValue;
|
||||
if( multiPartRequest != null ) {
|
||||
String str = (String)cache.get( name );
|
||||
String str = cache.get(name);
|
||||
if( str != null ) {
|
||||
result = str;
|
||||
}
|
||||
|
@ -1211,7 +1211,7 @@ public class WebMail extends HttpServlet
|
||||
for (Integer item : getCheckedItems(request)) {
|
||||
int n = item.intValue();
|
||||
for( int i = 0; i < sessionObject.attachments.size(); i++ ) {
|
||||
Attachment attachment = (Attachment)sessionObject.attachments.get( i );
|
||||
Attachment attachment = sessionObject.attachments.get(i);
|
||||
if( attachment.hashCode() == n ) {
|
||||
sessionObject.attachments.remove( i );
|
||||
break;
|
||||
|
@ -290,7 +290,7 @@ public class MultiPartRequest
|
||||
{
|
||||
String key = line.substring(0,c).trim().toLowerCase();
|
||||
String value = line.substring(c+1,line.length()).trim();
|
||||
String ev = (String) part._headers.get(key);
|
||||
String ev = part._headers.get(key);
|
||||
part._headers.put(key,(ev!=null)?(ev+';'+value):value);
|
||||
//if(log.isDebugEnabled())log.debug(key+": "+value);
|
||||
if (key.equals("content-disposition"))
|
||||
|
@ -317,7 +317,7 @@ public class FortunaStandalone extends BasePRNGStandalone implements Serializabl
|
||||
seeded = false;
|
||||
Arrays.fill(key, (byte) 0);
|
||||
Arrays.fill(counter, (byte) 0);
|
||||
byte[] seed = (byte[]) attributes.get(SEED);
|
||||
byte[] seed = attributes.get(SEED);
|
||||
if (seed != null)
|
||||
addRandomBytes(seed);
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public class EepGetNamingService extends DummyNamingService {
|
||||
|
||||
// lookup
|
||||
for (int i = 0; i < URLs.size(); i++) {
|
||||
String url = (String)URLs.get(i);
|
||||
String url = URLs.get(i);
|
||||
String key = fetchAddr(url, hostname);
|
||||
if (key != null) {
|
||||
_log.error("Success: " + url + hostname);
|
||||
|
@ -425,7 +425,7 @@ public class BlockFile {
|
||||
*/
|
||||
public BSkipList getIndex(String name, Serializer key, Serializer val) throws IOException {
|
||||
// added I2P
|
||||
BSkipList bsl = (BSkipList) openIndices.get(name);
|
||||
BSkipList bsl = openIndices.get(name);
|
||||
if (bsl != null)
|
||||
return bsl;
|
||||
|
||||
@ -465,7 +465,7 @@ public class BlockFile {
|
||||
* Added I2P
|
||||
*/
|
||||
public void closeIndex(String name) {
|
||||
BSkipList bsl = (BSkipList) openIndices.remove(name);
|
||||
BSkipList bsl = openIndices.remove(name);
|
||||
if (bsl != null)
|
||||
bsl.flush();
|
||||
}
|
||||
|
@ -379,8 +379,8 @@ public class InNetMessagePool implements Service {
|
||||
Hash from = null;
|
||||
synchronized (_pendingDataMessages) {
|
||||
if (!_pendingDataMessages.isEmpty()) {
|
||||
msg = (I2NPMessage)_pendingDataMessages.remove(0);
|
||||
from = (Hash)_pendingDataMessagesFrom.remove(0);
|
||||
msg = _pendingDataMessages.remove(0);
|
||||
from = _pendingDataMessagesFrom.remove(0);
|
||||
}
|
||||
remaining = _pendingDataMessages.size();
|
||||
}
|
||||
@ -402,7 +402,7 @@ public class InNetMessagePool implements Service {
|
||||
int remaining = 0;
|
||||
synchronized (_pendingGatewayMessages) {
|
||||
if (!_pendingGatewayMessages.isEmpty())
|
||||
msg = (I2NPMessage)_pendingGatewayMessages.remove(0);
|
||||
msg = _pendingGatewayMessages.remove(0);
|
||||
remaining = _pendingGatewayMessages.size();
|
||||
}
|
||||
if (msg != null)
|
||||
@ -422,7 +422,7 @@ public class InNetMessagePool implements Service {
|
||||
if (_pendingGatewayMessages.isEmpty())
|
||||
_pendingGatewayMessages.wait();
|
||||
else
|
||||
msg = (I2NPMessage)_pendingGatewayMessages.remove(0);
|
||||
msg = _pendingGatewayMessages.remove(0);
|
||||
}
|
||||
if (msg != null) {
|
||||
long before = _context.clock().now();
|
||||
@ -453,8 +453,8 @@ public class InNetMessagePool implements Service {
|
||||
if (_pendingDataMessages.isEmpty()) {
|
||||
_pendingDataMessages.wait();
|
||||
} else {
|
||||
msg = (I2NPMessage)_pendingDataMessages.remove(0);
|
||||
from = (Hash)_pendingDataMessagesFrom.remove(0);
|
||||
msg = _pendingDataMessages.remove(0);
|
||||
from = _pendingDataMessagesFrom.remove(0);
|
||||
}
|
||||
}
|
||||
if (msg != null) {
|
||||
|
@ -240,7 +240,7 @@ public class MultiRouter {
|
||||
while (true) {
|
||||
int alive = 0;
|
||||
for (int i = 0; i < _routers.size(); i++) {
|
||||
Router r = (Router)_routers.get(i);
|
||||
Router r = _routers.get(i);
|
||||
if (!r.isAlive()) {
|
||||
_out.println("Router " + i + " is dead");
|
||||
} else {
|
||||
|
@ -49,12 +49,12 @@ public class DummyNetworkDatabaseFacade extends NetworkDatabaseFacade {
|
||||
else
|
||||
_context.jobQueue().addJob(onFindJob);
|
||||
}
|
||||
public RouterInfo lookupRouterInfoLocally(Hash key) { return (RouterInfo)_routers.get(key); }
|
||||
public RouterInfo lookupRouterInfoLocally(Hash key) { return _routers.get(key); }
|
||||
public void publish(LeaseSet localLeaseSet) {}
|
||||
public void publish(RouterInfo localRouterInfo) {}
|
||||
public LeaseSet store(Hash key, LeaseSet leaseSet) { return leaseSet; }
|
||||
public RouterInfo store(Hash key, RouterInfo routerInfo) {
|
||||
RouterInfo rv = (RouterInfo)_routers.put(key, routerInfo);
|
||||
RouterInfo rv = _routers.put(key, routerInfo);
|
||||
return rv;
|
||||
}
|
||||
public void unpublish(LeaseSet localLeaseSet) {}
|
||||
|
@ -52,7 +52,7 @@ public class VMCommSystem extends CommSystemFacade {
|
||||
*/
|
||||
public void processMessage(OutNetMessage msg) {
|
||||
Hash peer = msg.getTarget().getIdentity().getHash();
|
||||
VMCommSystem peerSys = (VMCommSystem)_commSystemFacades.get(peer);
|
||||
VMCommSystem peerSys = _commSystemFacades.get(peer);
|
||||
|
||||
long now = _context.clock().now();
|
||||
long sendTime = now - msg.getSendBegin();
|
||||
|
@ -43,7 +43,7 @@ public class LoadClientAppsJob extends JobImpl {
|
||||
return;
|
||||
}
|
||||
for(int i = 0; i < apps.size(); i++) {
|
||||
ClientAppConfig app = (ClientAppConfig) apps.get(i);
|
||||
ClientAppConfig app = apps.get(i);
|
||||
if (app.disabled) {
|
||||
if ("net.i2p.router.web.RouterConsoleRunner".equals(app.className)) {
|
||||
String s = "Warning - Router console is disabled. To enable,\n edit the file " +
|
||||
|
@ -70,7 +70,7 @@ class NtpClient {
|
||||
names.add(serverNames[i]);
|
||||
Collections.shuffle(names);
|
||||
for (int i = 0; i < names.size(); i++) {
|
||||
long now = currentTime((String)names.get(i));
|
||||
long now = currentTime(names.get(i));
|
||||
if (now > 0)
|
||||
return now;
|
||||
}
|
||||
@ -92,7 +92,7 @@ class NtpClient {
|
||||
names.add(serverNames[i]);
|
||||
Collections.shuffle(names);
|
||||
for (int i = 0; i < names.size(); i++) {
|
||||
long[] rv = currentTimeAndStratum((String)names.get(i));
|
||||
long[] rv = currentTimeAndStratum(names.get(i));
|
||||
if (rv != null && rv[0] > 0)
|
||||
return rv;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ public class CommSystemFacadeImpl extends CommSystemFacade {
|
||||
// Sum skew values
|
||||
long sum = 0;
|
||||
for (int i = first; i <= last; i++) {
|
||||
long value = ((Long) (skews.get(i))).longValue();
|
||||
long value = skews.get(i).longValue();
|
||||
//if (_log.shouldLog(Log.DEBUG))
|
||||
// _log.debug("Adding clock skew " + i + " valued " + value + " s.");
|
||||
sum = sum + value;
|
||||
|
@ -124,7 +124,7 @@ class TimedWeightedPriorityMessageQueue implements MessageQueue, OutboundMessage
|
||||
int currentQueue = (_nextQueue + i) % _queue.length;
|
||||
synchronized (_queue[currentQueue]) {
|
||||
for (int j = 0; j < _queue[currentQueue].size(); j++) {
|
||||
OutNetMessage msg = (OutNetMessage)_queue[currentQueue].get(j);
|
||||
OutNetMessage msg = _queue[currentQueue].get(j);
|
||||
Hash to = msg.getTarget().getIdentity().getHash();
|
||||
if (_chokedPeers.contains(to))
|
||||
continue;
|
||||
@ -239,7 +239,7 @@ class TimedWeightedPriorityMessageQueue implements MessageQueue, OutboundMessage
|
||||
for (int i = 0; i < _queue.length; i++) {
|
||||
synchronized (_queue[i]) {
|
||||
for (int j = 0; j < _queue[i].size(); j++) {
|
||||
OutNetMessage m = (OutNetMessage)_queue[i].get(j);
|
||||
OutNetMessage m = _queue[i].get(j);
|
||||
if (m.getExpiration() < now) {
|
||||
_bytesQueued[i] -= m.getMessageSize();
|
||||
removed.add(m);
|
||||
@ -252,7 +252,7 @@ class TimedWeightedPriorityMessageQueue implements MessageQueue, OutboundMessage
|
||||
}
|
||||
|
||||
for (int i = 0; i < removed.size(); i++) {
|
||||
OutNetMessage m = (OutNetMessage)removed.get(i);
|
||||
OutNetMessage m = removed.get(i);
|
||||
m.timestamp("expirer killed it");
|
||||
_listener.failed(m, "expired before getting on the active pool");
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ public abstract class BuildMessageGenerator {
|
||||
// encrypt the records so that the right elements will be visible at the right time
|
||||
for (int i = 0; i < msg.getRecordCount(); i++) {
|
||||
ByteArray rec = msg.getRecord(i);
|
||||
Integer hopNum = (Integer)order.get(i);
|
||||
Integer hopNum = order.get(i);
|
||||
int hop = hopNum.intValue();
|
||||
if ( (isBlank(cfg, hop)) || (!cfg.isInbound() && hop == 1) ) {
|
||||
//if (log.shouldLog(Log.DEBUG))
|
||||
|
Reference in New Issue
Block a user