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

Check internal JNI calls for pending exceptions and no-op #1091

Merged
merged 1 commit into from
Jan 28, 2021

Conversation

fractalwrench
Copy link
Contributor

@fractalwrench fractalwrench commented Jan 26, 2021

Goal

Checks additional JNI calls in the NDK module for pending exceptions and no-ops, building on #1088. This is achieved by calling ExceptionClear to remove any pending JVM exceptions that could lead to app termination.

Changeset

Added safe versions of the following methods and updated code to check the return value where appropriate:

NewStringUTF
CallBooleanMethod
CallDoubleMethod
CallFloatMethod
CallIntMethod
NewByteArray
SetByteArrayRegion
NewObjectArray
SetObjectArrayElement
GetObjectArrayElement

Additionally fixes a (unlikely) deadlock introduced in #1088 in Java_com_bugsnag_android_ndk_NativeBridge_deliverReportAtPath

Testing

Relied on existing test coverage.

@fractalwrench fractalwrench force-pushed the PLAT-5746/jni-handling branch from 621fe84 to af8dff7 Compare January 26, 2021 15:07
@fractalwrench fractalwrench changed the title fix: enhance error handling in JNI Check internal JNI calls for pending exceptions and no-op Jan 26, 2021
@fractalwrench fractalwrench marked this pull request as ready for review January 26, 2021 15:28
@bugsnagbot
Copy link
Collaborator

bugsnagbot commented Jan 26, 2021

Android notifier sizes

Format Size impact of Bugsnag (kB) Size impact of Bugsnag when Minified (kB)
APK 1463.92 1378.65
arm64_v8a 377.51 291.5
armeabi 357.03 271.01
armeabi_v7a 340.65 250.54
x86 418.45 328.34
x86_64 397.98 311.97

Generated by 🚫 Danger

@kstenerud kstenerud self-requested a review January 28, 2021 10:41
@fractalwrench fractalwrench merged commit 773a06c into next Jan 28, 2021
@fractalwrench fractalwrench deleted the PLAT-5746/jni-handling branch January 28, 2021 11:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants