Merge pull request #570 from andrewgaul/checkstate

Prefer checkNotNull when appropriate
This commit is contained in:
Adrian Cole 2012-04-17 14:46:04 -07:00
commit a238d63578
2 changed files with 5 additions and 6 deletions

View File

@ -162,10 +162,10 @@ public class AdaptingComputeServiceStrategies<N, H, I, L> implements CreateNodeW
*/
@Override
public NodeMetadata createNodeWithGroupEncodedIntoName(String group, String name, Template template) {
checkState(group != null, "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);
checkState(template != null, "template was null");
checkState(template.getOptions() != null, "template options was null");
checkNotNull(group, "group (that which groups identical nodes together) must be specified");
checkNotNull(name, "name should have %s encoded into it", group);
checkNotNull(template, "template was null");
checkNotNull(template.getOptions(), "template options was null");
NodeAndInitialCredentials<N> from = client.createNodeWithGroupEncodedIntoName(group, name, template);
LoginCredentials fromNode = from.getCredentials();

View File

@ -19,7 +19,6 @@
package org.jclouds.io;
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 java.io.File;
@ -141,7 +140,7 @@ public class Payloads {
* @see #calculateMD5(Payload, MessageDigest)
*/
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);
if (newPayload != payloadEnclosing.getPayload())
payloadEnclosing.setPayload(newPayload);