mirror of https://github.com/apache/jclouds.git
Merge pull request #978 from andrewgaul/checkstyle-unnecessary-parentheses
Enforce no unnecessary parentheses via Checkstyle
This commit is contained in:
commit
49dd8f96db
|
@ -150,7 +150,7 @@ public class CloudSigmaComputeServiceAdapter implements
|
|||
@Override
|
||||
public boolean apply(Image input) {
|
||||
String toParse = input.getUserMetadata().get("size");
|
||||
return (toParse != null && new Float(toParse) <= size);
|
||||
return toParse != null && new Float(toParse) <= size;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -63,7 +63,7 @@ public class StaticNATVirtualMachineInNetwork implements Function<VirtualMachine
|
|||
|
||||
public PublicIPAddress apply(VirtualMachine vm) {
|
||||
PublicIPAddress ip;
|
||||
for (ip = reuseOrAssociate.apply(network); (!ip.isStaticNAT() || ip.getVirtualMachineId() != vm.getId()); ip = reuseOrAssociate
|
||||
for (ip = reuseOrAssociate.apply(network); !ip.isStaticNAT() || ip.getVirtualMachineId() != vm.getId(); ip = reuseOrAssociate
|
||||
.apply(network)) {
|
||||
// check to see if someone already grabbed this ip
|
||||
if (ip.getVirtualMachineId() != null && ip.getVirtualMachineId() != vm.getId())
|
||||
|
|
|
@ -36,7 +36,7 @@ public enum Statistics {
|
|||
UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -58,7 +58,7 @@ public enum Unit {
|
|||
UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()).replace("PerSecond", "/Second"));
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()).replace("PerSecond", "/Second");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -75,7 +75,7 @@ public class EC2ComputeServiceContextModule extends BaseComputeServiceContextMod
|
|||
protected boolean shouldEagerlyParseImages(Injector injector) {
|
||||
// If no owners to query, then will never lookup all images
|
||||
String[] amiOwners = injector.getInstance(Key.get(String[].class, Names.named(PROPERTY_EC2_AMI_OWNERS)));
|
||||
return (amiOwners.length > 0);
|
||||
return amiOwners.length > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -104,7 +104,7 @@ public class BlockDeviceMapping implements Comparable<BlockDeviceMapping>{
|
|||
Preconditions2.checkNotEmpty(deviceName, "the deviceName must be non-empty");
|
||||
|
||||
if (sizeInGib != null) {
|
||||
checkArgument((sizeInGib >= VOLUME_SIZE_MIN_VALUE && sizeInGib <= VOLUME_SIZE_MAX_VALUE),
|
||||
checkArgument(sizeInGib >= VOLUME_SIZE_MIN_VALUE && sizeInGib <= VOLUME_SIZE_MAX_VALUE,
|
||||
String.format("Size in Gib must be between %s and %s GB", VOLUME_SIZE_MIN_VALUE, VOLUME_SIZE_MAX_VALUE));
|
||||
}
|
||||
this.deviceName = deviceName;
|
||||
|
|
|
@ -62,7 +62,7 @@ public enum InstanceState {
|
|||
STOPPED, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name()));
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -143,7 +143,7 @@ public class ElasticStackComputeServiceAdapter implements
|
|||
@Override
|
||||
public boolean apply(Image input) {
|
||||
String toParse = input.getUserMetadata().get("size");
|
||||
return (toParse != null && new Float(toParse) <= size);
|
||||
return toParse != null && new Float(toParse) <= size;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -71,10 +71,10 @@ public class MapToNICs implements Function<Map<String, String>, List<NIC>> {
|
|||
private String getDhcpIp(Map<String, String> from, String key) {
|
||||
if (apiVersion.equals("2.0")) {
|
||||
final String ip = from.get(key + ":dhcp:ip");
|
||||
return (ip == null ? "auto" : ip);
|
||||
return ip == null ? "auto" : ip;
|
||||
} else {
|
||||
final String ip = from.get(key + ":dhcp");
|
||||
return (ip == null ? "auto" : ip);
|
||||
return ip == null ? "auto" : ip;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ public class ServerInZoneToNodeMetadata implements Function<ServerInZone, NodeMe
|
|||
public boolean apply(String input) {
|
||||
try {
|
||||
// Note we can do this, as InetAddress is now on the white list
|
||||
return (InetAddresses.forString(input) instanceof Inet4Address);
|
||||
return InetAddresses.forString(input) instanceof Inet4Address;
|
||||
} catch (IllegalArgumentException e) {
|
||||
// could be a hostname
|
||||
return true;
|
||||
|
|
|
@ -108,7 +108,7 @@ public class MultipartUploadSlicingAlgorithm {
|
|||
this.parts = parts;
|
||||
this.remaining = length - partSize * parts;
|
||||
logger.debug(" %d bytes partitioned in %d parts of part size: %d, remaining: %d%s", length, parts, chunkSize,
|
||||
remaining, (remaining > MultipartUpload.MAX_PART_SIZE ? " overflow!" : ""));
|
||||
remaining, remaining > MultipartUpload.MAX_PART_SIZE ? " overflow!" : "");
|
||||
return this.chunkSize;
|
||||
}
|
||||
|
||||
|
|
|
@ -108,16 +108,16 @@ public class ParallelMultipartUploadStrategy implements AsyncMultipartUploadStra
|
|||
try {
|
||||
etags.put(part, futureETag.get());
|
||||
logger.debug(String.format("async uploaded part %s of %s to container %s in %sms",
|
||||
part, key, container, (System.currentTimeMillis() - start)));
|
||||
part, key, container, System.currentTimeMillis() - start));
|
||||
} catch (CancellationException e) {
|
||||
errorMap.put(part, e);
|
||||
String message = String.format("%s while uploading part %s - [%s,%s] to container %s with running since %dms",
|
||||
e.getMessage(), part, offset, size, container, (System.currentTimeMillis() - start));
|
||||
e.getMessage(), part, offset, size, container, System.currentTimeMillis() - start);
|
||||
logger.debug(message);
|
||||
} catch (Exception e) {
|
||||
errorMap.put(part, e);
|
||||
String message = String.format("%s while uploading part %s - [%s,%s] to container %s running since %dms",
|
||||
e.getMessage(), part, offset, size, container, (System.currentTimeMillis() - start));
|
||||
e.getMessage(), part, offset, size, container, System.currentTimeMillis() - start);
|
||||
logger.error(message, e);
|
||||
if (errors.incrementAndGet() <= maxRetries)
|
||||
toRetry.add(new Part(part, offset, size));
|
||||
|
|
|
@ -77,13 +77,13 @@ public class OrgAndVDCToLocationSupplier extends JustProvider implements Locatio
|
|||
Map<String, Supplier<Set<String>>> isoCodesById = isoCodesByIdSupplier.get();
|
||||
for (ReferenceType org : orgNameToResource.get().values()) {
|
||||
LocationBuilder builder = new LocationBuilder().scope(LocationScope.REGION).id(org.getHref().toASCIIString())
|
||||
.description((org.getName())).parent(provider);
|
||||
.description(org.getName()).parent(provider);
|
||||
if (isoCodesById.containsKey(org.getHref().toASCIIString()))
|
||||
builder.iso3166Codes(isoCodesById.get(org.getHref().toASCIIString()).get());
|
||||
Location orgL = builder.build();
|
||||
for (ReferenceType vdc : orgNameToVDCResource.get().get(org.getName()).getVDCs().values()) {
|
||||
builder = new LocationBuilder().scope(LocationScope.ZONE).id(vdc.getHref().toASCIIString()).description(
|
||||
(vdc.getName())).parent(orgL);
|
||||
vdc.getName()).parent(orgL);
|
||||
if (isoCodesById.containsKey(vdc.getHref().toASCIIString()))
|
||||
builder.iso3166Codes(isoCodesById.get(vdc.getHref().toASCIIString()).get());
|
||||
locations.add(builder.build());
|
||||
|
|
|
@ -55,17 +55,17 @@ public class CatalogItemHandler extends ParseSax.HandlerWithResult<CatalogItem>
|
|||
Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
|
||||
if (SaxUtils.equalsOrSuffix(qName, "CatalogItem")) {
|
||||
catalogItem = newReferenceType(attributes);
|
||||
} else if (SaxUtils.equalsOrSuffix(qName, ("Entity"))) {
|
||||
} else if (SaxUtils.equalsOrSuffix(qName, "Entity")) {
|
||||
entity = newReferenceType(attributes);
|
||||
} else if (SaxUtils.equalsOrSuffix(qName, ("Property"))) {
|
||||
} else if (SaxUtils.equalsOrSuffix(qName, "Property")) {
|
||||
key = attributes.get("key");
|
||||
}
|
||||
}
|
||||
|
||||
public void endElement(String uri, String name, String qName) {
|
||||
if (SaxUtils.equalsOrSuffix(qName, ("Description"))) {
|
||||
if (SaxUtils.equalsOrSuffix(qName, "Description")) {
|
||||
description = currentOrNull();
|
||||
} else if (SaxUtils.equalsOrSuffix(qName, ("Property"))) {
|
||||
} else if (SaxUtils.equalsOrSuffix(qName, "Property")) {
|
||||
properties.put(key, currentOrNull());
|
||||
key = null;
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ public class LocalAsyncBlobStore extends BaseAsyncBlobStore {
|
|||
if (prefix != null) {
|
||||
contents = newTreeSet(filter(contents, new Predicate<StorageMetadata>() {
|
||||
public boolean apply(StorageMetadata o) {
|
||||
return (o != null && o.getName().startsWith(prefix) && !o.getName().equals(prefix));
|
||||
return o != null && o.getName().startsWith(prefix) && !o.getName().equals(prefix);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
|
|
@ -90,6 +90,6 @@ public class ListAllOptions implements Cloneable {
|
|||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ListAllOptions other = (ListAllOptions) obj;
|
||||
return (eager == other.eager);
|
||||
return eager == other.eager;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -195,6 +195,6 @@ public class DeleteAllKeysInList implements ClearListStrategy, ClearContainerStr
|
|||
}
|
||||
|
||||
private boolean parentIsFolder(final ListContainerOptions options, final StorageMetadata md) {
|
||||
return (options.getDir() != null && md.getName().indexOf('/') == -1);
|
||||
return options.getDir() != null && md.getName().indexOf('/') == -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ public class AWSUtils {
|
|||
String[] values = (String[]) input;
|
||||
Builder<String, String> builder = ImmutableMultimap.builder();
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
builder.put(String.format(format, (i + 1)), checkNotNull(values[i], format.toLowerCase() + "s[" + i + "]"));
|
||||
builder.put(String.format(format, i + 1), checkNotNull(values[i], format.toLowerCase() + "s[" + i + "]"));
|
||||
}
|
||||
ImmutableMultimap<String, String> forms = builder.build();
|
||||
return forms.size() == 0 ? request : (R) request.toBuilder().replaceFormParams(forms).build();
|
||||
|
|
|
@ -76,13 +76,13 @@ public class OrgAndVDCToLocationSupplier extends JustProvider implements Locatio
|
|||
Map<String, Supplier<Set<String>>> isoCodesById = isoCodesByIdSupplier.get();
|
||||
for (ReferenceType org : orgNameToResource.get().values()) {
|
||||
LocationBuilder builder = new LocationBuilder().scope(LocationScope.REGION).id(org.getHref().toASCIIString())
|
||||
.description((org.getName())).parent(provider);
|
||||
.description(org.getName()).parent(provider);
|
||||
if (isoCodesById.containsKey(org.getHref().toASCIIString()))
|
||||
builder.iso3166Codes(isoCodesById.get(org.getHref().toASCIIString()).get());
|
||||
Location orgL = builder.build();
|
||||
for (ReferenceType vdc : orgNameToVDCResource.get().get(org.getName()).getVDCs().values()) {
|
||||
builder = new LocationBuilder().scope(LocationScope.ZONE).id(vdc.getHref().toASCIIString()).description(
|
||||
(vdc.getName())).parent(orgL);
|
||||
vdc.getName()).parent(orgL);
|
||||
if (isoCodesById.containsKey(vdc.getHref().toASCIIString()))
|
||||
builder.iso3166Codes(isoCodesById.get(vdc.getHref().toASCIIString()).get());
|
||||
locations.add(builder.build());
|
||||
|
|
|
@ -420,8 +420,8 @@ public class InstantiateVAppTemplateOptions {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "[cpuCount=" + cpuCount + ", memorySizeMegabytes=" + memorySizeMegabytes + ", networkConfig="
|
||||
+ networkConfig + ", customizeOnInstantiate=" + customizeOnInstantiate + ", deploy=" + (deploy)
|
||||
+ ", powerOn=" + (powerOn) + "]";
|
||||
+ networkConfig + ", customizeOnInstantiate=" + customizeOnInstantiate + ", deploy=" + deploy
|
||||
+ ", powerOn=" + powerOn + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -83,7 +83,7 @@ public class NetworkHandler extends ParseSax.HandlerWithResult<Network> {
|
|||
} else if (qName.equals("Netmask")) {
|
||||
netmask = currentOrNull(currentText);
|
||||
} else if (qName.equals("FenceMode")) {
|
||||
fenceMode = (FenceMode.fromValue(currentOrNull(currentText)));
|
||||
fenceMode = FenceMode.fromValue(currentOrNull(currentText));
|
||||
}
|
||||
currentText = new StringBuilder();
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ public class RunScriptOnNodeUsingSsh implements RunScriptOnNode {
|
|||
ssh.connect();
|
||||
ExecResponse returnVal;
|
||||
eventBus.post(new StatementOnNodeSubmission(statement, node));
|
||||
String command = (runAsRoot) ? execAsRoot(statement.render(OsFamily.UNIX)) : execScriptAsDefaultUser(statement
|
||||
String command = runAsRoot ? execAsRoot(statement.render(OsFamily.UNIX)) : execScriptAsDefaultUser(statement
|
||||
.render(OsFamily.UNIX));
|
||||
try {
|
||||
returnVal = runCommand(command);
|
||||
|
|
|
@ -126,7 +126,7 @@ public class ImageImpl extends ComputeMetadataImpl implements Image {
|
|||
ToStringHelper helper = computeToStringPrefix();
|
||||
helper.add("os", getOperatingSystem()).add("description", getDescription()).add("version", getVersion())
|
||||
.add("status", formatStatus(this))
|
||||
.add("loginUser", ((defaultCredentials != null) ? defaultCredentials.identity : null));
|
||||
.add("loginUser", defaultCredentials != null ? defaultCredentials.identity : null);
|
||||
return addComputeToStringSuffix(helper);
|
||||
}
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ public class NodeMetadataImpl extends ComputeMetadataImpl implements NodeMetadat
|
|||
helper.add("privateAddresses", getPrivateAddresses());
|
||||
if (getPublicAddresses().size() > 0)
|
||||
helper.add("publicAddresses", getPublicAddresses());
|
||||
helper.add("hardware", getHardware()).add("loginUser", ((credentials != null) ? credentials.identity : null));
|
||||
helper.add("hardware", getHardware()).add("loginUser", credentials != null ? credentials.identity : null);
|
||||
return addComputeToStringSuffix(helper);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class ImagePredicates {
|
|||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
return (obj instanceof Is64BitPredicate);
|
||||
return obj instanceof Is64BitPredicate;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ public class ComputeServiceUtils {
|
|||
public static double getCoresAndSpeed(Hardware input) {
|
||||
double total = 0;
|
||||
for (Processor processor : input.getProcessors())
|
||||
total += (processor.getCores() * processor.getSpeed());
|
||||
total += processor.getCores() * processor.getSpeed();
|
||||
return total;
|
||||
}
|
||||
|
||||
|
|
|
@ -419,12 +419,12 @@ public class ContextBuilder {
|
|||
}
|
||||
|
||||
static boolean nothingConfiguresAnHttpService(List<Module> modules) {
|
||||
return (!any(modules, new Predicate<Module>() {
|
||||
return !any(modules, new Predicate<Module>() {
|
||||
public boolean apply(Module input) {
|
||||
return input.getClass().isAnnotationPresent(ConfiguresHttpCommandExecutorService.class);
|
||||
}
|
||||
|
||||
}));
|
||||
});
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
|
|
@ -96,9 +96,9 @@ public class CryptoStreams {
|
|||
if (length == 0)
|
||||
return provisional;
|
||||
// we know base64 is in 4 character chunks, so out of bounds risk here
|
||||
else if (provisional.charAt((length - 2)) == '=')
|
||||
else if (provisional.charAt(length - 2) == '=')
|
||||
length-=2;
|
||||
else if (provisional.charAt((length - 1)) == '=')
|
||||
else if (provisional.charAt(length - 1) == '=')
|
||||
length-=1;
|
||||
|
||||
char[] tmp = new char[length];
|
||||
|
|
|
@ -115,7 +115,7 @@ public class SshKeys {
|
|||
int byte2 = in.read();
|
||||
int byte3 = in.read();
|
||||
int byte4 = in.read();
|
||||
int length = ((byte1 << 24) + (byte2 << 16) + (byte3 << 8) + (byte4 << 0));
|
||||
int length = (byte1 << 24) + (byte2 << 16) + (byte3 << 8) + (byte4 << 0);
|
||||
byte[] val = new byte[length];
|
||||
in.read(val, 0, length);
|
||||
return val;
|
||||
|
|
|
@ -173,7 +173,7 @@ public class JavaUrlHttpCommandExecutorService extends BaseHttpCommandExecutorSe
|
|||
Proxy proxy = new Proxy(Proxy.Type.HTTP, addr);
|
||||
Authenticator authenticator = new Authenticator() {
|
||||
public PasswordAuthentication getPasswordAuthentication() {
|
||||
return (new PasswordAuthentication(utils.getProxyUser(), utils.getProxyPassword().toCharArray()));
|
||||
return new PasswordAuthentication(utils.getProxyUser(), utils.getProxyPassword().toCharArray());
|
||||
}
|
||||
};
|
||||
Authenticator.setDefault(authenticator);
|
||||
|
|
|
@ -73,8 +73,8 @@ public class FilterStringsBoundToInjectorByName implements Function<Predicate<St
|
|||
@Override
|
||||
public String apply(Binding<String> input) {
|
||||
Annotation annotation = input.getKey().getAnnotation();
|
||||
return ((annotation instanceof javax.inject.Named) ? javax.inject.Named.class.cast(annotation)
|
||||
.value() : com.google.inject.name.Named.class.cast(annotation).value());
|
||||
return (annotation instanceof javax.inject.Named) ? javax.inject.Named.class.cast(annotation)
|
||||
.value() : com.google.inject.name.Named.class.cast(annotation).value();
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -81,7 +81,7 @@ public class Part extends DelegatingPayload {
|
|||
private Part(String name, Part.PartMap map, Payload delegate) {
|
||||
super(delegate);
|
||||
this.name = name;
|
||||
this.headers = ImmutableMultimap.copyOf(forMap((checkNotNull(map, "headers"))));
|
||||
this.headers = ImmutableMultimap.copyOf(forMap(checkNotNull(map, "headers")));
|
||||
}
|
||||
|
||||
public static class PartOptions {
|
||||
|
|
|
@ -96,7 +96,7 @@ public class BindLoggersAnnotatedWithResource implements TypeListener {
|
|||
Predicate<Field> {
|
||||
public boolean apply(Field from) {
|
||||
Annotation inject = from.getAnnotation(Resource.class);
|
||||
return (inject != null && from.getType().isAssignableFrom(Logger.class));
|
||||
return inject != null && from.getType().isAssignableFrom(Logger.class);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ public abstract class Wire {
|
|||
output((String) data);
|
||||
return data;
|
||||
} else if (data instanceof File) {
|
||||
output(((File) data));
|
||||
output((File) data);
|
||||
return data;
|
||||
}
|
||||
throw new UnsupportedOperationException("Content not supported " + data.getClass());
|
||||
|
|
|
@ -106,7 +106,7 @@ public class RetryableNumTimesPredicate<T> implements Predicate<T> {
|
|||
protected long nextMaxInterval(long attempt) {
|
||||
// Interval increases exponentially, at a rate of nextInterval *= 1.5
|
||||
// Note that attempt starts counting at 1
|
||||
long interval = (long) (period * Math.pow(1.5, (attempt-1)));
|
||||
return (interval > maxPeriod ? maxPeriod : interval);
|
||||
long interval = (long) (period * Math.pow(1.5, attempt - 1));
|
||||
return interval > maxPeriod ? maxPeriod : interval;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,7 +111,7 @@ public class RetryablePredicate<T> implements Predicate<T> {
|
|||
protected long nextMaxInterval(long attempt, Date end) {
|
||||
// Interval increases exponentially, at a rate of nextInterval *= 1.5
|
||||
// Note that attempt starts counting at 1
|
||||
long interval = (long) (period * Math.pow(1.5, (attempt-1)));
|
||||
long interval = (long) (period * Math.pow(1.5, attempt - 1));
|
||||
interval = interval > maxPeriod ? maxPeriod : interval;
|
||||
long max = end.getTime() - System.currentTimeMillis();
|
||||
return (interval > max) ? max : interval;
|
||||
|
|
|
@ -850,7 +850,7 @@ public class RestAnnotationProcessor<T> {
|
|||
if (method.getReturnType().getTypeParameters().length == 0) {
|
||||
returnVal = method.getReturnType();
|
||||
} else if (method.getReturnType().equals(ListenableFuture.class)) {
|
||||
ParameterizedType futureType = ((ParameterizedType) method.getGenericReturnType());
|
||||
ParameterizedType futureType = (ParameterizedType) method.getGenericReturnType();
|
||||
returnVal = futureType.getActualTypeArguments()[0];
|
||||
if (returnVal instanceof WildcardType)
|
||||
returnVal = WildcardType.class.cast(returnVal).getUpperBounds()[0];
|
||||
|
|
|
@ -168,7 +168,7 @@ public class ApacheHCUtils {
|
|||
}
|
||||
}
|
||||
|
||||
assert (apacheRequest.getEntity() != null);
|
||||
assert apacheRequest.getEntity() != null;
|
||||
}
|
||||
|
||||
public static class HttpEntityPayload extends BasePayload<HttpEntity> {
|
||||
|
|
|
@ -24,7 +24,7 @@ public class CimAnySimpleTypeAdapter extends XmlAdapter<String, String> {
|
|||
|
||||
@Override
|
||||
public String unmarshal(String value) {
|
||||
return (javax.xml.bind.DatatypeConverter.parseAnySimpleType(value));
|
||||
return javax.xml.bind.DatatypeConverter.parseAnySimpleType(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,7 +32,7 @@ public class CimAnySimpleTypeAdapter extends XmlAdapter<String, String> {
|
|||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
return (javax.xml.bind.DatatypeConverter.printAnySimpleType(value));
|
||||
return javax.xml.bind.DatatypeConverter.printAnySimpleType(value);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public enum Scheme {
|
|||
UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name()));
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -47,7 +47,7 @@ public enum BuiltinServerConfiguration {
|
|||
UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -39,7 +39,7 @@ public enum BuiltinServerStatus {
|
|||
DEPLOYING, RUNNING, STOPPING, STOPPED, STARTING, FAILOVER, UNEXPECTED_STOP, RESTORING, BACKUP_ING, ERROR, EXECUTE_NETWORK_SERVER, START_ERROR, STOP_ERROR, UPDATE, BACKOUT, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -37,7 +37,7 @@ public enum PublicIPStatus {
|
|||
ATTACHED, ATTACHING, DETACHING, DETACHED, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -35,7 +35,7 @@ public enum VDiskStatus {
|
|||
NORMAL, BACKUP_ING, DEPLOYING, DETACHING, ATTACHING, RESTORING, ERROR, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,7 +34,7 @@ public enum VServerStatus {
|
|||
DEPLOYING, RUNNING, STOPPING, STOPPED, STARTING, FAILOVER, UNEXPECTED_STOP, RESTORING, BACKUP_ING, ERROR, START_ERROR, STOP_ERROR, CHANGE_TYPE, REGISTERING, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,7 +34,7 @@ public enum VSystemStatus {
|
|||
NORMAL, RECONFIG_ING, DEPLOYING, ERROR, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -59,7 +59,7 @@ public class Machine implements Comparable<Machine> {
|
|||
}
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -80,7 +80,7 @@ public class Machine implements Comparable<Machine> {
|
|||
}
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -110,10 +110,10 @@ public class RetrieveActiveBridgedInterfaces implements Function<NodeMetadata, L
|
|||
@Override
|
||||
public boolean apply(BridgedIf bridgedInterface) {
|
||||
try {
|
||||
return (bridgedInterface.getName().startsWith(networkInterface.getDisplayName()) &&
|
||||
return bridgedInterface.getName().startsWith(networkInterface.getDisplayName()) &&
|
||||
bridgedInterface.getStatus().equals("Up") &&
|
||||
networkInterface.isUp() &&
|
||||
!networkInterface.isLoopback());
|
||||
!networkInterface.isLoopback();
|
||||
} catch (SocketException e) {
|
||||
logger.error(e, "Problem in listing network interfaces.");
|
||||
throw Throwables.propagate(e);
|
||||
|
|
|
@ -55,7 +55,7 @@ class SendScancodes implements Function<ISession, Void> {
|
|||
for (List<Integer> maxOrLess : partition(scancodes, MAX_SIZE)) {
|
||||
long codesSent = iSession.getConsole().getKeyboard().putScancodes(maxOrLess);
|
||||
logger.debug("List of scancodes sent: ", maxOrLess);
|
||||
assert (codesSent == maxOrLess.size());
|
||||
assert codesSent == maxOrLess.size();
|
||||
if (any(maxOrLess, in(SPECIAL_KEYBOARD_BUTTON_MAP_LIST.values()))) {
|
||||
Uninterruptibles.sleepUninterruptibly(300, TimeUnit.MILLISECONDS);
|
||||
} else {
|
||||
|
|
|
@ -150,7 +150,7 @@ public class CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions
|
|||
|
||||
@Override
|
||||
public boolean apply(TemplateOptions options) {
|
||||
return (options.getRunScript() == null && options.getPrivateKey() == null);
|
||||
return options.getRunScript() == null && options.getPrivateKey() == null;
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -187,7 +187,7 @@ public class SpotInstanceRequest implements Comparable<SpotInstanceRequest> {
|
|||
ONE_TIME, PERSISTENT, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name()));
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -208,7 +208,7 @@ public class SpotInstanceRequest implements Comparable<SpotInstanceRequest> {
|
|||
OPEN, ACTIVE, CANCELLED, CLOSED, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name()));
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_HYPHEN, name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -109,7 +109,7 @@ public class MultipartUploadSlicingAlgorithm {
|
|||
this.parts = parts;
|
||||
this.remaining = length - partSize * parts;
|
||||
logger.debug(" %d bytes partitioned in %d parts of part size: %d, remaining: %d%s", length, parts, chunkSize,
|
||||
remaining, (remaining > MultipartUpload.MAX_PART_SIZE ? " overflow!" : ""));
|
||||
remaining, remaining > MultipartUpload.MAX_PART_SIZE ? " overflow!" : "");
|
||||
return this.chunkSize;
|
||||
}
|
||||
|
||||
|
|
|
@ -130,16 +130,16 @@ public class ParallelMultipartUploadStrategy implements AsyncMultipartUploadStra
|
|||
try {
|
||||
etags.put(part, futureETag.get());
|
||||
logger.debug(String.format("async uploaded part %s of %s to container %s in %sms with uploadId %s",
|
||||
part, key, container, (System.currentTimeMillis()-start), uploadId));
|
||||
part, key, container, System.currentTimeMillis() - start, uploadId));
|
||||
} catch (CancellationException e) {
|
||||
errorMap.put(part, e);
|
||||
String message = String.format("%s while uploading part %s - [%s,%s] to container %s with uploadId: %s running since %dms",
|
||||
e.getMessage(), part, offset, size, container, uploadId, (System.currentTimeMillis()-start));
|
||||
e.getMessage(), part, offset, size, container, uploadId, System.currentTimeMillis() - start);
|
||||
logger.debug(message);
|
||||
} catch (Exception e) {
|
||||
errorMap.put(part, e);
|
||||
String message = String.format("%s while uploading part %s - [%s,%s] to container %s with uploadId: %s running since %dms",
|
||||
e.getMessage(), part, offset, size, container, uploadId, (System.currentTimeMillis()-start));
|
||||
e.getMessage(), part, offset, size, container, uploadId, System.currentTimeMillis() - start);
|
||||
logger.error(message, e);
|
||||
if (errors.incrementAndGet() <= maxRetries)
|
||||
toRetry.add(new Part(part, offset, size));
|
||||
|
|
|
@ -29,7 +29,7 @@ public enum BlobType {
|
|||
BLOCK_BLOB, PAGE_BLOB, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,7 +29,7 @@ public enum LeaseStatus {
|
|||
LOCKED, UNLOCKED, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -52,7 +52,7 @@ public class ServerSpecToHardware implements Function<ServerSpec, Hardware> {
|
|||
@Override
|
||||
public Hardware apply(ServerSpec spec) {
|
||||
Location location = findLocationForServerSpec.apply(spec);
|
||||
assert (location != null) : String.format("no location matched ServerSpec %s", spec);
|
||||
assert location != null : String.format("no location matched ServerSpec %s", spec);
|
||||
return new HardwareBuilder().ids(spec.toString()).ram(spec.getMemorySizeMB()).processors(
|
||||
ImmutableList.of(new Processor(spec.getCpuCores(), 1.0))).volumes(
|
||||
ImmutableList.<Volume> of(new VolumeImpl((float) spec.getDiskSizeGB(), true, true))).hypervisor(
|
||||
|
|
|
@ -41,7 +41,7 @@ public class Server {
|
|||
RUNNING, LOCKED, STOPPED, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -69,7 +69,7 @@ public class ServerImageToImage implements Function<ServerImage, Image> {
|
|||
String osArch = from.getArchitecture().getDescription();
|
||||
String osVersion = null;
|
||||
String osDescription = from.getOs().getDescription();
|
||||
boolean is64Bit = (from.getOs().getName().indexOf("64") != -1 || from.getDescription().indexOf("64") != -1);
|
||||
boolean is64Bit = from.getOs().getName().indexOf("64") != -1 || from.getDescription().indexOf("64") != -1;
|
||||
|
||||
if (osName.startsWith("Windows")) {
|
||||
osFamily = OsFamily.WINDOWS;
|
||||
|
|
|
@ -29,7 +29,7 @@ public enum IpState {
|
|||
UNASSIGNED, ASSIGNED, UNRECOGNIZED;
|
||||
|
||||
public String toString() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
|
||||
}
|
||||
|
||||
public static IpState fromValue(String state) {
|
||||
|
|
|
@ -33,7 +33,7 @@ public enum LoadBalancerState {
|
|||
UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -36,7 +36,7 @@ public enum ObjectType {
|
|||
UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -30,7 +30,7 @@ public enum ServerState {
|
|||
ON, STARTING, OFF, STOPPING, RESTARTING, SAVING, RESTORING, UPDATING, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name()));
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -59,6 +59,6 @@ public class CloneOptions implements PostData {
|
|||
}
|
||||
|
||||
public void validate(){
|
||||
assert(instanceId == null || instanceId < 0);
|
||||
assert instanceId == null || instanceId < 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ public class CreateOptions implements PostData{
|
|||
|
||||
@Override
|
||||
public void validate() {
|
||||
assert(imageId != null && imageId.length() != 0);
|
||||
assert imageId != null && imageId.length() != 0;
|
||||
//TODO validation of FQDN
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ public class IpRequestData implements PostData {
|
|||
|
||||
@Override
|
||||
public void validate() {
|
||||
assert(numberOfIps < 1 && numberOfIps > 5);
|
||||
assert(numberOfIps > 1 && extraIpReason == null || extraIpReason.length() == 0);
|
||||
assert numberOfIps < 1 && numberOfIps > 5;
|
||||
assert numberOfIps > 1 && extraIpReason == null || extraIpReason.length() == 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -179,13 +179,13 @@ public class NewServerData implements PostData {
|
|||
|
||||
public void validate() {
|
||||
// bitwise XOR, works with boolean :)
|
||||
assert (this.cloneOptions == null ^ this.createOptions == null);
|
||||
assert this.cloneOptions == null ^ this.createOptions == null;
|
||||
if (this.cloneOptions != null) {
|
||||
this.cloneOptions.validate();
|
||||
}
|
||||
if (this.createOptions != null) {
|
||||
this.createOptions.validate();
|
||||
assert (this.planId != null && this.planId.length() == 0);
|
||||
assert this.planId != null && this.planId.length() == 0;
|
||||
}
|
||||
|
||||
if (this.ipRequest != null) {
|
||||
|
|
|
@ -42,7 +42,7 @@ public class Slice {
|
|||
ACTIVE, BUILD, REBOOT, HARD_REBOOT, TERMINATED, UNRECOGNIZED;
|
||||
|
||||
public String value() {
|
||||
return (CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_UNDERSCORE, name()));
|
||||
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.LOWER_UNDERSCORE, name());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
<module name="Checker">
|
||||
<property name="severity" value="warning"/>
|
||||
<module name="NewlineAtEndOfFile"/>
|
||||
<module name="SuppressionFilter">
|
||||
<property name="file" value="resources/checkstyle_suppressions.xml"/>
|
||||
</module>
|
||||
<module name="TreeWalker">
|
||||
<module name="EmptyStatement"/>
|
||||
<module name="IllegalThrows"/>
|
||||
|
@ -18,6 +21,7 @@
|
|||
<module name="ModifierOrder"/>
|
||||
<module name="MultipleVariableDeclarations"/>
|
||||
<module name="SimplifyBooleanExpression"/>
|
||||
<module name="UnnecessaryParentheses"/>
|
||||
<module name="UnusedImports"/>
|
||||
</module>
|
||||
<module name="RegexpMultiline">
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!DOCTYPE suppressions PUBLIC
|
||||
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
|
||||
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
|
||||
|
||||
<suppressions>
|
||||
<suppress files="Base64\.java" checks="UnnecessaryParentheses"/>
|
||||
</suppressions>
|
Loading…
Reference in New Issue