Program: 80114
Project: 80114
Buggy source:
/** 
 * Convert Gora query to Orient DB specific query which underline API understands. And maintain it s state encapsulated to Gora implementation of the   {@link org.apache.gora.query.Query}.
 * @return a {@link OSQLSynchQuery} query executable over Orient DB.
 */
public OSQLSynchQuery<ODocument> populateOrientDBQuery(final OrientDBMapping orientDBMapping,final String[] fields,final String[] schemaFields){
  params=new HashMap<String,Object>();
  Query selectQuery=new Query();
  selectQuery.from(orientDBMapping.getDocumentClass());
  if ((this.getStartKey() != null) && (this.getEndKey() != null) && this.getStartKey().equals(this.getEndKey())) {
    selectQuery.where(projection("String_Node_Str").eq(Parameter.parameter("String_Node_Str")));
    params.put("String_Node_Str",this.getStartKey());
  }
 else   if (this.getStartKey() != null || this.getEndKey() != null) {
    if (this.getStartKey() != null) {
      selectQuery.where(projection("String_Node_Str").ge(Parameter.parameter("String_Node_Str")));
      params.put("String_Node_Str",this.getStartKey());
    }
    if (this.getEndKey() != null) {
      selectQuery.where(projection("String_Node_Str").le(Parameter.parameter("String_Node_Str")));
      params.put("String_Node_Str",this.getEndKey());
    }
  }
  if (fields.length == schemaFields.length) {
    selectQuery.select(Projection.ALL);
  }
 else {
    for (    String k : fields) {
      String dbFieldName=orientDBMapping.getDocumentField(k);
      if (dbFieldName != null && dbFieldName.length() > 0) {
        selectQuery.select(dbFieldName);
      }
    }
    selectQuery.select("String_Node_Str");
  }
  dbQuery=new OSQLSynchQuery<ODocument>(selectQuery.toString());
  return dbQuery;
}

Fixed version (ground truth):
/** 
 * Convert Gora query to Orient DB specific query which underline API understands. And maintain it s state encapsulated to Gora implementation of the   {@link org.apache.gora.query.Query}.
 * @param orientDBMapping OrientDB mapping file.
 * @param fields OrientDB query fields.
 * @param schemaFields AVRO schema fields for persistent bean.
 * @return a {@link OSQLSynchQuery} query executable over Orient DB.
 */
public OSQLSynchQuery<ODocument> populateOrientDBQuery(final OrientDBMapping orientDBMapping,final String[] fields,final String[] schemaFields){
  params=new HashMap<String,Object>();
  Query selectQuery=new Query();
  selectQuery.from(orientDBMapping.getDocumentClass());
  if ((this.getStartKey() != null) && (this.getEndKey() != null) && this.getStartKey().equals(this.getEndKey())) {
    selectQuery.where(projection("String_Node_Str").eq(Parameter.parameter("String_Node_Str")));
    params.put("String_Node_Str",this.getStartKey());
  }
 else   if (this.getStartKey() != null || this.getEndKey() != null) {
    if (this.getStartKey() != null) {
      selectQuery.where(projection("String_Node_Str").ge(Parameter.parameter("String_Node_Str")));
      params.put("String_Node_Str",this.getStartKey());
    }
    if (this.getEndKey() != null) {
      selectQuery.where(projection("String_Node_Str").le(Parameter.parameter("String_Node_Str")));
      params.put("String_Node_Str",this.getEndKey());
    }
  }
  if (fields.length == schemaFields.length) {
    selectQuery.select(Projection.ALL);
  }
 else {
    for (    String k : fields) {
      String dbFieldName=orientDBMapping.getDocumentField(k);
      if (dbFieldName != null && dbFieldName.length() > 0) {
        selectQuery.select(dbFieldName);
      }
    }
    selectQuery.select("String_Node_Str");
  }
  dbQuery=new OSQLSynchQuery<ODocument>(selectQuery.toString());
  return dbQuery;
}