NullPointerException: com.braintreepayments.api.TLSCertificatePinning.getCertInputStream (TLSCertificatePinning.java:719)
Braintree SDK Version
4.45.0
Environment
Production
Android Version & Device
Multiple
Braintree dependencies
com.braintreepayments.api:card:4.45.0
Describe the bug
We're seeing a new crash affecting some of our customers, since updating from 4.44.0 to 4.45.0. It occurs during initialisation of BraintreeClient
To reproduce
Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'byte[] java.lang.String.getBytes(java.nio.charset.Charset)' on a null object reference
com.braintreepayments.api.TLSCertificatePinning.getCertInputStream (TLSCertificatePinning.java:719)
com.braintreepayments.api.BraintreeHttpClient$Companion.createDefaultHttpClient (BraintreeHttpClient.java:178)
com.braintreepayments.api.BraintreeHttpClient$Companion.access$createDefaultHttpClient (BraintreeHttpClient.java:172)
com.braintreepayments.api.BraintreeHttpClient.<init> (BraintreeHttpClient.kt:12)
com.braintreepayments.api.AnalyticsClient.<init> (AnalyticsClient.kt:25)
com.braintreepayments.api.BraintreeClientParams.<init> (BraintreeClientParams.kt:14)
com.braintreepayments.api.BraintreeClientParams.<init> (BraintreeClientParams.kt:22)
com.braintreepayments.api.BraintreeClient.<init> (BraintreeClient.kt:70)
com.braintreepayments.api.BraintreeClient.<init> (BraintreeClient.kt:80)
Expected behavior
exception handled
Screenshots
No response
Hey @kimrtaylor thanks for using the Braintree SDK for Android. I'd like to help pinpoint the issue and hopefully find a fix.
One thing that seems odd to me is the stack trace mentions the exception originating form TLSCertificatePinning.java in our SDK. TLSCetificatePinning in our project is written in Kotlin.
Can you help me to answer a few questions:
- Have you been able to reproduce the issue?
- Is your app native Android or React Native?
- Is there any additional information you can provide about the devices that experience this issue (e.g. Android version, Device Manufacturer / Model)?
Hey @kimrtaylor @nick-titov-sw checking in. Is there any additional information available for this crash?
Hey @sshropshire, thanks for such a quick response! We are not able to reproduce the issue ourselves, most of the crashes happened on Samsung devicese and the rest on Oppo and Google Pixel, Android versions 13 and 14. Its a native Android application. Thanks a lot for checking!
Thanks @nick-titov-sw. It's interesting the portion of the code that throws the NPE is virtually the same for TLSCertificatePinning.kt in v4.44.0. We did update the SDK's pinned certificates, but we only changed the string contents of the CERTIFICATES property. Does your app have any similar crashes with the 4.44.0 version?
@sshropshire seems like we never had it before, it's a new one for 4.45.0.
@nick-titov-sw going to try this to see if it helps resolve: https://github.com/braintree/braintree_android/pull/1036.
@all we've provided a potential fix for this issue in our latest 4.48.0 version. Please upgrade and feel free to re-open this issue if the crashes persist.