Buggy code:
@ RestController @ RequestMapping ( "//api" ) public class GigSignupResource { private final Logger LOG = LoggerFactory . getLogger ( GigSignupResource . class ) ; @ Inject private GigSignupRepository gigSignupRepository ; @ Inject private GigSignupSearchRepository gigSignupSearchRepository ; @ Inject private UserRepository userRepository ; @ RequestMapping ( value = "//gigSignups" , method = RequestMethod . POST , produces = MediaType . APPLICATION_JSON_VALUE ) @ Timed @ Secured ( "ROLE_USER" ) public ResponseEntity < GigSignup > createGigSignup ( @ Valid @ RequestBody GigSignup gigSignup ) throws URISyntaxException { LOG . debug ( "REST<seq2seq4repair_space>request<seq2seq4repair_space>to<seq2seq4repair_space>save<seq2seq4repair_space>GigSignup<seq2seq4repair_space>:<seq2seq4repair_space>{}" , gigSignup ) ; if ( ( gigSignup . getId ( ) ) != null ) { return ResponseEntity . badRequest ( ) . headers ( HeaderUtil . createFailureAlert ( "gigSignup" , "idexists" , "A<seq2seq4repair_space>new<seq2seq4repair_space>gigSignup<seq2seq4repair_space>cannot<seq2seq4repair_space>already<seq2seq4repair_space>have<seq2seq4repair_space>an<seq2seq4repair_space>ID" ) ) . body ( null ) ; } if ( ( gigSignup . getPlayer ( ) ) == null ) { Optional < User > user = userRepository . findOneByLogin ( SecurityUtils . getCurrentUserLogin ( ) ) ; if ( user . isPresent ( ) ) { gigSignup . setPlayer ( user . get ( ) ) ; } else { return ResponseEntity . badRequest ( ) . headers ( HeaderUtil . createFailureAlert ( "gigSignup" , "usernotloggedin" , "User<seq2seq4repair_space>is<seq2seq4repair_space>not<seq2seq4repair_space>correctly<seq2seq4repair_space>authenticated" ) ) . body ( null ) ; } } GigSignup result = gigSignupRepository . save ( gigSignup ) ; gigSignupSearchRepository . save ( result ) ; <START_BUG> return ResponseEntity . created ( new URI ( ( "//api//gigSignups//" + ( result . getId ( ) ) ) ) ) . headers ( HeaderUtil . createEntityCreationAlert ( "gigSignup" , result . getId ( ) . toString ( ) ) ) . body ( result ) ; <END_BUG> } @ RequestMapping ( value = "//gigSignups" , method = RequestMethod . PUT , produces = MediaType . APPLICATION_JSON_VALUE ) @ Timed @ Secured ( "ROLE_ADMIN" ) public ResponseEntity < GigSignup > updateGigSignup ( @ Valid @ RequestBody GigSignup gigSignup ) throws URISyntaxException { } @ RequestMapping ( value = "//gigSignups" , method = RequestMethod . GET , produces = MediaType . APPLICATION_JSON_VALUE ) @ Timed @ Secured ( "ROLE_USER" ) public List < GigSignup > getAllGigSignups ( ) { } @ RequestMapping ( value = "//gigSignups//gig//{id}" , method = RequestMethod . GET , produces = MediaType . APPLICATION_JSON_VALUE ) @ Timed @ Secured ( "ROLE_USER" ) public List < GigSignup > getGigSignupsByGigId ( @ PathVariable Long id ) { } @ RequestMapping ( value = "//gigSignups//user" , method = RequestMethod . GET , produces = MediaType . APPLICATION_JSON_VALUE ) @ Timed @ Secured ( "ROLE_USER" ) public List < GigSignup > getGigSignupsByLoggedInUser ( ) { } @ RequestMapping ( value = "//gigSignups//{id}" , method = RequestMethod . GET , produces = MediaType . APPLICATION_JSON_VALUE ) @ Timed @ Secured ( "ROLE_USER" ) public ResponseEntity < GigSignup > getGigSignup ( @ PathVariable Long id ) { } @ RequestMapping ( value = "//gigSignups//user//{gigId}" , method = RequestMethod . GET , produces = MediaType . APPLICATION_JSON_VALUE ) @ Timed @ Secured ( "ROLE_USER" ) public ResponseEntity < GigSignup > getGigSignupByUserForSpecificGig ( @ PathVariable Long gigId ) { } @ RequestMapping ( value = "//gigSignups//{id}" , method = RequestMethod . DELETE , produces = MediaType . APPLICATION_JSON_VALUE ) @ Timed @ Secured ( "ROLE_ADMIN" ) public ResponseEntity < Void > deleteGigSignup ( @ PathVariable Long id ) { } @ RequestMapping ( value = "//_search//gigSignups//{query:.+}" , method = RequestMethod . GET , produces = MediaType . APPLICATION_JSON_VALUE ) @ Timed @ Secured ( "ROLE_USER" ) public List < GigSignup > searchGigSignups ( @ PathVariable String query ) { } }

Fix:
return ResponseEntity . created ( new URI ( ( "//api//gigSignups//" + ( result . getId ( ) ) ) ) ) . headers ( HeaderUtil . createEntityCreationAlert ( "gigSignup" , result . getGig ( ) . getName ( ) ) ) . body ( result ) ;