Program: 70009
Project: 70009
Buggy source:
/** 
 * Updates the users efficiency statement for this course
 * @param userCourseEnv
 * @param repoEntryKey
 * @param checkForExistingProperty
 */
private void updateUserEfficiencyStatement(final UserCourseEnvironment userCourseEnv,final Long repoEntryKey,ICourse course,final boolean checkForExistingProperty){
  CourseConfig cc=userCourseEnv.getCourseEnvironment().getCourseConfig();
  if (cc.isEfficencyStatementEnabled()) {
    Identity identity=userCourseEnv.getIdentityEnvironment().getIdentity();
    CourseNode rootNode=userCourseEnv.getCourseEnvironment().getRunStructure().getRootNode();
    List<Map<String,Object>> assessmentNodes=AssessmentHelper.addAssessableNodeAndDataToList(0,rootNode,userCourseEnv,true,true);
    EfficiencyStatement efficiencyStatement=new EfficiencyStatement();
    efficiencyStatement.setAssessmentNodes(assessmentNodes);
    efficiencyStatement.setCourseTitle(userCourseEnv.getCourseEnvironment().getCourseTitle());
    efficiencyStatement.setCourseRepoEntryKey(repoEntryKey);
    User user=identity.getUser();
    efficiencyStatement.setDisplayableUserInfo(user.getProperty(UserConstants.FIRSTNAME,null) + "String_Node_Str" + user.getProperty(UserConstants.LASTNAME,null)+ "String_Node_Str"+ identity.getName()+ "String_Node_Str");
    efficiencyStatement.setLastUpdated(System.currentTimeMillis());
    UserEfficiencyStatementImpl efficiencyProperty=null;
    if (checkForExistingProperty) {
      efficiencyProperty=getUserEfficiencyStatementFull(repoEntryKey,identity);
    }
    if (assessmentNodes != null) {
      if (efficiencyProperty == null) {
        efficiencyProperty=new UserEfficiencyStatementImpl();
        efficiencyProperty.setIdentity(identity);
        efficiencyProperty.setCourseRepoKey(repoEntryKey);
        RepositoryEntry re=repositoryManager.lookupRepositoryEntry(repoEntryKey,false);
        if (re != null) {
          efficiencyProperty.setResource(re.getOlatResource());
        }
        fillEfficiencyStatement(efficiencyStatement,efficiencyProperty);
        dbInstance.saveObject(efficiencyProperty);
        if (isLogDebugEnabled()) {
          logDebug("String_Node_Str" + efficiencyProperty.getKey() + "String_Node_Str"+ identity.getName()+ "String_Node_Str"+ repoEntryKey);
        }
      }
 else {
        if (isLogDebugEnabled()) {
          logDebug("String_Node_Str" + efficiencyProperty.getKey() + "String_Node_Str"+ identity.getName()+ "String_Node_Str"+ repoEntryKey);
        }
        fillEfficiencyStatement(efficiencyStatement,efficiencyProperty);
        dbInstance.updateObject(efficiencyProperty);
      }
    }
 else {
      if (efficiencyProperty != null) {
        if (isLogDebugEnabled()) {
          logDebug("String_Node_Str" + efficiencyProperty.getKey() + "String_Node_Str"+ identity.getName()+ "String_Node_Str"+ repoEntryKey+ "String_Node_Str");
        }
        dbInstance.deleteObject(efficiencyProperty);
      }
    }
    AssessmentChangedEvent ace=new AssessmentChangedEvent(AssessmentChangedEvent.TYPE_EFFICIENCY_STATEMENT_CHANGED,identity);
    CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(ace,course);
  }
}

Fixed version (ground truth):
/** 
 * Updates the users efficiency statement for this course
 * @param userCourseEnv
 * @param repoEntryKey
 * @param checkForExistingProperty
 */
private void updateUserEfficiencyStatement(final UserCourseEnvironment userCourseEnv,final Long repoEntryKey,ICourse course,final boolean checkForExistingProperty){
  CourseConfig cc=userCourseEnv.getCourseEnvironment().getCourseConfig();
  if (cc.isEfficencyStatementEnabled()) {
    Identity identity=userCourseEnv.getIdentityEnvironment().getIdentity();
    CourseNode rootNode=userCourseEnv.getCourseEnvironment().getRunStructure().getRootNode();
    List<Map<String,Object>> assessmentNodes=AssessmentHelper.addAssessableNodeAndDataToList(0,rootNode,userCourseEnv,true,true);
    EfficiencyStatement efficiencyStatement=new EfficiencyStatement();
    efficiencyStatement.setAssessmentNodes(assessmentNodes);
    efficiencyStatement.setCourseTitle(userCourseEnv.getCourseEnvironment().getCourseTitle());
    efficiencyStatement.setCourseRepoEntryKey(repoEntryKey);
    User user=identity.getUser();
    efficiencyStatement.setDisplayableUserInfo(user.getProperty(UserConstants.FIRSTNAME,null) + "String_Node_Str" + user.getProperty(UserConstants.LASTNAME,null)+ "String_Node_Str"+ identity.getName()+ "String_Node_Str");
    efficiencyStatement.setLastUpdated(System.currentTimeMillis());
    UserEfficiencyStatementImpl efficiencyProperty=null;
    if (checkForExistingProperty) {
      efficiencyProperty=getUserEfficiencyStatementFull(repoEntryKey,identity);
    }
    if (assessmentNodes != null) {
      if (efficiencyProperty == null) {
        efficiencyProperty=new UserEfficiencyStatementImpl();
        efficiencyProperty.setIdentity(identity);
        efficiencyProperty.setCourseRepoKey(repoEntryKey);
        RepositoryEntry re=repositoryManager.lookupRepositoryEntry(repoEntryKey,false);
        if (re != null) {
          efficiencyProperty.setResource(re.getOlatResource());
          efficiencyProperty.setCourseRepoKey(re.getKey());
        }
        fillEfficiencyStatement(efficiencyStatement,efficiencyProperty);
        dbInstance.saveObject(efficiencyProperty);
        if (isLogDebugEnabled()) {
          logDebug("String_Node_Str" + efficiencyProperty.getKey() + "String_Node_Str"+ identity.getName()+ "String_Node_Str"+ repoEntryKey);
        }
      }
 else {
        if (isLogDebugEnabled()) {
          logDebug("String_Node_Str" + efficiencyProperty.getKey() + "String_Node_Str"+ identity.getName()+ "String_Node_Str"+ repoEntryKey);
        }
        fillEfficiencyStatement(efficiencyStatement,efficiencyProperty);
        dbInstance.updateObject(efficiencyProperty);
      }
    }
 else {
      if (efficiencyProperty != null) {
        if (isLogDebugEnabled()) {
          logDebug("String_Node_Str" + efficiencyProperty.getKey() + "String_Node_Str"+ identity.getName()+ "String_Node_Str"+ repoEntryKey+ "String_Node_Str");
        }
        dbInstance.deleteObject(efficiencyProperty);
      }
    }
    AssessmentChangedEvent ace=new AssessmentChangedEvent(AssessmentChangedEvent.TYPE_EFFICIENCY_STATEMENT_CHANGED,identity);
    CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(ace,course);
  }
}