Fix critical typo in ZoneVerifier; more sonarlint

This commit is contained in:
David Blacka 2023-07-24 00:12:28 -04:00
parent 69a0a34239
commit 3601676406
7 changed files with 15 additions and 10 deletions

View File

@ -47,8 +47,8 @@
deprecation="true" deprecation="true"
includeantruntime="false" includeantruntime="false"
includes="com/verisignlabs/dnssec/" includes="com/verisignlabs/dnssec/"
source="8" source="11"
target="8" /> target="11" />
</target> </target>
<target name="sectools-jar" depends="usage,sectools"> <target name="sectools-jar" depends="usage,sectools">

View File

@ -22,7 +22,6 @@ import java.io.FileFilter;
import java.io.IOException; import java.io.IOException;
import java.time.Instant; import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;

View File

@ -21,7 +21,6 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.time.Instant; import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLine;

View File

@ -24,7 +24,6 @@ import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.time.Instant; import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;

View File

@ -455,9 +455,7 @@ public class DnsKeyAlgorithm {
* alias. * alias.
*/ */
public boolean supportedAlgorithm(int algorithm) { public boolean supportedAlgorithm(int algorithm) {
if (mAlgorithmMap.containsKey(algorithm)) return mAlgorithmMap.containsKey(algorithm);
return true;
return false;
} }
/** /**

View File

@ -262,7 +262,7 @@ public class DnsSecVerifier {
* @return true if the set verified, false if it did not. * @return true if the set verified, false if it did not.
*/ */
public boolean verify(RRset rrset) { public boolean verify(RRset rrset) {
boolean result = mVerifyAllSigs ? true : false; boolean result = mVerifyAllSigs;
if (rrset.sigs().isEmpty()) { if (rrset.sigs().isEmpty()) {
log.fine("RRset failed to verify due to lack of signatures"); log.fine("RRset failed to verify due to lack of signatures");

View File

@ -84,6 +84,14 @@ public class ZoneVerifier {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private boolean mIsMarked = false; private boolean mIsMarked = false;
@Override
public boolean equals(Object o) {
return super.equals(o);
}
@Override
public int hashCode() {
return super.hashCode();
}
boolean getMark() { boolean getMark() {
return mIsMarked; return mIsMarked;
} }
@ -161,7 +169,7 @@ public class ZoneVerifier {
if (mNSEC3Map == null) { if (mNSEC3Map == null) {
mNSEC3Map = new TreeMap<>(); mNSEC3Map = new TreeMap<>();
} }
MarkRRset rrset = mNSECMap.computeIfAbsent(n, k -> new MarkRRset()); MarkRRset rrset = mNSEC3Map.computeIfAbsent(n, k -> new MarkRRset());
return addRRtoRRset(rrset, r); return addRRtoRRset(rrset, r);
} }
@ -326,6 +334,8 @@ public class ZoneVerifier {
} }
switch (mDNSSECType) { switch (mDNSSECType) {
case UNSIGNED:
throw new IllegalArgumentException("Cannot process Unsigned zone");
case NSEC: case NSEC:
// all nodes with NSEC records have NSEC and RRSIG types // all nodes with NSEC records have NSEC and RRSIG types
typeset.add(Type.NSEC); typeset.add(Type.NSEC);