Buggy code:
@ Component ( "formResponseResource" ) @ Path ( "//formResponses" ) public class FormResponseResource { @ Autowired private FormResponseService formResponseService ; @ Autowired private FormService formService ; @ POST @ Consumes ( { MediaType . APPLICATION_JSON } ) @ Produces ( { MediaType . TEXT_HTML } ) public Response createFormResponse ( FormResponse formResponse ) throws JsonParseException , JsonMappingException , AppException , IOException { Long createFormResponseId = formResponseService . createFormResponse ( formResponse ) ; <START_BUG> return Response . status ( CREATED ) . entity ( "A<seq2seq4repair_space>new<seq2seq4repair_space>formResponse<seq2seq4repair_space>has<seq2seq4repair_space>been<seq2seq4repair_space>created<seq2seq4repair_space>at<seq2seq4repair_space>index" ) . header ( "Location" , String . valueOf ( createFormResponseId ) ) . header ( "ObjectId" , String . valueOf ( createFormResponseId ) ) . build ( ) ; <END_BUG> } @ GET @ Produces ( { MediaType . APPLICATION_JSON , MediaType . APPLICATION_XML } ) public List < FormResponse > getFormResponses ( @ QueryParam ( "numberOfFormResponses" ) @ DefaultValue ( "25" ) int numberOfFormResponses , @ QueryParam ( "startIndex" ) @ DefaultValue ( "0" ) Long startIndex ) throws AppException , IOException { } @ GET @ Path ( "//myFormResponses" ) @ Produces ( { MediaType . APPLICATION_JSON , MediaType . APPLICATION_XML } ) public List < FormResponse > getMyFormResponses ( @ QueryParam ( "numberOfFormResponses" ) @ DefaultValue ( "25" ) int numberOfFormResponses , @ QueryParam ( "startIndex" ) @ DefaultValue ( "0" ) Long startIndex ) throws AppException , IOException { } @ GET @ Path ( "//byFormId//{id}" ) @ Produces ( { MediaType . APPLICATION_JSON } ) public List < FormResponse > getFormResponseByFormId ( @ PathParam ( "id" ) Long id , @ QueryParam ( "numberOfFormResponses" ) @ DefaultValue ( "25" ) int numberOfFormResponses , @ QueryParam ( "page" ) @ DefaultValue ( "1" ) int page ) throws AppException , IOException { } @ GET @ Path ( "{id}" ) @ Produces ( { MediaType . APPLICATION_JSON } ) public Response getFormResponseById ( @ PathParam ( "id" ) Long id , @ QueryParam ( "detailed" ) boolean detailed ) throws AppException , IOException { } @ PUT @ Path ( "{id}" ) @ Consumes ( { MediaType . APPLICATION_JSON } ) @ Produces ( { MediaType . TEXT_HTML } ) public Response putFormResponseById ( @ PathParam ( "id" ) Long id , FormResponse formResponse ) throws AppException { } @ POST @ Path ( "{id}" ) @ Consumes ( { MediaType . APPLICATION_JSON } ) @ Produces ( { MediaType . TEXT_HTML } ) public Response partialUpdateFormResponse ( @ PathParam ( "id" ) Long id , FormResponse formResponse ) throws AppException { } @ DELETE @ Path ( "{id}" ) @ Produces ( { MediaType . TEXT_HTML } ) public Response deletePost ( @ PathParam ( "id" ) Long id ) throws AppException { } @ POST @ Path ( "//upload" ) @ Consumes ( { MediaType . MULTIPART_FORM_DATA } ) public Response uploadFile ( @ QueryParam ( "responseId" ) Long id , @ QueryParam ( "entryId" ) Long entryId , @ FormDataParam ( "file" ) InputStream uploadedInputStream , @ FormDataParam ( "file" ) FormDataContentDisposition fileDetail , @ HeaderParam ( "Content-Length" ) final long fileSize ) throws AppException { } @ GET @ Path ( "//download" ) public Response getFile ( @ QueryParam ( "responseId" ) Long id , @ QueryParam ( "entryId" ) Long entryId , @ QueryParam ( "fileName" ) String fileName ) throws AppException { } @ DELETE @ Path ( "//upload" ) public Response deleteUpload ( @ QueryParam ( "responseId" ) Long id , @ QueryParam ( "entryId" ) Long entryId , @ QueryParam ( "fileName" ) String fileName ) throws AppException { } @ XmlRootElement ( name = "fileNames" ) public static class JaxbList < T > { protected List < T > list ; public JaxbList ( ) { } public JaxbList ( List < T > list ) { } @ XmlElement ( name = "fileName" ) public List < T > getList ( ) { } } }

Fix:
return Response . status ( CREATED ) . entity ( createFormResponseId . toString ( ) ) . header ( "Location" , String . valueOf ( createFormResponseId ) ) . header ( "ObjectId" , String . valueOf ( createFormResponseId ) ) . build ( ) ;