diff --git a/azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java b/azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java index 50255ba600899..0a952b6d2334f 100644 --- a/azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java +++ b/azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java @@ -100,7 +100,7 @@ public void updateFromResponseOnPutPatch(Response response) throws } if (responseContent == null || responseContent.isEmpty()) { - CloudException exception = new CloudException("no body"); + CloudException exception = new CloudException("polling response does not contain a valid body"); exception.setResponse(response); throw exception; } diff --git a/client-runtime/src/main/java/com/microsoft/rest/ServiceCall.java b/client-runtime/src/main/java/com/microsoft/rest/ServiceCall.java index 0d97464beeae7..d256c118a0305 100644 --- a/client-runtime/src/main/java/com/microsoft/rest/ServiceCall.java +++ b/client-runtime/src/main/java/com/microsoft/rest/ServiceCall.java @@ -29,6 +29,13 @@ public class ServiceCall extends AbstractFuture> { protected ServiceCall() { } + /** + * Creates a ServiceCall from an observable object. + * + * @param observable the observable to create from + * @param the type of the response + * @return the created ServiceCall + */ public static ServiceCall create(final Observable> observable) { final ServiceCall serviceCall = new ServiceCall<>(); serviceCall.subscription = observable @@ -47,6 +54,14 @@ public void call(Throwable throwable) { return serviceCall; } + /** + * Creates a ServiceCall from an observable object and a callback. + * + * @param observable the observable to create from + * @param callback the callback to call when events happen + * @param the type of the response + * @return the created ServiceCall + */ public static ServiceCall create(final Observable> observable, final ServiceCallback callback) { final ServiceCall serviceCall = new ServiceCall<>(); serviceCall.subscription = observable @@ -71,6 +86,15 @@ public void call(Throwable throwable) { return serviceCall; } + /** + * Creates a ServiceCall from an observable and a callback for a header response. + * + * @param observable the observable of a REST call that returns JSON in a header + * @param callback the callback to call when events happen + * @param the type of the response body + * @param the type of the response header + * @return the created ServiceCall + */ public static ServiceCall createWithHeaders(final Observable> observable, final ServiceCallback callback) { final ServiceCall serviceCall = new ServiceCall<>(); serviceCall.subscription = observable @@ -95,20 +119,17 @@ public void call(Throwable throwable) { return serviceCall; } + /** + * @return the current Rx subscription associated with the ServiceCall. + */ public Subscription getSubscription() { return subscription; } - public void setSubscription(Subscription subscription) { + protected void setSubscription(Subscription subscription) { this.subscription = subscription; } - /** - * Cancel the Retrofit call if possible. Parameter - * 'mayInterruptIfRunning is ignored. - * - * @param mayInterruptIfRunning ignored - */ @Override public boolean cancel(boolean mayInterruptIfRunning) { subscription.unsubscribe();