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.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.http.HttpResponseException;
|
|
||||||
import org.jclouds.http.functions.ReturnTrueOn404;
|
import org.jclouds.http.functions.ReturnTrueOn404;
|
||||||
import org.jclouds.rest.ResourceNotFoundException;
|
import org.jclouds.rest.ResourceNotFoundException;
|
||||||
|
|
||||||
|
@ -46,9 +45,9 @@ public class ReturnFalseOnNotFoundOr404 implements Function<Exception, Boolean>
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean apply(Exception from) {
|
public Boolean apply(Exception from) {
|
||||||
Iterable<HttpResponseException> throwables = Iterables.filter(
|
Iterable<ResourceNotFoundException> throwables = Iterables.filter(Throwables
|
||||||
Throwables.getCausalChain(from), HttpResponseException.class);
|
.getCausalChain(from), ResourceNotFoundException.class);
|
||||||
if (Iterables.size(Iterables.filter(throwables, ResourceNotFoundException.class)) >= 1) {
|
if (Iterables.size(throwables) >= 1) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return !rto404.apply(from);
|
return !rto404.apply(from);
|
||||||
|
|
|
@ -24,7 +24,6 @@ import static org.jclouds.util.Utils.propagateOrNull;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.http.HttpResponseException;
|
|
||||||
import org.jclouds.http.functions.ReturnTrueOn404;
|
import org.jclouds.http.functions.ReturnTrueOn404;
|
||||||
import org.jclouds.rest.ResourceNotFoundException;
|
import org.jclouds.rest.ResourceNotFoundException;
|
||||||
|
|
||||||
|
@ -46,9 +45,9 @@ public class ReturnNullOnNotFoundOr404 implements Function<Exception, Object> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object apply(Exception from) {
|
public Object apply(Exception from) {
|
||||||
Iterable<HttpResponseException> throwables = Iterables.filter(
|
Iterable<ResourceNotFoundException> throwables = Iterables.filter(
|
||||||
Throwables.getCausalChain(from), HttpResponseException.class);
|
Throwables.getCausalChain(from), ResourceNotFoundException.class);
|
||||||
if (Iterables.size(Iterables.filter(throwables, ResourceNotFoundException.class)) >= 1) {
|
if (Iterables.size(throwables) >= 1) {
|
||||||
return null;
|
return null;
|
||||||
} else if (rto404.apply(from)) {
|
} else if (rto404.apply(from)) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -24,7 +24,6 @@ import static org.jclouds.util.Utils.propagateOrNull;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import org.jclouds.http.HttpResponseException;
|
|
||||||
import org.jclouds.http.functions.ReturnTrueOn404;
|
import org.jclouds.http.functions.ReturnTrueOn404;
|
||||||
import org.jclouds.rest.ResourceNotFoundException;
|
import org.jclouds.rest.ResourceNotFoundException;
|
||||||
|
|
||||||
|
@ -47,9 +46,9 @@ public class ReturnVoidOnNotFoundOr404 implements Function<Exception, Void> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Void apply(Exception from) {
|
public Void apply(Exception from) {
|
||||||
Iterable<HttpResponseException> throwables = Iterables.filter(
|
Iterable<ResourceNotFoundException> throwables = Iterables.filter(
|
||||||
Throwables.getCausalChain(from), HttpResponseException.class);
|
Throwables.getCausalChain(from), ResourceNotFoundException.class);
|
||||||
if (Iterables.size(Iterables.filter(throwables, ResourceNotFoundException.class)) >= 1) {
|
if (Iterables.size(throwables) >= 1) {
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
Boolean value = rto404.apply(from);
|
Boolean value = rto404.apply(from);
|
||||||
|
|
Loading…
Reference in New Issue