Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

NPE when calling unsubscribe() while not subcribed #131

Open
StephanSchuster opened this issue Oct 16, 2018 · 0 comments
Open

NPE when calling unsubscribe() while not subcribed #131

StephanSchuster opened this issue Oct 16, 2018 · 0 comments

Comments

@StephanSchuster
Copy link

Calling
client.getEventHandler().unsubscribe("my/event", mMyListener)
without having called
client.getEventHandler().subscribe("my/event", mMyListener)
before, results in an NPE in
DeepstreamClientAbstract.onError(...)

Reason: The server sends NOT_SUBSCRIBED which is an event type that is not known by the respective Event enum on the client. Maybe this is already a bug. I'm not sure because on https://deepstreamhub.com/docs/server/constants-and-errors/ there is no check behind NOT_SUBSCRIBED for the client (whatever that means). In any case the client should handle such situations more gracefully with throwing a DeepstreamError instead of crashing with a NPE.

In contrast to other open issues there is no workaround for this by extending and fixing the client. All relevant methods cannot be overriden due to access rights. Therefore it would be very helpful if someone could fix and release this (maybe together with a few other issues).

I'll provide a patch shortly.

yasserf added a commit that referenced this issue Oct 24, 2018
Fixed NPE when being called for unknown event types (see issue #131)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant