Skip to content

PreventionDisplayConfig.java null checks#212

Open
phc007 wants to merge 1 commit intoopen-osp:mainfrom
phc007:patch-11
Open

PreventionDisplayConfig.java null checks#212
phc007 wants to merge 1 commit intoopen-osp:mainfrom
phc007:patch-11

Conversation

@phc007
Copy link
Copy Markdown
Contributor

@phc007 phc007 commented Mar 7, 2026

Guard prevention display population against null names and incomplete immunization data to avoid inserting invalid entries into internal collections. This is necessary to allow for data migration from OSCAR 19 for users who have CVC style Preventions, otherwise the nulls cause havoc in prevention displays and will cause a 500 for oscarPrevention/index.jsp.

Bug Fixes:

Avoid adding prevention entries with null names to the prevention list and hash map to prevent null-related errors and invalid map keys.
Skip immunization-based prevention entries that lack a picklist name to avoid creating incomplete or invalid prevention records.

Description

Implemented null checks to prevent adding prevention entries with null names to the list and hash map.
Enhanced data integrity by skipping immunization-based prevention entries that lack a valid picklist name.
This change addresses issues related to null-related errors and invalid map keys.

line 167 is necessary to avoid picking up essentially partial data in CVC/NVC that don't map directly to a name
line 149 The first one is for symmetry although it is unlikely to be called as its based on XML configuration.

line 167 is necessary to avoid picking up essentially partial data in CVC/NVC that don't map directly to a name
line 149 The first one is for symmetry however you are not likely to have null names for XML Preventions.
@phc007
Copy link
Copy Markdown
Contributor Author

phc007 commented Mar 7, 2026

@warrendennis
this is copied from OSCAR 19 and is necessary if you are to support your own CVC data or that of OSCAR 19 users

@warrendennis
Copy link
Copy Markdown
Collaborator

Where is the NPE being caught?

A key cannot be null. A value should be null when it is null.
Wouldn't it be better to filter out ALL null keys BEFORE they are populated into the HashMap (goto line 224)?
If the CVC file did not include a 'name' key then it would be better to validate it with

HashMap.containsKey('name')

@phc007
Copy link
Copy Markdown
Contributor Author

phc007 commented Mar 10, 2026 via email

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