Program: 177020
Project: 177020
Buggy source:
/** 
 * From thrift row.
 * @param < E > the element type
 * @param clazz the clazz
 * @param m the m
 * @param tr the cr
 * @return the e
 * @throws Exception the exception
 */
public <E>E fromThriftRow(Class<E> clazz,EntityMetadata m,DataRow<SuperColumn> tr) throws Exception {
  E e=clazz.newInstance();
  PropertyAccessorHelper.setId(e,m,tr.getId());
  Map<String,Field> columnNameToFieldMap=new HashMap<String,Field>();
  Map<String,Field> superColumnNameToFieldMap=new HashMap<String,Field>();
  MetadataUtils.populateColumnAndSuperColumnMaps(m,columnNameToFieldMap,superColumnNameToFieldMap);
  Collection embeddedCollection=null;
  Field embeddedCollectionField=null;
  for (  SuperColumn sc : tr.getColumns()) {
    String scName=PropertyAccessorFactory.STRING.fromBytes(sc.getName());
    String scNamePrefix=null;
    if (scName.indexOf(Constants.EMBEDDED_COLUMN_NAME_DELIMITER) != -1) {
      scNamePrefix=MetadataUtils.getEmbeddedCollectionPrefix(scName);
      embeddedCollectionField=superColumnNameToFieldMap.get(scNamePrefix);
      embeddedCollection=MetadataUtils.getEmbeddedCollectionInstance(embeddedCollectionField);
      Object embeddedObject=populateEmbeddedObject(sc,m);
      embeddedCollection.add(embeddedObject);
      PropertyAccessorHelper.set(e,embeddedCollectionField,embeddedCollection);
    }
 else {
      boolean intoRelations=false;
      if (scName.equals(Constants.FOREIGN_KEY_EMBEDDED_COLUMN_NAME)) {
        intoRelations=true;
      }
      for (      Column column : sc.getColumns()) {
        String name=PropertyAccessorFactory.STRING.fromBytes(column.getName());
        byte[] value=column.getValue();
        if (value == null) {
          continue;
        }
        if (intoRelations) {
          Relation relation=m.getRelation(name);
          String foreignKeys=PropertyAccessorFactory.STRING.fromBytes(value);
          Set<String> keys=MetadataUtils.deserializeKeys(foreignKeys);
        }
 else {
          Field field=columnNameToFieldMap.get(name);
          Object embeddedObject=PropertyAccessorHelper.getObject(e,scName);
          PropertyAccessorHelper.set(embeddedObject,field,value);
        }
      }
    }
  }
  return e;
}

Fixed version (ground truth):
/** 
 * From thrift row.
 * @param < E > the element type
 * @param clazz the clazz
 * @param m the m
 * @param tr the cr
 * @return the e
 * @throws Exception the exception
 */
public <E>E fromThriftRow(Class<E> clazz,EntityMetadata m,DataRow<SuperColumn> tr) throws Exception {
  E e=null;
  Map<String,Field> columnNameToFieldMap=new HashMap<String,Field>();
  Map<String,Field> superColumnNameToFieldMap=new HashMap<String,Field>();
  MetadataUtils.populateColumnAndSuperColumnMaps(m,columnNameToFieldMap,superColumnNameToFieldMap);
  Collection embeddedCollection=null;
  Field embeddedCollectionField=null;
  for (  SuperColumn sc : tr.getColumns()) {
    if (e == null) {
      e=clazz.newInstance();
      PropertyAccessorHelper.setId(e,m,tr.getId());
    }
    String scName=PropertyAccessorFactory.STRING.fromBytes(sc.getName());
    String scNamePrefix=null;
    if (scName.indexOf(Constants.EMBEDDED_COLUMN_NAME_DELIMITER) != -1) {
      scNamePrefix=MetadataUtils.getEmbeddedCollectionPrefix(scName);
      embeddedCollectionField=superColumnNameToFieldMap.get(scNamePrefix);
      embeddedCollection=MetadataUtils.getEmbeddedCollectionInstance(embeddedCollectionField);
      Object embeddedObject=populateEmbeddedObject(sc,m);
      embeddedCollection.add(embeddedObject);
      PropertyAccessorHelper.set(e,embeddedCollectionField,embeddedCollection);
    }
 else {
      boolean intoRelations=false;
      if (scName.equals(Constants.FOREIGN_KEY_EMBEDDED_COLUMN_NAME)) {
        intoRelations=true;
      }
      for (      Column column : sc.getColumns()) {
        String name=PropertyAccessorFactory.STRING.fromBytes(column.getName());
        byte[] value=column.getValue();
        if (value == null) {
          continue;
        }
        if (intoRelations) {
          Relation relation=m.getRelation(name);
          String foreignKeys=PropertyAccessorFactory.STRING.fromBytes(value);
          Set<String> keys=MetadataUtils.deserializeKeys(foreignKeys);
        }
 else {
          Field field=columnNameToFieldMap.get(name);
          Object embeddedObject=PropertyAccessorHelper.getObject(e,scName);
          PropertyAccessorHelper.set(embeddedObject,field,value);
        }
      }
    }
  }
  return e;
}