Program: 16246
Project: 16246
Buggy source:
/** 
 * Scans a protein sequence for Pfam profile matches.
 * @param sequence
 * @param serviceLocation
 * @return
 * @throws IOException
 */
public SortedSet<HmmerResult> scan(ProteinSequence sequence,URL serviceLocation) throws IOException {
  StringBuffer postContent=new StringBuffer();
  postContent.append("String_Node_Str");
  postContent.append("String_Node_Str");
  postContent.append(sequence.getSequenceAsString());
  HttpURLConnection connection=(HttpURLConnection)serviceLocation.openConnection();
  connection.setDoOutput(true);
  connection.setDoInput(true);
  connection.setConnectTimeout(15000);
  connection.setInstanceFollowRedirects(false);
  connection.setRequestMethod("String_Node_Str");
  connection.setRequestProperty("String_Node_Str","String_Node_Str");
  connection.setRequestProperty("String_Node_Str","String_Node_Str");
  connection.setRequestProperty("String_Node_Str","String_Node_Str" + Integer.toString(postContent.toString().getBytes().length));
  DataOutputStream wr=new DataOutputStream(connection.getOutputStream());
  wr.write(postContent.toString().getBytes());
  wr.flush();
  wr.close();
  URL respUrl=new URL(connection.getHeaderField("String_Node_Str"));
  int responseCode=connection.getResponseCode();
  if (responseCode == 500) {
    System.err.println("String_Node_Str" + serviceLocation);
    System.err.println(connection.getResponseMessage());
  }
  HttpURLConnection connection2=(HttpURLConnection)respUrl.openConnection();
  connection2.setRequestMethod("String_Node_Str");
  connection2.setRequestProperty("String_Node_Str","String_Node_Str");
  connection2.setConnectTimeout(60000);
  BufferedReader in=new BufferedReader(new InputStreamReader(connection2.getInputStream()));
  String inputLine;
  StringBuffer result=new StringBuffer();
  while ((inputLine=in.readLine()) != null) {
    result.append(inputLine);
  }
  in.close();
  SortedSet<HmmerResult> results=new TreeSet<HmmerResult>();
  try {
    JSONObject json=JSONObject.fromObject(result.toString());
    JSONObject hmresults=json.getJSONObject("String_Node_Str");
    JSONArray hits=hmresults.getJSONArray("String_Node_Str");
    for (int i=0; i < hits.size(); i++) {
      JSONObject hit=hits.getJSONObject(i);
      HmmerResult hmmResult=new HmmerResult();
      Object dclO=hit.get("String_Node_Str");
      Integer dcl=-1;
      if (dclO instanceof Long) {
        Long dclL=(Long)dclO;
        dcl=dclL.intValue();
      }
 else       if (dclO instanceof Integer) {
        dcl=(Integer)dclO;
      }
      hmmResult.setAcc((String)hit.get("String_Node_Str"));
      hmmResult.setDcl(dcl);
      hmmResult.setDesc((String)hit.get("String_Node_Str"));
      hmmResult.setEvalue(Float.parseFloat((String)hit.get("String_Node_Str")));
      hmmResult.setName((String)hit.get("String_Node_Str"));
      hmmResult.setNdom((Integer)hit.get("String_Node_Str"));
      hmmResult.setNreported((Integer)hit.get("String_Node_Str"));
      hmmResult.setPvalue((Double)hit.get("String_Node_Str"));
      hmmResult.setScore(Float.parseFloat((String)hit.get("String_Node_Str")));
      JSONArray hmmdomains=hit.getJSONArray("String_Node_Str");
      SortedSet<HmmerDomain> domains=new TreeSet<HmmerDomain>();
      for (int j=0; j < hmmdomains.size(); j++) {
        JSONObject d=hmmdomains.getJSONObject(j);
        Integer is_included=getInteger(d.get("String_Node_Str"));
        if (is_included == 0) {
          continue;
        }
        Integer outcompeted=getInteger(d.get("String_Node_Str"));
        if (outcompeted != null && outcompeted == 1) {
          continue;
        }
        Integer significant=getInteger(d.get("String_Node_Str"));
        if (significant != 1) {
          continue;
        }
        HmmerDomain dom=new HmmerDomain();
        dom.setAliLenth((Integer)d.get("String_Node_Str"));
        dom.setHmmAcc((String)d.get("String_Node_Str"));
        dom.setHmmDesc((String)d.get("String_Node_Str"));
        dom.setHmmFrom(getInteger(d.get("String_Node_Str")));
        dom.setHmmTo(getInteger(d.get("String_Node_Str")));
        dom.setSimCount((Integer)d.get("String_Node_Str"));
        dom.setSqFrom(getInteger(d.get("String_Node_Str")));
        dom.setSqTo(getInteger(d.get("String_Node_Str")));
        dom.setHmmName((String)d.get("String_Node_Str"));
        dom.setEvalue(Float.parseFloat((String)d.get("String_Node_Str")));
        domains.add(dom);
      }
      hmmResult.setDomains(domains);
      results.add(hmmResult);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return results;
}

Fixed version (ground truth):
/** 
 * Scans a protein sequence for Pfam profile matches.
 * @param sequence
 * @param serviceLocation
 * @return
 * @throws IOException
 */
public SortedSet<HmmerResult> scan(ProteinSequence sequence,URL serviceLocation) throws IOException {
  StringBuffer postContent=new StringBuffer();
  postContent.append("String_Node_Str");
  postContent.append("String_Node_Str");
  postContent.append(sequence.getSequenceAsString());
  HttpURLConnection connection=(HttpURLConnection)serviceLocation.openConnection();
  connection.setDoOutput(true);
  connection.setDoInput(true);
  connection.setConnectTimeout(15000);
  connection.setInstanceFollowRedirects(false);
  connection.setRequestMethod("String_Node_Str");
  connection.setRequestProperty("String_Node_Str","String_Node_Str");
  connection.setRequestProperty("String_Node_Str","String_Node_Str");
  connection.setRequestProperty("String_Node_Str","String_Node_Str" + Integer.toString(postContent.toString().getBytes().length));
  DataOutputStream wr=new DataOutputStream(connection.getOutputStream());
  wr.write(postContent.toString().getBytes());
  wr.flush();
  wr.close();
  URL respUrl=new URL(connection.getHeaderField("String_Node_Str"));
  int responseCode=connection.getResponseCode();
  if (responseCode == 500) {
    LOGGER.warn("String_Node_Str",serviceLocation,connection.getResponseMessage());
  }
  HttpURLConnection connection2=(HttpURLConnection)respUrl.openConnection();
  connection2.setRequestMethod("String_Node_Str");
  connection2.setRequestProperty("String_Node_Str","String_Node_Str");
  connection2.setConnectTimeout(60000);
  BufferedReader in=new BufferedReader(new InputStreamReader(connection2.getInputStream()));
  String inputLine;
  StringBuffer result=new StringBuffer();
  while ((inputLine=in.readLine()) != null) {
    result.append(inputLine);
  }
  in.close();
  SortedSet<HmmerResult> results=new TreeSet<HmmerResult>();
  try {
    JSONObject json=JSONObject.fromObject(result.toString());
    JSONObject hmresults=json.getJSONObject("String_Node_Str");
    JSONArray hits=hmresults.getJSONArray("String_Node_Str");
    for (int i=0; i < hits.size(); i++) {
      JSONObject hit=hits.getJSONObject(i);
      HmmerResult hmmResult=new HmmerResult();
      Object dclO=hit.get("String_Node_Str");
      Integer dcl=-1;
      if (dclO instanceof Long) {
        Long dclL=(Long)dclO;
        dcl=dclL.intValue();
      }
 else       if (dclO instanceof Integer) {
        dcl=(Integer)dclO;
      }
      hmmResult.setAcc((String)hit.get("String_Node_Str"));
      hmmResult.setDcl(dcl);
      hmmResult.setDesc((String)hit.get("String_Node_Str"));
      hmmResult.setEvalue(Float.parseFloat((String)hit.get("String_Node_Str")));
      hmmResult.setName((String)hit.get("String_Node_Str"));
      hmmResult.setNdom((Integer)hit.get("String_Node_Str"));
      hmmResult.setNreported((Integer)hit.get("String_Node_Str"));
      hmmResult.setPvalue((Double)hit.get("String_Node_Str"));
      hmmResult.setScore(Float.parseFloat((String)hit.get("String_Node_Str")));
      JSONArray hmmdomains=hit.getJSONArray("String_Node_Str");
      SortedSet<HmmerDomain> domains=new TreeSet<HmmerDomain>();
      for (int j=0; j < hmmdomains.size(); j++) {
        JSONObject d=hmmdomains.getJSONObject(j);
        Integer is_included=getInteger(d.get("String_Node_Str"));
        if (is_included == 0) {
          continue;
        }
        Integer outcompeted=getInteger(d.get("String_Node_Str"));
        if (outcompeted != null && outcompeted == 1) {
          continue;
        }
        Integer significant=getInteger(d.get("String_Node_Str"));
        if (significant != 1) {
          continue;
        }
        HmmerDomain dom=new HmmerDomain();
        dom.setAliLenth((Integer)d.get("String_Node_Str"));
        dom.setHmmAcc((String)d.get("String_Node_Str"));
        dom.setHmmDesc((String)d.get("String_Node_Str"));
        dom.setHmmFrom(getInteger(d.get("String_Node_Str")));
        dom.setHmmTo(getInteger(d.get("String_Node_Str")));
        dom.setSimCount((Integer)d.get("String_Node_Str"));
        dom.setSqFrom(getInteger(d.get("String_Node_Str")));
        dom.setSqTo(getInteger(d.get("String_Node_Str")));
        dom.setHmmName((String)d.get("String_Node_Str"));
        dom.setEvalue(Float.parseFloat((String)d.get("String_Node_Str")));
        domains.add(dom);
      }
      hmmResult.setDomains(domains);
      results.add(hmmResult);
    }
  }
 catch (  NumberFormatException e) {
    LOGGER.warn("String_Node_Str",e.getMessage());
  }
  return results;
}