Program: 63085
Project: 63085
Buggy source:
@OnEvent public void onRecommendationAcceptEvent(AjaxRecommendationAcceptedEvent aEvent){
  AnnotatorState annotatorState=ActiveLearningSidebar.this.getModelObject();
  predictionModel=recommendationService.getPredictions(annotatorState.getUser(),annotatorState.getProject());
  AnnotatorState eventState=aEvent.getAnnotatorState();
  AnnotationObject acceptedRecommendation=predictionModel.getPredictionByVID(aEvent.getVid());
  LearningRecord record=new LearningRecord();
  record.setUser(eventState.getUser().getUsername());
  record.setSourceDocument(eventState.getDocument());
  record.setTokenText(acceptedRecommendation.getCoveredText());
  record.setUserAction(LearningRecordUserAction.ACCEPTED);
  record.setOffsetTokenBegin(acceptedRecommendation.getOffset().getBeginToken());
  record.setOffsetTokenEnd(acceptedRecommendation.getOffset().getEndToken());
  record.setOffsetCharacterBegin(acceptedRecommendation.getOffset().getBeginCharacter());
  record.setOffsetCharacterEnd(acceptedRecommendation.getOffset().getEndCharacter());
  record.setAnnotation(acceptedRecommendation.getAnnotation());
  record.setLayer(annotationService.getLayer(aEvent.getVid().getLayerId()));
  record.setChangeLocation(LearningRecordChangeLocation.MAIN_EDITOR);
  learningRecordService.create(record);
  if (sessionActive && currentRecommendation != null && eventState.getUser().equals(annotatorState.getUser()) && eventState.getProject().equals(annotatorState.getProject())) {
    if (acceptedRecommendation.getOffset().equals(currentRecommendation.getOffset())) {
      moveToNextRecommendation(aEvent.getTarget());
    }
    aEvent.getTarget().add(mainContainer);
  }
}

Fixed version (ground truth):
@OnEvent public void onRecommendationAcceptEvent(AjaxRecommendationAcceptedEvent aEvent){
  AnnotatorState annotatorState=ActiveLearningSidebar.this.getModelObject();
  model=recommendationService.getPredictions(annotatorState.getUser(),annotatorState.getProject());
  AnnotatorState eventState=aEvent.getAnnotatorState();
  SourceDocument document=annotatorState.getDocument();
  VID vid=aEvent.getVid();
  Optional<AnnotationObject> oRecommendation=model.getPredictionByVID(document,vid);
  if (!oRecommendation.isPresent()) {
    LOG.error("String_Node_Str",document,vid);
    error("String_Node_Str");
    aEvent.getTarget().addChildren(getPage(),IFeedback.class);
    return;
  }
  AnnotationObject acceptedRecommendation=oRecommendation.get();
  LearningRecord record=new LearningRecord();
  record.setUser(eventState.getUser().getUsername());
  record.setSourceDocument(eventState.getDocument());
  record.setTokenText(acceptedRecommendation.getCoveredText());
  record.setUserAction(LearningRecordUserAction.ACCEPTED);
  record.setOffsetTokenBegin(acceptedRecommendation.getOffset().getBeginToken());
  record.setOffsetTokenEnd(acceptedRecommendation.getOffset().getEndToken());
  record.setOffsetCharacterBegin(acceptedRecommendation.getOffset().getBeginCharacter());
  record.setOffsetCharacterEnd(acceptedRecommendation.getOffset().getEndCharacter());
  record.setAnnotation(acceptedRecommendation.getAnnotation());
  record.setLayer(annotationService.getLayer(vid.getLayerId()));
  record.setChangeLocation(LearningRecordChangeLocation.MAIN_EDITOR);
  learningRecordService.create(record);
  if (sessionActive && currentRecommendation != null && eventState.getUser().equals(annotatorState.getUser()) && eventState.getProject().equals(annotatorState.getProject())) {
    if (acceptedRecommendation.getOffset().equals(currentRecommendation.getOffset())) {
      moveToNextRecommendation(aEvent.getTarget());
    }
    aEvent.getTarget().add(mainContainer);
  }
}