Program: 69368
Project: 69368
Buggy source:
@Override protected void initForm(FormItemContainer formLayout,Controller listener,UserRequest ureq){
  String[] correctionModeValues=new String[]{translate("String_Node_Str"),translate("String_Node_Str")};
  correctionModeEl=uifactory.addRadiosVertical("String_Node_Str","String_Node_Str",formLayout,correctionModeKeys,correctionModeValues);
  String mode=modConfig.getStringValue(IQEditController.CONFIG_CORRECTION_MODE);
  boolean selected=false;
  for (  String correctionModeKey : correctionModeKeys) {
    if (correctionModeKey.equals(mode)) {
      correctionModeEl.select(correctionModeKey,true);
      selected=true;
    }
  }
  if (!selected) {
    if (needManulCorrection) {
      correctionModeEl.select(correctionModeKeys[1],true);
    }
 else {
      correctionModeEl.select(correctionModeKeys[0],true);
    }
  }
  limitAttemptsEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,onKeys,onValues);
  limitAttemptsEl.addActionListener(FormEvent.ONCLICK);
  String maxAttemptsValue="String_Node_Str";
  int maxAttempts=modConfig.getIntegerSafe(IQEditController.CONFIG_KEY_ATTEMPTS,deliveryOptions.getMaxAttempts());
  if (maxAttempts > 0) {
    limitAttemptsEl.select(onKeys[0],true);
  }
  maxAttemptsEl=uifactory.addTextElement("String_Node_Str","String_Node_Str",8,maxAttemptsValue,formLayout);
  maxAttemptsEl.setDisplaySize(2);
  maxAttemptsEl.setVisible(maxAttempts > 0);
  boolean blockAfterSuccess=modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_BLOCK_AFTER_SUCCESS,deliveryOptions.isBlockAfterSuccess());
  blockAfterSuccessEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,onKeys,onValues);
  if (blockAfterSuccess) {
    blockAfterSuccessEl.select(onKeys[0],true);
  }
  boolean allowAnonym=modConfig.getBooleanSafe(IQEditController.CONFIG_ALLOW_ANONYM,deliveryOptions.isAllowAnonym());
  allowAnonymEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,onKeys,onValues);
  if (allowAnonym) {
    allowAnonymEl.select(onKeys[0],true);
  }
  boolean fullWindow=modConfig.getBooleanSafe(IQEditController.CONFIG_FULLWINDOW);
  fullWindowEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,new String[]{"String_Node_Str"},new String[]{"String_Node_Str"});
  fullWindowEl.select("String_Node_Str",fullWindow);
  boolean showTitles=modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_QUESTIONTITLE,deliveryOptions.isShowTitles());
  showTitlesEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,onKeys,onValues);
  if (showTitles) {
    showTitlesEl.select(onKeys[0],true);
  }
  boolean showMenu=modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_ENABLEMENU,deliveryOptions.isShowMenu());
  showMenuEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,onKeys,onValues);
  if (showMenu) {
    showMenuEl.select(onKeys[0],true);
  }
  boolean personalNotes=modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_MEMO,deliveryOptions.isPersonalNotes());
  personalNotesEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,onKeys,onValues);
  if (personalNotes) {
    personalNotesEl.select(onKeys[0],true);
  }
  boolean questionProgress=modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_QUESTIONPROGRESS,deliveryOptions.isDisplayQuestionProgress());
  displayQuestionProgressEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,onKeys,onValues);
  if (questionProgress) {
    displayQuestionProgressEl.select(onKeys[0],true);
  }
  boolean questionScore=modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_SCOREPROGRESS,deliveryOptions.isDisplayScoreProgress());
  displayScoreProgressEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,onKeys,onValues);
  if (questionScore) {
    displayScoreProgressEl.select(onKeys[0],true);
  }
  boolean enableSuspend=modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_ENABLESUSPEND,deliveryOptions.isEnableSuspend());
  enableSuspendEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,onKeys,onValues);
  if (enableSuspend) {
    enableSuspendEl.select(onKeys[0],true);
  }
  boolean enableCancel=modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_ENABLECANCEL,deliveryOptions.isEnableCancel());
  enableCancelEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,onKeys,onValues);
  if (enableCancel) {
    enableCancelEl.select(onKeys[0],true);
  }
  showResultsOnFinishEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,onKeys,onValues);
  showResultsOnFinishEl.addActionListener(FormEvent.ONCHANGE);
  ShowResultsOnFinish showSummary=deliveryOptions.getShowResultsOnFinish();
  String defaultConfSummary=showSummary == null ? AssessmentInstance.QMD_ENTRY_SUMMARY_COMPACT : showSummary.getIQEquivalent();
  String confSummary=modConfig.getStringValue(IQEditController.CONFIG_KEY_SUMMARY,defaultConfSummary);
  if (!AssessmentInstance.QMD_ENTRY_SUMMARY_NONE.equals(confSummary)) {
    showResultsOnFinishEl.select(onKeys[0],true);
  }
  String[] typeShowResultsOnFinishKeys=new String[]{AssessmentInstance.QMD_ENTRY_SUMMARY_COMPACT,AssessmentInstance.QMD_ENTRY_SUMMARY_SECTION,AssessmentInstance.QMD_ENTRY_SUMMARY_DETAILED};
  String[] typeShowResultsOnFinishValues=new String[]{translate("String_Node_Str"),translate("String_Node_Str"),translate("String_Node_Str")};
  typeShowResultsOnFinishEl=uifactory.addRadiosVertical("String_Node_Str","String_Node_Str",formLayout,typeShowResultsOnFinishKeys,typeShowResultsOnFinishValues);
  typeShowResultsOnFinishEl.setVisible(showResultsOnFinishEl.isAtLeastSelected(1));
  if (StringHelper.containsNonWhitespace(confSummary)) {
    for (    String typeShowResultsOnFinishKey : typeShowResultsOnFinishKeys) {
      typeShowResultsOnFinishEl.select(typeShowResultsOnFinishKey,true);
    }
  }
  if (typeShowResultsOnFinishEl.isOneSelected()) {
    typeShowResultsOnFinishEl.select(AssessmentInstance.QMD_ENTRY_SUMMARY_COMPACT,true);
  }
  uifactory.addFormSubmitButton("String_Node_Str",formLayout);
}

