Program: 177081
Project: 177081
Buggy source:
private void populateEntityFromHbaseData(Object entity,HBaseData data,EntityMetadata m,String rowKey){
  try {
    PropertyAccessorHelper.set(entity,m.getIdColumn().getField(),rowKey);
    List<EmbeddedColumn> columnFamilies=m.getEmbeddedColumnsAsList();
    for (    EmbeddedColumn columnFamily : columnFamilies) {
      Field columnFamilyFieldInEntity=columnFamily.getField();
      Class<?> columnFamilyClass=columnFamilyFieldInEntity.getType();
      Map<String,Field> columnNameToFieldMap=MetadataUtils.createColumnsFieldMap(m,columnFamily);
      List<KeyValue> hbaseValues=data.getColumns();
      if (Collection.class.isAssignableFrom(columnFamilyClass)) {
        Field embeddedCollectionField=columnFamily.getField();
        Object[] embeddedObjectArr=new Object[hbaseValues.size()];
        Object embeddedObject=MetadataUtils.getEmbeddedGenericObjectInstance(embeddedCollectionField);
        int prevCFNameCounter=0;
        for (        KeyValue colData : hbaseValues) {
          String cfInHbase=Bytes.toString(colData.getFamily());
          if (!cfInHbase.startsWith(columnFamily.getName())) {
            continue;
          }
          String cfNamePostfix=MetadataUtils.getEmbeddedCollectionPostfix(cfInHbase);
          int cfNameCounter=Integer.parseInt(cfNamePostfix);
          if (cfNameCounter != prevCFNameCounter) {
            prevCFNameCounter=cfNameCounter;
            embeddedObject=MetadataUtils.getEmbeddedGenericObjectInstance(embeddedCollectionField);
          }
          setHBaseDataIntoObject(colData,columnNameToFieldMap,embeddedObject);
          embeddedObjectArr[cfNameCounter]=embeddedObject;
          ElementCollectionCacheManager.getInstance().addElementCollectionCacheMapping(rowKey,embeddedObject,cfInHbase);
        }
        Collection embeddedCollection=MetadataUtils.getEmbeddedCollectionInstance(embeddedCollectionField);
        embeddedCollection.addAll(Arrays.asList(embeddedObjectArr));
        embeddedCollection.removeAll(Collections.singletonList(null));
        embeddedObjectArr=null;
        if (embeddedCollection != null && !embeddedCollection.isEmpty()) {
          PropertyAccessorHelper.set(entity,embeddedCollectionField,embeddedCollection);
        }
      }
 else {
        Object columnFamilyObj=columnFamilyClass.newInstance();
        for (        KeyValue colData : hbaseValues) {
          String cfInHbase=Bytes.toString(colData.getFamily());
          if (!cfInHbase.equals(columnFamily.getName())) {
            continue;
          }
          setHBaseDataIntoObject(colData,columnNameToFieldMap,columnFamilyObj);
        }
        PropertyAccessorHelper.set(entity,columnFamilyFieldInEntity,columnFamilyObj);
      }
    }
  }
 catch (  PropertyAccessException e1) {
    throw new RuntimeException(e1.getMessage());
  }
catch (  InstantiationException e1) {
    throw new RuntimeException(e1.getMessage());
  }
catch (  IllegalAccessException e1) {
    throw new RuntimeException(e1.getMessage());
  }
}

Fixed version (ground truth):
private void populateEntityFromHbaseData(Object entity,HBaseData hbaseData,EntityMetadata m,String rowKey){
  try {
    PropertyAccessorHelper.set(entity,m.getIdColumn().getField(),rowKey);
    List<EmbeddedColumn> columnFamilies=m.getEmbeddedColumnsAsList();
    List<KeyValue> hbaseValues=hbaseData.getColumns();
    for (    EmbeddedColumn columnFamily : columnFamilies) {
      Field columnFamilyFieldInEntity=columnFamily.getField();
      Class<?> columnFamilyClass=columnFamilyFieldInEntity.getType();
      Map<String,Field> columnNameToFieldMap=MetadataUtils.createColumnsFieldMap(m,columnFamily);
      if (Collection.class.isAssignableFrom(columnFamilyClass)) {
        Field embeddedCollectionField=columnFamily.getField();
        Object[] embeddedObjectArr=new Object[hbaseValues.size()];
        Object embeddedObject=MetadataUtils.getEmbeddedGenericObjectInstance(embeddedCollectionField);
        int prevCFNameCounter=0;
        for (        KeyValue colData : hbaseValues) {
          String cfInHbase=Bytes.toString(colData.getFamily());
          if (!cfInHbase.startsWith(columnFamily.getName())) {
            continue;
          }
          String cfNamePostfix=MetadataUtils.getEmbeddedCollectionPostfix(cfInHbase);
          int cfNameCounter=Integer.parseInt(cfNamePostfix);
          if (cfNameCounter != prevCFNameCounter) {
            prevCFNameCounter=cfNameCounter;
            embeddedObject=MetadataUtils.getEmbeddedGenericObjectInstance(embeddedCollectionField);
          }
          setHBaseDataIntoObject(colData,columnNameToFieldMap,embeddedObject);
          embeddedObjectArr[cfNameCounter]=embeddedObject;
          ElementCollectionCacheManager.getInstance().addElementCollectionCacheMapping(rowKey,embeddedObject,cfInHbase);
        }
        Collection embeddedCollection=MetadataUtils.getEmbeddedCollectionInstance(embeddedCollectionField);
        embeddedCollection.addAll(Arrays.asList(embeddedObjectArr));
        embeddedCollection.removeAll(Collections.singletonList(null));
        embeddedObjectArr=null;
        if (embeddedCollection != null && !embeddedCollection.isEmpty()) {
          PropertyAccessorHelper.set(entity,embeddedCollectionField,embeddedCollection);
        }
      }
 else {
        Object columnFamilyObj=columnFamilyClass.newInstance();
        for (        KeyValue colData : hbaseValues) {
          String cfInHbase=Bytes.toString(colData.getFamily());
          if (!cfInHbase.equals(columnFamily.getName())) {
            continue;
          }
          setHBaseDataIntoObject(colData,columnNameToFieldMap,columnFamilyObj);
        }
        PropertyAccessorHelper.set(entity,columnFamilyFieldInEntity,columnFamilyObj);
      }
    }
  }
 catch (  PropertyAccessException e1) {
    throw new RuntimeException(e1.getMessage());
  }
catch (  InstantiationException e1) {
    throw new RuntimeException(e1.getMessage());
  }
catch (  IllegalAccessException e1) {
    throw new RuntimeException(e1.getMessage());
  }
}