Program: 4852
Project: 4852
Buggy source:
/** 
 * Sends a GET request using an already open socket, and reads all  headers.  <p>
 * @param start The byte at which the HTTPDownloader should begin
 * @param stop The byte at which the HTTPDownloader should stop<p>
 * @exception TryAgainLaterException the host is busy
 * @exception FileNotFoundException the host doesn't recognize the file
 * @exception NotSharingException the host isn't sharing files (BearShare)
 * @exception IOException miscellaneous  error 
 */
public void connectHTTP(int start,int stop) throws IOException, TryAgainLaterException, FileNotFoundException, NotSharingException {
  _amountToRead=stop - start;
  _initialReadingPoint=start;
  OutputStream os=_socket.getOutputStream();
  OutputStreamWriter osw=new OutputStreamWriter(os);
  BufferedWriter out=new BufferedWriter(osw);
  String startRange=java.lang.String.valueOf(_initialReadingPoint);
  out.write("String_Node_Str" + _index + "String_Node_Str"+ _filename+ "String_Node_Str");
  out.write("String_Node_Str" + CommonUtils.getHttpServer() + "String_Node_Str");
  AlternateLocationCollection alts=new AlternateLocationCollection();
synchronized (_alternateLocationsToSend) {
    alts.addAlternateLocationCollection(_alternateLocationsToSend);
  }
  URN sha1=_rfd.getSHA1Urn();
  if (sha1 != null)   HTTPUtils.writeHeader(HTTPHeaderName.CONTENT_URN,sha1,out);
  if (alts.size() > 0) {
    HTTPUtils.writeHeader(HTTPHeaderName.ALT_LOCATION,alts,out);
  }
  out.write("String_Node_Str" + startRange + "String_Node_Str");
  SettingsManager sm=SettingsManager.instance();
  if (sm.getChatEnabled()) {
    int port;
    String host;
    if (sm.getForceIPAddress()) {
      port=sm.getForcedPort();
      host=sm.getForcedIPAddressString();
    }
 else {
      port=sm.getPort();
      host=_socket.getLocalAddress().getHostAddress();
    }
    out.write("String_Node_Str" + host + "String_Node_Str"+ port+ "String_Node_Str");
  }
  out.write("String_Node_Str");
  out.flush();
  readHeaders();
}

Fixed version (ground truth):
/** 
 * Sends a GET request using an already open socket, and reads all  headers.  <p>
 * @param start The byte at which the HTTPDownloader should begin
 * @param stop the index just past the last byte to read;stop-1 is the last byte the HTTPDownloader should download <p>
 * @exception TryAgainLaterException the host is busy
 * @exception FileNotFoundException the host doesn't recognize the file
 * @exception NotSharingException the host isn't sharing files (BearShare)
 * @exception IOException miscellaneous  error 
 */
public void connectHTTP(int start,int stop) throws IOException, TryAgainLaterException, FileNotFoundException, NotSharingException {
  _amountToRead=stop - start;
  _initialReadingPoint=start;
  OutputStream os=_socket.getOutputStream();
  OutputStreamWriter osw=new OutputStreamWriter(os);
  BufferedWriter out=new BufferedWriter(osw);
  String startRange=java.lang.String.valueOf(_initialReadingPoint);
  out.write("String_Node_Str" + _index + "String_Node_Str"+ _filename+ "String_Node_Str");
  out.write("String_Node_Str" + CommonUtils.getHttpServer() + "String_Node_Str");
  AlternateLocationCollection alts=new AlternateLocationCollection();
synchronized (_alternateLocationsToSend) {
    alts.addAlternateLocationCollection(_alternateLocationsToSend);
  }
  URN sha1=_rfd.getSHA1Urn();
  if (sha1 != null)   HTTPUtils.writeHeader(HTTPHeaderName.CONTENT_URN,sha1,out);
  if (alts.size() > 0) {
    HTTPUtils.writeHeader(HTTPHeaderName.ALT_LOCATION,alts,out);
  }
  out.write("String_Node_Str" + startRange + "String_Node_Str");
  SettingsManager sm=SettingsManager.instance();
  if (sm.getChatEnabled()) {
    int port;
    String host;
    if (sm.getForceIPAddress()) {
      port=sm.getForcedPort();
      host=sm.getForcedIPAddressString();
    }
 else {
      port=sm.getPort();
      host=_socket.getLocalAddress().getHostAddress();
    }
    out.write("String_Node_Str" + host + "String_Node_Str"+ port+ "String_Node_Str");
  }
  out.write("String_Node_Str");
  out.flush();
  readHeaders();
}