Program: 155358
Project: 155358
Buggy source:
/** 
 * @param request -	any string.
 * @param groupId - group id from which not to select users
 * @param maxAmount - 	max amount of results to return, -1 for unlimited. If this value is negativeand not equal to -1 than result is undefined
 * @param startingEntry - user id from which result will be taken.
 * @return Collection of autocompleted strings with images
 */
@RemoteMethod public Collection<String> autocompleteUserSearchWithImagesRequest(String request,int groupId,int maxAmount,int startingEntry){
  request=request.toLowerCase();
  Collection<User> requestedUsers=(this.getUserHome().ejbAutocompleteRequest(request,groupId,maxAmount,startingEntry));
  UserApplicationEngine userApplicationEngine=this.getUserApplicationEngine();
  String words[]=request.split(CoreConstants.SPACE);
  ArrayList<String> strings=new ArrayList<String>();
  int last=words.length - 1;
  int extractAmount=request.lastIndexOf(CoreConstants.SPACE) == (request.length() - 1) ? 1 : 0;
  StringBuilder phraseBuilding=new StringBuilder(request);
  for (  User user : requestedUsers) {
    UserDataBean data=userApplicationEngine.getUserInfo(user);
    StringBuilder responseItem=new StringBuilder("String_Node_Str").append(PostBusiness.ParameterNames.RECEIVERS_PARAMETER_NAME).append("String_Node_Str").append(user.getId()).append("String_Node_Str").append(data.getPictureUri()).append("String_Node_Str");
    StringBuilder autocompleted=phraseBuilding;
    String name=data.getName().toLowerCase();
    String names[]=name.split(CoreConstants.SPACE);
    String firstName=names.length > 0 ? names[0] : null;
    String lastName=names.length == 2 ? names[1] : names.length > 2 ? names[2] : null;
    String email=data.getEmail().toLowerCase();
    if (email.contains(words[last]) && !request.contains(email)) {
      autocompleted=new StringBuilder(request.substring(0,request.length() - words[last].length() - extractAmount)).append(email);
    }
 else     if (name.contains(words[last]) && !request.contains(name)) {
      for (int i=0; i < names.length; i++) {
        if (!request.contains(names[i])) {
          autocompleted=new StringBuilder(request.substring(0,request.length() - words[last].length() - extractAmount)).append(names[i]);
        }
      }
    }
 else     if (firstName.contains(words[last]) && !request.contains(firstName)) {
      autocompleted=new StringBuilder(request.substring(0,request.length() - words[last].length() - extractAmount)).append(firstName);
    }
 else     if ((lastName != null) && lastName.contains(words[last]) && !request.contains(lastName)) {
      autocompleted=new StringBuilder(request.substring(0,request.length() - words[last].length() - extractAmount)).append(lastName);
    }
    responseItem.append(autocompleted);
    responseItem.append("String_Node_Str");
    strings.add(responseItem.toString());
    strings.add(autocompleted != null ? autocompleted.toString() : CoreConstants.EMPTY);
  }
  return strings;
}

Fixed version (ground truth):
/** 
 * @param request -	any string.
 * @param groupId - group id from which not to select users
 * @param maxAmount - 	max amount of results to return, -1 for unlimited. If this value is negativeand not equal to -1 than result is undefined
 * @param startingEntry - user id from which result will be taken.
 * @return Collection of autocompleted strings with images
 */
@RemoteMethod public Collection<String> autocompleteUserSearchWithImagesRequest(String request,int groupId,int maxAmount,int startingEntry){
  request=request.toLowerCase();
  Collection<User> requestedUsers=(this.getUserHome().ejbAutocompleteRequest(request,groupId,maxAmount,startingEntry));
  UserApplicationEngine userApplicationEngine=this.getUserApplicationEngine();
  String words[]=request.split(CoreConstants.SPACE);
  List<String> strings=new ArrayList<String>();
  int last=words.length - 1;
  int extractAmount=request.lastIndexOf(CoreConstants.SPACE) == (request.length() - 1) ? 1 : 0;
  StringBuilder phraseBuilding=new StringBuilder(request);
  for (  User user : requestedUsers) {
    UserDataBean data=userApplicationEngine.getUserInfo(user);
    StringBuilder responseItem=new StringBuilder("String_Node_Str").append(PostBusiness.ParameterNames.RECEIVERS_PARAMETER_NAME).append("String_Node_Str").append(user.getId()).append("String_Node_Str").append(data.getPictureUri()).append("String_Node_Str");
    StringBuilder autocompleted=phraseBuilding;
    String name=data.getName().toLowerCase();
    String names[]=name.split(CoreConstants.SPACE);
    String firstName=names.length > 0 ? names[0] : null;
    String lastName=names.length == 2 ? names[1] : names.length > 2 ? names[2] : null;
    String email=data.getEmail().toLowerCase();
    if (email.contains(words[last]) && !request.contains(email)) {
      autocompleted=new StringBuilder(request.substring(0,request.length() - words[last].length() - extractAmount)).append(email);
    }
 else     if (name.contains(words[last]) && !request.contains(name)) {
      for (int i=0; i < names.length; i++) {
        if (!request.contains(names[i])) {
          autocompleted=new StringBuilder(request.substring(0,request.length() - words[last].length() - extractAmount)).append(names[i]);
        }
      }
    }
 else     if (firstName.contains(words[last]) && !request.contains(firstName)) {
      autocompleted=new StringBuilder(request.substring(0,request.length() - words[last].length() - extractAmount)).append(firstName);
    }
 else     if ((lastName != null) && lastName.contains(words[last]) && !request.contains(lastName)) {
      autocompleted=new StringBuilder(request.substring(0,request.length() - words[last].length() - extractAmount)).append(lastName);
    }
    responseItem.append(autocompleted);
    responseItem.append("String_Node_Str");
    strings.add(responseItem.toString());
    strings.add(autocompleted != null ? autocompleted.toString() : CoreConstants.EMPTY);
  }
  return strings;
}