Skip to content
This repository was archived by the owner on Jun 15, 2026. It is now read-only.
This repository was archived by the owner on Jun 15, 2026. It is now read-only.

NullPointerException on ServiceFuture.cancel() #717

Description

ServiceFuture.fromBody(Completable, ServiceCallback) does not assign value to subscription class variable.
https://github.com/Azure/autorest-clientruntime-for-java/blob/master/client-runtime/src/main/java/com/microsoft/rest/ServiceFuture.java#L129-L150

Then ServiceFuture.cancel() calls subscription.unsubscribe() which produces NullPointerException, as subscription is null.

The correct code should be serviceFuture.subscription = completable.subscribe(...


Temporary workaround, avoid calling ServiceFuture.fromBody(Completable, ServiceCallback). Use other factory method e.g. ServiceFuture.fromBody(Observable, ServiceCallback).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions