mirror of https://github.com/apache/jclouds.git
fixed status checkers
This commit is contained in:
parent
df86359e65
commit
7050b0f85c
|
@ -23,7 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.http.HttpResponseException;
|
||||
import org.jclouds.http.functions.ReturnTrueOn404;
|
||||
import org.jclouds.rest.ResourceNotFoundException;
|
||||
|
||||
|
@ -46,9 +45,9 @@ public class ReturnFalseOnNotFoundOr404 implements Function<Exception, Boolean>
|
|||
}
|
||||
|
||||
public Boolean apply(Exception from) {
|
||||
Iterable<HttpResponseException> throwables = Iterables.filter(
|
||||
Throwables.getCausalChain(from), HttpResponseException.class);
|
||||
if (Iterables.size(Iterables.filter(throwables, ResourceNotFoundException.class)) >= 1) {
|
||||
Iterable<ResourceNotFoundException> throwables = Iterables.filter(Throwables
|
||||
.getCausalChain(from), ResourceNotFoundException.class);
|
||||
if (Iterables.size(throwables) >= 1) {
|
||||
return false;
|
||||
} else {
|
||||
return !rto404.apply(from);
|
||||
|
|
|
@ -24,7 +24,6 @@ import static org.jclouds.util.Utils.propagateOrNull;
|
|||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.http.HttpResponseException;
|
||||
import org.jclouds.http.functions.ReturnTrueOn404;
|
||||
import org.jclouds.rest.ResourceNotFoundException;
|
||||
|
||||
|
@ -46,9 +45,9 @@ public class ReturnNullOnNotFoundOr404 implements Function<Exception, Object> {
|
|||
}
|
||||
|
||||
public Object apply(Exception from) {
|
||||
Iterable<HttpResponseException> throwables = Iterables.filter(
|
||||
Throwables.getCausalChain(from), HttpResponseException.class);
|
||||
if (Iterables.size(Iterables.filter(throwables, ResourceNotFoundException.class)) >= 1) {
|
||||
Iterable<ResourceNotFoundException> throwables = Iterables.filter(
|
||||
Throwables.getCausalChain(from), ResourceNotFoundException.class);
|
||||
if (Iterables.size(throwables) >= 1) {
|
||||
return null;
|
||||
} else if (rto404.apply(from)) {
|
||||
return null;
|
||||
|
|
|
@ -24,7 +24,6 @@ import static org.jclouds.util.Utils.propagateOrNull;
|
|||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.http.HttpResponseException;
|
||||
import org.jclouds.http.functions.ReturnTrueOn404;
|
||||
import org.jclouds.rest.ResourceNotFoundException;
|
||||
|
||||
|
@ -47,9 +46,9 @@ public class ReturnVoidOnNotFoundOr404 implements Function<Exception, Void> {
|
|||
}
|
||||
|
||||
public Void apply(Exception from) {
|
||||
Iterable<HttpResponseException> throwables = Iterables.filter(
|
||||
Throwables.getCausalChain(from), HttpResponseException.class);
|
||||
if (Iterables.size(Iterables.filter(throwables, ResourceNotFoundException.class)) >= 1) {
|
||||
Iterable<ResourceNotFoundException> throwables = Iterables.filter(
|
||||
Throwables.getCausalChain(from), ResourceNotFoundException.class);
|
||||
if (Iterables.size(throwables) >= 1) {
|
||||
return null;
|
||||
} else {
|
||||
Boolean value = rto404.apply(from);
|
||||
|
|
Loading…
Reference in New Issue