[jax-rs-spec users] [jsr339-experts] Re: Error status in case of default MessageBodyReaders failing to read the message

From: Sergey Beryozkin <>
Date: Thu, 8 Dec 2011 21:46:02 +0000

On 08/12/11 19:08, Santiago Pericas-Geertsen wrote:
> On Dec 8, 2011, at 6:28 AM, Sergey Beryozkin wrote:
>> Hi
>> I can see the spec (1.1 or the 2.0 early draft) saying what one of the default MessageBodyReader providers should do when it fails to read the incoming message.
>> The only clarification is that 400 should be thrown by the JAXB provider and null returned by others in case of empty messages.
>> What if JAXB provider deals with a malformed xml, is it 400 or 500 ?
> I don't think this is specified, should it be? A 400 makes more sense for a MBR.

It appears it does make sense more, especially given that
400 is mandated for the JAXB one in case of empty payloads.

I was thinking that may be failing to read does not necessarily mean it
is a problem with a client request, but I could not think of any
realistic case, may be a large correct payload causes a problem for a
default InputStream provider but it seems hypothetical a bit; may be the
spec should note that a default jaxb provider *SHOULD* as opposed to
MUST throw 400, but I won;t insist

thanks, Sergey

> -- Santiago