Program: 172241
Project: 172241
Buggy source:
/** 
 * Get the collection of people stored in the repository. An optional filter query may be provided by which to filter the people collection. Space separate the query terms i.e. "john bob" will find all users who's first or second names contain the strings "john" or "bob".
 * @param filter filter query string by which to filter the collection of people.If <pre>null</pre> then all people stored in the repository are returned
 * @param maxResults maximum results to return or all if <= 0
 * @return people collection as a JavaScript array
 */
public Scriptable getPeople(String filter,int maxResults){
  Object[] people=null;
  if (filter == null) {
    people=personService.getAllPeople().toArray();
  }
 else {
    filter=filter.trim();
    if (filter.length() != 0) {
      StringBuilder query=new StringBuilder(128);
      for (StringTokenizer t=new StringTokenizer(filter,"String_Node_Str"); t.hasMoreTokens(); ) {
        String term=LuceneQueryParser.escape(t.nextToken().replace('"',' '));
        query.append("String_Node_Str").append(NamespaceService.CONTENT_MODEL_PREFIX).append("String_Node_Str");
        query.append(term);
        query.append("String_Node_Str").append(NamespaceService.CONTENT_MODEL_PREFIX).append("String_Node_Str");
        query.append(term);
        query.append("String_Node_Str");
      }
      SearchParameters params=new SearchParameters();
      params.setLanguage(SearchService.LANGUAGE_LUCENE);
      params.addStore(this.storeRef);
      params.setQuery(query.toString());
      if (maxResults > 0) {
        params.setLimitBy(LimitBy.FINAL_SIZE);
        params.setLimit(maxResults);
      }
      ResultSet results=null;
      try {
        results=services.getSearchService().query(params);
        people=results.getNodeRefs().toArray();
      }
  finally {
        if (results != null) {
          results.close();
        }
      }
    }
  }
  if (people == null) {
    people=new Object[0];
  }
  return Context.getCurrentContext().newArray(getScope(),people);
}

Fixed version (ground truth):
/** 
 * Get the collection of people stored in the repository. An optional filter query may be provided by which to filter the people collection. Space separate the query terms i.e. "john bob" will find all users who's first or second names contain the strings "john" or "bob".
 * @param filter filter query string by which to filter the collection of people.If <pre>null</pre> then all people stored in the repository are returned
 * @param maxResults maximum results to return or all if <= 0
 * @return people collection as a JavaScript array
 */
public Scriptable getPeople(String filter,int maxResults){
  Object[] people=null;
  if (filter == null || filter.length() == 0) {
    people=personService.getAllPeople().toArray();
  }
 else {
    filter=filter.trim();
    if (filter.length() != 0) {
      StringBuilder query=new StringBuilder(128);
      for (StringTokenizer t=new StringTokenizer(filter,"String_Node_Str"); t.hasMoreTokens(); ) {
        String term=LuceneQueryParser.escape(t.nextToken().replace('"',' '));
        query.append("String_Node_Str").append(NamespaceService.CONTENT_MODEL_PREFIX).append("String_Node_Str");
        query.append(term);
        query.append("String_Node_Str").append(NamespaceService.CONTENT_MODEL_PREFIX).append("String_Node_Str");
        query.append(term);
        query.append("String_Node_Str");
      }
      SearchParameters params=new SearchParameters();
      params.setLanguage(SearchService.LANGUAGE_LUCENE);
      params.addStore(this.storeRef);
      params.setQuery(query.toString());
      if (maxResults > 0) {
        params.setLimitBy(LimitBy.FINAL_SIZE);
        params.setLimit(maxResults);
      }
      ResultSet results=null;
      try {
        results=services.getSearchService().query(params);
        people=results.getNodeRefs().toArray();
      }
  finally {
        if (results != null) {
          results.close();
        }
      }
    }
  }
  if (people == null) {
    people=new Object[0];
  }
  return Context.getCurrentContext().newArray(getScope(),people);
}