Doing something different this time -- but only to core
I marked all the empty statements with //nop I removed unneccessary elses (ie, the if returns or throws) I took out some casts (integral promotions/some didn't need to be there) -- Love, shendaras (2 in one day, w00t)
This commit is contained in:
@ -187,7 +187,7 @@ public class ATalk implements I2PSessionListener, Runnable {
|
||||
}
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop!
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -302,7 +302,7 @@ public class ATalk implements I2PSessionListener, Runnable {
|
||||
_log.debug("Keys generation failed");
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
} else if (args.length == 3) {
|
||||
_log.debug("Starting chat");
|
||||
@ -320,7 +320,7 @@ public class ATalk implements I2PSessionListener, Runnable {
|
||||
System.out.println(MANUAL);
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
System.exit(-1);
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ class ConnectionRunner implements I2CPMessageReader.I2CPMessageEventListener {
|
||||
|
||||
}
|
||||
|
||||
protected void sessionCreated() {
|
||||
protected void sessionCreated() { // nop
|
||||
}
|
||||
|
||||
protected SessionConfig getConfig() {
|
||||
|
@ -252,7 +252,7 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
||||
synchronized (_dateReceivedLock) {
|
||||
_dateReceivedLock.wait(1000);
|
||||
}
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
}
|
||||
if (_log.shouldLog(Log.DEBUG)) _log.debug(getPrefix() + "After received a SetDate response");
|
||||
@ -266,7 +266,7 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
||||
synchronized (_leaseSetWait) {
|
||||
try {
|
||||
_leaseSetWait.wait(1000);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -375,7 +375,8 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
||||
if (_pendingIds.size() <= 0) {
|
||||
try {
|
||||
AvailabilityNotifier.this.wait();
|
||||
} catch (InterruptedException ie) {}
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
}
|
||||
if (_pendingIds.size() > 0) {
|
||||
msgId = (Integer)_pendingIds.remove(0);
|
||||
@ -480,7 +481,7 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug(getPrefix() + "Message written out and flushed w/ "
|
||||
+ (inSync-beforeSync) + "ms to sync and "
|
||||
+ (afterSync-inSync) + "ms to send");;
|
||||
+ (afterSync-inSync) + "ms to send");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -551,9 +552,8 @@ abstract class I2PSessionImpl implements I2PSession, I2CPMessageReader.I2CPMessa
|
||||
if (reconnect()) {
|
||||
if (_log.shouldLog(Log.INFO)) _log.info(getPrefix() + "I2CP reconnection successful");
|
||||
return;
|
||||
} else {
|
||||
if (_log.shouldLog(Log.ERROR)) _log.error(getPrefix() + "I2CP reconnection failed");
|
||||
}
|
||||
if (_log.shouldLog(Log.ERROR)) _log.error(getPrefix() + "I2CP reconnection failed");
|
||||
}
|
||||
|
||||
if (_log.shouldLog(Log.ERROR))
|
||||
|
@ -76,9 +76,8 @@ class I2PSessionImpl2 extends I2PSessionImpl {
|
||||
// as well as the nonblocking sends with application managed keys. Later.
|
||||
if (isGuaranteed() || true) {
|
||||
return sendGuaranteed(dest, payload, keyUsed, tagsSent);
|
||||
} else {
|
||||
return sendBestEffort(dest, payload, keyUsed, tagsSent);
|
||||
}
|
||||
return sendBestEffort(dest, payload, keyUsed, tagsSent);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -94,9 +93,8 @@ class I2PSessionImpl2 extends I2PSessionImpl {
|
||||
} catch (IOException ioe) {
|
||||
throw new I2PSessionException("Error decompressing message", ioe);
|
||||
}
|
||||
} else {
|
||||
return compressed;
|
||||
}
|
||||
return compressed;
|
||||
}
|
||||
|
||||
private boolean sendBestEffort(Destination dest, byte payload[], SessionKey keyUsed, Set tagsSent)
|
||||
@ -116,7 +114,7 @@ class I2PSessionImpl2 extends I2PSessionImpl {
|
||||
if (false) // rekey
|
||||
newKey = _context.keyGenerator().generateSessionKey();
|
||||
|
||||
long nonce = (long)_context.random().nextInt(Integer.MAX_VALUE);
|
||||
long nonce = _context.random().nextInt(Integer.MAX_VALUE);
|
||||
MessageState state = new MessageState(nonce, getPrefix());
|
||||
state.setKey(key);
|
||||
state.setTags(sentTags);
|
||||
@ -196,7 +194,7 @@ class I2PSessionImpl2 extends I2PSessionImpl {
|
||||
if (false) // rekey
|
||||
newKey = _context.keyGenerator().generateSessionKey();
|
||||
|
||||
long nonce = (long)_context.random().nextInt(Integer.MAX_VALUE);
|
||||
long nonce = _context.random().nextInt(Integer.MAX_VALUE);
|
||||
MessageState state = new MessageState(nonce, getPrefix());
|
||||
state.setKey(key);
|
||||
state.setTags(sentTags);
|
||||
|
@ -127,7 +127,7 @@ class MessageState {
|
||||
synchronized (_lock) {
|
||||
try {
|
||||
_lock.wait(timeToWait);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -163,13 +163,11 @@ class MessageState {
|
||||
case MessageStatusMessage.STATUS_SEND_ACCEPTED:
|
||||
if (wantedStatus == MessageStatusMessage.STATUS_SEND_ACCEPTED) {
|
||||
return true; // if we're only looking for accepted, take it directly (don't let any GUARANTEED_* override it)
|
||||
} else {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug(_prefix + "Got accepted, but we're waiting for more from "
|
||||
+ toString());
|
||||
continue;
|
||||
// ignore accepted, as we want something better
|
||||
}
|
||||
// ignore accepted, as we want something better
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug(_prefix + "Got accepted, but we're waiting for more from " + toString());
|
||||
continue;
|
||||
case MessageStatusMessage.STATUS_SEND_BEST_EFFORT_SUCCESS:
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug(_prefix + "Received best effort success after " + getElapsed()
|
||||
|
@ -64,7 +64,7 @@ public class TestClient implements I2PSessionListener {
|
||||
while ((_dest1 == null) || (_dest2 == null))
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
|
||||
if (isDest1) {
|
||||
@ -79,12 +79,12 @@ public class TestClient implements I2PSessionListener {
|
||||
try {
|
||||
_log.debug("waiting for a message...");
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
}
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
System.exit(0);
|
||||
}
|
||||
@ -98,7 +98,7 @@ public class TestClient implements I2PSessionListener {
|
||||
doTest();
|
||||
try {
|
||||
Thread.sleep(30 * 1000);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ public class TestServer implements Runnable {
|
||||
* Fire up the router
|
||||
*/
|
||||
public static void main(String args[]) {
|
||||
if (args.length == 1) {
|
||||
if (args.length == 1) { // nop
|
||||
} else if (args.length == 2) {
|
||||
try {
|
||||
LISTEN_PORT = Integer.parseInt(args[1]);
|
||||
|
@ -46,7 +46,8 @@ public final class I2PDatagramDissector {
|
||||
/**
|
||||
* Crate a new I2P repliable datagram dissector.
|
||||
*/
|
||||
public I2PDatagramDissector() {}
|
||||
public I2PDatagramDissector() { // nop
|
||||
}
|
||||
|
||||
/**
|
||||
* Load an I2P repliable datagram into the dissector.
|
||||
|
@ -61,7 +61,7 @@ public class HostsTxtNamingService extends NamingService {
|
||||
} finally {
|
||||
if (fis != null) try {
|
||||
fis.close();
|
||||
} catch (IOException ioe) {
|
||||
} catch (IOException ioe) { // nop
|
||||
}
|
||||
}
|
||||
String res = hosts.getProperty(hostname);
|
||||
|
@ -35,7 +35,8 @@ public abstract class NamingService {
|
||||
protected NamingService(I2PAppContext context) {
|
||||
_context = context;
|
||||
}
|
||||
private NamingService() {}
|
||||
private NamingService() { // nop
|
||||
}
|
||||
|
||||
/**
|
||||
* Look up a host name.
|
||||
|
@ -73,16 +73,15 @@ public class AESInputStream extends FilterInputStream {
|
||||
Integer nval = getNext();
|
||||
if (nval != null) {
|
||||
return nval.intValue();
|
||||
} else {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("No byte available. eof? " + _eofFound);
|
||||
if (_eofFound)
|
||||
return -1;
|
||||
else {
|
||||
throw new IOException("Not EOF, but none available? " + _readyBuf.size() + "/" + _encryptedBuf.size()
|
||||
+ "/" + _cumulativeRead + "... impossible");
|
||||
}
|
||||
}
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("No byte available. eof? " + _eofFound);
|
||||
|
||||
if (_eofFound)
|
||||
return -1;
|
||||
|
||||
throw new IOException("Not EOF, but none available? " + _readyBuf.size() + "/" + _encryptedBuf.size()
|
||||
+ "/" + _cumulativeRead + "... impossible");
|
||||
}
|
||||
|
||||
public int read(byte dest[]) throws IOException {
|
||||
@ -90,13 +89,11 @@ public class AESInputStream extends FilterInputStream {
|
||||
int val = read();
|
||||
if (val == -1) {
|
||||
// no more to read... can they expect more?
|
||||
if (_eofFound && (i == 0))
|
||||
return -1;
|
||||
else
|
||||
return i;
|
||||
} else {
|
||||
dest[i] = (byte) val;
|
||||
if (_eofFound && (i == 0)) return -1;
|
||||
|
||||
return i;
|
||||
}
|
||||
dest[i] = (byte) val;
|
||||
}
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Read the full buffer of size " + dest.length);
|
||||
@ -141,7 +138,7 @@ public class AESInputStream extends FilterInputStream {
|
||||
+ encrypted + " still encrypted]");
|
||||
}
|
||||
|
||||
public void mark(int readLimit) {
|
||||
public void mark(int readLimit) { // nop
|
||||
}
|
||||
|
||||
public void reset() throws IOException {
|
||||
@ -159,9 +156,9 @@ public class AESInputStream extends FilterInputStream {
|
||||
private Integer getNext() {
|
||||
if (_readyBuf.size() > 0) {
|
||||
return (Integer) _readyBuf.remove(0);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -240,7 +237,7 @@ public class AESInputStream extends FilterInputStream {
|
||||
byte data[] = DataHelper.xor(decrypted, _lastBlock);
|
||||
int cleaned[] = stripPadding(data);
|
||||
for (int j = 0; j < cleaned.length; j++) {
|
||||
if (((int) cleaned[j]) <= 0) {
|
||||
if (cleaned[j] <= 0) {
|
||||
cleaned[j] += 256;
|
||||
//_log.error("(modified: " + cleaned[j] + ")");
|
||||
}
|
||||
@ -258,7 +255,7 @@ public class AESInputStream extends FilterInputStream {
|
||||
+ " bytes back onto the buffer, lets delay 1s our action so we don't fast busy until the net transfers data");
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
} else {
|
||||
//_log.debug("No remaining encrypted bytes beyond the block size");
|
||||
@ -280,7 +277,7 @@ public class AESInputStream extends FilterInputStream {
|
||||
*
|
||||
*/
|
||||
private int[] stripPadding(byte data[]) throws IOException {
|
||||
int numPadBytes = (int) data[data.length - 1];
|
||||
int numPadBytes = data[data.length - 1];
|
||||
if ((numPadBytes >= data.length) || (numPadBytes <= 0)) {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("stripPadding from block " + DataHelper.toHexString(data) + " (" + data.length + "bytes): "
|
||||
@ -363,7 +360,7 @@ public class AESInputStream extends FilterInputStream {
|
||||
|
||||
try {
|
||||
Thread.sleep(30 * 1000);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,14 +166,13 @@ public final class CryptixRijndael_Algorithm // implicit no-argument constructor
|
||||
t++;
|
||||
if (t == 4)
|
||||
throw new RuntimeException("G matrix is not invertible");
|
||||
else {
|
||||
for (j = 0; j < 8; j++) {
|
||||
tmp = AA[i][j];
|
||||
AA[i][j] = AA[t][j];
|
||||
AA[t][j] = (byte) tmp;
|
||||
}
|
||||
pivot = AA[i][i];
|
||||
|
||||
for (j = 0; j < 8; j++) {
|
||||
tmp = AA[i][j];
|
||||
AA[i][j] = AA[t][j];
|
||||
AA[t][j] = tmp;
|
||||
}
|
||||
pivot = AA[i][i];
|
||||
}
|
||||
for (j = 0; j < 8; j++)
|
||||
if (AA[i][j] != 0) AA[i][j] = (byte) _alog[(255 + _log[AA[i][j] & 0xFF] - _log[pivot & 0xFF]) % 255];
|
||||
|
@ -266,7 +266,7 @@ public class DHSessionKeyBuilder {
|
||||
RandomSource.getInstance().nextBoolean(); // warm it up
|
||||
try {
|
||||
Thread.sleep(20 * 1000);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
I2PAppContext ctx = new I2PAppContext();
|
||||
_log.debug("\n\n\n\nBegin test\n");
|
||||
@ -303,7 +303,7 @@ public class DHSessionKeyBuilder {
|
||||
_log.debug("Negotiation time for 5 runs: " + negTime + " @ " + negTime / 5l + "ms each");
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
}
|
||||
|
||||
@ -329,7 +329,7 @@ public class DHSessionKeyBuilder {
|
||||
// for some relief...
|
||||
try {
|
||||
Thread.sleep(CALC_DELAY);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -343,7 +343,7 @@ public class DHSessionKeyBuilder {
|
||||
}
|
||||
try {
|
||||
Thread.sleep(30 * 1000);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ public class DSAEngine {
|
||||
k += 512;
|
||||
}
|
||||
int padbytes = k / 8;
|
||||
int wordlength = (int) (source.length / 4 + padbytes / 4 + 3);
|
||||
int wordlength = source.length / 4 + padbytes / 4 + 3;
|
||||
int[] M0 = new int[wordlength];
|
||||
int wordcount = 0;
|
||||
int x = 0;
|
||||
|
@ -97,11 +97,10 @@ public class DummyElGamalEngine extends ElGamalEngine {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Hash matches: " + DataHelper.toString(hash.getData(), hash.getData().length));
|
||||
return rv;
|
||||
} else {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Doesn't match hash [calc=" + calcHash + " sent hash=" + hash + "]\ndata = " + new String(rv),
|
||||
new Exception("Doesn't match"));
|
||||
return null;
|
||||
}
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Doesn't match hash [calc=" + calcHash + " sent hash=" + hash + "]\ndata = " + new String(rv),
|
||||
new Exception("Doesn't match"));
|
||||
return null;
|
||||
}
|
||||
}
|
@ -37,7 +37,9 @@ public class ElGamalAESEngine {
|
||||
private final static int MIN_ENCRYPTED_SIZE = 80; // smallest possible resulting size
|
||||
private I2PAppContext _context;
|
||||
|
||||
private ElGamalAESEngine() {}
|
||||
private ElGamalAESEngine() { // nop
|
||||
}
|
||||
|
||||
public ElGamalAESEngine(I2PAppContext ctx) {
|
||||
_context = ctx;
|
||||
|
||||
@ -217,13 +219,12 @@ public class ElGamalAESEngine {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Decrypt with a non session tag, but tags read: " + foundTags.size());
|
||||
return decryptNewSession(data, targetPrivateKey, foundTags, usedKey, foundKey);
|
||||
} else {
|
||||
// existing session decrypted successfully!
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Decrypt with an EXISTING session tag successfull, # tags read: " + foundTags.size(),
|
||||
new Exception("Decrypted by"));
|
||||
return decrypted;
|
||||
}
|
||||
// existing session decrypted successfully!
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Decrypt with an EXISTING session tag successfull, # tags read: " + foundTags.size(),
|
||||
new Exception("Decrypted by"));
|
||||
return decrypted;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -292,9 +293,9 @@ public class ElGamalAESEngine {
|
||||
foundTags.addAll(tags);
|
||||
if (newKey != null) foundKey.setData(newKey.getData());
|
||||
return unencrData;
|
||||
} else {
|
||||
throw new Exception("Hash does not match");
|
||||
}
|
||||
|
||||
throw new Exception("Hash does not match");
|
||||
} catch (Exception e) {
|
||||
if (_log.shouldLog(Log.WARN)) _log.warn("Unable to decrypt AES block", e);
|
||||
return null;
|
||||
@ -321,12 +322,11 @@ public class ElGamalAESEngine {
|
||||
_log.info("Current tag is null, encrypting as new session", new Exception("encrypt new"));
|
||||
_context.statManager().updateFrequency("crypto.elGamalAES.encryptNewSession");
|
||||
return encryptNewSession(data, target, key, tagsForDelivery, newKey, paddedSize);
|
||||
} else {
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Current tag is NOT null, encrypting as existing session", new Exception("encrypt existing"));
|
||||
_context.statManager().updateFrequency("crypto.elGamalAES.encryptExistingSession");
|
||||
return encryptExistingSession(data, target, key, tagsForDelivery, currentTag, newKey, paddedSize);
|
||||
}
|
||||
if (_log.shouldLog(Log.INFO))
|
||||
_log.info("Current tag is NOT null, encrypting as existing session", new Exception("encrypt existing"));
|
||||
_context.statManager().updateFrequency("crypto.elGamalAES.encryptExistingSession");
|
||||
return encryptExistingSession(data, target, key, tagsForDelivery, currentTag, newKey, paddedSize);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,7 +75,9 @@ public class ElGamalEngine {
|
||||
_context = context;
|
||||
_log = context.logManager().getLog(ElGamalEngine.class);
|
||||
}
|
||||
private ElGamalEngine() {}
|
||||
|
||||
private ElGamalEngine() { // nop
|
||||
}
|
||||
|
||||
|
||||
private final static BigInteger _two = new NativeBigInteger(1, new byte[] { 0x02});
|
||||
@ -215,12 +217,11 @@ public class ElGamalEngine {
|
||||
if (ok) {
|
||||
//_log.debug("Hash matches: " + DataHelper.toString(hash.getData(), hash.getData().length));
|
||||
return rv;
|
||||
} else {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Doesn't match hash [calc=" + calcHash + " sent hash=" + hash + "]\ndata = "
|
||||
+ Base64.encode(rv), new Exception("Doesn't match"));
|
||||
return null;
|
||||
}
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Doesn't match hash [calc=" + calcHash + " sent hash=" + hash + "]\ndata = "
|
||||
+ Base64.encode(rv), new Exception("Doesn't match"));
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
@ -230,12 +231,12 @@ public class ElGamalEngine {
|
||||
int numRuns = 100;
|
||||
if (args.length > 0) try {
|
||||
numRuns = Integer.parseInt(args[0]);
|
||||
} catch (NumberFormatException nfe) {
|
||||
} catch (NumberFormatException nfe) { // nop
|
||||
}
|
||||
|
||||
try {
|
||||
Thread.sleep(30 * 1000);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
|
||||
RandomSource.getInstance().nextBoolean();
|
||||
|
@ -11,7 +11,9 @@ import net.i2p.data.SessionKey;
|
||||
*
|
||||
*/
|
||||
public class HMACSHA256Generator {
|
||||
public HMACSHA256Generator(I2PAppContext context) {};
|
||||
public HMACSHA256Generator(I2PAppContext context) { // nop
|
||||
}
|
||||
|
||||
public static HMACSHA256Generator getInstance() {
|
||||
return I2PAppContext.getGlobalContext().hmac();
|
||||
}
|
||||
|
@ -166,7 +166,7 @@ public class KeyGenerator {
|
||||
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
}
|
||||
}
|
@ -182,7 +182,7 @@ public class PersistentSessionKeyManager extends TransientSessionKeyManager {
|
||||
}
|
||||
try {
|
||||
Thread.sleep(3000);
|
||||
} catch (Throwable t) {
|
||||
} catch (Throwable t) { // nop
|
||||
}
|
||||
}
|
||||
}
|
@ -39,7 +39,9 @@ import net.i2p.data.Hash;
|
||||
* @author thecrypto,jrandom
|
||||
*/
|
||||
public class SHA256Generator {
|
||||
public SHA256Generator(I2PAppContext context) {};
|
||||
public SHA256Generator(I2PAppContext context) { // nop
|
||||
}
|
||||
|
||||
public static SHA256Generator getInstance() {
|
||||
return I2PAppContext.getGlobalContext().sha();
|
||||
}
|
||||
@ -66,7 +68,7 @@ public class SHA256Generator {
|
||||
k += 512;
|
||||
}
|
||||
int padbytes = k / 8;
|
||||
int wordlength = (int) (source.length / 4 + padbytes / 4 + 3);
|
||||
int wordlength = source.length / 4 + padbytes / 4 + 3;
|
||||
int[] M0 = new int[wordlength];
|
||||
int wordcount = 0;
|
||||
int x = 0;
|
||||
|
@ -25,9 +25,12 @@ import net.i2p.data.SessionTag;
|
||||
*/
|
||||
public class SessionKeyManager {
|
||||
/** session key managers must be created through an app context */
|
||||
protected SessionKeyManager(I2PAppContext context) {}
|
||||
protected SessionKeyManager(I2PAppContext context) { // nop
|
||||
}
|
||||
|
||||
/** see above */
|
||||
private SessionKeyManager() {}
|
||||
private SessionKeyManager() { // nop
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the session key currently associated with encryption to the target,
|
||||
@ -43,7 +46,7 @@ public class SessionKeyManager {
|
||||
* when to expire that key begin with this call.
|
||||
*
|
||||
*/
|
||||
public void createSession(PublicKey target, SessionKey key) {
|
||||
public void createSession(PublicKey target, SessionKey key) { // nop
|
||||
}
|
||||
|
||||
/**
|
||||
@ -90,7 +93,7 @@ public class SessionKeyManager {
|
||||
* method after receiving an ack to a message delivering them)
|
||||
*
|
||||
*/
|
||||
public void tagsDelivered(PublicKey target, SessionKey key, Set sessionTags) {
|
||||
public void tagsDelivered(PublicKey target, SessionKey key, Set sessionTags) { // nop
|
||||
}
|
||||
|
||||
/**
|
||||
@ -99,14 +102,14 @@ public class SessionKeyManager {
|
||||
* from corrupted tag sets and crashes
|
||||
*
|
||||
*/
|
||||
public void failTags(PublicKey target) {
|
||||
public void failTags(PublicKey target) { // nop
|
||||
}
|
||||
|
||||
/**
|
||||
* Accept the given tags and associate them with the given key for decryption
|
||||
*
|
||||
*/
|
||||
public void tagsReceived(SessionKey key, Set sessionTags) {
|
||||
public void tagsReceived(SessionKey key, Set sessionTags) { // nop
|
||||
}
|
||||
|
||||
/**
|
||||
@ -125,6 +128,6 @@ public class SessionKeyManager {
|
||||
* whatever precautions are necessary (saving state, etc)
|
||||
*
|
||||
*/
|
||||
public void shutdown() {
|
||||
public void shutdown() { // nop
|
||||
}
|
||||
}
|
@ -123,9 +123,8 @@ class TransientSessionKeyManager extends SessionKeyManager {
|
||||
+ new Date(sess.getEstablishedDate())
|
||||
+ " with target " + target);
|
||||
return null;
|
||||
} else {
|
||||
return sess.getCurrentKey();
|
||||
}
|
||||
return sess.getCurrentKey();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -158,11 +157,10 @@ class TransientSessionKeyManager extends SessionKeyManager {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Tag consumed: " + nxt);
|
||||
return nxt;
|
||||
} else {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Key does not match existing key, no tag");
|
||||
return null;
|
||||
}
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Key does not match existing key, no tag");
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -175,9 +173,8 @@ class TransientSessionKeyManager extends SessionKeyManager {
|
||||
if (sess == null) { return 0; }
|
||||
if (sess.getCurrentKey().equals(key)) {
|
||||
return sess.availableTags();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -189,9 +186,8 @@ class TransientSessionKeyManager extends SessionKeyManager {
|
||||
if (sess == null) { return 0; }
|
||||
if (sess.getCurrentKey().equals(key)) {
|
||||
return (sess.getLastExpirationDate() + SESSION_TAG_DURATION_MS) - Clock.getInstance().now();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -263,9 +259,9 @@ class TransientSessionKeyManager extends SessionKeyManager {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Cannot consume tag " + tag + " as it is not known");
|
||||
return null;
|
||||
} else {
|
||||
tagSet.consume(tag);
|
||||
}
|
||||
tagSet.consume(tag);
|
||||
|
||||
SessionKey key = tagSet.getAssociatedKey();
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Consuming tag " + tag + " for sessionKey " + key);
|
||||
@ -555,11 +551,11 @@ class TransientSessionKeyManager extends SessionKeyManager {
|
||||
public SessionTag consumeNext() {
|
||||
if (_sessionTags.size() <= 0) {
|
||||
return null;
|
||||
} else {
|
||||
SessionTag first = (SessionTag) _sessionTags.iterator().next();
|
||||
_sessionTags.remove(first);
|
||||
return first;
|
||||
}
|
||||
|
||||
SessionTag first = (SessionTag) _sessionTags.iterator().next();
|
||||
_sessionTags.remove(first);
|
||||
return first;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
|
@ -157,7 +157,7 @@ class YKGenerator {
|
||||
RandomSource.getInstance().nextBoolean(); // warm it up
|
||||
try {
|
||||
Thread.sleep(20 * 1000);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
_log.debug("\n\n\n\nBegin test\n");
|
||||
long negTime = 0;
|
||||
@ -169,7 +169,7 @@ class YKGenerator {
|
||||
_log.debug("YK fetch time for 5 runs: " + negTime + " @ " + negTime / 5l + "ms each");
|
||||
try {
|
||||
Thread.sleep(30 * 1000);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ class YKGenerator {
|
||||
// for some relief...
|
||||
try {
|
||||
Thread.sleep(CALC_DELAY);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -211,7 +211,7 @@ class YKGenerator {
|
||||
}
|
||||
try {
|
||||
Thread.sleep(CHECK_DELAY);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public class Base64 {
|
||||
private final static byte EQUALS_SIGN_ENC = -1; // Indicates equals sign in encoding
|
||||
|
||||
/** Defeats instantiation. */
|
||||
private Base64() {
|
||||
private Base64() { // nop
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
@ -40,13 +40,13 @@ public class ByteArray implements Serializable {
|
||||
if (o == null) return false;
|
||||
if (o instanceof ByteArray) {
|
||||
return compare(getData(), ((ByteArray) o).getData());
|
||||
} else {
|
||||
try {
|
||||
byte val[] = (byte[]) o;
|
||||
return compare(getData(), val);
|
||||
} catch (Throwable t) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
byte val[] = (byte[]) o;
|
||||
return compare(getData(), val);
|
||||
} catch (Throwable t) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,9 +78,9 @@ public class Certificate extends DataStructureImpl {
|
||||
if (_type < 0) throw new DataFormatException("Invalid certificate type: " + _type);
|
||||
if ((_type != 0) && (_payload == null)) throw new DataFormatException("Payload is required for non null type");
|
||||
|
||||
DataHelper.writeLong(out, 1, (long) _type);
|
||||
DataHelper.writeLong(out, 1, _type);
|
||||
if (_payload != null) {
|
||||
DataHelper.writeLong(out, 2, (long) _payload.length);
|
||||
DataHelper.writeLong(out, 2, _payload.length);
|
||||
out.write(_payload);
|
||||
} else {
|
||||
DataHelper.writeLong(out, 2, 0L);
|
||||
|
@ -148,10 +148,9 @@ public class DataHelper {
|
||||
}
|
||||
|
||||
public static String toString(byte buf[]) {
|
||||
if (buf == null)
|
||||
return "";
|
||||
else
|
||||
return toString(buf, buf.length);
|
||||
if (buf == null) return "";
|
||||
|
||||
return toString(buf, buf.length);
|
||||
}
|
||||
|
||||
private static final byte[] EMPTY_BUFFER = "".getBytes();
|
||||
@ -164,7 +163,7 @@ public class DataHelper {
|
||||
out.append("00");
|
||||
}
|
||||
for (int i = 0; i < buf.length && i < len; i++) {
|
||||
StringBuffer temp = new StringBuffer(Integer.toHexString((int) buf[i]));
|
||||
StringBuffer temp = new StringBuffer(Integer.toHexString(buf[i]));
|
||||
while (temp.length() < 2) {
|
||||
temp.insert(0, '0');
|
||||
}
|
||||
@ -241,10 +240,9 @@ public class DataHelper {
|
||||
*/
|
||||
public static Date readDate(InputStream in) throws DataFormatException, IOException {
|
||||
long date = readLong(in, 8);
|
||||
if (date == 0L)
|
||||
return null;
|
||||
else
|
||||
return new Date(date);
|
||||
if (date == 0L) return null;
|
||||
|
||||
return new Date(date);
|
||||
}
|
||||
|
||||
/** Write out a date to the stream as specified by the I2P data structure spec.
|
||||
@ -448,10 +446,9 @@ public class DataHelper {
|
||||
*
|
||||
*/
|
||||
public static int hashCode(Object obj) {
|
||||
if (obj == null)
|
||||
return 0;
|
||||
else
|
||||
return obj.hashCode();
|
||||
if (obj == null) return 0;
|
||||
|
||||
return obj.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -459,10 +456,9 @@ public class DataHelper {
|
||||
*
|
||||
*/
|
||||
public static int hashCode(Date obj) {
|
||||
if (obj == null)
|
||||
return 0;
|
||||
else
|
||||
return (int) obj.getTime();
|
||||
if (obj == null) return 0;
|
||||
|
||||
return (int) obj.getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -495,10 +491,9 @@ public class DataHelper {
|
||||
while (cur < target.length) {
|
||||
int numRead = in.read(target, cur, target.length - cur);
|
||||
if (numRead == -1) {
|
||||
if (cur == 0)
|
||||
return -1; // throw new EOFException("EOF Encountered during reading");
|
||||
else
|
||||
return cur;
|
||||
if (cur == 0) return -1; // throw new EOFException("EOF Encountered during reading");
|
||||
|
||||
return cur;
|
||||
}
|
||||
cur += numRead;
|
||||
}
|
||||
|
@ -29,8 +29,8 @@ public abstract class DataStructureImpl implements DataStructure {
|
||||
byte data[] = toByteArray();
|
||||
if (data == null)
|
||||
return null;
|
||||
else
|
||||
return Base64.encode(data);
|
||||
|
||||
return Base64.encode(data);
|
||||
}
|
||||
|
||||
public void fromBase64(String data) throws DataFormatException {
|
||||
|
@ -99,7 +99,7 @@ public class Hash extends DataStructureImpl {
|
||||
_xorCache.remove(iter.next());
|
||||
}
|
||||
distance = DataHelper.xor(key.getData(), getData());
|
||||
_xorCache.put(key, (Object)distance);
|
||||
_xorCache.put(key, (Object) distance);
|
||||
cached = _xorCache.size();
|
||||
}
|
||||
if (_log.shouldLog(Log.DEBUG)) {
|
||||
|
@ -121,8 +121,8 @@ public class LeaseSet extends DataStructureImpl {
|
||||
Hash rk = RoutingKeyGenerator.getInstance().getRoutingKey(destKey);
|
||||
if (rk.equals(getRoutingKey()))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -136,7 +136,7 @@ public class LeaseSet extends DataStructureImpl {
|
||||
public long getEarliestLeaseDate() {
|
||||
long when = -1;
|
||||
for (int i = 0; i < getLeaseCount(); i++) {
|
||||
Lease lse = (Lease) getLease(i);
|
||||
Lease lse = getLease(i);
|
||||
if ((lse != null) && (lse.getEndDate() != null)) {
|
||||
if ((when <= 0) || (lse.getEndDate().getTime() < when)) when = lse.getEndDate().getTime();
|
||||
}
|
||||
|
@ -302,8 +302,8 @@ public class RouterInfo extends DataStructureImpl {
|
||||
Hash rk = RoutingKeyGenerator.getInstance().getRoutingKey(identKey);
|
||||
if (rk.equals(getRoutingKey()))
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -316,11 +316,10 @@ public class RouterInfo extends DataStructureImpl {
|
||||
*/
|
||||
public boolean isCurrent(long maxAgeMs) {
|
||||
long earliestExpire = Clock.getInstance().now() - maxAgeMs;
|
||||
if (getPublished() < earliestExpire) {
|
||||
if (getPublished() < earliestExpire)
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -124,7 +124,7 @@ public class RoutingKeyGenerator {
|
||||
}
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (Throwable t) {
|
||||
} catch (Throwable t) { // nop
|
||||
}
|
||||
}
|
||||
}
|
@ -76,7 +76,7 @@ public class UnsignedInteger {
|
||||
} else if (data.length == 0) { return 0; }
|
||||
long rv = 0;
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
long cur = (long)(data[i]&0xFF);
|
||||
long cur = data[i] & 0xFF;
|
||||
if (cur < 0) cur = cur+256;
|
||||
cur = (cur << (8*(data.length-i-1)));
|
||||
rv += cur;
|
||||
@ -90,7 +90,7 @@ public class UnsignedInteger {
|
||||
+ " != \n " + Long.toBinaryString(rv) + " /\t" + Long.toHexString(rv)
|
||||
+ " /\t" + rv);
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
long cur = (long)(data[i]&0xFF);
|
||||
long cur = data[i] & 0xFF;
|
||||
if (cur < 0) cur = cur+256;
|
||||
long shiftBy = (8*(data.length-i-1));
|
||||
long old = cur;
|
||||
@ -210,9 +210,8 @@ public class UnsignedInteger {
|
||||
if ((obj != null) && (obj instanceof UnsignedInteger)) {
|
||||
return DataHelper.eq(_data, ((UnsignedInteger) obj)._data)
|
||||
&& DataHelper.eq(_value, ((UnsignedInteger) obj)._value);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
@ -242,7 +241,7 @@ public class UnsignedInteger {
|
||||
} catch (Throwable t) { t.printStackTrace(); }
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (Throwable t) {
|
||||
} catch (Throwable t) { // nop
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,9 +114,9 @@ public class CreateLeaseSetMessage extends I2CPMessageImpl {
|
||||
&& DataHelper.eq(getSigningPrivateKey(), msg.getSigningPrivateKey())
|
||||
&& DataHelper.eq(getPrivateKey(), msg.getPrivateKey())
|
||||
&& DataHelper.eq(getLeaseSet(), msg.getLeaseSet());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
@ -74,9 +74,9 @@ public class CreateSessionMessage extends I2CPMessageImpl {
|
||||
if ((object != null) && (object instanceof CreateSessionMessage)) {
|
||||
CreateSessionMessage msg = (CreateSessionMessage) object;
|
||||
return DataHelper.eq(getSessionConfig(), msg.getSessionConfig());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
@ -70,9 +70,9 @@ public class DestroySessionMessage extends I2CPMessageImpl {
|
||||
if ((object != null) && (object instanceof DestroySessionMessage)) {
|
||||
DestroySessionMessage msg = (DestroySessionMessage) object;
|
||||
return DataHelper.eq(getSessionId(), msg.getSessionId());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
@ -66,9 +66,9 @@ public class DisconnectMessage extends I2CPMessageImpl {
|
||||
if ((object != null) && (object instanceof DisconnectMessage)) {
|
||||
DisconnectMessage msg = (DisconnectMessage) object;
|
||||
return DataHelper.eq(getReason(), msg.getReason());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
@ -42,9 +42,9 @@ public class GetDateMessage extends I2CPMessageImpl {
|
||||
public boolean equals(Object object) {
|
||||
if ((object != null) && (object instanceof GetDateMessage)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
@ -27,7 +27,7 @@ import net.i2p.util.Log;
|
||||
public abstract class I2CPMessageImpl extends DataStructureImpl implements I2CPMessage {
|
||||
private final static Log _log = new Log(I2CPMessageImpl.class);
|
||||
|
||||
public I2CPMessageImpl() {
|
||||
public I2CPMessageImpl() { // nop
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -168,7 +168,7 @@ public class I2CPMessageReader {
|
||||
// pause .5 secs when we're paused
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,9 +103,9 @@ public class MessagePayloadMessage extends I2CPMessageImpl {
|
||||
return DataHelper.eq(getSessionId(), msg.getSessionId())
|
||||
&& DataHelper.eq(getMessageId(), msg.getMessageId())
|
||||
&& DataHelper.eq(getPayload(), msg.getPayload());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
@ -146,9 +146,9 @@ public class MessageStatusMessage extends I2CPMessageImpl {
|
||||
return DataHelper.eq(getSessionId(), msg.getSessionId())
|
||||
&& DataHelper.eq(getMessageId(), msg.getMessageId()) && (getNonce() == msg.getNonce())
|
||||
&& DataHelper.eq(getSize(), msg.getSize()) && DataHelper.eq(getStatus(), msg.getStatus());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
@ -83,9 +83,9 @@ public class ReceiveMessageBeginMessage extends I2CPMessageImpl {
|
||||
ReceiveMessageBeginMessage msg = (ReceiveMessageBeginMessage) object;
|
||||
return DataHelper.eq(getSessionId(), msg.getSessionId())
|
||||
&& DataHelper.eq(getMessageId(), msg.getMessageId());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
@ -83,9 +83,9 @@ public class ReceiveMessageEndMessage extends I2CPMessageImpl {
|
||||
ReceiveMessageEndMessage msg = (ReceiveMessageEndMessage) object;
|
||||
return DataHelper.eq(getSessionId(), msg.getSessionId())
|
||||
&& DataHelper.eq(getMessageId(), msg.getMessageId());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
@ -113,9 +113,9 @@ public class ReportAbuseMessage extends I2CPMessageImpl {
|
||||
ReportAbuseMessage msg = (ReportAbuseMessage) object;
|
||||
return DataHelper.eq(getSessionId(), msg.getSessionId()) && DataHelper.eq(getSeverity(), msg.getSeverity())
|
||||
&& DataHelper.eq(getReason(), msg.getReason()) && DataHelper.eq(getMessageId(), msg.getMessageId());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
@ -131,9 +131,9 @@ public class RequestLeaseSetMessage extends I2CPMessageImpl {
|
||||
return false;
|
||||
}
|
||||
return DataHelper.eq(getSessionId(), msg.getSessionId()) && DataHelper.eq(getEndDate(), msg.getEndDate());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
@ -111,9 +111,9 @@ public class SendMessageMessage extends I2CPMessageImpl {
|
||||
return DataHelper.eq(getSessionId(), msg.getSessionId())
|
||||
&& DataHelper.eq(getDestination(), msg.getDestination()) && (getNonce() == msg.getNonce())
|
||||
&& DataHelper.eq(getPayload(), msg.getPayload());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
@ -204,9 +204,9 @@ public class SessionConfig extends DataStructureImpl {
|
||||
&& DataHelper.eq(getDestination(), cfg.getDestination())
|
||||
&& DataHelper.eq(getCreationDate(), cfg.getCreationDate())
|
||||
&& DataHelper.eq(getOptions(), cfg.getOptions());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
@ -86,9 +86,9 @@ public class SessionStatusMessage extends I2CPMessageImpl {
|
||||
if ((object != null) && (object instanceof SessionStatusMessage)) {
|
||||
SessionStatusMessage msg = (SessionStatusMessage) object;
|
||||
return DataHelper.eq(getSessionId(), msg.getSessionId()) && DataHelper.eq(getStatus(), msg.getStatus());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
@ -69,9 +69,9 @@ public class SetDateMessage extends I2CPMessageImpl {
|
||||
if ((object != null) && (object instanceof SetDateMessage)) {
|
||||
SetDateMessage msg = (SetDateMessage) object;
|
||||
return DataHelper.eq(getDate(), msg.getDate());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
@ -55,20 +55,18 @@ public class Frequency {
|
||||
/** calculate how many events would occur in a period given the current average */
|
||||
public double getAverageEventsPerPeriod() {
|
||||
synchronized (_lock) {
|
||||
if (_avgInterval > 0)
|
||||
return _period / _avgInterval;
|
||||
else
|
||||
return 0;
|
||||
if (_avgInterval > 0) return _period / _avgInterval;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/** calculate how many events would occur in a period given the maximum average */
|
||||
public double getMaxAverageEventsPerPeriod() {
|
||||
synchronized (_lock) {
|
||||
if (_minAverageInterval > 0)
|
||||
return _period / _minAverageInterval;
|
||||
else
|
||||
return 0;
|
||||
if (_minAverageInterval > 0) return _period / _minAverageInterval;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,10 +74,9 @@ public class Frequency {
|
||||
public double getStrictAverageInterval() {
|
||||
synchronized (_lock) {
|
||||
long duration = now() - _start;
|
||||
if ((duration <= 0) || (_count <= 0))
|
||||
return 0;
|
||||
else
|
||||
return duration / _count;
|
||||
if ((duration <= 0) || (_count <= 0)) return 0;
|
||||
|
||||
return duration / _count;
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,10 +84,9 @@ public class Frequency {
|
||||
public double getStrictAverageEventsPerPeriod() {
|
||||
double avgInterval = getStrictAverageInterval();
|
||||
synchronized (_lock) {
|
||||
if (avgInterval > 0)
|
||||
return _period / avgInterval;
|
||||
else
|
||||
return 0;
|
||||
if (avgInterval > 0) return _period / avgInterval;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -182,27 +182,26 @@ public class Rate {
|
||||
if (measuredPeriod < _period) {
|
||||
// no need to coallesce
|
||||
return;
|
||||
} else {
|
||||
// ok ok, lets coallesce
|
||||
|
||||
// how much were we off by? (so that we can sample down the measured values)
|
||||
double periodFactor = measuredPeriod / _period;
|
||||
_lastTotalValue = (_currentTotalValue == 0 ? 0.0d : _currentTotalValue / periodFactor);
|
||||
_lastEventCount = (_currentEventCount == 0 ? 0l : (long) (_currentEventCount / periodFactor));
|
||||
_lastTotalEventTime = (_currentTotalEventTime == 0 ? 0l
|
||||
: (long) (_currentTotalEventTime / periodFactor));
|
||||
_lastCoallesceDate = now;
|
||||
|
||||
if (_lastTotalValue > _extremeTotalValue) {
|
||||
_extremeTotalValue = _lastTotalValue;
|
||||
_extremeEventCount = _lastEventCount;
|
||||
_extremeTotalEventTime = _lastTotalEventTime;
|
||||
}
|
||||
|
||||
_currentTotalValue = 0.0d;
|
||||
_currentEventCount = 0;
|
||||
_currentTotalEventTime = 0;
|
||||
}
|
||||
|
||||
// ok ok, lets coallesce
|
||||
|
||||
// how much were we off by? (so that we can sample down the measured values)
|
||||
double periodFactor = measuredPeriod / _period;
|
||||
_lastTotalValue = (_currentTotalValue == 0 ? 0.0D : _currentTotalValue / periodFactor);
|
||||
_lastEventCount = (_currentEventCount == 0 ? 0L : (long) (_currentEventCount / periodFactor));
|
||||
_lastTotalEventTime = (_currentTotalEventTime == 0 ? 0L : (long) (_currentTotalEventTime / periodFactor));
|
||||
_lastCoallesceDate = now;
|
||||
|
||||
if (_lastTotalValue > _extremeTotalValue) {
|
||||
_extremeTotalValue = _lastTotalValue;
|
||||
_extremeEventCount = _lastEventCount;
|
||||
_extremeTotalEventTime = _lastTotalEventTime;
|
||||
}
|
||||
|
||||
_currentTotalValue = 0.0D;
|
||||
_currentEventCount = 0;
|
||||
_currentTotalEventTime = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,24 +209,24 @@ public class Rate {
|
||||
public double getAverageValue() {
|
||||
if ((_lastTotalValue != 0) && (_lastEventCount > 0))
|
||||
return _lastTotalValue / _lastEventCount;
|
||||
else
|
||||
return 0.0d;
|
||||
|
||||
return 0.0D;
|
||||
}
|
||||
|
||||
/** what was the average value across the events in the most active period? */
|
||||
public double getExtremeAverageValue() {
|
||||
if ((_extremeTotalValue != 0) && (_extremeEventCount > 0))
|
||||
return _extremeTotalValue / _extremeEventCount;
|
||||
else
|
||||
return 0.0d;
|
||||
|
||||
return 0.0D;
|
||||
}
|
||||
|
||||
/** what was the average value across the events since the stat was created? */
|
||||
public double getLifetimeAverageValue() {
|
||||
if ((_lifetimeTotalValue != 0) && (_lifetimeEventCount > 0))
|
||||
return _lifetimeTotalValue / _lifetimeEventCount;
|
||||
else
|
||||
return 0.0d;
|
||||
|
||||
return 0.0D;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -239,12 +238,12 @@ public class Rate {
|
||||
public double getLastEventSaturation() {
|
||||
if ((_lastEventCount > 0) && (_lastTotalEventTime > 0)) {
|
||||
double eventTime = (double) _lastTotalEventTime / (double) _lastEventCount;
|
||||
double maxEvents = (double) _period / eventTime;
|
||||
double maxEvents = _period / eventTime;
|
||||
double saturation = _lastEventCount / maxEvents;
|
||||
return saturation;
|
||||
} else {
|
||||
return 0.0d;
|
||||
}
|
||||
|
||||
return 0.0D;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -256,11 +255,10 @@ public class Rate {
|
||||
public double getExtremeEventSaturation() {
|
||||
if ((_extremeEventCount > 0) && (_extremeTotalEventTime > 0)) {
|
||||
double eventTime = (double) _extremeTotalEventTime / (double) _extremeEventCount;
|
||||
double maxEvents = (double) _period / eventTime;
|
||||
double maxEvents = _period / eventTime;
|
||||
return _extremeEventCount / maxEvents;
|
||||
} else {
|
||||
return 0.0d;
|
||||
}
|
||||
return 0.0D;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -272,13 +270,12 @@ public class Rate {
|
||||
public double getLifetimeEventSaturation() {
|
||||
if ((_lastEventCount > 0) && (_lifetimeTotalEventTime > 0)) {
|
||||
double eventTime = (double) _lifetimeTotalEventTime / (double) _lifetimeEventCount;
|
||||
double maxEvents = (double) _period / eventTime;
|
||||
double maxEvents = _period / eventTime;
|
||||
double numPeriods = getLifetimePeriods();
|
||||
double avgEventsPerPeriod = _lifetimeEventCount / numPeriods;
|
||||
return avgEventsPerPeriod / maxEvents;
|
||||
} else {
|
||||
return 0.0d;
|
||||
}
|
||||
return 0.0D;
|
||||
}
|
||||
|
||||
/** how many periods have we already completed? */
|
||||
@ -297,13 +294,11 @@ public class Rate {
|
||||
public double getLastSaturationLimit() {
|
||||
if ((_lastTotalValue != 0) && (_lastEventCount > 0) && (_lastTotalEventTime > 0)) {
|
||||
double saturation = getLastEventSaturation();
|
||||
if (saturation != 0.0d)
|
||||
return _lastTotalValue / saturation;
|
||||
else
|
||||
return 0.0d;
|
||||
} else {
|
||||
return 0.0d;
|
||||
if (saturation != 0.0D) return _lastTotalValue / saturation;
|
||||
|
||||
return 0.0D;
|
||||
}
|
||||
return 0.0D;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -315,13 +310,12 @@ public class Rate {
|
||||
public double getExtremeSaturationLimit() {
|
||||
if ((_extremeTotalValue != 0) && (_extremeEventCount > 0) && (_extremeTotalEventTime > 0)) {
|
||||
double saturation = getExtremeEventSaturation();
|
||||
if (saturation != 0.0d)
|
||||
return _extremeTotalValue / saturation;
|
||||
else
|
||||
return 0.0d;
|
||||
} else {
|
||||
return 0.0d;
|
||||
}
|
||||
if (saturation != 0.0d) return _extremeTotalValue / saturation;
|
||||
|
||||
return 0.0D;
|
||||
}
|
||||
|
||||
return 0.0D;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -331,8 +325,8 @@ public class Rate {
|
||||
public double getPercentageOfExtremeValue() {
|
||||
if ((_lastTotalValue != 0) && (_extremeTotalValue != 0))
|
||||
return _lastTotalValue / _extremeTotalValue;
|
||||
else
|
||||
return 0.0d;
|
||||
|
||||
return 0.0D;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -343,9 +337,9 @@ public class Rate {
|
||||
if ((_lastTotalValue != 0) && (_lifetimeTotalValue != 0)) {
|
||||
double lifetimePeriodValue = _period * (_lifetimeTotalValue / (now() - _creationDate));
|
||||
return _lastTotalValue / lifetimePeriodValue;
|
||||
} else {
|
||||
return 0.0d;
|
||||
}
|
||||
|
||||
return 0.0D;
|
||||
}
|
||||
|
||||
public void store(String prefix, StringBuffer buf) throws IOException {
|
||||
@ -468,7 +462,7 @@ public class Rate {
|
||||
for (int i = 0; i < 50; i++) {
|
||||
try {
|
||||
Thread.sleep(20);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
rate.addData(i * 100, 20);
|
||||
}
|
||||
@ -492,7 +486,7 @@ public class Rate {
|
||||
}
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
}
|
||||
}
|
@ -97,9 +97,9 @@ public class RateStat {
|
||||
for (int i = 0; i < _rates.length; i++)
|
||||
if (!_rates[i].equals(rs.getRate(_rates[i].getPeriod()))) return false;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void store(OutputStream out, String prefix) throws IOException {
|
||||
@ -158,7 +158,7 @@ public class RateStat {
|
||||
for (int i = 0; i < 50; i++) {
|
||||
try {
|
||||
Thread.sleep(20);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
rs.addData(i * 100, 20);
|
||||
}
|
||||
@ -185,7 +185,7 @@ public class RateStat {
|
||||
}
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
}
|
||||
}
|
@ -132,7 +132,7 @@ public class EventDispatcherImpl implements EventDispatcher {
|
||||
}
|
||||
try {
|
||||
_events.wait(1 * 1000);
|
||||
} catch (InterruptedException e) {
|
||||
} catch (InterruptedException e) { // nop
|
||||
}
|
||||
}
|
||||
} while (true);
|
||||
|
@ -84,7 +84,7 @@ public class HTTPSendData {
|
||||
_log.debug("Sent? " + sent);
|
||||
try {
|
||||
Thread.sleep(2000);
|
||||
} catch (InterruptedException ie) {
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
}
|
||||
}
|
@ -106,7 +106,7 @@ public class HexDump {
|
||||
if (i >= nextbytes) {
|
||||
out.write(" ".getBytes());
|
||||
} else {
|
||||
val = ((int) data[dumpoff + i]) & 0xff;
|
||||
val = data[dumpoff + i] & 0xff;
|
||||
out.write(HEXCHARS[val >>> 4]);
|
||||
out.write(HEXCHARS[val & 0xf]);
|
||||
out.write(" ".getBytes());
|
||||
|
@ -86,7 +86,7 @@ public class I2PThread extends Thread {
|
||||
t.start();
|
||||
try {
|
||||
Thread.sleep(10000);
|
||||
} catch (Throwable tt) {
|
||||
} catch (Throwable tt) { // nop
|
||||
}
|
||||
}
|
||||
}
|
@ -161,10 +161,9 @@ public class Log {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
if (_class != null)
|
||||
return _class.getName();
|
||||
else
|
||||
return _name;
|
||||
if (_class != null) return _class.getName();
|
||||
|
||||
return _name;
|
||||
}
|
||||
|
||||
public Object getScope() { return _scope; }
|
||||
@ -189,9 +188,9 @@ public class Log {
|
||||
LogScope s = (LogScope)obj;
|
||||
return DataHelper.eq(s._scopeName, _scopeName) &&
|
||||
DataHelper.eq(s._scopeClass, _scopeClass);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -108,7 +108,9 @@ public class LogManager {
|
||||
}
|
||||
//System.out.println("Created logManager " + this + " with context: " + context);
|
||||
}
|
||||
private LogManager() {}
|
||||
|
||||
private LogManager() { // nop
|
||||
}
|
||||
|
||||
public Log getLog(Class cls) { return getLog(cls, null); }
|
||||
public Log getLog(String name) { return getLog(null, name); }
|
||||
@ -213,10 +215,11 @@ public class LogManager {
|
||||
+ (_context.clock().now() - _configLastRead) + "ms ago, config file modified "
|
||||
+ (_context.clock().now() - cfgFile.lastModified()) + "ms ago");
|
||||
return;
|
||||
} else {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Loading config from " + _location);
|
||||
}
|
||||
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Loading config from " + _location);
|
||||
|
||||
Properties p = new Properties();
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
@ -228,7 +231,7 @@ public class LogManager {
|
||||
} finally {
|
||||
if (fis != null) try {
|
||||
fis.close();
|
||||
} catch (IOException ioe) {
|
||||
} catch (IOException ioe) { // nop
|
||||
}
|
||||
}
|
||||
parseConfig(p);
|
||||
@ -320,7 +323,7 @@ public class LogManager {
|
||||
char mod = size.toUpperCase().charAt(size.length() - 1);
|
||||
if (!Character.isDigit(mod)) v = size.substring(0, size.length() - 1);
|
||||
int val = Integer.parseInt(v);
|
||||
switch ((int) mod) {
|
||||
switch (mod) {
|
||||
case 'K':
|
||||
val *= 1024;
|
||||
break;
|
||||
@ -443,7 +446,7 @@ public class LogManager {
|
||||
l1.error("test exception", new Exception("test"));
|
||||
try {
|
||||
Thread.sleep(2 * 1000);
|
||||
} catch (Throwable t) {
|
||||
} catch (Throwable t) { // nop
|
||||
}
|
||||
System.exit(0);
|
||||
}
|
||||
|
@ -33,20 +33,20 @@ class LogRecordFormatter {
|
||||
StringBuffer buf = new StringBuffer(size);
|
||||
char format[] = manager.getFormat();
|
||||
for (int i = 0; i < format.length; ++i) {
|
||||
switch ((int) format[i]) {
|
||||
case (int) LogManager.DATE:
|
||||
switch (format[i]) {
|
||||
case LogManager.DATE:
|
||||
buf.append(getWhen(manager, rec));
|
||||
break;
|
||||
case (int) LogManager.CLASS:
|
||||
case LogManager.CLASS:
|
||||
buf.append(getWhere(rec));
|
||||
break;
|
||||
case (int) LogManager.THREAD:
|
||||
case LogManager.THREAD:
|
||||
buf.append(getThread(rec));
|
||||
break;
|
||||
case (int) LogManager.PRIORITY:
|
||||
case LogManager.PRIORITY:
|
||||
buf.append(getPriority(rec));
|
||||
break;
|
||||
case (int) LogManager.MESSAGE:
|
||||
case LogManager.MESSAGE:
|
||||
buf.append(getWhat(rec));
|
||||
break;
|
||||
default:
|
||||
@ -62,7 +62,7 @@ class LogRecordFormatter {
|
||||
try {
|
||||
pw.flush();
|
||||
baos.flush();
|
||||
} catch (IOException ioe) {
|
||||
} catch (IOException ioe) { // nop
|
||||
}
|
||||
byte tb[] = baos.toByteArray();
|
||||
buf.append(new String(tb));
|
||||
|
@ -33,7 +33,9 @@ class LogWriter implements Runnable {
|
||||
|
||||
private boolean _write;
|
||||
|
||||
private LogWriter() {}
|
||||
private LogWriter() { // nop
|
||||
}
|
||||
|
||||
public LogWriter(LogManager manager) {
|
||||
_manager = manager;
|
||||
}
|
||||
@ -69,7 +71,10 @@ class LogWriter implements Runnable {
|
||||
} catch (Throwable t) {
|
||||
t.printStackTrace();
|
||||
} finally {
|
||||
try { Thread.sleep(100); } catch (InterruptedException ie) {}
|
||||
try {
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException ie) { // nop
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,19 +153,21 @@ class LogWriter implements Runnable {
|
||||
*/
|
||||
private File getNextFile(String pattern) {
|
||||
File f = null;
|
||||
|
||||
if (pattern.indexOf('#') < 0) {
|
||||
return new File(pattern);
|
||||
} else {
|
||||
int max = _manager.getRotationLimit();
|
||||
if (_rotationNum == -1) {
|
||||
return getFirstFile(pattern, max);
|
||||
} else {
|
||||
// we're in rotation, just go to the next
|
||||
_rotationNum++;
|
||||
if (_rotationNum > max) _rotationNum = 0;
|
||||
return new File(replace(pattern, _rotationNum));
|
||||
}
|
||||
}
|
||||
|
||||
int max = _manager.getRotationLimit();
|
||||
if (_rotationNum == -1) {
|
||||
return getFirstFile(pattern, max);
|
||||
}
|
||||
|
||||
// we're in rotation, just go to the next
|
||||
_rotationNum++;
|
||||
if (_rotationNum > max) _rotationNum = 0;
|
||||
|
||||
return new File(replace(pattern, _rotationNum));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -137,8 +137,8 @@ public class NativeBigInteger extends BigInteger {
|
||||
public BigInteger modPow(BigInteger exponent, BigInteger m) {
|
||||
if (_nativeOk)
|
||||
return new NativeBigInteger(nativeModPow(toByteArray(), exponent.toByteArray(), m.toByteArray()));
|
||||
else
|
||||
return super.modPow(exponent, m);
|
||||
|
||||
return super.modPow(exponent, m);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -197,10 +197,10 @@ public class NativeBigInteger extends BigInteger {
|
||||
System.err.println("ERROR: java modPow value: " + jval.toString());
|
||||
System.err.println("ERROR: run time: " + totalTime + "ms (" + (totalTime / (runsProcessed + 1)) + "ms each)");
|
||||
break;
|
||||
} else {
|
||||
System.out.println("DEBUG: current run time: " + (afterModPow - beforeModPow) + "ms (total: "
|
||||
+ totalTime + "ms, " + (totalTime / (runsProcessed + 1)) + "ms each)");
|
||||
}
|
||||
|
||||
System.out.println("DEBUG: current run time: " + (afterModPow - beforeModPow) + "ms (total: "
|
||||
+ totalTime + "ms, " + (totalTime / (runsProcessed + 1)) + "ms each)");
|
||||
}
|
||||
System.out.println("INFO: run time: " + totalTime + "ms (" + (totalTime / (runsProcessed + 1)) + "ms each)");
|
||||
if (numRuns == runsProcessed)
|
||||
@ -212,7 +212,7 @@ public class NativeBigInteger extends BigInteger {
|
||||
System.out.println("native run time: \t" + totalTime + "ms (" + (totalTime / (runsProcessed + 1))
|
||||
+ "ms each)");
|
||||
System.out.println("java run time: \t" + javaTime + "ms (" + (javaTime / (runsProcessed + 1)) + "ms each)");
|
||||
System.out.println("native = " + ((totalTime * 100.0d) / (double) javaTime) + "% of pure java time");
|
||||
System.out.println("native = " + ((totalTime * 100.0D) / javaTime) + "% of pure java time");
|
||||
} else {
|
||||
System.out.println("java run time: \t" + javaTime + "ms (" + (javaTime / (runsProcessed + 1)) + "ms each)");
|
||||
System.out.println("However, we couldn't load the native library, so this doesn't test much");
|
||||
@ -349,7 +349,12 @@ public class NativeBigInteger extends BigInteger {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
} finally {
|
||||
if (in != null) try { in.close(); } catch (IOException ioe) {}
|
||||
if (in != null) {
|
||||
try {
|
||||
in.close();
|
||||
} catch (IOException ioe) { // nop
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,9 +69,9 @@ public class OrderedProperties extends Properties {
|
||||
synchronized (_lock) {
|
||||
return _data.equals(obj);
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
@ -96,10 +96,9 @@ public class OrderedProperties extends Properties {
|
||||
if (key == null) return null;
|
||||
synchronized (_lock) {
|
||||
Object rv = _data.get(key);
|
||||
if ((rv != null) && (rv instanceof String))
|
||||
return (String) rv;
|
||||
else
|
||||
return null;
|
||||
if ((rv != null) && (rv instanceof String)) return (String) rv;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,17 +190,17 @@ public class OrderedProperties extends Properties {
|
||||
return Collections.enumeration(keySet());
|
||||
}
|
||||
|
||||
public void list(PrintStream out) {
|
||||
public void list(PrintStream out) { // nop
|
||||
}
|
||||
|
||||
public void list(PrintWriter out) {
|
||||
public void list(PrintWriter out) { // nop
|
||||
}
|
||||
|
||||
public void load(InputStream in) {
|
||||
public void load(InputStream in) { // nop
|
||||
}
|
||||
|
||||
//public void save(OutputStream out, String header) {}
|
||||
public void store(OutputStream out, String header) {
|
||||
public void store(OutputStream out, String header) { // nop
|
||||
}
|
||||
|
||||
private Set buildEntrySet(Set data) {
|
||||
|
Reference in New Issue
Block a user