Program: 115109
Project: 115109
Buggy source:
protected DisplayItemWithGroupBean buildMatrixForRepeatingGroups(DisplayItemWithGroupBean diwgb,DisplayItemGroupBean itemGroup,EventCRFBean ecb,SectionBean sb,List<ItemBean> itBeans,HashMap<String,ItemDataBean> dataMap){
  int tempOrdinal=1;
  ItemDataDAO iddao=new ItemDataDAO(getDataSource(),locale);
  int maxOrdinal=iddao.getMaxOrdinalForGroup(ecb,sb,itemGroup.getItemGroupBean());
  if (maxOrdinal == 0)   maxOrdinal=1;
  ItemFormMetadataDAO ifmdao=new ItemFormMetadataDAO<String,ArrayList>(getDataSource());
  List<DisplayItemGroupBean> itemGroups=new ArrayList<DisplayItemGroupBean>();
  for (int i=1; i <= maxOrdinal; i++) {
    List<DisplayItemBean> displayItemBeans=new ArrayList<DisplayItemBean>();
    DisplayItemGroupBean dig=new DisplayItemGroupBean();
    for (    ItemBean itBean : itBeans) {
      DisplayItemBean displayItemBean=new DisplayItemBean();
      ItemFormMetadataBean ifm=ifmdao.findByItemIdAndCRFVersionId(itBean.getId(),ecb.getCRFVersionId());
      displayItemBean.setMetadata(ifm);
      displayItemBean.setItem(itBean);
      ItemDataBean itemData=dataMap.get(itBean.getId() + "String_Node_Str" + i);
      if (itemData != null) {
        logger.debug("String_Node_Str" + itemData);
      }
      if (itemData == null) {
        itemData=displayItemBean.getData();
        itemData.setValue("String_Node_Str");
        itemData.setOrdinal(i);
      }
      displayItemBean.setData(itemData);
      displayItemBean.loadDBValue();
      displayItemBeans.add(displayItemBean);
    }
    dig.setItems(displayItemBeans);
    itemGroups.add(dig);
  }
  diwgb.setItemGroups(itemGroups);
  diwgb.setDbItemGroups(itemGroups);
  return diwgb;
}

Fixed version (ground truth):
protected DisplayItemWithGroupBean buildMatrixForRepeatingGroups(DisplayItemWithGroupBean diwgb,DisplayItemGroupBean itemGroup,EventCRFBean ecb,SectionBean sb,List<ItemBean> itBeans,HashMap<String,ItemDataBean> dataMap){
  int tempOrdinal=1;
  ItemDataDAO iddao=new ItemDataDAO(getDataSource(),locale);
  int maxOrdinal=iddao.getMaxOrdinalForGroup(ecb,sb,itemGroup.getItemGroupBean());
  if (maxOrdinal == 0)   maxOrdinal=1;
  ItemFormMetadataDAO ifmdao=new ItemFormMetadataDAO<String,ArrayList>(getDataSource());
  List<DisplayItemGroupBean> itemGroups=new ArrayList<DisplayItemGroupBean>();
  boolean groupHasData=false;
  for (int i=1; i <= maxOrdinal; i++) {
    List<DisplayItemBean> displayItemBeans=new ArrayList<DisplayItemBean>();
    DisplayItemGroupBean dig=new DisplayItemGroupBean();
    for (    ItemBean itBean : itBeans) {
      DisplayItemBean displayItemBean=new DisplayItemBean();
      ItemFormMetadataBean ifm=ifmdao.findByItemIdAndCRFVersionId(itBean.getId(),ecb.getCRFVersionId());
      displayItemBean.setMetadata(ifm);
      displayItemBean.setItem(itBean);
      ItemDataBean itemData=dataMap.get(itBean.getId() + "String_Node_Str" + i);
      if (itemData != null) {
        groupHasData=true;
        logger.debug("String_Node_Str" + itemData);
      }
      if (itemData == null) {
        itemData=displayItemBean.getData();
        itemData.setValue("String_Node_Str");
        itemData.setOrdinal(i);
      }
      displayItemBean.setData(itemData);
      displayItemBean.loadDBValue();
      displayItemBeans.add(displayItemBean);
    }
    dig.setItems(displayItemBeans);
    dig.setHasData(groupHasData);
    itemGroups.add(dig);
  }
  diwgb.setItemGroups(itemGroups);
  diwgb.setDbItemGroups(itemGroups);
  return diwgb;
}