Program: 177083
Project: 177083
Buggy source:
@Override public void writeData(String tableName,EntityMetadata m,EnhancedEntity e) throws IOException {
  List<EmbeddedColumn> columnFamilies=m.getEmbeddedColumnsAsList();
  for (  EmbeddedColumn columnFamily : columnFamilies) {
    String columnFamilyName=columnFamily.getName();
    Field columnFamilyField=columnFamily.getField();
    Object columnFamilyObject=null;
    try {
      columnFamilyObject=PropertyAccessorHelper.getObject(e.getEntity(),columnFamilyField);
    }
 catch (    PropertyAccessException e1) {
      log.error("String_Node_Str" + columnFamilyName + "String_Node_Str"+ e.getEntity());
      return;
    }
    if (columnFamilyObject == null) {
      return;
    }
    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(gethTable(tableName),dynamicCFName,e.getId(),columns,obj);
          count++;
        }
      }
 else {
        int lastEmbeddedObjectCount=ecCacheHandler.getLastElementCollectionObjectCount(e.getId());
        for (        Object obj : (Collection)columnFamilyObject) {
          dynamicCFName=ecCacheHandler.getElementCollectionObjectName(e.getId(),obj);
          if (dynamicCFName == null) {
            dynamicCFName=columnFamilyName + Constants.EMBEDDED_COLUMN_NAME_DELIMITER + (++lastEmbeddedObjectCount);
          }
        }
        ecCacheHandler.clearCache();
      }
    }
 else {
      hbaseWriter.writeColumns(gethTable(tableName),columnFamilyName,e.getId(),columns,columnFamilyObject);
    }
  }
  List<Column> columns=m.getColumnsAsList();
  if (columns != null && !columns.isEmpty()) {
    hbaseWriter.writeColumns(gethTable(tableName),e.getId(),columns,e.getEntity());
  }
  List<Relation> relations=m.getRelations();
  for (  Map.Entry<String,Set<String>> entry : e.getForeignKeysMap().entrySet()) {
    String property=entry.getKey();
    Set<String> foreignKeys=entry.getValue();
    String keys=MetadataUtils.serializeKeys(foreignKeys);
    if (null != keys) {
      List<Column> columns2=new ArrayList<Column>();
    }
    hbaseWriter.writeColumns(gethTable(tableName),Constants.FOREIGN_KEY_EMBEDDED_COLUMN_NAME,e.getId(),columns,keys);
  }
}

Fixed version (ground truth):
@Override public void writeData(String tableName,EntityMetadata m,EnhancedEntity e) throws IOException {
  List<EmbeddedColumn> columnFamilies=m.getEmbeddedColumnsAsList();
  for (  EmbeddedColumn columnFamily : columnFamilies) {
    String columnFamilyName=columnFamily.getName();
    Field columnFamilyField=columnFamily.getField();
    Object columnFamilyObject=null;
    try {
      columnFamilyObject=PropertyAccessorHelper.getObject(e.getEntity(),columnFamilyField);
    }
 catch (    PropertyAccessException e1) {
      log.error("String_Node_Str" + columnFamilyName + "String_Node_Str"+ e.getEntity());
      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(gethTable(tableName),dynamicCFName,e.getId(),columns,obj);
          count++;
        }
      }
 else {
        int lastEmbeddedObjectCount=ecCacheHandler.getLastElementCollectionObjectCount(e.getId());
        for (        Object obj : (Collection)columnFamilyObject) {
          dynamicCFName=ecCacheHandler.getElementCollectionObjectName(e.getId(),obj);
          if (dynamicCFName == null) {
            dynamicCFName=columnFamilyName + Constants.EMBEDDED_COLUMN_NAME_DELIMITER + (++lastEmbeddedObjectCount);
          }
        }
        ecCacheHandler.clearCache();
      }
    }
 else {
      hbaseWriter.writeColumns(gethTable(tableName),columnFamilyName,e.getId(),columns,columnFamilyObject);
    }
  }
  List<Column> columns=m.getColumnsAsList();
  if (columns != null && !columns.isEmpty()) {
    hbaseWriter.writeColumns(gethTable(tableName),e.getId(),columns,e.getEntity());
  }
  if (e.getForeignKeysMap() != null && !e.getForeignKeysMap().isEmpty()) {
    hbaseWriter.writeForeignKeys(gethTable(tableName),e.getId(),e.getForeignKeysMap());
  }
}