Program: 4803
Project: 4803
Buggy source:
/** 
 * Accepts a new push upload, creating a new <tt>HTTPUploader</tt>. NON-BLOCKING: creates a new thread to transfer the file. <p> The thread makes the uploader connect (which does the connecting  and also writes out the GIV, so the state of the returned socket  is the same as a socket which the accpetUpload methos would  expect)and delegates to the acceptUpload method with the socket  it gets from connecting. <p>
 * @param file the fully qualified pathname of the file to upload
 * @param host the ip address of the host to upload to
 * @param port the port over which the transfer will occur
 * @param index the index of the file in <tt>FileManager</tt>
 * @param guid the unique identifying client guid of the uploading client
 */
public synchronized void acceptPushUpload(final String file,final String host,final int port,final int index,final String guid){
  final HTTPUploader GIVuploader=new HTTPUploader(file,host,port,index,guid,this,_fileManager,_router);
  clearFailedPushes();
  if ((!testAttemptingPush(host,index)) || (!testFailedPush(host,index)))   return;
  insertAttemptingPush(host,index);
  Thread runner=new Thread(){
    public void run(){
      try {
        Socket s=GIVuploader.connect();
        acceptUpload(HTTPRequestMethod.GET,s);
      }
 catch (      IOException ioe) {
synchronized (UploadManager.this) {
          insertFailedPush(host,index);
        }
      }
catch (      Exception e) {
        _callback.error(e);
      }
 finally {
        GIVuploader.stop();
synchronized (UploadManager.this) {
          removeAttemptingPush(host,index);
        }
      }
    }
  }
;
  runner.start();
}

Fixed version (ground truth):
/** 
 * Accepts a new push upload, creating a new <tt>HTTPUploader</tt>. NON-BLOCKING: creates a new thread to transfer the file. <p> The thread makes the uploader connect (which does the connecting  and also writes out the GIV, so the state of the returned socket  is the same as a socket which the accpetUpload methos would  expect)and delegates to the acceptUpload method with the socket  it gets from connecting. <p>
 * @param file the fully qualified pathname of the file to upload
 * @param host the ip address of the host to upload to
 * @param port the port over which the transfer will occur
 * @param index the index of the file in <tt>FileManager</tt>
 * @param guid the unique identifying client guid of the uploading client
 */
public synchronized void acceptPushUpload(final String file,final String host,final int port,final int index,final String guid){
  final HTTPUploader GIVuploader=new HTTPUploader(file,host,port,index,guid,this,_fileManager,_router);
  clearFailedPushes();
  if ((!testAttemptingPush(host,index)) || (!testFailedPush(host,index)))   return;
  insertAttemptingPush(host,index);
  Thread runner=new Thread(){
    public void run(){
      try {
        Socket s=GIVuploader.connect();
        String word=IOUtils.readWord(s.getInputStream(),4);
        if (word.equals("String_Node_Str"))         acceptUpload(HTTPRequestMethod.GET,s);
 else         if (word.equals("String_Node_Str"))         acceptUpload(HTTPRequestMethod.HEAD,s);
 else         throw new IOException();
      }
 catch (      IOException ioe) {
synchronized (UploadManager.this) {
          insertFailedPush(host,index);
        }
      }
catch (      Exception e) {
        _callback.error(e);
      }
 finally {
        GIVuploader.stop();
synchronized (UploadManager.this) {
          removeAttemptingPush(host,index);
        }
      }
    }
  }
;
  runner.start();
}