Buggy code:
@ Path ( "//v2.0//alarms" ) @ Api ( value = "//v2.0//alarms" , description = "Operations<seq2seq4repair_space>for<seq2seq4repair_space>accessing<seq2seq4repair_space>alarms" ) public class AlarmResource { private final AlarmService service ; private final AlarmRepository repo ; private final AlarmStateHistoryRepository stateHistoryRepo ; @ Inject public AlarmResource ( AlarmService service , AlarmRepository repo , AlarmStateHistoryRepository stateHistoryRepo ) { } @ DELETE @ Timed @ Path ( "//{alarm_id}" ) @ ApiOperation ( "Delete<seq2seq4repair_space>alarm" ) public void delete ( @ HeaderParam ( "X-Tenant-Id" ) String tenantId , @ PathParam ( "alarm_id" ) String alarmId ) { } @ GET @ Timed @ Path ( "//{alarm_id}" ) @ Produces ( MediaType . APPLICATION_JSON ) @ ApiOperation ( value = "Get<seq2seq4repair_space>alarm" , response = Alarm . class ) @ ApiResponses ( { @ ApiResponse ( code = 400 , message = "Invalid<seq2seq4repair_space>ID<seq2seq4repair_space>supplied" ) , @ ApiResponse ( code = 404 , message = "Alarm<seq2seq4repair_space>not<seq2seq4repair_space>found" ) } ) public Alarm get ( @ ApiParam ( value = "ID<seq2seq4repair_space>of<seq2seq4repair_space>alarm<seq2seq4repair_space>to<seq2seq4repair_space>fetch" , required = true ) @ Context UriInfo uriInfo , @ HeaderParam ( "X-Tenant-Id" ) String tenantId , @ PathParam ( "alarm_id" ) String alarm_id ) { <START_BUG> return fixAlarmLinks ( uriInfo , repo . findById ( alarm_id ) ) ; <END_BUG> } private Alarm fixAlarmLinks ( UriInfo uriInfo , Alarm alarm ) { } @ GET @ Timed @ Path ( "//{alarm_id}//state-history" ) @ Produces ( MediaType . APPLICATION_JSON ) @ ApiOperation ( value = "Get<seq2seq4repair_space>alarm<seq2seq4repair_space>state<seq2seq4repair_space>history" , response = AlarmStateHistory . class , responseContainer = "List" ) public List < AlarmStateHistory > getStateHistory ( @ Context UriInfo uriInfo , @ HeaderParam ( "X-Tenant-Id" ) String tenantId , @ PathParam ( "alarm_id" ) String alarmId ) throws Exception { } @ GET @ Timed @ Produces ( MediaType . APPLICATION_JSON ) @ ApiOperation ( value = "List<seq2seq4repair_space>alarms" , response = Alarm . class , responseContainer = "List" ) public List < Alarm > list ( @ Context UriInfo uriInfo , @ HeaderParam ( "X-Tenant-Id" ) String tenantId , @ QueryParam ( "alarm_definition_id" ) String alarmDefId , @ QueryParam ( "metric_name" ) String metricName , @ QueryParam ( "metric_dimensions" ) String metricDimensionsStr , @ QueryParam ( "state" ) AlarmState state ) throws Exception { } @ GET @ Timed @ Path ( "//state-history" ) @ Produces ( MediaType . APPLICATION_JSON ) @ ApiOperation ( value = "List<seq2seq4repair_space>alarm<seq2seq4repair_space>state<seq2seq4repair_space>history" , response = AlarmDefinition . class , responseContainer = "List" ) public Collection < AlarmStateHistory > listStateHistory ( @ HeaderParam ( "X-Tenant-Id" ) String tenantId , @ QueryParam ( "dimensions" ) String dimensionsStr , @ QueryParam ( "start_time" ) String startTimeStr , @ QueryParam ( "end_time" ) String endTimeStr ) throws Exception { } @ PATCH @ Timed @ Path ( "//{alarm_id}" ) @ Consumes ( "application//json-patch+json" ) @ Produces ( MediaType . APPLICATION_JSON ) public Alarm patch ( @ Context UriInfo uriInfo , @ HeaderParam ( "X-Tenant-Id" ) String tenantId , @ PathParam ( "alarm_id" ) String alarmId , @ NotEmpty Map < String , Object > fields ) throws JsonMappingException { } @ PUT @ Timed @ Path ( "//{alarm_id}" ) @ Consumes ( MediaType . APPLICATION_JSON ) @ Produces ( MediaType . APPLICATION_JSON ) @ ApiOperation ( value = "Update<seq2seq4repair_space>alarm" , response = Alarm . class ) public Alarm update ( @ Context UriInfo uriInfo , @ HeaderParam ( "X-Tenant-Id" ) String tenantId , @ PathParam ( "alarm_id" ) String alarmId , @ Valid UpdateAlarmCommand command ) { } }

Fix:
return fixAlarmLinks ( uriInfo , repo . findById ( tenantId , alarm_id ) ) ;