binance / binance/binance-connector-java
unsubscribe java.lang.UnsupportedOperationException: JsonNull
- Dominant language
- Java
- Stars
- 581
- Forks
- 255
- Avg merge
- 2m
- Merged PRs (30d)
- 2
Description
public void unsubscribe(StreamBlockingQueue queue) {
String operationId = queue.getOperationId();
List> 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
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with unsubscribe(StreamBlockingQueue), the RequestWrapperDTO construction, and the onWebSocketText parsing path described in the report. Reproduce an unsubscribe and inspect the resulting {"result":null,"id":null} message; done means unsubscribe responses no longer cause JsonNull or UnsupportedOperationException during parsing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100