Program: 69302
Project: 69302
Buggy source:
@Override protected void initForm(FormItemContainer formLayout,Controller listener,UserRequest ureq){
  FormLayoutContainer headersLayout=FormLayoutContainer.createCustomFormLayout("String_Node_Str",getTranslator(),velocity_root + "String_Node_Str");
  formLayout.add(headersLayout);
  headersLayout.contextPut("String_Node_Str",repositoryModule.isCatalogEnabled());
  FormLayoutContainer publishLayout=FormLayoutContainer.createDefaultFormLayout("String_Node_Str",getTranslator());
  formLayout.add(publishLayout);
  publishLayout.setFormTitle(translate("String_Node_Str"));
  publishLayout.setFormContextHelp("String_Node_Str");
  publishLayout.setElementCssClass("String_Node_Str");
  if (loginModule.isGuestLoginLinksEnabled()) {
    publishedKeys=new String[]{OAU_KEY,OAUG_KEY,MEMBERSONLY_KEY};
  }
 else {
    publishedKeys=new String[]{OAU_KEY,MEMBERSONLY_KEY};
  }
  String resourceType=entry.getOlatResource().getResourceableTypeName();
  if (TestFileResource.TYPE_NAME.equals(resourceType) || SurveyFileResource.TYPE_NAME.equals(resourceType) || ScormCPFileResource.TYPE_NAME.equals(resourceType)) {
    String warning=translate("String_Node_Str");
    flc.contextPut("String_Node_Str",warning);
  }
  if (CourseModule.ORES_TYPE_COURSE.equals(resourceType)) {
    publishLayout.setFormDescription(translate("String_Node_Str"));
  }
 else {
    publishLayout.setFormDescription(translate("String_Node_Str"));
  }
  if (resourceType != null) {
    handler=RepositoryHandlerFactory.getInstance().getRepositoryHandler(resourceType);
  }
  final boolean managedSettings=RepositoryEntryManagedFlag.isManaged(entry,RepositoryEntryManagedFlag.settings);
  final boolean managedAccess=RepositoryEntryManagedFlag.isManaged(entry,RepositoryEntryManagedFlag.access);
  String[] yesNoValues=new String[]{translate("String_Node_Str"),translate("String_Node_Str")};
  authorsSwitch=uifactory.addRadiosHorizontal("String_Node_Str","String_Node_Str",publishLayout,yesNoKeys,yesNoValues);
  authorsSwitch.setEnabled(!managedAccess);
  authorsSwitch.addActionListener(FormEvent.ONCHANGE);
  authorConfigLayout=FormLayoutContainer.createBareBoneFormLayout("String_Node_Str",getTranslator());
  publishLayout.add(authorConfigLayout);
  canReference=uifactory.addCheckboxesVertical("String_Node_Str",null,authorConfigLayout,new String[]{YES_KEY},new String[]{translate("String_Node_Str")},1);
  canReference.setEnabled(!managedSettings);
  canCopy=uifactory.addCheckboxesVertical("String_Node_Str",null,authorConfigLayout,new String[]{YES_KEY},new String[]{translate("String_Node_Str")},1);
  canCopy.setEnabled(!managedSettings);
  canDownload=uifactory.addCheckboxesVertical("String_Node_Str",null,authorConfigLayout,new String[]{YES_KEY},new String[]{translate("String_Node_Str")},1);
  canDownload.setEnabled(!managedSettings);
  canDownload.setVisible(handler.supportsDownload());
  uifactory.addSpacerElement("String_Node_Str",authorConfigLayout,true);
  String[] publishedValues;
  if (loginModule.isGuestLoginLinksEnabled()) {
    publishedValues=new String[]{translate("String_Node_Str"),translate("String_Node_Str"),translate("String_Node_Str")};
  }
 else {
    publishedValues=new String[]{translate("String_Node_Str"),translate("String_Node_Str")};
  }
  usersSwitch=uifactory.addRadiosHorizontal("String_Node_Str","String_Node_Str",publishLayout,yesNoKeys,yesNoValues);
  usersSwitch.addActionListener(FormEvent.ONCHANGE);
  usersSwitch.setEnabled(!managedAccess);
  userConfigLayout=FormLayoutContainer.createBareBoneFormLayout("String_Node_Str",getTranslator());
  publishLayout.add(userConfigLayout);
  publishedForUsers=uifactory.addDropdownSingleselect("String_Node_Str",null,userConfigLayout,publishedKeys,publishedValues,null);
  publishedForUsers.setEnabled(!managedAccess);
  publishedForUsers.addActionListener(FormEvent.ONCHANGE);
  uifactory.addSpacerElement("String_Node_Str",userConfigLayout,true);
  FormLayoutContainer membershipLayout=FormLayoutContainer.createDefaultFormLayout("String_Node_Str",getTranslator());
  formLayout.add(membershipLayout);
  membershipLayout.setFormTitle(translate("String_Node_Str"));
  String[] leaveValues=new String[]{translate("String_Node_Str"),translate("String_Node_Str"),translate("String_Node_Str")};
  final boolean managedLeaving=RepositoryEntryManagedFlag.isManaged(entry,RepositoryEntryManagedFlag.membersmanagement);
  leaveEl=uifactory.addDropdownSingleselect("String_Node_Str","String_Node_Str",membershipLayout,leaveKeys,leaveValues,null);
  boolean found=false;
  for (  String leaveKey : leaveKeys) {
    if (leaveKey.equals(entry.getAllowToLeaveOption().name())) {
      leaveEl.select(leaveKey,true);
      found=true;
    }
  }
  if (!found) {
    if (managedLeaving) {
      leaveEl.select(RepositoryEntryAllowToLeaveOptions.never.name(),true);
    }
 else {
      RepositoryEntryAllowToLeaveOptions defaultOption=repositoryModule.getAllowToLeaveDefaultOption();
      leaveEl.select(defaultOption.name(),true);
    }
  }
  leaveEl.setEnabled(!managedLeaving);
  accessLayout=FormLayoutContainer.createCustomFormLayout("String_Node_Str",getTranslator(),velocity_root + "String_Node_Str");
  formLayout.add(accessLayout);
  accessLayout.setVisible(entry.getAccess() == RepositoryEntry.ACC_USERS || loginModule.isGuestLoginLinksEnabled() && entry.getAccess() == RepositoryEntry.ACC_USERS_GUESTS || entry.isMembersOnly());
  accessLayout.setFormTitle(translate("String_Node_Str"));
  HelpTooltip acMethodsLabelHelp=new HelpTooltip("String_Node_Str","String_Node_Str","String_Node_Str",getLocale());
  ((FormLayoutContainer)accessLayout).put("String_Node_Str",acMethodsLabelHelp);
  if (editable) {
    List<AccessMethod> methods=acService.getAvailableMethods(getIdentity(),ureq.getUserSession().getRoles());
    for (    AccessMethod method : methods) {
      AccessMethodHandler handler=acModule.getAccessMethodHandler(method.getType());
      if (handler.isPaymentMethod() && !allowPaymentMethod) {
        continue;
      }
      String title=handler.getMethodName(getLocale());
      FormLink add=uifactory.addFormLink("String_Node_Str" + handler.getType(),title,null,accessLayout,Link.LINK | Link.NONTRANSLATED);
      add.setUserObject(method);
      add.setIconLeftCSS(("String_Node_Str" + method.getMethodCssClass() + "String_Node_Str").intern());
      addMethods.add(add);
      accessLayout.add(add.getName(),add);
    }
    ((FormLayoutContainer)accessLayout).contextPut("String_Node_Str",addMethods);
  }
  String confPage=velocity_root + "String_Node_Str";
  confControllerContainer=FormLayoutContainer.createCustomFormLayout("String_Node_Str",getTranslator(),confPage);
  accessLayout.add(confControllerContainer);
  loadConfigurations();
  confControllerContainer.contextPut("String_Node_Str",confControllers);
  confControllerContainer.contextPut("String_Node_Str",Boolean.valueOf(emptyConfigGrantsFullAccess));
  initFormData();
}

