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

URI formate exception #73

Closed
purna-jobget opened this issue Nov 7, 2022 · 11 comments
Closed

URI formate exception #73

purna-jobget opened this issue Nov 7, 2022 · 11 comments
Assignees
Labels
bug Something isn't working

Comments

@purna-jobget
Copy link

Faced the following issue while using the library in prod, any possible solution for

Fatal Exception: java.lang.IllegalArgumentException: uri format is unknown
       at com.alexstyl.contactstore.RawContactQueries.fetchRawContacts(:2)
       at com.alexstyl.contactstore.ContactQueries.access$fetchAdditionalColumns(:1)
       at com.alexstyl.contactstore.ContactQueries$queryContacts$$inlined$map$1$2.emit(:69)
       at com.alexstyl.contactstore.ContactQueries$queryAllContacts$$inlined$map$1$2.emit(:64)
       at com.alexstyl.contactstore.utils.ContentResolverKt$runQueryFlow$$inlined$map$1$2.emit(:74)
       at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
       at kotlinx.coroutines.flow.internal.SafeCollectorKt$emitFun$1.invoke(SafeCollector.kt:15)
       at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:87)
       at kotlinx.coroutines.flow.internal.SafeCollector.emit(SafeCollector.kt:66)
       at com.alexstyl.contactstore.utils.FlowExtensionsKt$a.invokeSuspend(:34)
       at com.alexstyl.contactstore.utils.FlowExtensionsKt$a.invoke(:1)
       at kotlinx.coroutines.flow.FlowKt__EmittersKt$onStart$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:116)
       at com.alexstyl.contactstore.utils.ContentResolverKt$runQueryFlow$$inlined$map$1.collect(:21)
       at com.alexstyl.contactstore.ContactQueries$queryAllContacts$$inlined$map$1.collect(:7)
       at com.alexstyl.contactstore.ContactQueries$queryContacts$$inlined$map$1.collect(:11)
       at kotlinx.coroutines.flow.FlowKt__ReduceKt.first(Reduce.kt:198)
       at kotlinx.coroutines.flow.FlowKt.first(:1)
       at com.alexstyl.contactstore.FetchRequest$a.invokeSuspend(:34)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:279)
       at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
       at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
       at kotlinx.coroutines.BuildersKt.runBlocking(:1)
       at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
       at kotlinx.coroutines.BuildersKt.runBlocking$default(:1)
       at com.alexstyl.contactstore.FetchRequest.blockingGet(:7)
       at com.jobget.onboarding.requestendorsements.repo.DefaultUserContactsProvider.get$lambda-1(UserContactsProvider.kt:45)
       at com.jobget.onboarding.requestendorsements.repo.DefaultUserContactsProvider.$r8$lambda$PCXMhjAq1fthczh8YCeZcJhq6FM()
       at com.jobget.onboarding.requestendorsements.repo.DefaultUserContactsProvider$$ExternalSyntheticLambda4.call(:2)
       at io.reactivex.rxjava3.internal.operators.observable.ObservableFromCallable.subscribeActual(ObservableFromCallable.java:46)
       at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13176)
       at io.reactivex.rxjava3.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:33)
       at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13176)
       at io.reactivex.rxjava3.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:33)
       at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13176)
       at io.reactivex.rxjava3.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:33)
       at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13176)
       at io.reactivex.rxjava3.internal.operators.observable.ObservableMap.subscribeActual(ObservableMap.java:33)
       at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13176)
       at io.reactivex.rxjava3.internal.operators.observable.ObservableOnErrorReturn.subscribeActual(ObservableOnErrorReturn.java:31)
       at io.reactivex.rxjava3.core.Observable.subscribe(Observable.java:13176)
       at io.reactivex.rxjava3.internal.operators.observable.ObservableSubscribeOn$SubscribeTask.run(ObservableSubscribeOn.java:96)
       at io.reactivex.rxjava3.core.Scheduler$DisposeTask.run(Scheduler.java:644)
       at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:65)
       at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:56)
       at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
       at java.lang.Thread.run(Thread.java:923)

We just fetch the contacts in our application to show them to our users.

@alexstyl alexstyl added the bug Something isn't working label Nov 8, 2022
@alexstyl
Copy link
Owner

alexstyl commented Nov 9, 2022

Hi @purna-jobget. Thanks for opening this issue.

I can see two parts here:

  1. Make sure the app recovers if the uri is invalid (return null from RawContactQueries.fetchRawContacts() instead of throw). I am afraid I do not have much time to look and fix this myself, but the fix should be straightforward. You can open a PR yourself and I can merge your changes to the repo.

  2. Understand why the URI is invalid. The code in RawContactQueries.fetchRawContacts() is taken from AOSP. Maybe Android changed something and a new URI format was introduced. Do you mind sharing some information about the crash? Such as which Android versions it occurs and which phone models?

@nwainwright
Copy link

@alexstyl @purna-jobget this is a problem for us too. We're getting Crashlytics crashes about it. Unfortunately me trying to fix it would break everything. We're looking forward to it being fixed. Great work on the library btw!

@alexstyl
Copy link
Owner

alexstyl commented Nov 11, 2022

@nwainwright can you share android versions and OEMs you are getting the crashes from?

@nwainwright
Copy link

@alexstyl Android 13 Galaxy S22 Ultra is one of our users that has crashed. Thank you!

@alexstyl
Copy link
Owner

@nwainwright other android versions and models would help. trying to understand if this is OEM specific, Android version specific or unrelated.

@purna-jobget
Copy link
Author

purna-jobget commented Nov 14, 2022

@alexstyl
Sorry, it's been a busy week last one. From the Crashlytics data, we have gathered so far. All the crashes happened on devices running OS >= 11. And No specific categorization on the manufacturer side. It happened on the stock as well as custom mods.

Significant Contributions by manufacturers:

44% Samsung
22% Wingtech
11% OnePlus
06% Motorola

By OS Version

50% on Android 11
44% on Android 12
06% on Android 13

@alexstyl
Copy link
Owner

@purna-jobget perfect. thanks for having a look.

@nwainwright could you kindly check as well?

That being aid, I will have a look this week (if not today) at the AOSP to see if something changed on Android 11+ which I was not aware about.

@alexstyl alexstyl self-assigned this Nov 14, 2022
@alexstyl
Copy link
Owner

alexstyl commented Nov 27, 2022

Just pushed a fix for this in b8a3294

Keeping this open until released.

EDIT: For those curious about why the URI might be invalid: I had a look at the AOSP. They are ignoring Uris they are not expecting. ContactStore will do the same to match that behavior. Those Uris are probably custom Raw Contact Uris created by apps, so probably not important for this part of the code base.

@piavan07
Copy link

@alexstyl Thanks, waiting for release :)

@alexstyl
Copy link
Owner

alexstyl commented Dec 1, 2022

@piavan07 Expect a new version this weekend

@alexstyl
Copy link
Owner

alexstyl commented Dec 3, 2022

Closing as done. Get the fix in 1.5.0

@alexstyl alexstyl closed this as completed Dec 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants