-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
protected Map<?,?> _orderEntries(Map<?,?> input)
{
// minor optimization: may already be sorted?
if (input instanceof SortedMap<?,?>) {
return input;
}
return new TreeMap<Object,Object>(input);
}
should be changed to
protected Map<?,?> _orderEntries(Map<?,?> input)
{
// minor optimization: may already be sorted?
if (input instanceof SortedMap<?,?>) {
return input;
}
// prevent NPE in TreeMap
if (input.containsKey(null)) {
return input;
}
return new TreeMap<Object,Object>(input);
}
TreeMap
will otherwise throw a NullPointerException
.
This would mean that a Map
is potentially serialized unsorted as a fallback even if ORDER_MAP_ENTRIES_BY_KEYS
is active but I guess that's still better than exploding with an exception.
Metadata
Metadata
Assignees
Labels
No labels