-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug?
We are experiencing crashes on some Android 9, 10 and 11 devices. Mostly Samsung S8, S9+ and A20e. But also on our Android Automotive variant in the Renault OpenR Link system.
On the Samsung devices it happens on the App's first interaction with the okta-mobile-kotlin library - in our migration process from our old token library, where the migrated token is stored in the Credential. The stack trace is:
Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'java.security.PublicKey java.security.cert.Certificate.getPublicKey()' on a null object reference
at com.okta.authfoundation.credential.DefaultTokenEncryptionHandler.encrypt(TokenEncryptionHandler.kt:203)
at com.okta.authfoundation.credential.RoomTokenStorage.add(RoomTokenStorage.kt:108)
at com.okta.authfoundation.credential.CredentialDataSource.createCredential(CredentialDataSource.kt:70)
at com.okta.authfoundation.credential.Credential$Companion.storeAsync(Credential.java:324)
at com.okta.authfoundation.credential.Credential$Companion$storeAsync$1.invokeSuspend(Credential.kt:12)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.UndispatchedCoroutine.afterResume(CoroutineContext.kt:266)
at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:100)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:263)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(BlockingCoroutine.java:95)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(BuildersKt__Builders.kt:69)
at kotlinx.coroutines.BuildersKt.runBlocking(Builders.kt:1)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(BuildersKt__Builders.kt:47)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Builders.kt:1)
at com.okta.authfoundation.credential.Credential$Companion.store(Credential.java:308)
at com.okta.authfoundation.credential.Credential$Companion.store$default(Credential.java:303)
at com.example.ourapp.SomeClass$Companion.migrateAppAuthToOkta(SomeClass.kt:122)
at com.example.ourapp.App.onCreate(App.kt:77)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1190)
at android.app.ActivityThread.handleMakeApplication(ActivityThread.java:7184)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7134)
at android.app.ActivityThread.access$1600(ActivityThread.java:274)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2102)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8167)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
On Automotive, it happens in the device flow during polling when it receives the token and attempts to store it:
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.security.PublicKey java.security.cert.Certificate.getPublicKey()' on a null object reference
at com.okta.authfoundation.credential.DefaultTokenEncryptionHandler.encrypt(TokenEncryptionHandler.kt:203)
at com.okta.authfoundation.credential.RoomTokenStorage.add(RoomTokenStorage.kt:108)
at com.okta.authfoundation.credential.CredentialDataSource.createCredential(CredentialDataSource.kt:70)
at com.okta.authfoundation.credential.Credential$Companion.storeAsync(Credential.kt:324)
at com.okta.authfoundation.credential.Credential$Companion$store$1.invokeSuspend(Credential.kt:308)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:263)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:95)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:69)
at kotlinx.coroutines.BuildersKt.runBlocking(:1)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:47)
at kotlinx.coroutines.BuildersKt.runBlocking$default(:1)
at com.okta.authfoundation.credential.Credential$Companion.store(Credential.kt:308)
at com.okta.authfoundation.credential.Credential$Companion.store$default(Credential.kt:303)
at com.example.automotive_device_flow.DeviceFlowHandler.newPollForAccessToken(DeviceFlowHandler.kt:94)
at com.example.automotive_device_flow.DeviceFlowHandler$newPollForAccessToken$1.invokeSuspend(:14)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:28)
at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:100)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:101)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
What is expected to happen?
No crash
What is the actual behavior?
A crash
Reproduction Steps?
We have not ourselfs been able to reproduce the issue.
Additional Information?
No response
SDK Version and Artifact(s) used.
2.0.2
Build Information
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working