Skip to content

unsubscribe java.lang.UnsupportedOperationException: JsonNull #247

Description

@yanwuweixu

public void unsubscribe(StreamBlockingQueue queue) {
String operationId = queue.getOperationId();
List<StreamBlockingQueue> blockingQueues = subscriptions.get(operationId);
blockingQueues.remove(queue);

    // unsubscribe from the stream if no more queue
    if (blockingQueues.isEmpty()) {
        RequestWrapperDTO listSubscriptions =
                new RequestWrapperDTO.Builder<>()
                        .method("UNSUBSCRIBE")
                        .params(Collections.singletonList(operationId))
                        .build();

        this.send(listSubscriptions);
    }
}

There was no ID in the unsubscribe construction, causing push notifications message : {"result":null,"id":null} onWebSocketText Then parsing this information will result in the following error JsonElement id = obj.get("id"); Analysis result appears id = "null" (JsonNull.INSTANCE )Judgment if (id != null) Through Execute RequestWrapperDTO requestWrapperDTO = pendingRequest.get(id.getAsString());
com.binance.connector.client.common.ApiException: Message: java.lang.UnsupportedOperationException: JsonNull

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions