mirror of
https://github.com/apache/jclouds.git
synced 2025-02-26 12:35:52 +00:00
Correct uses of checkNotNull
These should provide a descriptive second argument, not the same as the first argument which is null in the failure case. This also found a logic error in CreateVolumeResponseHandler.
This commit is contained in:
parent
a4855eb9fd
commit
53c47aa0bd
@ -186,7 +186,7 @@ public class CreateVolumeResponseHandler extends ParseSax.HandlerForGeneratedReq
|
||||
}
|
||||
|
||||
}
|
||||
checkNotNull(regionToZones, "zone %s not in %s", zone, regionToZones);
|
||||
checkNotNull(region, "zone %s not in %s", zone, regionToZones);
|
||||
} else {
|
||||
region = defaultRegion.get();
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public final class Limit {
|
||||
@ConstructorProperties({ "verb", "unit", "value", "remaining", "next-available" })
|
||||
private Limit(String verb, String unit, int value, @Nullable Integer remaining, @Nullable Date nextAvailable) {
|
||||
this.verb = checkNotNull(verb, "verb");
|
||||
this.unit = checkNotNull(unit, "unit", unit);
|
||||
this.unit = checkNotNull(unit, "unit");
|
||||
this.value = value;
|
||||
this.remaining = Optional.fromNullable(remaining);
|
||||
this.nextAvailable = Optional.fromNullable(nextAvailable);
|
||||
|
@ -52,7 +52,7 @@ public class SwiftObject implements Comparable<SwiftObject> {
|
||||
protected SwiftObject(String name, URI uri, String etag, Date lastModified,
|
||||
Multimap<String, String> headers, Map<String, String> metadata, Payload payload) {
|
||||
this.name = checkNotNull(name, "name");
|
||||
this.uri = checkNotNull(uri, "uri of %s", uri);
|
||||
this.uri = checkNotNull(uri, "uri of %s", name);
|
||||
this.etag = etag != null ? etag.replace("\"", "") : null;
|
||||
this.lastModified = checkNotNull(lastModified, "lastModified of %s", name);
|
||||
this.headers = headers == null ? ImmutableMultimap.<String, String> of() : checkNotNull(headers, "headers of %s", name);
|
||||
|
@ -36,7 +36,7 @@ public final class HostedZone {
|
||||
this.name = checkNotNull(name, "name");
|
||||
this.callerReference = checkNotNull(callerReference, "callerReference for %s", name);
|
||||
this.resourceRecordSetCount = resourceRecordSetCount;
|
||||
this.comment = checkNotNull(comment, "comment for %s", comment);
|
||||
this.comment = checkNotNull(comment, "comment for %s", name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -183,7 +183,7 @@ public class ResourceRecordSet {
|
||||
this.ttl = checkNotNull(ttl, "ttl for %s", name);
|
||||
checkArgument(ttl.or(0) >= 0, "ttl of %s must be unsigned", name);
|
||||
this.values = checkNotNull(values, "values for %s", name);
|
||||
this.aliasTarget = checkNotNull(aliasTarget, "aliasTarget for %s", aliasTarget);
|
||||
this.aliasTarget = checkNotNull(aliasTarget, "aliasTarget for %s", name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -54,7 +54,7 @@ public class WireLiveTest {
|
||||
InputStream in = wire.input(fromServer);
|
||||
byte[] compare = md5().hashBytes(ByteStreams.toByteArray(in)).asBytes();
|
||||
Thread.sleep(100);
|
||||
assertEquals(base16().lowerCase().encode(compare), checkNotNull(sysHttpStreamMd5, sysHttpStreamMd5));
|
||||
assertEquals(base16().lowerCase().encode(compare), checkNotNull(sysHttpStreamMd5, "sysHttpStreamMd5"));
|
||||
assertEquals(((BufferLogger) wire.getWireLog()).buff.toString().getBytes().length, 3331484);
|
||||
return null;
|
||||
}
|
||||
@ -134,7 +134,7 @@ public class WireLiveTest {
|
||||
InputStream in = wire.input(connection.getInputStream());
|
||||
byte[] compare = ByteStreams2.hashAndClose(in, md5()).asBytes();
|
||||
Thread.sleep(100);
|
||||
assertEquals(base16().lowerCase().encode(compare), checkNotNull(sysHttpStreamMd5, sysHttpStreamMd5));
|
||||
assertEquals(base16().lowerCase().encode(compare), checkNotNull(sysHttpStreamMd5, "sysHttpStreamMd5"));
|
||||
assertEquals(((BufferLogger) wire.getWireLog()).buff.toString().getBytes().length, 3331484);
|
||||
} catch (UnknownHostException e) {
|
||||
// probably in offline mode
|
||||
@ -159,7 +159,7 @@ public class WireLiveTest {
|
||||
InputStream in = wire.input(connection.getInputStream());
|
||||
byte[] compare = ByteStreams2.hashAndClose(in, md5()).asBytes();
|
||||
Thread.sleep(100);
|
||||
assertEquals(base16().lowerCase().encode(compare), checkNotNull(sysHttpStreamMd5, sysHttpStreamMd5));
|
||||
assertEquals(base16().lowerCase().encode(compare), checkNotNull(sysHttpStreamMd5, "sysHttpStreamMd5"));
|
||||
assertEquals(((BufferLogger) wire.getWireLog()).buff.toString().getBytes().length, 3331484);
|
||||
} catch (UnknownHostException e) {
|
||||
// probably in offline mode
|
||||
|
@ -41,7 +41,7 @@ public final class CreatePrimaryZone {
|
||||
this.fqdn = checkNotNull(fqdn, "fqdn");
|
||||
this.contact = checkNotNull(contact, "contact for %s", fqdn);
|
||||
this.defaultTTL = defaultTTL;
|
||||
this.serialStyle = checkNotNull(serialStyle, "serialStyle for %s", serialStyle);
|
||||
this.serialStyle = checkNotNull(serialStyle, "serialStyle for %s", fqdn);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,7 +91,7 @@ public final class Zone {
|
||||
this.fqdn = checkNotNull(fqdn, "fqdn");
|
||||
this.type = checkNotNull(type, "type for %s", fqdn);
|
||||
this.serial = serial;
|
||||
this.serialStyle = checkNotNull(serialStyle, "serialStyle for %s", serialStyle);
|
||||
this.serialStyle = checkNotNull(serialStyle, "serialStyle for %s", fqdn);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -48,7 +48,7 @@ public final class TrafficControllerPoolRecordDetail {
|
||||
this.probingEnabled = probingEnabled;
|
||||
this.status = checkNotNull(status, "status for %s", poolId);
|
||||
this.serving = serving;
|
||||
this.description = checkNotNull(description, "description for %s", description);
|
||||
this.description = checkNotNull(description, "description for %s", poolId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,7 +44,7 @@ public final class Zone {
|
||||
this.accountId = checkNotNull(accountId, "accountId for %s", name);
|
||||
this.ownerId = checkNotNull(ownerId, "ownerId for %s", name);
|
||||
this.dnssecStatus = checkNotNull(dnssecStatus, "dnssecStatus for %s", name);
|
||||
this.primarySrc = checkNotNull(primarySrc, "primarySrc for %s", primarySrc);
|
||||
this.primarySrc = checkNotNull(primarySrc, "primarySrc for %s", name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user