From 0d5ccf2af55009c4c038e1d143eae12f6782bf90 Mon Sep 17 00:00:00 2001 From: Jason King Date: Tue, 20 Dec 2011 15:58:14 +0000 Subject: [PATCH] Issue 695: URISource : improved input validation --- .../org/jclouds/tmrk/enterprisecloud/functions/URISource.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sandbox-providers/tmrk-enterprisecloud/src/main/java/org/jclouds/tmrk/enterprisecloud/functions/URISource.java b/sandbox-providers/tmrk-enterprisecloud/src/main/java/org/jclouds/tmrk/enterprisecloud/functions/URISource.java index c84660af5b..bbfcfe67c2 100644 --- a/sandbox-providers/tmrk-enterprisecloud/src/main/java/org/jclouds/tmrk/enterprisecloud/functions/URISource.java +++ b/sandbox-providers/tmrk-enterprisecloud/src/main/java/org/jclouds/tmrk/enterprisecloud/functions/URISource.java @@ -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(); }