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

Fixes app crashes reported on Android Version 5 #267

Closed
wants to merge 11 commits into from

Conversation

junaidwarsivd
Copy link
Contributor

@junaidwarsivd junaidwarsivd commented Aug 23, 2021

issue reported on ZEIR opensrp/opensrp-client-path-zeir#185

@junaidwarsivd junaidwarsivd requested a review from ellykits August 23, 2021 12:49
Copy link
Contributor

@ellykits ellykits left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this implementation mean for existing projects that are not using MVACC? Is it backward compatible?

Comment on lines +210 to +213
if(this.getZeirId() != null && childMotherDetailModel.getZeirId() != null)
return this.getZeirId().compareTo(childMotherDetailModel.getZeirId());
else
return 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for the extra null check? Ideally both the identifiers for the child and the mother can never be null. If they are so then the fix should be ensuring the zeir id is never null. Returning 0 means the objects are equal, is that what is desired?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xception: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.compareTo(java.lang.String)' on a null object reference
at org.smartregister.child.model.ChildMotherDetailModel.compareTo(ChildMotherDetailModel.java:201)
at org.smartregister.child.model.ChildMotherDetailModel.compareTo(ChildMotherDetailModel.java:9)
at java.util.Collections$ReverseComparator.compare(Collections.java:5165)
at java.util.Collections$ReverseComparator.compare(Collections.java:5156)
at java.util.TimSort.countRunAndMakeAscending(TimSort.java:355)
at java.util.TimSort.sort(TimSort.java:220)
at java.util.Arrays.sort(Arrays.java:1498)
at java.util.ArrayList.sort(ArrayList.java:1470)
at java.util.Collections.sort(Collections.java:201)
at org.smartregister.child.util.ChildJsonFormUtils.processReturnedAdvanceSearchResults(ChildJsonFormUtils.java:2253)
at org.smartregister.child.model.BaseChildAdvancedSearchModel.getChildMotherDetailModels(BaseChildAdvancedSearchModel.java:208)
at org.smartregister.path.model.AdvancedSearchModel.createMatrixCursor(AdvancedSearchModel.java:63)
at org.smartregister.child.presenter.BaseChildAdvancedSearchPresenter.onResultsFound(BaseChildAdvancedSearchPresenter.java:112)
at org.smartregister.child.interactor.ChildAdvancedSearchInteractor.lambda$null$0(ChildAdvancedSearchInteractor.java:55)
at org.smartregister.child.interactor.-$$Lambda$ChildAdvancedSearchInteractor$sKC-cLVEIGA04K-drgD59pcU0cY.run(:6)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7156)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:975)

In firebase this crash was occurring frequently on thats why i've added an extra null check where it was occuring on comparison the goal was if any Odd object with null id occurs then it wont do any sort on the false object @ellykits

@ellykits
Copy link
Contributor

@junaidwarsivd Rename this PR with a more descriptive name. You can tag the issue it fixes in the description. Also update the version in gradle.properties file

@ellykits ellykits changed the title Issue fix 185 Fixes app crashes reported on Android Version 5 Aug 24, 2021
@ellykits
Copy link
Contributor

Closing this as it is covered here #268

@ellykits ellykits closed this Aug 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants