Remove unnecessary if statements in CloudDnsWriter (#2071)

The condition they are guarding against cannot possibly occur.
This commit is contained in:
Ben McIlwain 2023-07-07 13:15:02 -04:00 committed by GitHub
parent fe19f0fe78
commit 8d22c2a8d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -144,15 +144,13 @@ public class CloudDnsWriter extends BaseDnsWriter {
dsRrData.add(ds.toRrData()); dsRrData.add(ds.toRrData());
} }
if (!dsRrData.isEmpty()) { domainRecords.add(
domainRecords.add( new ResourceRecordSet()
new ResourceRecordSet() .setName(absoluteDomainName)
.setName(absoluteDomainName) .setTtl((int) tld.getDnsDsTtl().orElse(defaultDsTtl).getStandardSeconds())
.setTtl((int) tld.getDnsDsTtl().orElse(defaultDsTtl).getStandardSeconds()) .setType("DS")
.setType("DS") .setKind("dns#resourceRecordSet")
.setKind("dns#resourceRecordSet") .setRrdatas(ImmutableList.copyOf(dsRrData)));
.setRrdatas(ImmutableList.copyOf(dsRrData)));
}
} }
// Construct NS records (if any). // Construct NS records (if any).
@ -169,15 +167,13 @@ public class CloudDnsWriter extends BaseDnsWriter {
} }
} }
if (!nsRrData.isEmpty()) { domainRecords.add(
domainRecords.add( new ResourceRecordSet()
new ResourceRecordSet() .setName(absoluteDomainName)
.setName(absoluteDomainName) .setTtl((int) tld.getDnsNsTtl().orElse(defaultNsTtl).getStandardSeconds())
.setTtl((int) tld.getDnsNsTtl().orElse(defaultNsTtl).getStandardSeconds()) .setType("NS")
.setType("NS") .setKind("dns#resourceRecordSet")
.setKind("dns#resourceRecordSet") .setRrdatas(ImmutableList.copyOf(nsRrData)));
.setRrdatas(ImmutableList.copyOf(nsRrData)));
}
} }
desiredRecords.put(absoluteDomainName, domainRecords.build()); desiredRecords.put(absoluteDomainName, domainRecords.build());