REST: "No content to map to Object due to end of input" returned for empty data on request

Dear community,

I have a REST endpoint that looks like this:

@PUT
@Path("/doSomething")
@Produces({MediaType.APPLICATION_JSON})
@Consumes({MediaType.APPLICATION_JSON})
public Response doSomething(@QueryParam("name") String name, MyModel myModel) {
        ResponseBuilder ok = Response.status(Response.Status.OK);
        return ok.build();
}

When calling with:

curl -X PUT -H 'Content-Type: application/json' -H 'User-Agent: x' -H 'Authorization: Basic xxx' -i http://localhost:2990/jira/rest/doSomething?name=bob --data '{}'

Everything is pretty fine (also with more data than an empty json).

But when I call with no data:

curl -X PUT -H 'Content-Type: application/json' -H 'User-Agent: x' -H 'Authorization: Basic xxx' -i http://localhost:2990/jira/rest/doSomething?name=bob

a 500 is returned that look pretty ugly for users:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<status>
<status-code>500</status-code>
<message>No content to map to Object due to end of input</message>
<stack-trace>java.io.EOFException: No content to map to Object due to end of input

It is obvious that myModel is null, because no data is sent. How can I catch this before doSomething() is called?

Many Thanks
Thomas