Details
-
Bug
-
Resolution: Fixed
-
Low
-
None
-
None
-
None
-
Severity 3 - Minor
-
Description
When a PUT is made to a resource with an empty body, a 500 Internal Server Error is returned. This is caused by a java.io.EOFException.
2016-11-28 09:31:25,898 ERROR [http-nio-7990-exec-4] admin @116HNQ5x571x18x0 0:0:0:0:0:0:0:1 "PUT /rest/api/latest/projects/PROJECT_1/repos/rep_1/settings/hooks/com.atlassian.bitbucket.server.bitbucket-bundled-hooks:force-push-hook/settings HTTP/1.1" c.a.s.i.r.e.DefaultUnhandledExceptionMapperHelper Unhandled exception while processing REST request: "PUT /rest/api/latest/projects/PROJECT_1/repos/rep_1/settings/hooks/com.atlassian.bitbucket.server.bitbucket-bundled-hooks:force-push-hook/settings HTTP/1.1" java.io.EOFException: No content to map to Object due to end of input at org.codehaus.jackson.map.ObjectMapper._initForReading(ObjectMapper.java:2775) ~[atlassian-rest-module-3.0.14_1469663223000.jar:1.9.13-atlassian-1] at org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:2691) ~[atlassian-rest-module-3.0.14_1469663223000.jar:1.9.13-atlassian-1] at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1315) ~[atlassian-rest-module-3.0.14_1469663223000.jar:1.9.13-atlassian-1] at org.codehaus.jackson.jaxrs.JacksonJsonProvider.readFrom(JacksonJsonProvider.java:419) ~[atlassian-rest-module-3.0.14_1469663223000.jar:na]
Steps to reproduce
1. PUT an authenticated request with an empty body (i.e. nothing at all, not even opening/closing braces) to a resource, e.g.
/rest/api/latest/projects/{project_key} Authorization: Baisc auth (a user with repo admin for the repo) Content-Type: application/json
Expected
400 Bad Request
Actual
500 Internal Server Error
{
"errors": [{ "context": null, "message": "An error occurred while processing the request. Check the server logs for more information.", "exceptionName": null }
]
}