-
Notifications
You must be signed in to change notification settings - Fork 3
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
Conversation
updated ChildMotherDetailModel for system_of_registry
# Conflicts: # opensrp-child/build.gradle
There was a problem hiding this 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?
if(this.getZeirId() != null && childMotherDetailModel.getZeirId() != null) | ||
return this.getZeirId().compareTo(childMotherDetailModel.getZeirId()); | ||
else | ||
return 0; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
@junaidwarsivd Rename this PR with a more descriptive name. You can tag the issue it fixes in the description. Also update the version in |
Closing this as it is covered here #268 |
issue reported on ZEIR opensrp/opensrp-client-path-zeir#185