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

Demo app crashes when searching patient which has invalid date. #2720

Open
santosh-pingle opened this issue Nov 14, 2024 · 0 comments · May be fixed by #2723
Open

Demo app crashes when searching patient which has invalid date. #2720

santosh-pingle opened this issue Nov 14, 2024 · 0 comments · May be fixed by #2723
Assignees
Labels
effort:xsmall Extra small effort - 1 day P2 Medium priority issue

Comments

@santosh-pingle
Copy link
Collaborator

santosh-pingle commented Nov 14, 2024

Describe the bug

Demo app get crashed when it parse invalid date of the patient in the PatientListViewModel.

Process: com.google.android.fhir.demo, PID: 27356
                                                                                                    java.time.format.DateTimeParseException: Text '1966' could not be parsed at index 4
                                                                                                    	at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:2050)
                                                                                                    	at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1952)
                                                                                                    	at java.time.LocalDate.parse(LocalDate.java:425)
                                                                                                    	at com.google.android.fhir.demo.PatientListViewModelKt.toPatientItem(PatientListViewModel.kt:186)
                                                                                                    	at com.google.android.fhir.demo.PatientListViewModel.getSearchResults(PatientListViewModel.kt:104)
                                                                                                    	at com.google.android.fhir.demo.PatientListViewModel.access$getSearchResults(PatientListViewModel.kt:40)
                                                                                                    	at com.google.android.fhir.demo.PatientListViewModel$getSearchResults$1.invokeSuspend(Unknown Source:15)
                                                                                                    	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
                                                                                                    	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
                                                                                                    	at android.os.Handler.handleCallback(Handler.java:942)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:240)
                                                                                                    	at android.os.Looper.loop(Looper.java:351)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:8423)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:584)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1013)
                                                                                                    	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@6e6ca8a, Dispatchers.Main.immediate]
val dob =
   if (hasBirthDateElement()) {
     LocalDate.parse(birthDateElement.valueAsString, DateTimeFormatter.ISO_DATE)
   } else {
     null
   }

Component
reference app

To Reproduce
Steps to reproduce the behavior:

  1. Open demo app.
  2. Sync patients resources from HAPI FHIR Test server by clicking one time sync or periodic sync, patients get downloaded.
  3. Open search patients screen.
  4. Start typing 't', app exists.

Expected behavior
App should not exit.
Just catch the exception, and set the null or default value.

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: Pixel4a emulator
  • Android version: Android 12
  • Build number:
  • Version
@santosh-pingle santosh-pingle changed the title Demo app crashes when typing 't' in the search box. Demo app crashes when searching patient which has invalid date. Nov 14, 2024
@santosh-pingle santosh-pingle linked a pull request Nov 15, 2024 that will close this issue
7 tasks
@MJ1998 MJ1998 added P2 Medium priority issue effort:xsmall Extra small effort - 1 day labels Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort:xsmall Extra small effort - 1 day P2 Medium priority issue
Projects
Status: New
Development

Successfully merging a pull request may close this issue.

2 participants