Buggy code:
@ Security . Authenticated ( FEMRAuthenticated . class ) @ AllowedRoles ( { Roles . PHYSICIAN , Roles . PHARMACIST , Roles . NURSE } ) public class PharmaciesController extends Controller { private final Form < EditViewModelPost > populatedViewModelPostForm = Form . form ( EditViewModelPost . class ) ; private final IEncounterService encounterService ; private final IMedicationService medicationService ; private final ISessionService sessionService ; private final ISearchService searchService ; @ Inject public PharmaciesController ( IEncounterService encounterService , IMedicationService medicationService , ISessionService sessionService , ISearchService searchService ) { } public Result indexGet ( ) { } public Result indexPost ( ) { } public Result editGet ( int patientId ) { CurrentUser currentUserSession = sessionService . retrieveCurrentUserSession ( ) ; EditViewModelGet viewModelGet = new EditViewModelGet ( ) ; String message ; <START_BUG> ServiceResponse < SettingItem > response = searchService . getSystemSettings ( ) ; <END_BUG> if ( response . hasErrors ( ) ) { throw new RuntimeException ( ) ; } viewModelGet . setSettings ( response . getResponseObject ( ) ) ; ServiceResponse < PatientItem > patientItemServiceResponse = searchService . retrievePatientItemByPatientId ( patientId ) ; if ( patientItemServiceResponse . hasErrors ( ) ) { message = patientItemServiceResponse . getErrors ( ) . get ( "" ) ; return ok ( index . render ( currentUserSession , message , 0 ) ) ; } PatientItem patient = patientItemServiceResponse . getResponseObject ( ) ; viewModelGet . setPatient ( patient ) ; if ( viewModelGet . getSettings ( ) . isMetric ( ) ) { patient = LocaleUnitConverter . toMetric ( patient ) ; } ServiceResponse < PatientEncounterItem > patientEncounterItemServiceResponse = searchService . retrieveRecentPatientEncounterItemByPatientId ( patient . getId ( ) ) ; if ( patientEncounterItemServiceResponse . hasErrors ( ) ) { message = patientEncounterItemServiceResponse . getErrors ( ) . get ( "" ) ; return ok ( index . render ( currentUserSession , message , 0 ) ) ; } PatientEncounterItem patientEncounterItem = patientEncounterItemServiceResponse . getResponseObject ( ) ; if ( patientEncounterItem . getIsClosed ( ) ) { return ok ( index . render ( currentUserSession , "That<seq2seq4repair_space>patient's<seq2seq4repair_space>encounter<seq2seq4repair_space>has<seq2seq4repair_space>been<seq2seq4repair_space>closed." , 0 ) ) ; } viewModelGet . setPatientEncounterItem ( patientEncounterItem ) ; ServiceResponse < List < PrescriptionItem > > prescriptionItemServiceResponse = searchService . retrieveUnreplacedPrescriptionItems ( patientEncounterItem . getId ( ) ) ; if ( prescriptionItemServiceResponse . hasErrors ( ) ) { throw new RuntimeException ( ) ; } else if ( ( prescriptionItemServiceResponse . getResponseObject ( ) . size ( ) ) < 1 ) { return ok ( index . render ( currentUserSession , "No<seq2seq4repair_space>prescriptions<seq2seq4repair_space>found<seq2seq4repair_space>for<seq2seq4repair_space>that<seq2seq4repair_space>patient" , 0 ) ) ; } viewModelGet . setMedications ( prescriptionItemServiceResponse . getResponseObject ( ) ) ; ServiceResponse < List < ProblemItem > > problemItemServiceResponse = encounterService . retrieveProblemItems ( patientEncounterItem . getId ( ) ) ; if ( problemItemServiceResponse . hasErrors ( ) ) { throw new RuntimeException ( ) ; } else { if ( ( problemItemServiceResponse . getResponseObject ( ) . size ( ) ) > 0 ) { viewModelGet . setProblems ( problemItemServiceResponse . getResponseObject ( ) ) ; } } return ok ( edit . render ( currentUserSession , viewModelGet , false ) ) ; } public Result editPost ( int id ) { } }

Fix:
ServiceResponse < SettingItem > response = searchService . retrieveSystemSettings ( ) ;