Fixed version (ground truth):
@Override protected void initForm(FormItemContainer formLayout,Controller listener,UserRequest ureq){
  FormLayoutContainer headersLayout=FormLayoutContainer.createCustomFormLayout("String_Node_Str",getTranslator(),velocity_root + "String_Node_Str");
  formLayout.add(headersLayout);
  headersLayout.contextPut("String_Node_Str",repositoryModule.isCatalogEnabled());
  FormLayoutContainer publishLayout=FormLayoutContainer.createDefaultFormLayout("String_Node_Str",getTranslator());
  formLayout.add(publishLayout);
  publishLayout.setFormTitle(translate("String_Node_Str"));
  publishLayout.setFormContextHelp("String_Node_Str");
  publishLayout.setElementCssClass("String_Node_Str");
  if (loginModule.isGuestLoginLinksEnabled()) {
    publishedKeys=new String[]{OAU_KEY,OAUG_KEY,MEMBERSONLY_KEY};
  }
 else {
    publishedKeys=new String[]{OAU_KEY,MEMBERSONLY_KEY};
  }
  String resourceType=entry.getOlatResource().getResourceableTypeName();
  if (TestFileResource.TYPE_NAME.equals(resourceType) || SurveyFileResource.TYPE_NAME.equals(resourceType) || ScormCPFileResource.TYPE_NAME.equals(resourceType)) {
    String warning=translate("String_Node_Str");
    flc.contextPut("String_Node_Str",warning);
  }
  if (CourseModule.ORES_TYPE_COURSE.equals(resourceType)) {
    publishLayout.setFormDescription(translate("String_Node_Str"));
  }
 else {
    publishLayout.setFormDescription(translate("String_Node_Str"));
  }
  if (resourceType != null) {
    handler=RepositoryHandlerFactory.getInstance().getRepositoryHandler(resourceType);
  }
  final boolean managedSettings=RepositoryEntryManagedFlag.isManaged(entry,RepositoryEntryManagedFlag.settings);
  final boolean managedAccess=RepositoryEntryManagedFlag.isManaged(entry,RepositoryEntryManagedFlag.access);
  String[] yesNoValues=new String[]{translate("String_Node_Str"),translate("String_Node_Str")};
  authorsSwitch=uifactory.addRadiosHorizontal("String_Node_Str","String_Node_Str",publishLayout,yesNoKeys,yesNoValues);
  authorsSwitch.setEnabled(!managedAccess);
  authorsSwitch.addActionListener(FormEvent.ONCHANGE);
  authorConfigLayout=FormLayoutContainer.createBareBoneFormLayout("String_Node_Str",getTranslator());
  publishLayout.add(authorConfigLayout);
  canReference=uifactory.addCheckboxesVertical("String_Node_Str",null,authorConfigLayout,new String[]{YES_KEY},new String[]{translate("String_Node_Str")},1);
  canReference.setEnabled(!managedSettings);
  canCopy=uifactory.addCheckboxesVertical("String_Node_Str",null,authorConfigLayout,new String[]{YES_KEY},new String[]{translate("String_Node_Str")},1);
  canCopy.setEnabled(!managedSettings);
  canDownload=uifactory.addCheckboxesVertical("String_Node_Str",null,authorConfigLayout,new String[]{YES_KEY},new String[]{translate("String_Node_Str")},1);
  canDownload.setEnabled(!managedSettings);
  canDownload.setVisible(handler.supportsDownload());
  uifactory.addSpacerElement("String_Node_Str",authorConfigLayout,true);
  String[] publishedValues;
  if (loginModule.isGuestLoginLinksEnabled()) {
    publishedValues=new String[]{translate("String_Node_Str"),translate("String_Node_Str"),translate("String_Node_Str")};
  }
 else {
    publishedValues=new String[]{translate("String_Node_Str"),translate("String_Node_Str")};
  }
  usersSwitch=uifactory.addRadiosHorizontal("String_Node_Str","String_Node_Str",publishLayout,yesNoKeys,yesNoValues);
  usersSwitch.addActionListener(FormEvent.ONCHANGE);
  usersSwitch.setEnabled(!managedAccess);
  userConfigLayout=FormLayoutContainer.createBareBoneFormLayout("String_Node_Str",getTranslator());
  publishLayout.add(userConfigLayout);
  publishedForUsers=uifactory.addDropdownSingleselect("String_Node_Str",null,userConfigLayout,publishedKeys,publishedValues,null);
  publishedForUsers.setEnabled(!managedAccess);
  publishedForUsers.addActionListener(FormEvent.ONCHANGE);
  uifactory.addSpacerElement("String_Node_Str",userConfigLayout,true);
  FormLayoutContainer membershipLayout=FormLayoutContainer.createDefaultFormLayout("String_Node_Str",getTranslator());
  formLayout.add(membershipLayout);
  membershipLayout.setFormTitle(translate("String_Node_Str"));
  String[] leaveValues=new String[]{translate("String_Node_Str"),translate("String_Node_Str"),translate("String_Node_Str")};
  final boolean managedLeaving=RepositoryEntryManagedFlag.isManaged(entry,RepositoryEntryManagedFlag.membersmanagement);
  leaveEl=uifactory.addDropdownSingleselect("String_Node_Str","String_Node_Str",membershipLayout,leaveKeys,leaveValues,null);
  boolean found=false;
  for (  String leaveKey : leaveKeys) {
    if (leaveKey.equals(entry.getAllowToLeaveOption().name())) {
      leaveEl.select(leaveKey,true);
      found=true;
    }
  }
  if (!found) {
    if (managedLeaving) {
      leaveEl.select(RepositoryEntryAllowToLeaveOptions.never.name(),true);
    }
 else {
      RepositoryEntryAllowToLeaveOptions defaultOption=repositoryModule.getAllowToLeaveDefaultOption();
      leaveEl.select(defaultOption.name(),true);
    }
  }
  leaveEl.setEnabled(!managedLeaving);
  accessLayout=FormLayoutContainer.createCustomFormLayout("String_Node_Str",getTranslator(),velocity_root + "String_Node_Str");
  formLayout.add(accessLayout);
  accessLayout.setVisible(entry.getAccess() == RepositoryEntry.ACC_USERS || loginModule.isGuestLoginLinksEnabled() && entry.getAccess() == RepositoryEntry.ACC_USERS_GUESTS || entry.isMembersOnly());
  accessLayout.setFormTitle(translate("String_Node_Str"));
  HelpTooltip acMethodsLabelHelp=new HelpTooltip("String_Node_Str","String_Node_Str","String_Node_Str",getLocale());
  accessLayout.put("String_Node_Str",acMethodsLabelHelp);
  if (editable) {
    List<AccessMethod> methods=acService.getAvailableMethods(getIdentity(),ureq.getUserSession().getRoles());
    for (    AccessMethod method : methods) {
      AccessMethodHandler handler=acModule.getAccessMethodHandler(method.getType());
      if (handler.isPaymentMethod() && !allowPaymentMethod) {
        continue;
      }
      String title=handler.getMethodName(getLocale());
      FormLink add=uifactory.addFormLink("String_Node_Str" + handler.getType(),title,null,accessLayout,Link.LINK | Link.NONTRANSLATED);
      add.setUserObject(method);
      add.setIconLeftCSS(("String_Node_Str" + method.getMethodCssClass() + "String_Node_Str").intern());
      addMethods.add(add);
      accessLayout.add(add.getName(),add);
    }
    accessLayout.contextPut("String_Node_Str",addMethods);
  }
  String confPage=velocity_root + "String_Node_Str";
  confControllerContainer=FormLayoutContainer.createCustomFormLayout("String_Node_Str",getTranslator(),confPage);
  accessLayout.add(confControllerContainer);
  loadConfigurations();
  confControllerContainer.contextPut("String_Node_Str",confControllers);
  confControllerContainer.contextPut("String_Node_Str",Boolean.valueOf(emptyConfigGrantsFullAccess));
  initFormData();
}