Merge pull request #1407 from maginatics/null-http-response-1.5.x

Null http response 1.5.x
This commit is contained in:
Adrian Cole 2013-03-11 15:49:07 -07:00
commit a76f728897
2 changed files with 4 additions and 2 deletions

View File

@ -19,6 +19,7 @@
package org.jclouds.blobstore.functions;
import org.jclouds.blobstore.ContainerNotFoundException;
import org.jclouds.http.HttpResponse;
import org.jclouds.http.HttpResponseException;
import com.google.common.base.Function;
@ -35,8 +36,8 @@ public class ThrowContainerNotFoundOn404 implements Function<Exception, Object>
public Object apply(Exception from) {
if (from instanceof HttpResponseException) {
HttpResponseException responseException = (HttpResponseException) from;
if (responseException.getResponse().getStatusCode() == 404) {
HttpResponse response = ((HttpResponseException) from).getResponse();
if (response != null && response.getStatusCode() == 404) {
// TODO: parse to get the bucket name
throw new ContainerNotFoundException(from);
}

View File

@ -104,6 +104,7 @@ public class HttpResponseException extends RuntimeException {
return command;
}
@Nullable
public HttpResponse getResponse() {
return response;
}