jersey
  1. jersey
  2. JERSEY-1540

Default JaxbElement provider does not throw WebApplicationException when no entity

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0-m09
    • Fix Version/s: 2.0-rc1, 2.0
    • Component/s: core
    • Labels:
      None

      Description

      spec. Section 4.2.4 says:

      When reading zero-length request entities all pre-packaged MessageBodyReader implementations, except the JAXB-related one and those for the (boxed) primitive types above, MUST create a corresponding Java object that represents zero-length data; they MUST NOT return null. The pre-packaged JAXB and the pre- packaged primitive type MessageBodyReader's MUST throw a BadRequestException (400 status) for zero-length request entities.

      But

      @Path("resource")
      public class Resource {
      	@Path("jaxb")
      	@POST
      	public String jaxb(JAXBElement<String> jaxb) {
      		return jaxb == null ? "NULL" : "NOT_NULL";
      	}
      }
      

      returns "NULL" for request:

      >> POST http://localhost:8080/web/resource/jaxb
      >> Accept:/, Content-Type:application/xml,

        Activity

        Hide
        jan.supol added a comment -

        This is the same for Boolean, Character and Number as the latest Spec extended 400 behaviour for these types and no content

        Show
        jan.supol added a comment - This is the same for Boolean, Character and Number as the latest Spec extended 400 behaviour for these types and no content

          People

          • Assignee:
            Pavel Bucek
            Reporter:
            jan.supol
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 3 hours Original Estimate - 3 hours
              3h
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 6 hours
              6h