Error-prone 2.3.2 fixes

This commit is contained in:
Andrew Gaul 2018-10-12 14:05:14 -07:00
parent 17cf6fec9e
commit cc65957997
20 changed files with 29 additions and 50 deletions

View File

@ -33,8 +33,8 @@ public class GetMetricStatisticsResponseHandler extends ParseSax.HandlerWithResu
private final DatapointHandler datapointHandler;
@Inject
public GetMetricStatisticsResponseHandler(DatapointHandler DatapointHandler) {
this.datapointHandler = DatapointHandler;
public GetMetricStatisticsResponseHandler(DatapointHandler datapointHandler) {
this.datapointHandler = datapointHandler;
}
public Set<Datapoint> getResult() {

View File

@ -39,8 +39,8 @@ public class GetMetricStatisticsResponseHandlerV2 extends ParseSax.HandlerWithRe
private boolean inDatapoints;
@Inject
public GetMetricStatisticsResponseHandlerV2(DatapointHandler DatapointHandler) {
this.datapointHandler = DatapointHandler;
public GetMetricStatisticsResponseHandlerV2(DatapointHandler datapointHandler) {
this.datapointHandler = datapointHandler;
}
public GetMetricStatisticsResponse getResult() {

View File

@ -92,9 +92,9 @@ public class KeyPairApiLiveTest extends BaseComputeServiceContextLiveTest {
assertNotNull(allResults);
if (!allResults.isEmpty()) {
KeyPair pair = allResults.last();
SortedSet<KeyPair> result = Sets.newTreeSet(client.describeKeyPairsInRegionWithFilter(region,
client.describeKeyPairsInRegionWithFilter(region,
ImmutableMultimap.<String, String>builder()
.put("invalid-filter", pair.getKeyName()).build()));
.put("invalid-filter", pair.getKeyName()).build());
}
}
}

View File

@ -39,7 +39,7 @@ public abstract class PasswordCredentials {
}
@Override
public String toString() {
public final String toString() {
return MoreObjects.toStringHelper(this).add("username", username())
.add("password", password() == null ? null : "*****").toString();
}

View File

@ -47,7 +47,7 @@ public abstract class Group {
@AutoValue.Builder
public abstract static class Builder {
public abstract Builder id(String id);
public abstract Builder name(String String);
public abstract Builder name(String string);
public abstract Builder description(String description);
public abstract Builder domainId(String domainId);
public abstract Builder link(Link link);

View File

@ -180,9 +180,6 @@ public class UserApiExpectTest extends BaseTroveApiExpectTest {
HttpResponse.builder().statusCode(202).build() // response
).getUserApi("RegionOne", "instanceId-1234-5678");
Set<String> databases = Sets.newHashSet();
databases.add( "database" );
databases.add( "database" );
boolean result = api.revoke("dbuser1", "databaseA");
assertTrue(result);
}
@ -198,9 +195,6 @@ public class UserApiExpectTest extends BaseTroveApiExpectTest {
HttpResponse.builder().statusCode(202).build() // response
).getUserApi("RegionOne", "instanceId-1234-5678");
Set<String> databases = Sets.newHashSet();
databases.add( "database" );
databases.add( "database" );
boolean result = api.delete("dbuser1");
assertTrue(result);
}

View File

@ -76,8 +76,6 @@ public class BaseServiceIntegrationTest extends BaseBlobStoreIntegrationTest {
@Test(groups = { "integration", "live" })
public void testGetAssignableLocations() throws Exception {
if (view.unwrap() instanceof Location)
assertProvider(Location.class.cast(view.unwrap()));
for (Location location : view.getBlobStore().listAssignableLocations()) {
System.err.printf("location %s%n", location);
assert location.getId() != null : location;

View File

@ -568,7 +568,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
});
Map<String, ? extends NodeMetadata> metadataMap = newLinkedHashMap(uniqueMap);
for (NodeMetadata node : nodes) {
metadataMap.remove(node.getId());
assertNotNull(metadataMap.remove(node.getId()));
NodeMetadata metadata = client.getNodeMetadata(node.getId());
assertEquals(metadata.getProviderId(), node.getProviderId());
assertEquals(metadata.getGroup(), node.getGroup());
@ -664,7 +664,6 @@ public abstract class BaseComputeServiceLiveTest extends BaseComputeServiceConte
assert node.getProviderId() != null : node;
assert node.getLocation() != null : node;
assertEquals(node.getType(), ComputeType.NODE);
assert node instanceof NodeMetadata;
NodeMetadata nodeMetadata = node;
assert nodeMetadata.getProviderId() != null : nodeMetadata;
// nullable

View File

@ -35,6 +35,7 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.StringReader;
import java.nio.charset.StandardCharsets;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.cert.CertificateEncodingException;
@ -174,6 +175,10 @@ public class Pems {
this.content = checkNotNull(content, "content");
}
@Override
public String toString() {
return type + " " + new String(content, StandardCharsets.UTF_8);
}
}
/**

View File

@ -169,6 +169,7 @@ public class SimpleDateFormatDateService implements DateService {
}
@Override
@SuppressWarnings("UnusedException")
public Date iso8601DateOrSecondsDateParse(String toParse)
throws IllegalArgumentException {
try {

View File

@ -83,7 +83,6 @@ public class Strings2 {
private static final String IP_ADDRESS = "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})";
private static final String SLASH_FORMAT = IP_ADDRESS + "/(\\d{1,3})";
private static final Pattern ADDRESS_PATTERN = Pattern.compile(IP_ADDRESS);
private static final Pattern CIDR_PATTERN = Pattern.compile(SLASH_FORMAT);
public static boolean isCidrFormat(String in) {

View File

@ -55,13 +55,13 @@ public abstract class ResourceGroupAndNameAndIngressRules {
// class so that we can search only by region/id in a map
@Override
public int hashCode() {
public final int hashCode() {
return Objects.hashCode(resourceGroup(), name());
}
@edu.umd.cs.findbugs.annotations.SuppressFBWarnings(value = "EQ_UNUSUAL")
@Override
public boolean equals(Object obj) {
public final boolean equals(Object obj) {
if (obj == this) {
return true;
}

View File

@ -178,11 +178,9 @@ public class VirtualMachineScaleSetApiLiveTest extends BaseAzureComputeApiLiveTe
private VirtualMachineScaleSetNetworkProfile getNetworkProfile() {
List<NetworkProfile.NetworkInterface> networkInterfacesList = new ArrayList<NetworkProfile.NetworkInterface>();
NetworkInterfaceCard nic = createNetworkInterfaceCard(resourceGroupName, "jc-nic-" + RAND, LOCATION, "ipConfig-" + RAND);
assertNotNull(nic);
networkInterfacesList.add(NetworkProfile.NetworkInterface.create(nic.id(), NetworkProfile.NetworkInterface.NetworkInterfaceProperties.create(true)));
NetworkProfile.NetworkInterface.create(nic.id(), NetworkProfile.NetworkInterface.NetworkInterfaceProperties.create(true));
List<NetworkInterfaceConfiguration> networkInterfaceConfigurations = new ArrayList<NetworkInterfaceConfiguration>();
List<VirtualMachineScaleSetIpConfiguration> virtualMachineScaleSetIpConfigurations = new ArrayList<VirtualMachineScaleSetIpConfiguration>();

View File

@ -276,16 +276,13 @@ public class VirtualMachineScaleSetApiMockTest extends BaseAzureComputeApiMockTe
private VirtualMachineScaleSetNetworkProfile getNetworkProfile() {
List<NetworkProfile.NetworkInterface> networkInterfacesList =
new ArrayList<NetworkProfile.NetworkInterface>();
NetworkInterfaceCard nic =
createNetworkInterfaceCard(
"jc-nic-" + 123,
"eastus");
networkInterfacesList.add(NetworkProfile.NetworkInterface.create(
NetworkProfile.NetworkInterface.create(
nic.id(),
NetworkProfile.NetworkInterface.NetworkInterfaceProperties.create(true)));
NetworkProfile.NetworkInterface.NetworkInterfaceProperties.create(true));
List<NetworkInterfaceConfiguration> networkInterfaceConfigurations =
new ArrayList<NetworkInterfaceConfiguration>();

View File

@ -21,6 +21,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.entry;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertNotEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
@ -314,7 +315,7 @@ public class ObjectApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
ListPageWithPrefixes<GoogleCloudStorageObject> list = api().listObjects(BUCKET_NAME);
assertNotNull(list);
assertEquals(list.get(0) instanceof GoogleCloudStorageObject, true);
assertNotEquals(list.size(), 0);
}
@Test(groups = "live", dependsOnMethods = "testComposeObjectWithOptions")
@ -324,7 +325,6 @@ public class ObjectApiLiveTest extends BaseGoogleCloudStorageApiLiveTest {
while (list.nextPageToken() != null) {
assertNotNull(list);
assertEquals(list.get(0) instanceof GoogleCloudStorageObject, true);
assertEquals(list.size(), 1);
options = new ListObjectOptions().maxResults(1).pageToken(list.nextPageToken());

View File

@ -53,9 +53,9 @@ public class ForwardingRuleCreationBinder extends BindToJsonPayload {
@SuppressWarnings("unused")
private String description;
@SuppressWarnings("unused")
private String IPAddress;
private String ipAddress;
@SuppressWarnings("unused")
private ForwardingRule.IPProtocol IPProtocol;
private ForwardingRule.IPProtocol ipProtocol;
@SuppressWarnings("unused")
private String portRange;
@SuppressWarnings("unused")
@ -64,8 +64,8 @@ public class ForwardingRuleCreationBinder extends BindToJsonPayload {
private ForwardingRuleCreationBinderHelper(String name, ForwardingRuleCreationOptions forwardingRuleCreationOptions){
this.name = name;
this.description = forwardingRuleCreationOptions.description();
this.IPAddress = forwardingRuleCreationOptions.ipAddress();
this.IPProtocol = forwardingRuleCreationOptions.ipProtocol();
this.ipAddress = forwardingRuleCreationOptions.ipAddress();
this.ipProtocol = forwardingRuleCreationOptions.ipProtocol();
this.portRange = forwardingRuleCreationOptions.portRange();
this.target = forwardingRuleCreationOptions.target();
}

View File

@ -62,8 +62,8 @@ public class ForwardingRuleCreationBinderTest extends BaseGoogleComputeEngineExp
"{\""
+ "name\":\"testForwardingRuleName\","
+ "\"description\":\"" + DESCRIPTION + "\","
+ "\"IPAddress\":\"" + IP_ADDRESS + "\","
+ "\"IPProtocol\":\"SCTP\","
+ "\"ipAddress\":\"" + IP_ADDRESS + "\","
+ "\"ipProtocol\":\"SCTP\","
+ "\"portRange\":\"" + PORT_RANGE + "\","
+ "\"target\":\"" + TARGET + "\""
+ "}");

View File

@ -19,9 +19,6 @@ package org.jclouds.profitbricks.binder.loadbalancer;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import java.util.List;
import com.google.common.collect.Lists;
import com.google.common.collect.ImmutableList;
import org.testng.annotations.Test;
@ -35,9 +32,6 @@ public class CreateLoadBalancerRequestBinderTest {
public void testCreatePayload() {
CreateLoadBalancerRequestBinder binder = new CreateLoadBalancerRequestBinder();
List<String> serverIds = Lists.newArrayList();
serverIds.add("server-ids");
String actual = binder.createPayload(
LoadBalancer.Request.creatingBuilder()
.dataCenterId("datacenter-id")

View File

@ -19,10 +19,6 @@ package org.jclouds.profitbricks.binder.loadbalancer;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import java.util.List;
import com.google.common.collect.Lists;
import org.jclouds.profitbricks.domain.LoadBalancer;
import org.testng.annotations.Test;
@ -32,9 +28,6 @@ public class UpdateLoadBalancerRequestBinderTest {
@Test
public void testDeregisterPayload() {
UpdateLoadBalancerRequestBinder binder = new UpdateLoadBalancerRequestBinder();
List<String> serverIds = Lists.newArrayList();
serverIds.add("1");
serverIds.add("2");
LoadBalancer.Request.UpdatePayload payload = LoadBalancer.Request.updatingBuilder()
.id("aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")

View File

@ -389,6 +389,7 @@ public class AdminAccessBuilderSpec {
&& equal(adminPrivateKeyFile, that.adminPrivateKeyFile) && equal(adminPassword, that.adminPassword)
&& equal(loginPassword, that.loginPassword) && equal(lockSsh, that.lockSsh)
&& equal(grantSudoToAdminUser, that.grantSudoToAdminUser)
&& equal(authorizeAdminPublicKey, that.authorizeAdminPublicKey)
&& equal(installAdminPrivateKey, that.installAdminPrivateKey)
&& equal(resetLoginPassword, that.resetLoginPassword);
}