Findbugs all over

This commit is contained in:
zzz
2018-08-26 13:50:40 +00:00
parent db54edc36d
commit 1f92232253
17 changed files with 56 additions and 66 deletions

View File

@ -41,7 +41,6 @@ public class HandshakeState implements Destroyable {
private DHState localEphemeral;
private DHState remotePublicKey;
private DHState remoteEphemeral;
private DHState fixedEphemeral;
private int action;
private final int requirements;
private int patternIndex;
@ -486,10 +485,7 @@ public class HandshakeState implements Destroyable {
// then the ephemeral key may have already been provided.
if (localEphemeral == null)
throw new IllegalStateException("Pattern definition error");
if (fixedEphemeral == null)
localEphemeral.generateKeyPair();
else
localEphemeral.copyFrom(fixedEphemeral);
localEphemeral.generateKeyPair();
len = localEphemeral.getPublicKeyLength();
if (space < len)
throw new ShortBufferException();
@ -802,8 +798,6 @@ public class HandshakeState implements Destroyable {
remotePublicKey.destroy();
if (remoteEphemeral != null)
remoteEphemeral.destroy();
if (fixedEphemeral != null)
fixedEphemeral.destroy();
if (prologue != null)
Noise.destroy(prologue);
}

View File

@ -312,6 +312,7 @@ public class DeliveryInstructions extends DataStructureImpl {
return additionalSize;
}
/****
private byte[] getAdditionalInfo() {
int additionalSize = getAdditionalInfoSize();
byte rv[] = new byte[additionalSize];
@ -322,7 +323,9 @@ public class DeliveryInstructions extends DataStructureImpl {
throw new IllegalStateException("size mismatch, additionalSize = " + additionalSize + ", offset = " + offset);
return rv;
}
****/
/** */
private int getAdditionalInfo(byte rv[], int offset) {
int origOffset = offset;

View File

@ -39,7 +39,7 @@ public class PersistentKeyRing extends KeyRing {
@Override
public SessionKey remove(Object o) {
SessionKey rv = super.remove(o);
if (rv != null && o != null && o instanceof Hash) {
if (rv != null && o instanceof Hash) {
Hash h = (Hash) o;
_ctx.router().saveConfig(PROP_PFX + h.toBase64().replace("=", "$"), null);
}

View File

@ -612,10 +612,6 @@ public class NTCPTransport extends TransportImpl {
/** queue up afterSend call, which can take some time w/ jobs, etc */
void sendComplete(OutNetMessage msg) { _finisher.add(msg); }
private boolean isEstablished(RouterIdentity peer) {
return isEstablished(peer.calculateHash());
}
@Override
public boolean isEstablished(Hash dest) {
NTCPConnection con = _conByIdent.get(dest);

View File

@ -407,14 +407,14 @@ class UDPPacket implements CDQEntry {
* @param inbound unused
*/
public static UDPPacket acquire(RouterContext ctx, boolean inbound) {
UDPPacket rv = null;
UDPPacket rv;
if (CACHE) {
PacketFactory.context = ctx;
rv = _packetCache.acquire();
rv.init(ctx);
}
if (rv == null)
} else {
rv = new UDPPacket(ctx);
}
return rv;
}