Program: 69508
Project: 69508
Buggy source:
@Override public void saveScoreEvaluation(CourseNode courseNode,Identity identity,Identity assessedIdentity,ScoreEvaluation scoreEvaluation,UserCourseEnvironment userCourseEnv,boolean incrementUserAttempts){
  ICourse course=CourseFactory.loadCourse(courseEntry.getOlatResource());
  Float score=scoreEvaluation.getScore();
  Boolean passed=scoreEvaluation.getPassed();
  Long assessmentId=scoreEvaluation.getAssessmentID();
  AssessmentEntry nodeAssessment=getOrCreate(assessedIdentity,courseNode);
  if (score == null) {
    nodeAssessment.setScore(null);
  }
 else {
    nodeAssessment.setScore(new BigDecimal(Float.toString(score)));
  }
  nodeAssessment.setPassed(passed);
  nodeAssessment.setFullyAssessed(scoreEvaluation.getFullyAssessed());
  nodeAssessment.setAssessmentId(assessmentId);
  if (incrementUserAttempts) {
    int attempts=nodeAssessment.getAttempts() == null ? 1 : nodeAssessment.getAttempts().intValue() + 1;
    nodeAssessment.setAttempts(attempts);
  }
  nodeAssessment=assessmentService.updateAssessmentEntry(nodeAssessment);
  if (courseNode instanceof AssessableCourseNode) {
    efficiencyStatementManager.updateUserEfficiencyStatement(userCourseEnv);
  }
  if (passed != null && passed.booleanValue() && course.getCourseConfig().isAutomaticCertificationEnabled()) {
    if (certificatesManager.isRecertificationAllowed(assessedIdentity,courseEntry)) {
      CertificateTemplate template=null;
      Long templateId=course.getCourseConfig().getCertificateTemplate();
      if (templateId != null) {
        template=certificatesManager.getTemplateById(templateId);
      }
      CertificateInfos certificateInfos=new CertificateInfos(assessedIdentity,score,passed);
      MailerResult result=new MailerResult();
      certificatesManager.generateCertificate(certificateInfos,courseEntry,template,result);
    }
  }
}

Fixed version (ground truth):
@Override public void saveScoreEvaluation(CourseNode courseNode,Identity identity,Identity assessedIdentity,ScoreEvaluation scoreEvaluation,UserCourseEnvironment userCourseEnv,boolean incrementUserAttempts){
  ICourse course=CourseFactory.loadCourse(courseEntry.getOlatResource());
  Float score=scoreEvaluation.getScore();
  Boolean passed=scoreEvaluation.getPassed();
  Long assessmentId=scoreEvaluation.getAssessmentID();
  AssessmentEntry assessmentEntry=getOrCreate(assessedIdentity,courseNode);
  if (score == null) {
    assessmentEntry.setScore(null);
  }
 else {
    assessmentEntry.setScore(new BigDecimal(Float.toString(score)));
  }
  assessmentEntry.setPassed(passed);
  assessmentEntry.setFullyAssessed(scoreEvaluation.getFullyAssessed());
  assessmentEntry.setAssessmentId(assessmentId);
  if (incrementUserAttempts) {
    int attempts=assessmentEntry.getAttempts() == null ? 1 : assessmentEntry.getAttempts().intValue() + 1;
    assessmentEntry.setAttempts(attempts);
  }
  assessmentEntry=assessmentService.updateAssessmentEntry(assessmentEntry);
  if (courseNode instanceof AssessableCourseNode) {
    userCourseEnv.getScoreAccounting().scoreInfoChanged((AssessableCourseNode)courseNode,scoreEvaluation);
    efficiencyStatementManager.updateUserEfficiencyStatement(userCourseEnv);
  }
  if (passed != null && passed.booleanValue() && course.getCourseConfig().isAutomaticCertificationEnabled()) {
    if (certificatesManager.isRecertificationAllowed(assessedIdentity,courseEntry)) {
      CertificateTemplate template=null;
      Long templateId=course.getCourseConfig().getCertificateTemplate();
      if (templateId != null) {
        template=certificatesManager.getTemplateById(templateId);
      }
      CertificateInfos certificateInfos=new CertificateInfos(assessedIdentity,score,passed);
      MailerResult result=new MailerResult();
      certificatesManager.generateCertificate(certificateInfos,courseEntry,template,result);
    }
  }
}