From 37fb951da1480f6f86135aaf286bff869949f983 Mon Sep 17 00:00:00 2001 From: Lee Surprenant Date: Mon, 4 Oct 2021 08:07:38 -0400 Subject: [PATCH] Update PropertyGroup.getProperties to omit properties with null values Now that convertJsonValue can return null, this is safer/easier than updating all the callers to be able to handle null. Signed-off-by: Lee Surprenant --- .../src/main/java/com/ibm/fhir/config/PropertyGroup.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fhir-config/src/main/java/com/ibm/fhir/config/PropertyGroup.java b/fhir-config/src/main/java/com/ibm/fhir/config/PropertyGroup.java index 20fca98e6a6..5bc37b17133 100644 --- a/fhir-config/src/main/java/com/ibm/fhir/config/PropertyGroup.java +++ b/fhir-config/src/main/java/com/ibm/fhir/config/PropertyGroup.java @@ -237,12 +237,16 @@ public Object[] getArrayProperty(String propertyName) throws Exception { /** * Returns the properties contained in the PropertyGroup in the form of a list of * PropertyEntry instances. If no properties exist, then an empty list will be returned. + * Properties with a value of null will be omitted from the list. * @throws Exception */ public List getProperties() throws Exception { List results = new ArrayList<>(); for (Map.Entry entry : jsonObj.entrySet()) { - results.add(new PropertyEntry(entry.getKey(), convertJsonValue(entry.getValue()))); + Object jsonValue = convertJsonValue(entry.getValue()); + if (jsonValue != null) { + results.add(new PropertyEntry(entry.getKey(), convertJsonValue(entry.getValue()))); + } } return results; }