forked from I2P_Developers/i2p.i2p
findbugs
This commit is contained in:
@@ -355,10 +355,8 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
||||
_socket = new Socket(_hostname, _portNum);
|
||||
// _socket.setSoTimeout(1000000); // Uhmmm we could really-really use a real timeout, and handle it.
|
||||
_out = _socket.getOutputStream();
|
||||
synchronized (_out) {
|
||||
_out.write(I2PClient.PROTOCOL_BYTE);
|
||||
_out.flush();
|
||||
}
|
||||
_out.write(I2PClient.PROTOCOL_BYTE);
|
||||
_out.flush();
|
||||
_writer = new ClientWriterRunner(_out, this);
|
||||
InputStream in = _socket.getInputStream();
|
||||
_reader = new I2CPMessageReader(in, this);
|
||||
|
@@ -78,10 +78,8 @@ class I2PSimpleSession extends I2PSessionImpl2 {
|
||||
else
|
||||
_socket = new Socket(_hostname, _portNum);
|
||||
_out = _socket.getOutputStream();
|
||||
synchronized (_out) {
|
||||
_out.write(I2PClient.PROTOCOL_BYTE);
|
||||
_out.flush();
|
||||
}
|
||||
_out.write(I2PClient.PROTOCOL_BYTE);
|
||||
_out.flush();
|
||||
_writer = new ClientWriterRunner(_out, this);
|
||||
InputStream in = _socket.getInputStream();
|
||||
_reader = new I2CPMessageReader(in, this);
|
||||
|
@@ -432,6 +432,7 @@ public class BlockfileNamingService extends DummyNamingService {
|
||||
* @param source may be null
|
||||
* @throws RuntimeException
|
||||
*/
|
||||
/****
|
||||
private void addEntry(SkipList sl, String key, Destination dest, String source) {
|
||||
Properties props = new Properties();
|
||||
props.setProperty(PROP_ADDED, Long.toString(_context.clock().now()));
|
||||
@@ -439,6 +440,7 @@ public class BlockfileNamingService extends DummyNamingService {
|
||||
props.setProperty(PROP_SOURCE, source);
|
||||
addEntry(sl, key, dest, props);
|
||||
}
|
||||
****/
|
||||
|
||||
/**
|
||||
* Caller must synchronize
|
||||
@@ -476,9 +478,11 @@ public class BlockfileNamingService extends DummyNamingService {
|
||||
* @return null without exception on error (logs only)
|
||||
* @since 0.8.9
|
||||
*/
|
||||
/****
|
||||
private String getReverseEntry(Destination dest) {
|
||||
return getReverseEntry(dest.calculateHash());
|
||||
}
|
||||
****/
|
||||
|
||||
/**
|
||||
* Caller must synchronize.
|
||||
|
@@ -126,6 +126,7 @@ public class SingleFileNamingService extends NamingService {
|
||||
_log.warn("Error loading hosts file " + _file, ioe);
|
||||
return null;
|
||||
} finally {
|
||||
if (in != null) try { in.close(); } catch (IOException ioe) {}
|
||||
releaseReadLock();
|
||||
}
|
||||
}
|
||||
|
@@ -519,9 +519,11 @@ public final class CryptixRijndael_Algorithm // implicit no-argument constructor
|
||||
}
|
||||
|
||||
/** A basic symmetric encryption/decryption test. */
|
||||
/****
|
||||
public static boolean self_test() {
|
||||
return self_test(_BLOCK_SIZE);
|
||||
}
|
||||
****/
|
||||
|
||||
// Rijndael own methods
|
||||
//...........................................................................
|
||||
@@ -745,6 +747,7 @@ public final class CryptixRijndael_Algorithm // implicit no-argument constructor
|
||||
}
|
||||
|
||||
/** A basic symmetric encryption/decryption test for a given key size. */
|
||||
/****
|
||||
private static boolean self_test(int keysize) {
|
||||
if (_RDEBUG) trace(_IN, "self_test(" + keysize + ")");
|
||||
boolean ok = false;
|
||||
@@ -795,6 +798,7 @@ public final class CryptixRijndael_Algorithm // implicit no-argument constructor
|
||||
if (_RDEBUG) trace(_OUT, "self_test()");
|
||||
return ok;
|
||||
}
|
||||
****/
|
||||
|
||||
/**
|
||||
* Return The number of rounds for a given Rijndael's key and block sizes.
|
||||
@@ -894,9 +898,11 @@ public final class CryptixRijndael_Algorithm // implicit no-argument constructor
|
||||
// main(): use to generate the Intermediate Values KAT
|
||||
//...........................................................................
|
||||
|
||||
/****
|
||||
public static void main(String[] args) {
|
||||
self_test(16);
|
||||
self_test(24);
|
||||
self_test(32);
|
||||
}
|
||||
}
|
||||
****/
|
||||
}
|
||||
|
@@ -298,10 +298,12 @@ public class ElGamalAESEngine {
|
||||
* @param foundKey out parameter. Data must be unset when called; may be filled with a new sessionKey found during decryption
|
||||
* @return decrypted data or null on failure
|
||||
*/
|
||||
/****
|
||||
private byte[] decryptAESBlock(byte encrypted[], SessionKey key, byte iv[],
|
||||
byte sentTag[], Set foundTags, SessionKey foundKey) throws DataFormatException {
|
||||
return decryptAESBlock(encrypted, 0, encrypted.length, key, iv, sentTag, foundTags, foundKey);
|
||||
}
|
||||
****/
|
||||
|
||||
/*
|
||||
* Note: package private for ElGamalTest.testAES()
|
||||
|
@@ -34,7 +34,7 @@ public class HMAC256Generator extends HMACGenerator {
|
||||
return new I2PHMac(new Sha256ForMAC());
|
||||
}
|
||||
|
||||
private class Sha256ForMAC extends Sha256Standalone implements Digest {
|
||||
private static class Sha256ForMAC extends Sha256Standalone implements Digest {
|
||||
public String getAlgorithmName() { return "sha256 for hmac"; }
|
||||
public int getDigestSize() { return 32; }
|
||||
public int doFinal(byte[] out, int outOff) {
|
||||
|
@@ -596,10 +596,10 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
}
|
||||
int total = 0;
|
||||
long now = _context.clock().now();
|
||||
for (Iterator<SessionKey> iter = inboundSets.keySet().iterator(); iter.hasNext();) {
|
||||
SessionKey skey = iter.next();
|
||||
for (Map.Entry<SessionKey, Set<TagSet>> e : inboundSets.entrySet()) {
|
||||
SessionKey skey = e.getKey();
|
||||
Set<TagSet> sets = new TreeSet(new TagSetComparator());
|
||||
sets.addAll(inboundSets.get(skey));
|
||||
sets.addAll(e.getValue());
|
||||
buf.append("<tr><td><b>Session key</b>: ").append(skey.toBase64()).append("</td>" +
|
||||
"<td><b># Sets:</b> ").append(sets.size()).append("</td></tr>" +
|
||||
"<tr><td colspan=\"2\"><ul>");
|
||||
@@ -653,9 +653,9 @@ public class TransientSessionKeyManager extends SessionKeyManager {
|
||||
* Just for the HTML method above so we can see what's going on easier
|
||||
* Earliest first
|
||||
*/
|
||||
private static class TagSetComparator implements Comparator {
|
||||
public int compare(Object l, Object r) {
|
||||
return (int) (((TagSet)l).getDate() - ((TagSet)r).getDate());
|
||||
private static class TagSetComparator implements Comparator<TagSet> {
|
||||
public int compare(TagSet l, TagSet r) {
|
||||
return (int) (l.getDate() - r.getDate());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -33,6 +33,7 @@ import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import net.i2p.util.RandomSource;
|
||||
|
||||
/**
|
||||
* This class represents a NTP message, as specified in RFC 2030. The message
|
||||
@@ -399,7 +400,7 @@ public class NtpMessage {
|
||||
// low order bits of the timestamp with a random, unbiased
|
||||
// bitstring, both to avoid systematic roundoff errors and as
|
||||
// a means of loop detection and replay detection.
|
||||
array[7+pointer] = (byte) (Math.random()*255.0);
|
||||
array[7+pointer] = (byte) (RandomSource.getInstance().nextInt());
|
||||
}
|
||||
|
||||
|
||||
|
@@ -321,14 +321,16 @@ public class Timestamper implements Runnable {
|
||||
_context.getProperty(PROP_CONCURRING_SERVERS, DEFAULT_CONCURRING_SERVERS)));
|
||||
}
|
||||
|
||||
/****
|
||||
public static void main(String args[]) {
|
||||
System.setProperty(PROP_DISABLED, "false");
|
||||
System.setProperty(PROP_QUERY_FREQUENCY, "30000");
|
||||
I2PAppContext ctx = I2PAppContext.getGlobalContext();
|
||||
I2PAppContext.getGlobalContext();
|
||||
for (int i = 0; i < 5*60*1000; i += 61*1000) {
|
||||
try { Thread.sleep(61*1000); } catch (InterruptedException ie) {}
|
||||
}
|
||||
}
|
||||
****/
|
||||
|
||||
/**
|
||||
* Interface to receive update notifications for when we query the time
|
||||
|
@@ -443,7 +443,7 @@ public class BlockFile {
|
||||
public BSkipList makeIndex(String name, Serializer key, Serializer val) throws IOException {
|
||||
if(metaIndex.get(name) != null) { throw new IOException("Index already exists"); }
|
||||
int page = allocPage();
|
||||
metaIndex.put(name, new Integer(page));
|
||||
metaIndex.put(name, Integer.valueOf(page));
|
||||
BSkipList.init(this, page, spanSize);
|
||||
BSkipList bsl = new BSkipList(spanSize, this, page, key, val, true);
|
||||
openIndices.put(name, bsl);
|
||||
|
Reference in New Issue
Block a user