Issue 463: updated to guava r08

This commit is contained in:
Adrian Cole 2011-02-06 20:25:30 -08:00
parent cd016a9ff6
commit 8476082ee3
2 changed files with 5 additions and 4 deletions

View File

@ -111,7 +111,7 @@
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>r07</version>
<version>r08</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>

View File

@ -21,7 +21,8 @@ package org.jclouds.rest.binders;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.net.InternetDomainName.isValid;
import static com.google.common.net.InternetDomainName.fromLenient;
import static com.google.common.net.InternetDomainName.isValidLenient;
import javax.inject.Inject;
import javax.inject.Provider;
@ -51,9 +52,9 @@ public class BindAsHostPrefix implements Binder {
@SuppressWarnings("unchecked")
public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
checkNotNull(payload, "hostprefix");
checkArgument(isValid(request.getEndpoint().getHost()), "this is only valid for hostnames: " + request);
checkArgument(isValidLenient(request.getEndpoint().getHost()), "this is only valid for hostnames: " + request);
UriBuilder builder = uriBuilderProvider.get().uri(request.getEndpoint());
InternetDomainName name = InternetDomainName.from(request.getEndpoint().getHost()).child(payload.toString());
InternetDomainName name = fromLenient(request.getEndpoint().getHost()).child(payload.toString());
builder.host(name.name());
return (R) request.toBuilder().endpoint(builder.build()).build();
}