mirror of https://github.com/apache/jclouds.git
Correct FindBugs warnings
This commit is contained in:
parent
cdbf856900
commit
da386ad0e2
|
@ -69,25 +69,15 @@ import org.jclouds.providers.ProviderMetadata;
|
|||
*/
|
||||
public abstract class Aws4SignerBase {
|
||||
private static final TimeZone GMT = TimeZone.getTimeZone("GMT");
|
||||
protected static final DateFormat timestampFormat;
|
||||
protected static final DateFormat dateFormat;
|
||||
protected final DateFormat timestampFormat;
|
||||
protected final DateFormat dateFormat;
|
||||
|
||||
// Do not URL-encode any of the unreserved characters that RFC 3986 defines:
|
||||
// A-Z, a-z, 0-9, hyphen (-), underscore (_), period (.), and tilde (~).
|
||||
private static final Escaper AWS_URL_PARAMETER_ESCAPER;
|
||||
private static final Escaper AWS_URL_PARAMETER_ESCAPER = new PercentEscaper("-_.~", false);
|
||||
|
||||
private static final Escaper AWS_PATH_ESCAPER = new PercentEscaper("/-_.~", false);
|
||||
|
||||
static {
|
||||
timestampFormat = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'");
|
||||
timestampFormat.setTimeZone(GMT);
|
||||
|
||||
dateFormat = new SimpleDateFormat("yyyyMMdd");
|
||||
dateFormat.setTimeZone(GMT);
|
||||
|
||||
AWS_URL_PARAMETER_ESCAPER = new PercentEscaper("-_.~", false);
|
||||
}
|
||||
|
||||
// Specifying a default for how to parse the service and region in this way allows
|
||||
// tests or other downstream services to not have to use guice overrides.
|
||||
@ImplementedBy(ServiceAndRegion.AWSServiceAndRegion.class)
|
||||
|
@ -137,6 +127,10 @@ public abstract class Aws4SignerBase {
|
|||
this.timestampProvider = timestampProvider;
|
||||
this.serviceAndRegion = serviceAndRegion;
|
||||
this.crypto = crypto;
|
||||
this.timestampFormat = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'");
|
||||
timestampFormat.setTimeZone(GMT);
|
||||
this.dateFormat = new SimpleDateFormat("yyyyMMdd");
|
||||
dateFormat.setTimeZone(GMT);
|
||||
}
|
||||
|
||||
protected String getContentType(HttpRequest request) {
|
||||
|
|
|
@ -45,7 +45,7 @@ public class BucketNameValidator extends Validator<String> {
|
|||
@Override
|
||||
public void validate(String name) {
|
||||
if (name == null) {
|
||||
throw exception(name, "Can't be null");
|
||||
throw exception("", "Can't be null");
|
||||
} else if (name.length() < 3) {
|
||||
throw exception(name, "Can't be less than 3 characters");
|
||||
} else if (name.length() > 255) {
|
||||
|
|
|
@ -136,7 +136,7 @@ public class BlockUntilInitScriptStatusIsZeroThenReturnOutput extends AbstractFu
|
|||
String stdout = commandRunner.runAction("stdout").getOutput();
|
||||
String stderr = commandRunner.runAction("stderr").getOutput();
|
||||
Integer exitStatus = Ints.tryParse(commandRunner.runAction("exitstatus").getOutput().trim());
|
||||
exec = new ExecResponse(stdout, stderr, exitStatus == null ? -1 : exitStatus);
|
||||
exec = new ExecResponse(stdout, stderr, exitStatus == null ? Integer.valueOf(-1) : exitStatus);
|
||||
} while (!isCancelled() && exec.getExitStatus() == -1);
|
||||
logger.debug("<< complete(%s) status(%s)", commandRunner.getStatement().getInstanceName(), exec
|
||||
.getExitStatus());
|
||||
|
|
|
@ -67,7 +67,7 @@ public class DigitalOcean2RateLimitExceededException extends RateLimitExceededEx
|
|||
|
||||
totalRequestsPerHour = limit == null ? null : Integer.valueOf(limit);
|
||||
remainingRequests = remaining == null ? null : Integer.valueOf(remaining);
|
||||
timeToNextAvailableRequest = reset == null ? null : millisUntilNextAvailableRequest(Long.valueOf(reset));
|
||||
timeToNextAvailableRequest = reset == null ? null : millisUntilNextAvailableRequest(Long.parseLong(reset));
|
||||
}
|
||||
|
||||
private static Multimap<String, String> rateLimitHeaders(HttpResponse response) {
|
||||
|
|
|
@ -128,8 +128,7 @@ public class ECDSAKeys {
|
|||
}
|
||||
ECParameterSpec spec = CURVES.get(curveName);
|
||||
stream = new ByteArrayInputStream(base64().decode(get(parts, 1)));
|
||||
@SuppressWarnings("unused")
|
||||
String keyType = new String(readLengthFirst(stream));
|
||||
readLengthFirst(stream); // ignore return value
|
||||
String curveMarker = new String(readLengthFirst(stream));
|
||||
checkArgument(curveName.equals(curveMarker), "looking for marker %s but got %s", curveName, curveMarker);
|
||||
|
||||
|
@ -308,7 +307,7 @@ public class ECDSAKeys {
|
|||
}
|
||||
|
||||
public static class EllipticCurves {
|
||||
public static ECParameterSpec nistp256 = new ECParameterSpec(
|
||||
public static final ECParameterSpec nistp256 = new ECParameterSpec(
|
||||
new EllipticCurve(
|
||||
new ECFieldFp(new BigInteger("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF", 16)),
|
||||
new BigInteger("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC", 16),
|
||||
|
@ -318,7 +317,7 @@ public class ECDSAKeys {
|
|||
new BigInteger("FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551", 16),
|
||||
1);
|
||||
|
||||
public static ECParameterSpec nistp384 = new ECParameterSpec(
|
||||
public static final ECParameterSpec nistp384 = new ECParameterSpec(
|
||||
new EllipticCurve(
|
||||
new ECFieldFp(new BigInteger("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF", 16)),
|
||||
new BigInteger("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC", 16),
|
||||
|
@ -328,7 +327,7 @@ public class ECDSAKeys {
|
|||
new BigInteger("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973", 16),
|
||||
1);
|
||||
|
||||
public static ECParameterSpec nistp521 = new ECParameterSpec(
|
||||
public static final ECParameterSpec nistp521 = new ECParameterSpec(
|
||||
new EllipticCurve(
|
||||
new ECFieldFp(new BigInteger("01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", 16)),
|
||||
new BigInteger("01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC", 16),
|
||||
|
|
|
@ -160,7 +160,7 @@ public class ProfitBricksComputeServiceAdapter implements ComputeServiceAdapter<
|
|||
if (options.getNetworks() != null)
|
||||
try {
|
||||
String networkId = Iterables.get(options.getNetworks(), 0);
|
||||
lanId = Integer.valueOf(networkId);
|
||||
lanId = Integer.parseInt(networkId);
|
||||
} catch (Exception ex) {
|
||||
logger.warn("no valid network id found from options. using default id='%d'", DEFAULT_LAN_ID);
|
||||
}
|
||||
|
|
|
@ -46,8 +46,6 @@ public class ProfitBricksHttpErrorHandler implements HttpErrorHandler {
|
|||
|
||||
Exception exception = message != null ? new HttpResponseException(command, response, message)
|
||||
: new HttpResponseException(command, response);
|
||||
message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(),
|
||||
response.getStatusLine());
|
||||
|
||||
try {
|
||||
switch (response.getStatusCode()) {
|
||||
|
|
Loading…
Reference in New Issue