Possible bug in Patient.addIdentifier allowing null identifiers

Hi everyone,

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.

Thanks, Siddhi

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.

If there are any starter or intro-level issues in openmrs-core or related modules that need help, I’d be happy to pick one up.