-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
java.lang.NullPointerException throw with null exception #3245
Comments
Executable test case to reproduce the problem? |
Seeing the same exact crash for a handful of users, mostly on Samsung S7 line devices. Unfortunately I'm unable to reproduce and due to the stacktrace, not even sure where it's coming from on my side. I'll let you know if I'm able to reproduce or find the origin. |
I think you probably want to report this to Samsung. It’s likely an issue with that device that you’ll probably see on any HTTP client. |
FYI @15characterlimi |
No action for us to take on this. |
This is a known bug in Android 7.0; it was fixed by this change which went into Android 7.1: https://android-review.googlesource.com/#/c/271775/ I'm very sorry that we found it too late for Android 7.0 and that you ran into it. The issue is that Android 7.0's PrivilegedActionException.getException() returns null, so places that do: throw privilegedActionException.getException() will attempt to throw a null value. There are 19 such places in Android N; sadly, this is one of them. :-( I plan to take appropriate measures to make vendors aware of this issue and the patch. |
PS. I should add that the NullPointerException from this Android bug masks some other Exception that would normally be thrown at affected places in the code. In the particular example of Socket, in cases where Socket.getInputStream() or getOutputStream() should throw IOException but the socket was still open at the start of that method being called, then the IOException will be swallowed and replaced by the NullPointerException that you have observed. :( |
We could fix the callsite to catch NPE and rethrow an IOException. Lemme see what that looks like. |
thanks. |
Such a workaround could work, but should probably be specific to the kind of "throw with null exception" kind of NPE. Let me know how you go / whether you need help. |
@15characterlimi i send email to developer@huawei.com report this bug. i think under ideal conditions this exception case by some rom, unnecessary throw null exception. |
Reviewed By: yungsters Differential Revision: D5144011 fbshipit-source-id: ef897bf7e03b84e4e60ec6607027666608a460cb
error stack:
environ: Android 7.0 samsung SM-G9350 , xiaomi mi5 Android 7.0 and other android 7.0.
okhttp3,3.6.0
The text was updated successfully, but these errors were encountered: