Page 1 of 1

getMapValue throws exception

Posted: 26 Jun 2014 12:54
by kintrupf
The function "getMapValue(Map map, String key, Object default)" throws an exception when 'map' is null.
In my opinion the variant of the function with a default value should return that default value when the map does not exist.

More like treating a 'null' like an empty map instead of throwing an exception ;)
That would simplify some flows because no check is needed if the map variable actually exists.

Using "mapVar = addMapEntry(mapVar, 'key', value)" should also work without exception when mapVar is null or does not yet exist.

Re: getMapValue throws exception

Posted: 26 Jun 2014 16:13
by Martin
I agree for the function "getMapValue(Map map, String key, Object default)" where the user is probably aware that map could be null.
"mapVar = addMapEntry(mapVar, 'key', value)" should create the map when it's null to make exactly this pattern possible so this is clearly a bug. This is fixed in the next build.