-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
With version 10.6 of OpenFeign, the behavior of the standard Decoders (GsonDecoder, JacksonJaxbJsonDecoder, JacksonDecoder, JacksonIteratorDecoder, JAXBDecoder, SAXDecoder) was changed such that they return null (instead of, in case of arrays or Collections, empty arrays or Collections) on a 404 Not Found return code. See OpenFeign PR 1012.
This was achieved by removing checking for 404 in the if condition that checks for 204 (no content) and returns an "Empty" version of the required type (empty arrays/collections/..., or null for others).
After that if condition, there's a check for an empty (null) body, and if so, null is returned.
This ignores that 404 does not mean "no content", instead, a descriptive error message (pretty HTML for HTML pages, or some detailed error message such as "user xy not found", written as a problem.json or an appropriate xml structure) can be there and will thus pass that "body == null" check, meaning that error message is then decoded with whatever means the decoder at hand provides - most likely resulting in a DecodeException (with, in case of JAXBDecoder, an UnmarshalException as its cause).
I propose (PR will follow) to add a new check for 404, and return null in these cases.
Note that without the decode404 flag, the regular decoders are not used if a 404 is returned, but instead the error decoder will be used.