Program: 176951
Project: 176951
Buggy source:
@Override public void writeData(String tableName,EntityMetadata m,Object entity,String rowId,List<RelationHolder> relations) throws IOException {
  HTable hTable=gethTable(tableName);
  List<EmbeddedColumn> columnFamilies=m.getEmbeddedColumnsAsList();
  for (  EmbeddedColumn columnFamily : columnFamilies) {
    String columnFamilyName=columnFamily.getName();
    Field columnFamilyField=columnFamily.getField();
    Object columnFamilyObject=null;
    try {
      columnFamilyObject=PropertyAccessorHelper.getObject(entity,columnFamilyField);
    }
 catch (    PropertyAccessException e1) {
      log.error("String_Node_Str" + columnFamilyName + "String_Node_Str"+ entity);
      return;
    }
    if (columnFamilyObject == null) {
      continue;
    }
    List<Column> columns=columnFamily.getColumns();
    if (columnFamilyObject instanceof Collection) {
      String dynamicCFName=null;
      ElementCollectionCacheManager ecCacheHandler=ElementCollectionCacheManager.getInstance();
      if (ecCacheHandler.isCacheEmpty()) {
        int count=0;
        for (        Object obj : (Collection)columnFamilyObject) {
          dynamicCFName=columnFamilyName + Constants.EMBEDDED_COLUMN_NAME_DELIMITER + count;
          addColumnFamilyToTable(tableName,dynamicCFName);
          hbaseWriter.writeColumns(hTable,dynamicCFName,rowId,columns,obj);
          count++;
        }
      }
 else {
        int lastEmbeddedObjectCount=ecCacheHandler.getLastElementCollectionObjectCount(rowId);
        for (        Object obj : (Collection)columnFamilyObject) {
          dynamicCFName=ecCacheHandler.getElementCollectionObjectName(rowId,obj);
          if (dynamicCFName == null) {
            dynamicCFName=columnFamilyName + Constants.EMBEDDED_COLUMN_NAME_DELIMITER + (++lastEmbeddedObjectCount);
          }
        }
        ecCacheHandler.clearCache();
      }
    }
 else {
      if (columnFamilyField.isAnnotationPresent(Embedded.class)) {
        hbaseWriter.writeColumns(hTable,columnFamilyName,rowId,columns,columnFamilyObject);
      }
 else {
        hbaseWriter.writeColumn(hTable,columnFamilyName,rowId,columns.get(0),columnFamilyObject);
      }
    }
  }
  List<Column> columns=m.getColumnsAsList();
  if (columns != null && !columns.isEmpty()) {
    hbaseWriter.writeColumns(hTable,rowId,columns,entity);
  }
  boolean containsEmbeddedObjectsOnly=(columns == null || columns.isEmpty());
  if (relations != null && !relations.isEmpty()) {
    hbaseWriter.writeRelations(hTable,rowId,containsEmbeddedObjectsOnly,relations);
  }
  puthTable(hTable);
}

Fixed version (ground truth):
@Override public void writeData(String tableName,EntityMetadata m,Object entity,String rowId,List<RelationHolder> relations) throws IOException {
  HTable hTable=gethTable(tableName);
  List<EmbeddedColumn> columnFamilies=m.getEmbeddedColumnsAsList();
  for (  EmbeddedColumn columnFamily : columnFamilies) {
    String columnFamilyName=columnFamily.getName();
    Field columnFamilyField=columnFamily.getField();
    Object columnFamilyObject=null;
    try {
      columnFamilyObject=PropertyAccessorHelper.getObject(entity,columnFamilyField);
    }
 catch (    PropertyAccessException e1) {
      log.error("String_Node_Str" + columnFamilyName + "String_Node_Str"+ entity);
      return;
    }
    if (columnFamilyObject == null) {
      continue;
    }
    List<Column> columns=columnFamily.getColumns();
    if (columnFamilyObject instanceof Collection) {
      String dynamicCFName=null;
      ElementCollectionCacheManager ecCacheHandler=ElementCollectionCacheManager.getInstance();
      if (ecCacheHandler.isCacheEmpty()) {
        int count=0;
        for (        Object obj : (Collection)columnFamilyObject) {
          dynamicCFName=columnFamilyName + Constants.EMBEDDED_COLUMN_NAME_DELIMITER + count;
          addColumnFamilyToTable(tableName,dynamicCFName);
          hbaseWriter.writeColumns(hTable,dynamicCFName,rowId,columns,obj);
          count++;
        }
      }
 else {
        int lastEmbeddedObjectCount=ecCacheHandler.getLastElementCollectionObjectCount(rowId);
        for (        Object obj : (Collection)columnFamilyObject) {
          dynamicCFName=ecCacheHandler.getElementCollectionObjectName(rowId,obj);
          if (dynamicCFName == null) {
            dynamicCFName=columnFamilyName + Constants.EMBEDDED_COLUMN_NAME_DELIMITER + (++lastEmbeddedObjectCount);
          }
          addColumnFamilyToTable(tableName,dynamicCFName);
          hbaseWriter.writeColumns(hTable,dynamicCFName,rowId,columns,obj);
        }
        ecCacheHandler.clearCache();
      }
    }
 else {
      if (columnFamilyField.isAnnotationPresent(Embedded.class)) {
        hbaseWriter.writeColumns(hTable,columnFamilyName,rowId,columns,columnFamilyObject);
      }
 else {
        hbaseWriter.writeColumn(hTable,columnFamilyName,rowId,columns.get(0),columnFamilyObject);
      }
    }
  }
  List<Column> columns=m.getColumnsAsList();
  if (columns != null && !columns.isEmpty()) {
    hbaseWriter.writeColumns(hTable,rowId,columns,entity);
  }
  boolean containsEmbeddedObjectsOnly=(columns == null || columns.isEmpty());
  if (relations != null && !relations.isEmpty()) {
    hbaseWriter.writeRelations(hTable,rowId,containsEmbeddedObjectsOnly,relations);
  }
  puthTable(hTable);
}