Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' #729

Closed
jemshit opened this issue Apr 2, 2019 · 8 comments

Comments

@jemshit
Copy link

jemshit commented Apr 2, 2019

Description:

Nullpointer exceptions on some users:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
       at org.json.JSONTokener.nextCleanInternal(JSONTokener.java:116)
       at org.json.JSONTokener.nextValue(JSONTokener.java:94)
       at org.json.JSONObject.(JSONObject.java:156)
       at org.json.JSONObject.(JSONObject.java:173)
       at com.onesignal.OneSignalRemoteParams.processJson(OneSignalRemoteParams.java:74)
       at com.onesignal.OneSignalRemoteParams.access$000(OneSignalRemoteParams.java:11)
       at com.onesignal.OneSignalRemoteParams$1.onSuccess(OneSignalRemoteParams.java:58)
       at com.onesignal.OneSignalRestClient$5.run(OneSignalRestClient.java:253)
       at java.lang.Thread.run(Thread.java:761)

This is the line, the code catches JSONException but NullpointerException is thrown.

Environment

  1. Android SDK 28
  2. Onesignal latest (3.10.7)
  3. Added onesignal to project using gradle as described in documentation

Steps to Reproduce Issue:

  1. SDK is added
  2. Push notifications are received, tags are sent
  3. NullpointerException occurs on some users, so can't reproduce. But code is available for such Exception flow, it can be avoided
@kingfisherphuoc
Copy link

I got this issue also.

@jkasten2
Copy link
Member

@jemshit @kingfisherphuoc Thanks for reporting, what volume of crashes are you seeing with this error? And it is specific to any Android versions or device models?

We are looking into root cause of this exception if possible, if not I believe catching Throwable and adding a retry for the network request will be the next best course.

@kingfisherphuoc
Copy link

kingfisherphuoc commented Apr 10, 2019

@jkasten2 I am facing this issue on all android versions. It occurs mostly on Android 6.0 as the image below:
Screen Shot 2019-04-10 at 9 20 47 AM

I assume that there's a problem with json response. You guys perhaps removed a field from it.

@jemshit
Copy link
Author

jemshit commented Apr 10, 2019

49% General Mobile phones
62% Android 7
Small amount of users

image

@gitton
Copy link

gitton commented Apr 18, 2019

got the same issue.

@tuinui
Copy link

tuinui commented Apr 23, 2019

got same issue

@9468lgy
Copy link

9468lgy commented Apr 23, 2019

got the same issue.

@jkasten2
Copy link
Member

Thanks for confirming the issue. It is now fixed in the 3.10.8 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants