Issue 471: revised to include java context on interrupted errors

This commit is contained in:
Adrian Cole 2011-04-01 19:38:45 -07:00
parent 54ea98ba49
commit 72768c206d
3 changed files with 13 additions and 7 deletions

View File

@ -90,7 +90,7 @@ public class HttpRequest extends HttpMessage {
public static <X extends HttpRequest> Builder<X> from(X input) { public static <X extends HttpRequest> Builder<X> from(X input) {
return new Builder<X>().method(input.getMethod()).endpoint(input.getEndpoint()).skips(input.getSkips()) return new Builder<X>().method(input.getMethod()).endpoint(input.getEndpoint()).skips(input.getSkips())
.filters(input.getFilters()).payload(input.getPayload()).headers(input.getHeaders()); .filters(input.getFilters()).payload(input.getPayload()).headers(input.getHeaders());
} }
} }
@ -120,7 +120,7 @@ public class HttpRequest extends HttpMessage {
} }
public HttpRequest(String method, URI endpoint, char[] skips, List<HttpRequestFilter> requestFilters, public HttpRequest(String method, URI endpoint, char[] skips, List<HttpRequestFilter> requestFilters,
@Nullable Payload payload) { @Nullable Payload payload) {
this(method, endpoint, skips, requestFilters, payload, ImmutableMultimap.<String, String> of()); this(method, endpoint, skips, requestFilters, payload, ImmutableMultimap.<String, String> of());
} }
@ -136,7 +136,7 @@ public class HttpRequest extends HttpMessage {
} }
public HttpRequest(String method, URI endpoint, char[] skips, List<HttpRequestFilter> requestFilters, public HttpRequest(String method, URI endpoint, char[] skips, List<HttpRequestFilter> requestFilters,
@Nullable Payload payload, Multimap<String, String> headers) { @Nullable Payload payload, Multimap<String, String> headers) {
super(payload, headers); super(payload, headers);
this.method = checkNotNull(method, "method"); this.method = checkNotNull(method, "method");
this.endpoint = checkNotNull(endpoint, "endpoint"); this.endpoint = checkNotNull(endpoint, "endpoint");
@ -248,7 +248,7 @@ public class HttpRequest extends HttpMessage {
@Override @Override
public String toString() { public String toString() {
return "[method=" + method + ", endpoint=" + endpoint + ", headers=" + headers + ", payload=" + payload + "]"; return String.format("[method=%s, endpoint=%s, headers=%s, payload=%s]", method, endpoint, headers, payload);
} }
} }

View File

@ -27,6 +27,7 @@ import javax.annotation.Resource;
import javax.inject.Inject; import javax.inject.Inject;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import org.jclouds.rest.internal.GeneratedHttpRequest;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListenableFuture;
@ -54,7 +55,7 @@ public class TransformingHttpCommandImpl<T> implements TransformingHttpCommand<T
@Inject @Inject
public TransformingHttpCommandImpl(TransformingHttpCommandExecutorService executorService, HttpRequest request, public TransformingHttpCommandImpl(TransformingHttpCommandExecutorService executorService, HttpRequest request,
Function<HttpResponse, T> transformer) { Function<HttpResponse, T> transformer) {
this.request = checkNotNull(request, "request"); this.request = checkNotNull(request, "request");
this.executorService = checkNotNull(executorService, "executorService"); this.executorService = checkNotNull(executorService, "executorService");
this.transformer = checkNotNull(transformer, "transformer"); this.transformer = checkNotNull(transformer, "transformer");
@ -146,7 +147,12 @@ public class TransformingHttpCommandImpl<T> implements TransformingHttpCommand<T
@Override @Override
public String toString() { public String toString() {
return "[request=" + request.getRequestLine() + "]"; if (request instanceof GeneratedHttpRequest<?>)
return String.format("[method=%s.%s, request=%s]", GeneratedHttpRequest.class.cast(request).getDeclaring()
.getSimpleName(), GeneratedHttpRequest.class.cast(request).getJavaMethod().getName(), request
.getRequestLine());
else
return "[request=" + request.getRequestLine() + "]";
} }
} }

View File

@ -205,7 +205,7 @@ public abstract class BaseHttpCommandExecutorService<Q> implements HttpCommandEx
@Override @Override
public String toString() { public String toString() {
return "[command=" + command + "]"; return command.toString();
} }
} }