mirror of https://github.com/apache/jclouds.git
Prefer checkNotNull when appropriate
Calling checkNotNull on parameters better captures our intent.
This commit is contained in:
parent
1aff618529
commit
004c160aac
|
@ -162,10 +162,10 @@ public class AdaptingComputeServiceStrategies<N, H, I, L> implements CreateNodeW
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public NodeMetadata createNodeWithGroupEncodedIntoName(String group, String name, Template template) {
|
public NodeMetadata createNodeWithGroupEncodedIntoName(String group, String name, Template template) {
|
||||||
checkState(group != null, "group (that which groups identical nodes together) must be specified");
|
checkNotNull(group, "group (that which groups identical nodes together) must be specified");
|
||||||
checkState(name != null && name.indexOf(group) != -1, "name should have %s encoded into it", group);
|
checkNotNull(name, "name should have %s encoded into it", group);
|
||||||
checkState(template != null, "template was null");
|
checkNotNull(template, "template was null");
|
||||||
checkState(template.getOptions() != null, "template options was null");
|
checkNotNull(template.getOptions(), "template options was null");
|
||||||
|
|
||||||
NodeAndInitialCredentials<N> from = client.createNodeWithGroupEncodedIntoName(group, name, template);
|
NodeAndInitialCredentials<N> from = client.createNodeWithGroupEncodedIntoName(group, name, template);
|
||||||
LoginCredentials fromNode = from.getCredentials();
|
LoginCredentials fromNode = from.getCredentials();
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
package org.jclouds.io;
|
package org.jclouds.io;
|
||||||
|
|
||||||
import static com.google.common.base.Preconditions.checkNotNull;
|
import static com.google.common.base.Preconditions.checkNotNull;
|
||||||
import static com.google.common.base.Preconditions.checkState;
|
|
||||||
import static com.google.common.io.ByteStreams.toByteArray;
|
import static com.google.common.io.ByteStreams.toByteArray;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -141,7 +140,7 @@ public class Payloads {
|
||||||
* @see #calculateMD5(Payload, MessageDigest)
|
* @see #calculateMD5(Payload, MessageDigest)
|
||||||
*/
|
*/
|
||||||
public static <T extends PayloadEnclosing> T calculateMD5(T payloadEnclosing, MessageDigest md5) throws IOException {
|
public static <T extends PayloadEnclosing> T calculateMD5(T payloadEnclosing, MessageDigest md5) throws IOException {
|
||||||
checkState(payloadEnclosing != null, "payloadEnclosing");
|
checkNotNull(payloadEnclosing, "payloadEnclosing");
|
||||||
Payload newPayload = calculateMD5(payloadEnclosing.getPayload(), md5);
|
Payload newPayload = calculateMD5(payloadEnclosing.getPayload(), md5);
|
||||||
if (newPayload != payloadEnclosing.getPayload())
|
if (newPayload != payloadEnclosing.getPayload())
|
||||||
payloadEnclosing.setPayload(newPayload);
|
payloadEnclosing.setPayload(newPayload);
|
||||||
|
|
Loading…
Reference in New Issue