Program: 4646
Project: 4646
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
 * @param forceAllow whether or not to force the UploadManager to sendaccept this request when it comes back.
 */
public synchronized void acceptPushUpload(final String file,final String host,final int port,final int index,final String guid,final boolean forceAllow){
  final HTTPUploader GIVuploader=new HTTPUploader(file,host,port,index,guid);
  clearFailedPushes();
  if (!forceAllow && ((!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,forceAllow);
 else         if (word.equals("String_Node_Str"))         acceptUpload(HTTPRequestMethod.HEAD,s,forceAllow);
 else         throw new IOException();
      }
 catch (      IOException ioe) {
synchronized (UploadManager.this) {
          insertFailedPush(host,index);
        }
      }
catch (      Throwable e) {
        ErrorService.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
 * @param forceAllow whether or not to force the UploadManager to sendaccept this request when it comes back.
 */
public void acceptPushUpload(final String file,final String host,final int port,final int index,final String guid,final boolean forceAllow){
  final HTTPUploader GIVuploader=new HTTPUploader(file,host,port,index,guid);
synchronized (UploadManager.this) {
    clearFailedPushes();
    if (!forceAllow && ((!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,forceAllow);
 else         if (word.equals("String_Node_Str"))         acceptUpload(HTTPRequestMethod.HEAD,s,forceAllow);
 else         throw new IOException();
      }
 catch (      IOException ioe) {
synchronized (UploadManager.this) {
          insertFailedPush(host,index);
        }
      }
catch (      Throwable e) {
        ErrorService.error(e);
      }
 finally {
        GIVuploader.stop();
synchronized (UploadManager.this) {
          removeAttemptingPush(host,index);
        }
      }
    }
  }
;
  runner.start();
}