Make a few minor changes to make the linter happy (#2010)

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/google/nomulus/2010)
<!-- Reviewable:end -->
This commit is contained in:
Lai Jiang 2023-04-26 15:49:32 -04:00 committed by GitHub
parent 68e7b51abf
commit b63642124f

View file

@ -173,7 +173,7 @@ public class CloudDnsWriter extends BaseDnsWriter {
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)));
@ -279,11 +279,12 @@ public class CloudDnsWriter extends BaseDnsWriter {
} }
/** Returns the glue records for in-bailiwick nameservers for the given domain+records. */ /** Returns the glue records for in-bailiwick nameservers for the given domain+records. */
private Stream<String> filterGlueRecords(String domainName, Stream<ResourceRecordSet> records) { private static Stream<String> filterGlueRecords(
String domainName, Stream<ResourceRecordSet> records) {
return records return records
.filter(record -> record.getType().equals("NS")) .filter(record -> "NS".equals(record.getType()))
.flatMap(record -> record.getRrdatas().stream()) .flatMap(record -> record.getRrdatas().stream())
.filter(hostName -> hostName.endsWith("." + domainName) && !hostName.equals(domainName)); .filter(hostName -> hostName.endsWith('.' + domainName) && !hostName.equals(domainName));
} }
/** Mutate the zone with the provided map of hostnames to desired DNS records. */ /** Mutate the zone with the provided map of hostnames to desired DNS records. */
@ -366,8 +367,8 @@ public class CloudDnsWriter extends BaseDnsWriter {
* <p>This call should be used in conjunction with {@link #getResourceRecordsForDomains} in a * <p>This call should be used in conjunction with {@link #getResourceRecordsForDomains} in a
* get-and-set retry loop. * get-and-set retry loop.
* *
* <p>See {@link "https://cloud.google.com/dns/troubleshooting"} for a list of errors produced by * <p>See {@link "<a href="https://cloud.google.com/dns/troubleshooting">Troubleshoot Cloud
* the Google Cloud DNS API. * DNS</a>"} for a list of errors produced by the Google Cloud DNS API.
* *
* @throws ZoneStateException if the operation could not be completely successfully because the * @throws ZoneStateException if the operation could not be completely successfully because the
* records to delete do not exist, already exist or have been modified with different * records to delete do not exist, already exist or have been modified with different
@ -420,12 +421,12 @@ public class CloudDnsWriter extends BaseDnsWriter {
* @param hostName the fully qualified hostname * @param hostName the fully qualified hostname
*/ */
private static String getAbsoluteHostName(String hostName) { private static String getAbsoluteHostName(String hostName) {
return hostName.endsWith(".") ? hostName : hostName + "."; return hostName.endsWith(".") ? hostName : hostName + '.';
} }
/** Zone state on Cloud DNS does not match the expected state. */ /** Zone state on Cloud DNS does not match the expected state. */
static class ZoneStateException extends RuntimeException { static class ZoneStateException extends RuntimeException {
public ZoneStateException(String reason) { ZoneStateException(String reason) {
super("Zone state on Cloud DNS does not match the expected state: " + reason); super("Zone state on Cloud DNS does not match the expected state: " + reason);
} }
} }