awslabs / awslabs/aws-mobile-appsync-sdk-android

Caused by java.lang.NullPointerException

Open
#347 0 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
Java
Stars
106
Forks
56
PR merge metrics
No merged PRs in 30d

Description

When trying to call "releaseSubscription" method in the WebSocketConnectionManager class app crash on subscriptions (null pointer exception )

crash logs

Caused by java.lang.NullPointerException
Attempt to invoke virtual method 'int java.lang.Object.hashCode()' on a null object reference
java.util.concurrent.ConcurrentHashMap.get (ConcurrentHashMap.java:944)
java.util.concurrent.ConcurrentHashMap.containsKey (ConcurrentHashMap.java:972)
com.amazonaws.mobileconnectors.appsync.WebSocketConnectionManager.releaseSubscription (WebSocketConnectionManager.java:357)
com.amazonaws.mobileconnectors.appsync.AppSyncWebSocketSubscriptionCall.cancel (AppSyncWebSocketSubscriptionCall.java:59)

synchronized void releaseSubscription(String subscriptionId) {
if (!subscriptions.containsKey(subscriptionId)) {
throw new IllegalArgumentException("No existing subscription with the given id.");
}

- AppSync SDK Version: [3.1.4]
- Device: [Pixel 4a , OnePlus 6]
- Android Version: [11 , 10]

Contributor guide

Open the contributing guide

Research direction

Start in WebSocketConnectionManager.releaseSubscription at line 357 and trace the cancellation call from AppSyncWebSocketSubscriptionCall.cancel at line 59. Reproduce cancellation with the reported subscription state, then verify the release path no longer crashes with a null key and preserves the intended missing-subscription behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.