Fixed version (ground truth):
@Override protected void initForm(FormItemContainer formLayout,Controller listener,UserRequest ureq){
  String[] correctionModeValues=new String[]{translate("String_Node_Str"),translate("String_Node_Str")};
  correctionModeEl=uifactory.addRadiosVertical("String_Node_Str","String_Node_Str",formLayout,correctionModeKeys,correctionModeValues);
  String mode=modConfig.getStringValue(IQEditController.CONFIG_CORRECTION_MODE);
  boolean selected=false;
  for (  String correctionModeKey : correctionModeKeys) {
    if (correctionModeKey.equals(mode)) {
      correctionModeEl.select(correctionModeKey,true);
      selected=true;
    }
  }
  if (!selected) {
    if (needManulCorrection) {
      correctionModeEl.select(correctionModeKeys[1],true);
    }
 else {
      correctionModeEl.select(correctionModeKeys[0],true);
    }
  }
  limitAttemptsEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,onKeys,onValues);
  limitAttemptsEl.addActionListener(FormEvent.ONCLICK);
  String maxAttemptsValue="String_Node_Str";
  int maxAttempts=modConfig.getIntegerSafe(IQEditController.CONFIG_KEY_ATTEMPTS,deliveryOptions.getMaxAttempts());
  if (maxAttempts > 0) {
    limitAttemptsEl.select(onKeys[0],true);
    maxAttemptsValue=Integer.toString(maxAttempts);
  }
  maxAttemptsEl=uifactory.addTextElement("String_Node_Str","String_Node_Str",8,maxAttemptsValue,formLayout);
  maxAttemptsEl.setDisplaySize(2);
  maxAttemptsEl.setVisible(maxAttempts > 0);
  boolean blockAfterSuccess=modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_BLOCK_AFTER_SUCCESS,deliveryOptions.isBlockAfterSuccess());
  blockAfterSuccessEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,onKeys,onValues);
  if (blockAfterSuccess) {
    blockAfterSuccessEl.select(onKeys[0],true);
  }
  boolean allowAnonym=modConfig.getBooleanSafe(IQEditController.CONFIG_ALLOW_ANONYM,deliveryOptions.isAllowAnonym());
  allowAnonymEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,onKeys,onValues);
  if (allowAnonym) {
    allowAnonymEl.select(onKeys[0],true);
  }
  boolean fullWindow=modConfig.getBooleanSafe(IQEditController.CONFIG_FULLWINDOW);
  fullWindowEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,new String[]{"String_Node_Str"},new String[]{"String_Node_Str"});
  fullWindowEl.select("String_Node_Str",fullWindow);
  boolean showTitles=modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_QUESTIONTITLE,deliveryOptions.isShowTitles());
  showTitlesEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,onKeys,onValues);
  if (showTitles) {
    showTitlesEl.select(onKeys[0],true);
  }
  boolean showMenu=modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_ENABLEMENU,deliveryOptions.isShowMenu());
  showMenuEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,onKeys,onValues);
  if (showMenu) {
    showMenuEl.select(onKeys[0],true);
  }
  boolean personalNotes=modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_MEMO,deliveryOptions.isPersonalNotes());
  personalNotesEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,onKeys,onValues);
  if (personalNotes) {
    personalNotesEl.select(onKeys[0],true);
  }
  boolean questionProgress=modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_QUESTIONPROGRESS,deliveryOptions.isDisplayQuestionProgress());
  displayQuestionProgressEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,onKeys,onValues);
  if (questionProgress) {
    displayQuestionProgressEl.select(onKeys[0],true);
  }
  boolean questionScore=modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_SCOREPROGRESS,deliveryOptions.isDisplayScoreProgress());
  displayScoreProgressEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,onKeys,onValues);
  if (questionScore) {
    displayScoreProgressEl.select(onKeys[0],true);
  }
  boolean enableSuspend=modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_ENABLESUSPEND,deliveryOptions.isEnableSuspend());
  enableSuspendEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,onKeys,onValues);
  if (enableSuspend) {
    enableSuspendEl.select(onKeys[0],true);
  }
  boolean enableCancel=modConfig.getBooleanSafe(IQEditController.CONFIG_KEY_ENABLECANCEL,deliveryOptions.isEnableCancel());
  enableCancelEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,onKeys,onValues);
  if (enableCancel) {
    enableCancelEl.select(onKeys[0],true);
  }
  showResultsOnFinishEl=uifactory.addCheckboxesHorizontal("String_Node_Str","String_Node_Str",formLayout,onKeys,onValues);
  showResultsOnFinishEl.addActionListener(FormEvent.ONCHANGE);
  ShowResultsOnFinish showSummary=deliveryOptions.getShowResultsOnFinish();
  String defaultConfSummary=showSummary == null ? AssessmentInstance.QMD_ENTRY_SUMMARY_COMPACT : showSummary.getIQEquivalent();
  String confSummary=modConfig.getStringValue(IQEditController.CONFIG_KEY_SUMMARY,defaultConfSummary);
  if (!AssessmentInstance.QMD_ENTRY_SUMMARY_NONE.equals(confSummary)) {
    showResultsOnFinishEl.select(onKeys[0],true);
  }
  String[] typeShowResultsOnFinishKeys=new String[]{AssessmentInstance.QMD_ENTRY_SUMMARY_COMPACT,AssessmentInstance.QMD_ENTRY_SUMMARY_SECTION,AssessmentInstance.QMD_ENTRY_SUMMARY_DETAILED};
  String[] typeShowResultsOnFinishValues=new String[]{translate("String_Node_Str"),translate("String_Node_Str"),translate("String_Node_Str")};
  typeShowResultsOnFinishEl=uifactory.addRadiosVertical("String_Node_Str","String_Node_Str",formLayout,typeShowResultsOnFinishKeys,typeShowResultsOnFinishValues);
  typeShowResultsOnFinishEl.setVisible(showResultsOnFinishEl.isAtLeastSelected(1));
  if (StringHelper.containsNonWhitespace(confSummary)) {
    for (    String typeShowResultsOnFinishKey : typeShowResultsOnFinishKeys) {
      typeShowResultsOnFinishEl.select(typeShowResultsOnFinishKey,true);
    }
  }
  if (typeShowResultsOnFinishEl.isOneSelected()) {
    typeShowResultsOnFinishEl.select(AssessmentInstance.QMD_ENTRY_SUMMARY_COMPACT,true);
  }
  uifactory.addFormSubmitButton("String_Node_Str",formLayout);
}