michaelklishin/langohr

Metadata may contain java.util.Collections$EmptyMap types

dgoeke opened this issue · 1 comments

While writing some message retry logic, we discovered that it's not safe to perform operations like (update-in metadata [:headers :field-here] f) because when no headers are present, the field is a java.util.Collections$EmptyMap. This type isn't associative so clojure functions like assoc/update throw exceptions when dealing with it.

I PR that coerces such instances to empty Clojure maps would be appreciated.