Program: 176917
Project: 176917
Buggy source:
/** 
 * Fetches data held in Thrift row columns and populates to Entity objects.
 * @param clazz the clazz
 * @param m the m
 * @param thriftRow the cr
 * @param relationNames the relation names
 * @param isWrapperReq the is wrapper req
 * @return the e
 * @throws Exception the exception
 */
public Object fromColumnThriftRow(Class<?> clazz,EntityMetadata m,ThriftRow thriftRow,List<String> relationNames,boolean isWrapperReq) throws Exception {
  Object entity=null;
  Map<String,Object> relations=new HashMap<String,Object>();
  for (  Column c : thriftRow.getColumns()) {
    if (entity == null) {
      entity=clazz.newInstance();
      PropertyAccessorHelper.setId(entity,m,thriftRow.getId());
    }
    String thriftColumnName=PropertyAccessorFactory.STRING.fromBytes(String.class,c.getName());
    byte[] thriftColumnValue=c.getValue();
    if (null == thriftColumnValue) {
      continue;
    }
    com.impetus.kundera.metadata.model.Column column=m.getColumn(thriftColumnName);
    if (column != null) {
      try {
        PropertyAccessorHelper.set(entity,column.getField(),thriftColumnValue);
      }
 catch (      PropertyAccessException pae) {
        log.warn(pae.getMessage());
      }
    }
 else {
      if (relationNames != null && !relationNames.isEmpty() && relationNames.contains(thriftColumnName)) {
        String value=PropertyAccessorFactory.STRING.fromBytes(String.class,thriftColumnValue);
        relations.put(thriftColumnName,value);
      }
    }
  }
  return isWrapperReq ? new EnhanceEntity(entity,thriftRow.getId(),relations) : entity;
}

Fixed version (ground truth):
/** 
 * Fetches data held in Thrift row columns and populates to Entity objects.
 * @param clazz the clazz
 * @param m the m
 * @param thriftRow the cr
 * @param relationNames the relation names
 * @param isWrapperReq the is wrapper req
 * @return the e
 * @throws Exception the exception
 */
public Object fromColumnThriftRow(Class<?> clazz,EntityMetadata m,ThriftRow thriftRow,List<String> relationNames,boolean isWrapperReq) throws Exception {
  Object entity=null;
  Map<String,Object> relations=new HashMap<String,Object>();
  for (  Column c : thriftRow.getColumns()) {
    if (entity == null) {
      entity=clazz.newInstance();
      PropertyAccessorHelper.setId(entity,m,thriftRow.getId());
    }
    String thriftColumnName=PropertyAccessorFactory.STRING.fromBytes(String.class,c.getName());
    byte[] thriftColumnValue=c.getValue();
    if (null == thriftColumnValue) {
      continue;
    }
    com.impetus.kundera.metadata.model.Column column=m.getColumn(thriftColumnName);
    if (column != null) {
      try {
        PropertyAccessorHelper.set(entity,column.getField(),thriftColumnValue);
      }
 catch (      PropertyAccessException pae) {
        log.warn(pae.getMessage());
      }
    }
 else {
      if (relationNames != null && !relationNames.isEmpty() && relationNames.contains(thriftColumnName)) {
        String value=PropertyAccessorFactory.STRING.fromBytes(String.class,thriftColumnValue);
        relations.put(thriftColumnName,value);
      }
    }
  }
  return isWrapperReq && relations != null && !relations.isEmpty() ? new EnhanceEntity(entity,thriftRow.getId(),relations) : entity;
}