Program: 69900
Project: 69900
Buggy source:
@Override protected boolean validateFormLogic(UserRequest ureq){
  boolean allOk=true;
  secureListBox();
  String genericError=null;
  for (  PolicyWrapper policyWrapper : policyWrappers) {
    Type type=policyWrapper.getType();
    TextElement mailEl=policyWrapper.getMailEl();
    if (mailEl != null) {
      String mail=mailEl.getValue();
      if (StringHelper.containsNonWhitespace(mail)) {
        if (MailHelper.isValidEmailAddress(mail)) {
          SecurityGroup allUsers=securityManager.findSecurityGroupByName(Constants.GROUP_OLATUSERS);
          Identity currentIdentity=userManager.findIdentityByEmail(mail);
          if (currentIdentity != null && securityManager.isIdentityInSecurityGroup(currentIdentity,allUsers)) {
            mailEl.setErrorKey("String_Node_Str",new String[]{mail});
            allOk&=false;
          }
        }
 else {
          mailEl.setErrorKey("String_Node_Str",null);
          allOk&=false;
        }
      }
 else       if (type.equals(Type.invitation)) {
        genericError=translate("String_Node_Str");
        allOk&=false;
      }
    }
 else     if (type.equals(Type.group)) {
      List<BusinessGroup> groups=policyWrapper.getGroups();
      if (groups.size() == 0) {
        genericError=translate("String_Node_Str");
        allOk&=false;
      }
    }
 else     if (type.equals(Type.user)) {
      List<Identity> idents=policyWrapper.getIdentities();
      if (idents.size() == 0) {
        genericError=translate("String_Node_Str");
        allOk&=false;
      }
    }
    if (policyWrapper.getFromChooser().hasError() || policyWrapper.getToChooser().hasError()) {
      genericError=translate("String_Node_Str");
      allOk&=false;
    }
    if (policyWrapper.getFrom() != null && policyWrapper.getTo() != null && policyWrapper.getFrom().after(policyWrapper.getTo())) {
      policyWrapper.getFromChooser().setErrorKey("String_Node_Str",null);
      policyWrapper.getFromChooser().showError(true);
      genericError=translate("String_Node_Str");
      allOk&=false;
    }
    FormLayoutContainer cmp=(FormLayoutContainer)flc.getFormComponent(policyWrapper.getComponentName());
    String errorCompName=policyWrapper.calc("String_Node_Str");
    StaticTextElement errTextEl=(StaticTextElement)cmp.getFormComponent(errorCompName);
    if (genericError != null)     errTextEl.setValue(genericError);
  }
  return allOk && super.validateFormLogic(ureq);
}

Fixed version (ground truth):
@Override protected boolean validateFormLogic(UserRequest ureq){
  boolean allOk=true;
  secureListBox();
  String genericError=null;
  for (  PolicyWrapper policyWrapper : policyWrappers) {
    Type type=policyWrapper.getType();
    if (type == null) {
      continue;
    }
    TextElement mailEl=policyWrapper.getMailEl();
    if (mailEl != null) {
      String mail=mailEl.getValue();
      if (StringHelper.containsNonWhitespace(mail)) {
        if (MailHelper.isValidEmailAddress(mail)) {
          SecurityGroup allUsers=securityManager.findSecurityGroupByName(Constants.GROUP_OLATUSERS);
          Identity currentIdentity=userManager.findIdentityByEmail(mail);
          if (currentIdentity != null && securityManager.isIdentityInSecurityGroup(currentIdentity,allUsers)) {
            mailEl.setErrorKey("String_Node_Str",new String[]{mail});
            allOk&=false;
          }
        }
 else {
          mailEl.setErrorKey("String_Node_Str",null);
          allOk&=false;
        }
      }
 else       if (type.equals(Type.invitation)) {
        genericError=translate("String_Node_Str");
        allOk&=false;
      }
    }
 else     if (type.equals(Type.group)) {
      List<BusinessGroup> groups=policyWrapper.getGroups();
      if (groups.size() == 0) {
        genericError=translate("String_Node_Str");
        allOk&=false;
      }
    }
 else     if (type.equals(Type.user)) {
      List<Identity> idents=policyWrapper.getIdentities();
      if (idents.size() == 0) {
        genericError=translate("String_Node_Str");
        allOk&=false;
      }
    }
    if ((policyWrapper.getFromChooser() != null && policyWrapper.getFromChooser().hasError()) || (policyWrapper.getToChooser() != null && policyWrapper.getToChooser().hasError())) {
      genericError=translate("String_Node_Str");
      allOk&=false;
    }
    if (policyWrapper.getFrom() != null && policyWrapper.getTo() != null && policyWrapper.getFrom().after(policyWrapper.getTo())) {
      policyWrapper.getFromChooser().setErrorKey("String_Node_Str",null);
      policyWrapper.getFromChooser().showError(true);
      genericError=translate("String_Node_Str");
      allOk&=false;
    }
    FormLayoutContainer cmp=(FormLayoutContainer)flc.getFormComponent(policyWrapper.getComponentName());
    String errorCompName=policyWrapper.calc("String_Node_Str");
    StaticTextElement errTextEl=(StaticTextElement)cmp.getFormComponent(errorCompName);
    if (genericError != null && errTextEl != null) {
      errTextEl.setValue(genericError);
    }
  }
  return allOk && super.validateFormLogic(ureq);
}