Skip to content

Commit

Permalink
Merge pull request #2852 from balcirakpeter/fixGetAddInfoNullEmpty
Browse files Browse the repository at this point in the history
stringToMapOfAttributes will return empty map
  • Loading branch information
Vojtech-Sassmann authored and zlamalp committed Aug 13, 2020
1 parent 8999ec4 commit 920f748
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,13 @@ public static Object stringToAttributeValue(String stringValue, String type) {
*
* @param attributesAsString Map attribute in String representation.
* @return LinkedHashMap with key values pairs extracted from the input
* or an empty map when the input parameter is an empty string or null.
*/
@SuppressWarnings("unchecked") // It is ok, we know that stringToAttributeValue always returns LinkedHashMap or null
public static LinkedHashMap<String, String> stringToMapOfAttributes(String attributesAsString) {
Object mapAsObject = BeansUtils.stringToAttributeValue(attributesAsString, LinkedHashMap.class.getName());
return objectMapper.convertValue(mapAsObject, new TypeReference<LinkedHashMap<String, String>>() {});
if (mapAsObject == null) return new LinkedHashMap<>();
return (LinkedHashMap<String, String>) mapAsObject;
}

/**
Expand Down

0 comments on commit 920f748

Please sign in to comment.