Issue 695: URISource : improved input validation

This commit is contained in:
Jason King 2011-12-20 15:58:14 +00:00
parent 84b5cfc8dc
commit 0d5ccf2af5
1 changed files with 3 additions and 1 deletions

View File

@ -1,9 +1,11 @@
package org.jclouds.tmrk.enterprisecloud.functions;
import com.google.common.base.Function;
import org.jclouds.tmrk.enterprisecloud.domain.vm.CreateVirtualMachine;
import java.net.URI;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
/**
@ -27,7 +29,7 @@ public interface URISource {
*/
@Override
public URI apply(Object source) {
checkNotNull(source,"source");
checkArgument(checkNotNull(source, "source") instanceof URISource, "this function is only valid for URISource instances");
URISource uriSource = URISource.class.cast(source);
return uriSource.getURI();
}