Program: 69334
Project: 69334
Buggy source:
private void initAssessment(){
  boolean enableScoreInfo=config.getBooleanSafe(IQEditController.CONFIG_KEY_ENABLESCOREINFO);
  mainVC.contextPut("String_Node_Str",new Boolean(enableScoreInfo));
  int maxAttempts=deliveryOptions.getMaxAttempts();
  if (maxAttempts > 0) {
    mainVC.contextPut("String_Node_Str",new Integer(maxAttempts));
  }
 else {
    mainVC.contextPut("String_Node_Str",Boolean.FALSE);
  }
  if (courseNode instanceof SelfAssessableCourseNode) {
    SelfAssessableCourseNode acn=(SelfAssessableCourseNode)courseNode;
    ScoreEvaluation scoreEval=acn.getUserScoreEvaluation(userCourseEnv);
    Integer attempts=acn.getUserAttempts(userCourseEnv);
    if (scoreEval != null) {
      mainVC.contextPut("String_Node_Str",Boolean.TRUE);
      mainVC.contextPut("String_Node_Str",AssessmentHelper.getRoundedScore(scoreEval.getScore()));
      mainVC.contextPut("String_Node_Str",(scoreEval.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
      mainVC.contextPut("String_Node_Str",scoreEval.getPassed());
      mainVC.contextPut("String_Node_Str",attempts);
    }
  }
 else   if (courseNode instanceof IQTESTCourseNode) {
    IQTESTCourseNode testCourseNode=(IQTESTCourseNode)courseNode;
    AssessmentEntry assessmentEntry=testCourseNode.getUserAssessmentEntry(userCourseEnv);
    if (assessmentEntry == null) {
      mainVC.contextPut("String_Node_Str",Boolean.FALSE);
      mainVC.contextPut("String_Node_Str",null);
      mainVC.contextPut("String_Node_Str",Boolean.FALSE);
      mainVC.contextPut("String_Node_Str",Boolean.FALSE);
      mainVC.contextPut("String_Node_Str",null);
      mainVC.contextPut("String_Node_Str",0);
    }
 else {
      Boolean passed=assessmentEntry.getPassed();
      Boolean blocked=Boolean.FALSE;
      boolean blockAfterSuccess=deliveryOptions.isBlockAfterSuccess();
      if (blockAfterSuccess && passed != null && passed.booleanValue()) {
        blocked=Boolean.TRUE;
      }
      mainVC.contextPut("String_Node_Str",blocked);
      Identity identity=userCourseEnv.getIdentityEnvironment().getIdentity();
      mainVC.contextPut("String_Node_Str",AssessmentHelper.getRoundedScore(assessmentEntry.getScore()));
      mainVC.contextPut("String_Node_Str",(passed == null ? Boolean.FALSE : Boolean.TRUE));
      mainVC.contextPut("String_Node_Str",passed);
      StringBuilder comment=Formatter.stripTabsAndReturns(testCourseNode.getUserUserComment(userCourseEnv));
      if (comment != null && comment.length() > 0) {
        mainVC.contextPut("String_Node_Str",StringHelper.xssScan(comment));
      }
      Integer attempts=assessmentEntry.getAttempts();
      mainVC.contextPut("String_Node_Str",attempts == null ? new Integer(0) : attempts);
      if (!anonym) {
        UserNodeAuditManager am=userCourseEnv.getCourseEnvironment().getAuditManager();
        mainVC.contextPut("String_Node_Str",am.getUserNodeLog(courseNode,identity));
      }
      if (deliveryOptions.isDigitalSignature()) {
        AssessmentTestSession session=qtiService.getAssessmentTestSession(assessmentEntry.getAssessmentId());
        if (session != null) {
          File signature=qtiService.getAssessmentResultSignature(session);
          if (signature != null && signature.exists()) {
            signatureDownloadLink=LinkFactory.createLink("String_Node_Str",mainVC,this);
            signatureDownloadLink.setIconLeftCSS("String_Node_Str");
            signatureDownloadLink.setTarget("String_Node_Str");
            Date issueDate=qtiService.getAssessmentResultSignatureIssueDate(session);
            if (issueDate != null) {
              mainVC.contextPut("String_Node_Str",Formatter.getInstance(getLocale()).formatDateAndTime(issueDate));
            }
          }
        }
      }
    }
  }
  exposeResults();
}

Fixed version (ground truth):
private void initAssessment(UserRequest ureq){
  boolean enableScoreInfo=config.getBooleanSafe(IQEditController.CONFIG_KEY_ENABLESCOREINFO);
  mainVC.contextPut("String_Node_Str",new Boolean(enableScoreInfo));
  int maxAttempts=deliveryOptions.getMaxAttempts();
  if (maxAttempts > 0) {
    mainVC.contextPut("String_Node_Str",new Integer(maxAttempts));
  }
 else {
    mainVC.contextPut("String_Node_Str",Boolean.FALSE);
  }
  if (courseNode instanceof AssessableCourseNode) {
    AssessableCourseNode assessableCourseNode=(AssessableCourseNode)courseNode;
    if (assessableCourseNode.hasScoreConfigured() || userCourseEnv.isCoach()) {
      HighScoreRunController highScoreCtr=new HighScoreRunController(ureq,getWindowControl(),userCourseEnv,courseNode);
      if (highScoreCtr.isViewHighscore()) {
        Component highScoreComponent=highScoreCtr.getInitialComponent();
        mainVC.put("String_Node_Str",highScoreComponent);
      }
    }
  }
  if (courseNode instanceof SelfAssessableCourseNode) {
    SelfAssessableCourseNode acn=(SelfAssessableCourseNode)courseNode;
    ScoreEvaluation scoreEval=acn.getUserScoreEvaluation(userCourseEnv);
    Integer attempts=acn.getUserAttempts(userCourseEnv);
    if (scoreEval != null) {
      mainVC.contextPut("String_Node_Str",Boolean.TRUE);
      mainVC.contextPut("String_Node_Str",AssessmentHelper.getRoundedScore(scoreEval.getScore()));
      mainVC.contextPut("String_Node_Str",(scoreEval.getPassed() == null ? Boolean.FALSE : Boolean.TRUE));
      mainVC.contextPut("String_Node_Str",scoreEval.getPassed());
      mainVC.contextPut("String_Node_Str",attempts);
    }
  }
 else   if (courseNode instanceof IQTESTCourseNode) {
    IQTESTCourseNode testCourseNode=(IQTESTCourseNode)courseNode;
    AssessmentEntry assessmentEntry=testCourseNode.getUserAssessmentEntry(userCourseEnv);
    if (assessmentEntry == null) {
      mainVC.contextPut("String_Node_Str",Boolean.FALSE);
      mainVC.contextPut("String_Node_Str",null);
      mainVC.contextPut("String_Node_Str",Boolean.FALSE);
      mainVC.contextPut("String_Node_Str",Boolean.FALSE);
      mainVC.contextPut("String_Node_Str",null);
      mainVC.contextPut("String_Node_Str",0);
    }
 else {
      Boolean passed=assessmentEntry.getPassed();
      Boolean blocked=Boolean.FALSE;
      boolean blockAfterSuccess=deliveryOptions.isBlockAfterSuccess();
      if (blockAfterSuccess && passed != null && passed.booleanValue()) {
        blocked=Boolean.TRUE;
      }
      mainVC.contextPut("String_Node_Str",blocked);
      Identity identity=userCourseEnv.getIdentityEnvironment().getIdentity();
      mainVC.contextPut("String_Node_Str",AssessmentHelper.getRoundedScore(assessmentEntry.getScore()));
      mainVC.contextPut("String_Node_Str",(passed == null ? Boolean.FALSE : Boolean.TRUE));
      mainVC.contextPut("String_Node_Str",passed);
      StringBuilder comment=Formatter.stripTabsAndReturns(testCourseNode.getUserUserComment(userCourseEnv));
      if (comment != null && comment.length() > 0) {
        mainVC.contextPut("String_Node_Str",StringHelper.xssScan(comment));
      }
      Integer attempts=assessmentEntry.getAttempts();
      mainVC.contextPut("String_Node_Str",attempts == null ? new Integer(0) : attempts);
      if (!anonym) {
        UserNodeAuditManager am=userCourseEnv.getCourseEnvironment().getAuditManager();
        mainVC.contextPut("String_Node_Str",am.getUserNodeLog(courseNode,identity));
      }
      if (deliveryOptions.isDigitalSignature()) {
        AssessmentTestSession session=qtiService.getAssessmentTestSession(assessmentEntry.getAssessmentId());
        if (session != null) {
          File signature=qtiService.getAssessmentResultSignature(session);
          if (signature != null && signature.exists()) {
            signatureDownloadLink=LinkFactory.createLink("String_Node_Str",mainVC,this);
            signatureDownloadLink.setIconLeftCSS("String_Node_Str");
            signatureDownloadLink.setTarget("String_Node_Str");
            Date issueDate=qtiService.getAssessmentResultSignatureIssueDate(session);
            if (issueDate != null) {
              mainVC.contextPut("String_Node_Str",Formatter.getInstance(getLocale()).formatDateAndTime(issueDate));
            }
          }
        }
      }
    }
  }
  exposeResults();
}