rmannibucau commented on issue #52: JOHNZON-281 JAX-RS Provider MUST throw 
NoContentException
URL: https://github.com/apache/johnzon/pull/52#issuecomment-536304154
 
 
   I just checked out the spec and seems this PR is wrong (4.2.4 from JAX-RS 
2.1 Final):
   
   
       When reading zero-length message entities all pre-packaged 
MessageBodyReader implementations, except the JAXB one and those for the 
(boxed) primitive types above, MUST create a corresponding Java
       object that represents zero-length data. The pre-packaged JAXB and the 
pre-packaged primitive type
       MessageBodyReader implementations MUST throw a NoContentException for 
zero-length message
       entities.
   
   
   So a few points:
   
   1. "pre-packaged MessageBodyReader implementations" does not concern johnzon 
(it does TomEE, Meecrowave etc but at johnzon level it is just an user library 
so out of scope),
   2. assuming 1 is true even for johnzon, it does not concern jaxb nor 
primitive so should create a zero-length data object which means throwing an 
exception since it is invalid for any JSON object.
   
   So at the end our current implementation is exactly aligned on the spec even 
if I suspect the spec wording is not the intended one.
   
   I will add the a way to enable to throw NoContentException if desired but 
will not handle it by default to respect the spec and keep backward 
compatibility (we really can't break already deployed API).

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to