Program: 80509
Project: 80509
Buggy source:
/** 
 * has one or more match clauses
 * @param domainObjectClass
 * @param context
 * @param ids
 * @return
 */
@SuppressWarnings("String_Node_Str") private <T>List<T> loadByIdsWithMatches(Class<T> domainObjectClass,ClosureQueryContext context,long... ids){
  List<T> resultList=new ArrayList<T>();
  JcQuery query;
  String nm=NodePrefix.concat(String.valueOf(0));
  List<JcQuery> queries=new ArrayList<JcQuery>();
  Map<Long,JcQueryResult> id2QueryResult=new HashMap<Long,JcQueryResult>();
  List<Long> queryIds=new ArrayList<Long>();
  Map<Long,T> id2Object=new HashMap<Long,T>();
  for (int i=0; i < ids.length; i++) {
    T obj=(T)this.domainState.checkForMappedObject(domainObjectClass,ids[i]);
    if (obj != null) {
      id2Object.put(ids[i],obj);
    }
 else {
      query=new JcQuery();
      JcNode n=new JcNode(nm);
      List<IClause> clauses=new ArrayList<IClause>();
      clauses.add(START.node(n).byId(ids[i]));
      clauses.addAll(context.matchClauses);
      clauses.add(RETURN.ALL());
      IClause[] clausesArray=clauses.toArray(new IClause[clauses.size()]);
      query.setClauses(clausesArray);
      queries.add(query);
      queryIds.add(ids[i]);
    }
  }
  if (queries.size() > 0) {
    List<JcQueryResult> results=this.dbAccess.execute(queries);
    List<JcError> errors=Util.collectErrors(results);
    if (errors.size() > 0) {
      throw new JcResultException(errors);
    }
    for (int i=0; i < queries.size(); i++) {
      id2QueryResult.put(queryIds.get(i),results.get(i));
    }
  }
  for (int i=0; i < ids.length; i++) {
    T obj=id2Object.get(ids[i]);
    if (obj == null) {
      FillModelContext<T> fContext=new FillModelContext<T>(domainObjectClass,id2QueryResult.get(ids[i]));
      new ClosureCalculator().fillModel(fContext);
      obj=fContext.domainObject;
    }
    resultList.add(obj);
  }
  return resultList;
}

Fixed version (ground truth):
/** 
 * has one or more match clauses
 * @param domainObjectClass
 * @param context
 * @param ids
 * @return
 */
@SuppressWarnings("String_Node_Str") private <T>List<T> loadByIdsWithMatches(Class<T> domainObjectClass,ClosureQueryContext context,long... ids){
  List<T> resultList=new ArrayList<T>();
  JcQuery query;
  String nm=NodePrefix.concat(String.valueOf(0));
  List<JcQuery> queries=new ArrayList<JcQuery>();
  Map<Long,JcQueryResult> id2QueryResult=new HashMap<Long,JcQueryResult>();
  List<Long> queryIds=new ArrayList<Long>();
  Map<Long,T> id2Object=new HashMap<Long,T>();
  for (int i=0; i < ids.length; i++) {
    T obj=(T)this.domainState.checkForMappedObject(domainObjectClass,ids[i]);
    if (obj != null) {
      id2Object.put(ids[i],obj);
    }
 else {
      query=new JcQuery();
      JcNode n=new JcNode(nm);
      List<IClause> clauses=new ArrayList<IClause>();
      clauses.add(START.node(n).byId(ids[i]));
      clauses.addAll(context.matchClauses);
      clauses.add(RETURN.ALL());
      IClause[] clausesArray=clauses.toArray(new IClause[clauses.size()]);
      query.setClauses(clausesArray);
      queries.add(query);
      queryIds.add(ids[i]);
    }
  }
  if (queries.size() > 0) {
    Util.printQueries(queries,"String_Node_Str",Format.PRETTY_1);
    List<JcQueryResult> results=this.dbAccess.execute(queries);
    List<JcError> errors=Util.collectErrors(results);
    if (errors.size() > 0) {
      throw new JcResultException(errors);
    }
    for (int i=0; i < queries.size(); i++) {
      id2QueryResult.put(queryIds.get(i),results.get(i));
    }
  }
  for (int i=0; i < ids.length; i++) {
    T obj=id2Object.get(ids[i]);
    if (obj == null) {
      FillModelContext<T> fContext=new FillModelContext<T>(domainObjectClass,id2QueryResult.get(ids[i]));
      new ClosureCalculator().fillModel(fContext);
      obj=fContext.domainObject;
    }
    resultList.add(obj);
  }
  return resultList;
}