Program: 176708
Project: 176708
Buggy source:
/** 
 * Parses and translates query into HBase filter and invokes client's method to return list of entities.
 * @param m Entity metadata
 * @param client hbase client
 * @return list of entities.
 */
private List onQuery(EntityMetadata m,Client client){
  QueryTranslator translator=new QueryTranslator();
  translator.translate(getKunderaQuery(),m);
  String[] columns=getTranslatedColumns(m,getKunderaQuery().getResult());
  Map<Boolean,Filter> filter=translator.getFilter();
  if (translator.isFindById && (filter == null && columns == null)) {
    List results=new ArrayList();
    Object output=client.find(m.getEntityClazz(),translator.rowKey);
    if (output != null) {
      results.add(output);
      return results;
    }
  }
  if (translator.isFindById && filter == null && columns != null) {
    return ((HBaseClient)client).findByRange(m.getEntityClazz(),m,translator.rowKey,translator.rowKey,columns);
  }
  if (MetadataUtils.useSecondryIndex(m.getPersistenceUnit())) {
    if (filter == null && !translator.isFindById) {
      if (translator.isRangeScan()) {
        return ((HBaseClient)client).findByRange(m.getEntityClazz(),m,translator.getStartRow(),translator.getEndRow(),columns);
      }
 else {
        return ((HBaseClient)client).findByRange(m.getEntityClazz(),m,null,null,columns);
      }
    }
 else {
      if (filter != null && filter.values() != null && !filter.values().isEmpty()) {
        ((HBaseClient)client).setFilter(filter.values().iterator().next());
      }
      if (translator.isRangeScan()) {
        return ((HBaseClient)client).findByRange(m.getEntityClazz(),m,translator.getStartRow(),translator.getEndRow(),columns);
      }
 else {
        return ((HBaseClient)client).findByQuery(m.getEntityClazz(),m,columns);
      }
    }
  }
 else {
    List results=null;
    return populateUsingLucene(m,client,results);
  }
}

Fixed version (ground truth):
/** 
 * Parses and translates query into HBase filter and invokes client's method to return list of entities.
 * @param m Entity metadata
 * @param client hbase client
 * @return list of entities.
 */
private List onQuery(EntityMetadata m,Client client){
  QueryTranslator translator=new QueryTranslator();
  translator.translate(getKunderaQuery(),m);
  List<String> columns=getTranslatedColumns(m,getKunderaQuery().getResult());
  Map<Boolean,Filter> filter=translator.getFilter();
  if (translator.isFindById && (filter == null && columns == null)) {
    List results=new ArrayList();
    Object output=client.find(m.getEntityClazz(),translator.rowKey);
    if (output != null) {
      results.add(output);
      return results;
    }
  }
  if (translator.isFindById && filter == null && columns != null) {
    return ((HBaseClient)client).findByRange(m.getEntityClazz(),m,translator.rowKey,translator.rowKey,columns.toArray(new String[columns.size()]));
  }
  if (MetadataUtils.useSecondryIndex(m.getPersistenceUnit())) {
    if (filter == null && !translator.isFindById) {
      if (translator.isRangeScan()) {
        return ((HBaseClient)client).findByRange(m.getEntityClazz(),m,translator.getStartRow(),translator.getEndRow(),columns.toArray(new String[columns.size()]));
      }
 else {
        return ((HBaseClient)client).findByRange(m.getEntityClazz(),m,null,null,columns.toArray(new String[columns.size()]));
      }
    }
 else {
      if (filter != null && filter.values() != null && !filter.values().isEmpty()) {
        ((HBaseClient)client).setFilter(filter.values().iterator().next());
      }
      if (translator.isRangeScan()) {
        return ((HBaseClient)client).findByRange(m.getEntityClazz(),m,translator.getStartRow(),translator.getEndRow(),columns.toArray(new String[columns.size()]));
      }
 else {
        return ((HBaseClient)client).findByQuery(m.getEntityClazz(),m,columns.toArray(new String[columns.size()]));
      }
    }
  }
 else {
    List results=null;
    return populateUsingLucene(m,client,results);
  }
}