Program: 35351
Project: 35351
Buggy source:
public static ContactSheetData createContactListSimpleTab(final Integer projectId,final LayoutGroupDTO layoutGroup,final ContactListElementDTO contactListElement,final Exporter exporter,final I18nServer i18nTranslator,final Language language) throws Throwable {
  ContactSheetData result=new ContactSheetData(contactListElement.getLabel());
  boolean isFirst=true;
  List<ExportDataCell> iterationHeaders=new ArrayList<>();
  List<ExportDataCell> values=new ArrayList<>();
  List<ContactDTO> contacts=null;
  for (  LayoutConstraintDTO constraint : layoutGroup.getConstraints()) {
    FlexibleElementDTO element=constraint.getFlexibleElementDTO();
    ValueResult valueResult=exporter.execute(new GetValue(projectId,element.getId(),"String_Node_Str" + element.getClass().getSimpleName(),-1,null));
    if (element == contactListElement) {
      Set<Integer> contactIds=new HashSet(ValueResultUtils.splitValuesAsInteger(valueResult.getValueObject()));
      if (!contactIds.isEmpty()) {
        contacts=exporter.execute(new GetContacts(contactIds)).getList();
      }
    }
 else {
      if (isFirst) {
        iterationHeaders.add(new ExportStringCell(ExporterUtil.getFlexibleElementLabel(element,i18nTranslator,language)));
      }
      values.add(valueResultToDataCell(element,valueResult,i18nTranslator,language));
    }
  }
  if (contacts == null || contacts.isEmpty()) {
    return result;
  }
  for (  ContactDTO contact : contacts) {
    List<ExportDataCell> line=new ArrayList<>();
    for (    LayoutGroupDTO group : contact.getContactModel().getDetails().getLayout().getGroups()) {
      if (group.getHasIterations()) {
        continue;
      }
      for (      LayoutConstraintDTO constraint : group.getConstraints()) {
        FlexibleElementDTO element=constraint.getFlexibleElementDTO();
        if (constraint.getFlexibleElementDTO() instanceof DefaultContactFlexibleElementDTO) {
          if (isFirst) {
            result.addHeader(new ExportStringCell(ExporterUtil.getFlexibleElementLabel(element,i18nTranslator,language)));
          }
          line.add(defaultValueToDataCell(element,contact));
        }
      }
    }
    line.addAll(values);
    result.addLine(line);
    isFirst=false;
  }
  result.addHeaders(iterationHeaders);
  return result;
}

Fixed version (ground truth):
public static ContactSheetData createContactListSimpleTab(final Integer projectId,final LayoutGroupDTO layoutGroup,final ContactListElementDTO contactListElement,final Exporter exporter,final I18nServer i18nTranslator,final Language language) throws Throwable {
  ContactSheetData result=new ContactSheetData(contactListElement.getLabel());
  boolean isFirst=true;
  List<ExportDataCell> iterationHeaders=new ArrayList<>();
  List<ExportDataCell> values=new ArrayList<>();
  List<ContactDTO> contacts=null;
  for (  LayoutConstraintDTO constraint : layoutGroup.getConstraints()) {
    FlexibleElementDTO element=constraint.getFlexibleElementDTO();
    ValueResult valueResult=exporter.execute(new GetValue(projectId,element.getId(),"String_Node_Str" + element.getClass().getSimpleName(),null,null));
    if (element == contactListElement) {
      Set<Integer> contactIds=new HashSet(ValueResultUtils.splitValuesAsInteger(valueResult.getValueObject()));
      if (!contactIds.isEmpty()) {
        contacts=exporter.execute(new GetContacts(contactIds)).getList();
      }
    }
 else {
      if (isFirst) {
        iterationHeaders.add(new ExportStringCell(ExporterUtil.getFlexibleElementLabel(element,i18nTranslator,language)));
      }
      values.add(valueResultToDataCell(element,valueResult,i18nTranslator,language));
    }
  }
  if (contacts == null || contacts.isEmpty()) {
    return result;
  }
  for (  ContactDTO contact : contacts) {
    List<ExportDataCell> line=new ArrayList<>();
    for (    LayoutGroupDTO group : contact.getContactModel().getDetails().getLayout().getGroups()) {
      if (group.getHasIterations()) {
        continue;
      }
      for (      LayoutConstraintDTO constraint : group.getConstraints()) {
        FlexibleElementDTO element=constraint.getFlexibleElementDTO();
        if (constraint.getFlexibleElementDTO() instanceof DefaultContactFlexibleElementDTO) {
          if (isFirst) {
            result.addHeader(new ExportStringCell(ExporterUtil.getFlexibleElementLabel(element,i18nTranslator,language)));
          }
          line.add(defaultValueToDataCell(element,contact));
        }
      }
    }
    line.addAll(values);
    result.addLine(line);
    isFirst=false;
  }
  result.addHeaders(iterationHeaders);
  return result;
}