mirror of https://github.com/apache/jclouds.git
Merge pull request #1407 from maginatics/null-http-response-1.5.x
Null http response 1.5.x
This commit is contained in:
commit
a76f728897
|
@ -19,6 +19,7 @@
|
||||||
package org.jclouds.blobstore.functions;
|
package org.jclouds.blobstore.functions;
|
||||||
|
|
||||||
import org.jclouds.blobstore.ContainerNotFoundException;
|
import org.jclouds.blobstore.ContainerNotFoundException;
|
||||||
|
import org.jclouds.http.HttpResponse;
|
||||||
import org.jclouds.http.HttpResponseException;
|
import org.jclouds.http.HttpResponseException;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
import com.google.common.base.Function;
|
||||||
|
@ -35,8 +36,8 @@ public class ThrowContainerNotFoundOn404 implements Function<Exception, Object>
|
||||||
|
|
||||||
public Object apply(Exception from) {
|
public Object apply(Exception from) {
|
||||||
if (from instanceof HttpResponseException) {
|
if (from instanceof HttpResponseException) {
|
||||||
HttpResponseException responseException = (HttpResponseException) from;
|
HttpResponse response = ((HttpResponseException) from).getResponse();
|
||||||
if (responseException.getResponse().getStatusCode() == 404) {
|
if (response != null && response.getStatusCode() == 404) {
|
||||||
// TODO: parse to get the bucket name
|
// TODO: parse to get the bucket name
|
||||||
throw new ContainerNotFoundException(from);
|
throw new ContainerNotFoundException(from);
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,6 +104,7 @@ public class HttpResponseException extends RuntimeException {
|
||||||
return command;
|
return command;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
public HttpResponse getResponse() {
|
public HttpResponse getResponse() {
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue