Program: 4358
Project: 4358
Buggy source:
/** 
 * Like tryDownloads2, but does not deal with the library, cleaning up corrupt files, etc.  Caller should look at corruptState to determine if the file is corrupted; a return value of COMPLETE does not mean no corruptions where encountered.
 * @return COMPLETE if a file was successfully downloadedWAITING_FOR_RETRY if no file was downloaded, but it makes sense  to try again later because some hosts reported busy. The caller should usually wait before retrying. GAVE_UP the download attempt failed, and there are  no more locations to try. COULDNT_MOVE_TO_LIBRARY couldn't write the incomplete file
 * @exception InterruptedException if the someone stop()'ed this download.stop() was called either because the user killed the download or a corruption was detected and they chose to kill and discard the download.  Calls to resume() do not result in InterruptedException.
 */
private int fireDownloadWorkers() throws InterruptedException {
  LOG.trace("String_Node_Str");
  int size=-1;
  while (true) {
    if (stopped || paused) {
      LOG.warn("String_Node_Str");
      throw new InterruptedException();
    }
    LOG.debug("String_Node_Str");
    try {
      commonOutFile.waitForPendingIfNeeded();
    }
 catch (    DiskException dio) {
      if (stopped || paused) {
        LOG.warn("String_Node_Str");
        throw new InterruptedException();
      }
      stop();
      return DISK_PROBLEM;
    }
    LOG.debug("String_Node_Str");
    if (commonOutFile.isComplete()) {
      killAllWorkers();
      LOG.trace("String_Node_Str");
      return COMPLETE;
    }
synchronized (this) {
      if (_workers.size() == 0 && !ranker.hasNonBusy()) {
        receivedNewSources=false;
        if (ranker.calculateWaitTime() > 0) {
          LOG.trace("String_Node_Str");
          return BUSY;
        }
 else {
          LOG.trace("String_Node_Str");
          return GAVE_UP;
        }
      }
      if (LOG.isDebugEnabled())       LOG.debug("String_Node_Str" + _activeWorkers.size() + "String_Node_Str"+ _workers.size());
      if (shouldStartWorker()) {
        ranker=getSourceRanker(ranker);
        RemoteFileDesc rfd=ranker.getBest();
        if (rfd != null) {
          if (rfd.isBusy())           addRFD(rfd);
 else           startWorker(rfd);
        }
      }
 else       if (LOG.isDebugEnabled())       LOG.debug("String_Node_Str");
      try {
        this.wait(DownloadSettings.WORKER_INTERVAL.getValue());
      }
 catch (      InterruptedException ignored) {
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Like tryDownloads2, but does not deal with the library, cleaning up corrupt files, etc.  Caller should look at corruptState to determine if the file is corrupted; a return value of COMPLETE does not mean no corruptions where encountered.
 * @return COMPLETE if a file was successfully downloadedWAITING_FOR_RETRY if no file was downloaded, but it makes sense  to try again later because some hosts reported busy. The caller should usually wait before retrying. GAVE_UP the download attempt failed, and there are  no more locations to try. COULDNT_MOVE_TO_LIBRARY couldn't write the incomplete file
 * @exception InterruptedException if the someone stop()'ed this download.stop() was called either because the user killed the download or a corruption was detected and they chose to kill and discard the download.  Calls to resume() do not result in InterruptedException.
 */
private int fireDownloadWorkers() throws InterruptedException {
  LOG.trace("String_Node_Str");
  while (true) {
    if (stopped || paused) {
      LOG.warn("String_Node_Str");
      throw new InterruptedException();
    }
    LOG.debug("String_Node_Str");
    try {
      commonOutFile.waitForPendingIfNeeded();
    }
 catch (    DiskException dio) {
      if (stopped || paused) {
        LOG.warn("String_Node_Str");
        throw new InterruptedException();
      }
      stop();
      return DISK_PROBLEM;
    }
    LOG.debug("String_Node_Str");
    if (commonOutFile.isComplete()) {
      killAllWorkers();
      LOG.trace("String_Node_Str");
      return COMPLETE;
    }
synchronized (this) {
      if (_workers.size() == 0 && !ranker.hasNonBusy()) {
        receivedNewSources=false;
        if (ranker.calculateWaitTime() > 0) {
          LOG.trace("String_Node_Str");
          return BUSY;
        }
 else {
          LOG.trace("String_Node_Str");
          return GAVE_UP;
        }
      }
      if (LOG.isDebugEnabled())       LOG.debug("String_Node_Str" + _activeWorkers.size() + "String_Node_Str"+ _workers.size());
      if (shouldStartWorker()) {
        ranker=getSourceRanker(ranker);
        RemoteFileDesc rfd=ranker.getBest();
        if (rfd != null) {
          if (rfd.isBusy())           addRFD(rfd);
 else           startWorker(rfd);
        }
      }
 else       if (LOG.isDebugEnabled())       LOG.debug("String_Node_Str");
      try {
        this.wait(DownloadSettings.WORKER_INTERVAL.getValue());
      }
 catch (      InterruptedException ignored) {
      }
    }
  }
}