Program: 8367
Project: 8367
Buggy source:
@Override public ArrayList<ImportKeysListEntry> search(String query) throws QueryFailedException, QueryNeedsRepairException {
  ArrayList<ImportKeysListEntry> results=new ArrayList<ImportKeysListEntry>();
  if (query.length() < 3) {
    throw new QueryTooShortException();
  }
  String encodedQuery;
  try {
    encodedQuery=URLEncoder.encode(query,"String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    return null;
  }
  String request="String_Node_Str" + encodedQuery;
  String data;
  try {
    data=query(request);
  }
 catch (  HttpError e) {
    if (e.getCode() == 404) {
      return results;
    }
 else {
      if (e.getData().toLowerCase(Locale.US).contains("String_Node_Str")) {
        return results;
      }
 else       if (e.getData().toLowerCase(Locale.US).contains("String_Node_Str")) {
        throw new TooManyResponsesException();
      }
 else       if (e.getData().toLowerCase(Locale.US).contains("String_Node_Str")) {
        throw new QueryTooShortException();
      }
    }
    throw new QueryFailedException("String_Node_Str" + mHost + "String_Node_Str");
  }
  final Matcher matcher=PUB_KEY_LINE.matcher(data);
  while (matcher.find()) {
    final ImportKeysListEntry entry=new ImportKeysListEntry();
    entry.setQuery(query);
    entry.setOrigin(getUrlPrefix() + mHost + "String_Node_Str"+ mPort);
    entry.setBitStrength(Integer.parseInt(matcher.group(3)));
    final int algorithmId=Integer.decode(matcher.group(2));
    entry.setAlgorithm(PgpKeyHelper.getAlgorithmInfo(algorithmId));
    String fingerprintOrKeyId=matcher.group(1);
    if (fingerprintOrKeyId.length() > 16) {
      entry.setFingerprintHex(fingerprintOrKeyId.toLowerCase(Locale.US));
      entry.setKeyIdHex("String_Node_Str" + fingerprintOrKeyId.substring(fingerprintOrKeyId.length() - 16,fingerprintOrKeyId.length()));
    }
 else {
      entry.setKeyIdHex("String_Node_Str" + fingerprintOrKeyId);
    }
    final long creationDate=Long.parseLong(matcher.group(4));
    final GregorianCalendar tmpGreg=new GregorianCalendar(TimeZone.getTimeZone("String_Node_Str"));
    tmpGreg.setTimeInMillis(creationDate * 1000);
    entry.setDate(tmpGreg.getTime());
    entry.setRevoked(matcher.group(6).contains("String_Node_Str"));
    entry.setExpired(matcher.group(6).contains("String_Node_Str"));
    ArrayList<String> userIds=new ArrayList<String>();
    final String uidLines=matcher.group(7);
    final Matcher uidMatcher=UID_LINE.matcher(uidLines);
    while (uidMatcher.find()) {
      String tmp=uidMatcher.group(1).trim();
      if (tmp.contains("String_Node_Str")) {
        try {
          tmp=(URLDecoder.decode(tmp,"String_Node_Str"));
        }
 catch (        UnsupportedEncodingException ignored) {
        }
      }
      userIds.add(tmp);
    }
    entry.setUserIds(userIds);
    entry.setPrimaryUserId(userIds.get(0));
    results.add(entry);
  }
  return results;
}

Fixed version (ground truth):
@Override public ArrayList<ImportKeysListEntry> search(String query) throws QueryFailedException, QueryNeedsRepairException {
  ArrayList<ImportKeysListEntry> results=new ArrayList<ImportKeysListEntry>();
  if (query.length() < 3) {
    throw new QueryTooShortException();
  }
  String encodedQuery;
  try {
    encodedQuery=URLEncoder.encode(query,"String_Node_Str");
  }
 catch (  UnsupportedEncodingException e) {
    return null;
  }
  String request="String_Node_Str" + encodedQuery;
  String data;
  try {
    data=query(request);
  }
 catch (  HttpError e) {
    if (e.getCode() == 404) {
      return results;
    }
 else {
      if (e.getData().toLowerCase(Locale.US).contains("String_Node_Str")) {
        return results;
      }
 else       if (e.getData().toLowerCase(Locale.US).contains("String_Node_Str")) {
        throw new TooManyResponsesException();
      }
 else       if (e.getData().toLowerCase(Locale.US).contains("String_Node_Str")) {
        throw new QueryTooShortException();
      }
    }
    throw new QueryFailedException("String_Node_Str" + mHost + "String_Node_Str");
  }
  final Matcher matcher=PUB_KEY_LINE.matcher(data);
  while (matcher.find()) {
    final ImportKeysListEntry entry=new ImportKeysListEntry();
    entry.setQuery(query);
    entry.setOrigin(getUrlPrefix() + mHost + "String_Node_Str"+ mPort);
    entry.setBitStrength(Integer.parseInt(matcher.group(3)));
    final int algorithmId=Integer.decode(matcher.group(2));
    entry.setAlgorithm(PgpKeyHelper.getAlgorithmInfo(algorithmId));
    String fingerprintOrKeyId=matcher.group(1);
    if (fingerprintOrKeyId.length() > 16) {
      entry.setFingerprintHex(fingerprintOrKeyId.toLowerCase(Locale.US));
      entry.setKeyIdHex("String_Node_Str" + fingerprintOrKeyId.substring(fingerprintOrKeyId.length() - 16,fingerprintOrKeyId.length()));
    }
 else {
      entry.setKeyIdHex("String_Node_Str" + fingerprintOrKeyId);
    }
    final long creationDate=Long.parseLong(matcher.group(4));
    final GregorianCalendar tmpGreg=new GregorianCalendar(TimeZone.getTimeZone("String_Node_Str"));
    tmpGreg.setTimeInMillis(creationDate * 1000);
    entry.setDate(tmpGreg.getTime());
    entry.setRevoked(matcher.group(6).contains("String_Node_Str"));
    entry.setExpired(matcher.group(6).contains("String_Node_Str"));
    ArrayList<String> userIds=new ArrayList<String>();
    final String uidLines=matcher.group(7);
    final Matcher uidMatcher=UID_LINE.matcher(uidLines);
    while (uidMatcher.find()) {
      String tmp=uidMatcher.group(1).trim();
      if (tmp.contains("String_Node_Str")) {
        if (tmp.contains("String_Node_Str")) {
          tmp=tmp.replace("String_Node_Str","String_Node_Str");
        }
        try {
          tmp=(URLDecoder.decode(tmp,"String_Node_Str"));
        }
 catch (        UnsupportedEncodingException ignored) {
        }
      }
      userIds.add(tmp);
    }
    entry.setUserIds(userIds);
    entry.setPrimaryUserId(userIds.get(0));
    results.add(entry);
  }
  return results;
}