Program: 4717
Project: 4717
Buggy source:
/** 
 * Sends an HTTP request that should succeed and send back all of the expected headers.
 */
private void sendRequestThatShouldSucceed(HTTPRequestMethod method,String request,FileDesc fd){
  try {
    ByteArrayOutputStream baos=new ByteArrayOutputStream();
    baos.write(request.getBytes());
    Socket sock=new TestSocket(new ByteArrayInputStream(baos.toByteArray()));
    _uploadManager.acceptUpload(method,sock);
    String reply=sock.getOutputStream().toString();
    StringTokenizer st=new StringTokenizer(reply,"String_Node_Str");
    boolean contentUrnHeaderPresent=false;
    boolean OKPresent=false;
    assertTrue("String_Node_Str" + fd,st.countTokens() > 0);
    while (st.hasMoreTokens()) {
      String curString=st.nextToken();
      if (HTTPHeaderName.ALT_LOCATION.matchesStartOfString(curString)) {
        continue;
      }
 else       if (HTTPHeaderName.GNUTELLA_CONTENT_URN.matchesStartOfString(curString)) {
        URN curUrn=null;
        try {
          String tmpString=HTTPUtils.extractHeaderValue(curString);
          curUrn=URN.createSHA1Urn(tmpString);
        }
 catch (        IOException e) {
          assertTrue("String_Node_Str" + e,false);
        }
        assertEquals(HTTPHeaderName.GNUTELLA_CONTENT_URN.toString() + "String_Node_Str" + fd,fd.getSHA1Urn(),curUrn);
        contentUrnHeaderPresent=true;
      }
 else       if (HTTPHeaderName.CONTENT_RANGE.matchesStartOfString(curString)) {
        continue;
      }
 else       if (HTTPHeaderName.CONTENT_TYPE.matchesStartOfString(curString)) {
        continue;
      }
 else       if (HTTPHeaderName.CONTENT_LENGTH.matchesStartOfString(curString)) {
        String value=HTTPUtils.extractHeaderValue(curString);
        assertEquals("String_Node_Str" + fd,(int)fd.getSize(),Integer.parseInt(value));
      }
 else       if (HTTPHeaderName.SERVER.matchesStartOfString(curString)) {
        continue;
      }
 else       if (curString.equals("String_Node_Str")) {
        OKPresent=true;
      }
    }
    assertTrue("String_Node_Str" + fd,OKPresent);
    assertTrue("String_Node_Str" + fd + "String_Node_Str"+ "String_Node_Str"+ reply,contentUrnHeaderPresent);
  }
 catch (  IOException e) {
    assertTrue("String_Node_Str" + e,false);
  }
}

Fixed version (ground truth):
/** 
 * Sends an HTTP request that should succeed and send back all of the expected headers.
 */
private void sendRequestThatShouldSucceed(HTTPRequestMethod method,String request,FileDesc fd){
  try {
    ByteArrayOutputStream baos=new ByteArrayOutputStream();
    baos.write(request.getBytes());
    Socket sock=new TestSocket(new ByteArrayInputStream(baos.toByteArray()));
    RouterService.getUploadManager().acceptUpload(method,sock);
    String reply=sock.getOutputStream().toString();
    StringTokenizer st=new StringTokenizer(reply,"String_Node_Str");
    boolean contentUrnHeaderPresent=false;
    boolean OKPresent=false;
    assertTrue("String_Node_Str" + fd,st.countTokens() > 0);
    while (st.hasMoreTokens()) {
      String curString=st.nextToken();
      if (HTTPHeaderName.ALT_LOCATION.matchesStartOfString(curString)) {
        continue;
      }
 else       if (HTTPHeaderName.GNUTELLA_CONTENT_URN.matchesStartOfString(curString)) {
        URN curUrn=null;
        try {
          String tmpString=HTTPUtils.extractHeaderValue(curString);
          curUrn=URN.createSHA1Urn(tmpString);
        }
 catch (        IOException e) {
          assertTrue("String_Node_Str" + e,false);
        }
        assertEquals(HTTPHeaderName.GNUTELLA_CONTENT_URN.toString() + "String_Node_Str" + fd,fd.getSHA1Urn(),curUrn);
        contentUrnHeaderPresent=true;
      }
 else       if (HTTPHeaderName.CONTENT_RANGE.matchesStartOfString(curString)) {
        continue;
      }
 else       if (HTTPHeaderName.CONTENT_TYPE.matchesStartOfString(curString)) {
        continue;
      }
 else       if (HTTPHeaderName.CONTENT_LENGTH.matchesStartOfString(curString)) {
        String value=HTTPUtils.extractHeaderValue(curString);
        assertEquals("String_Node_Str" + fd,(int)fd.getSize(),Integer.parseInt(value));
      }
 else       if (HTTPHeaderName.SERVER.matchesStartOfString(curString)) {
        continue;
      }
 else       if (curString.equals("String_Node_Str")) {
        OKPresent=true;
      }
    }
    assertTrue("String_Node_Str" + fd,OKPresent);
    assertTrue("String_Node_Str" + fd + "String_Node_Str"+ "String_Node_Str"+ reply,contentUrnHeaderPresent);
  }
 catch (  IOException e) {
    e.printStackTrace();
    fail("String_Node_Str" + e);
  }
}