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

LocationOfInterestRepository.getOfflineLoi java.lang.IllegalStateException - LOI not found #2773

Open
anandwana001 opened this issue Sep 30, 2024 · 4 comments · May be fixed by #2788
Open
Assignees
Labels
type: bug Something isn't working

Comments

@anandwana001
Copy link
Collaborator

anandwana001 commented Sep 30, 2024

 Fatal Exception: java.lang.IllegalStateException: LOI not found: uJcwRNB9BB7yPwGhrKF6
       at com.google.android.ground.repository.LocationOfInterestRepository.getOfflineLoi(LocationOfInterestRepository.kt:93)
       at com.google.android.ground.repository.LocationOfInterestRepository$getOfflineLoi$1.invokeSuspend(:15)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
       at android.os.Handler.handleCallback(Handler.java:958)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:230)
       at android.os.Looper.loop(Looper.java:319)
       at android.app.ActivityThread.main(ActivityThread.java:8913)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:608)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
        

Total events by version
0.1.10 (20)
15
for the last 7 days

@anandwana001 anandwana001 added the type: bug Something isn't working label Sep 30, 2024
@anandwana001
Copy link
Collaborator Author

@shobhitagarwal1612 is this the correct user behaviour?

as per the code

 suspend fun getOfflineLoi(surveyId: String, loiId: String): LocationOfInterest {
    val survey = localSurveyStore.getSurveyById(surveyId) ?: error("Survey not found: $surveyId")
    return localLoiStore.getLocationOfInterest(survey, loiId) ?: error("LOI not found: $loiId")
  }

it should crash, but, is it good to crash or should we do something better for the user behaviour?

@shobhitagarwal1612
Copy link
Member

Are you sure that the application is crashing?

@anandwana001
Copy link
Collaborator Author

anandwana001 commented Sep 30, 2024

it says Fatal Exception, so I am assuming its an app crash.
And, error("LOI not found: $loiId") throw exception so it should crash.

WDYT?

BTW, the stack trace is from firebase.

@shobhitagarwal1612
Copy link
Member

From crash logs I found that this is happening in SyncStatusFragment. In this particular usecase, the code isn't wrapped around a try-catch block. So the app must be getting crashed when opening the sync status screen. Can you please try to understand how this is happening and the root cause for the LOIs to be missing?

@anandwana001 anandwana001 linked a pull request Oct 10, 2024 that will close this issue
@anandwana001 anandwana001 self-assigned this Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants