While reviewing Patient.java in openmrs-core, I noticed that the method
addIdentifier(PatientIdentifier) may add a null value to the identifiers set
when a null parameter is passed.
This could lead to unexpected null entries and potential NullPointerExceptions
later in the code.
I wanted to confirm if this behavior is unintended and whether I should
create a JIRA ticket and submit a PR to fix this.
null patient identifiers are rejected on validation, so before they hit the database. We generally don’t perform validation in the setters on data classes themselves.
Thanks for the clarification! I understand now that validation is handled earlier in the flow and that setters in domain objects are intentionally kept free of validation logic.