Skip to content

NullPointerException on ServiceFuture.cancel() #717

@weidongxu-microsoft

Description

@weidongxu-microsoft

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).

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