Program: 4442
Project: 4442
Buggy source:
/** 
 * Notifies all existing HTTPDownloaders about this RFD. If good is true, it notifies them of a succesful alternate location, otherwise it notifies them of a failed alternate location. The internal validAlts is also updated if good is true, and invalidAlts is updated if good is false. The IncompleteFileDesc is also notified of new locations for this file.
 */
private synchronized void informMesh(RemoteFileDesc rfd,boolean good){
  URN bucketHash=null;
  IncompleteFileDesc ifd=null;
  AlternateLocation loc=null;
  AlternateLocation forFD=null;
  if (!rfd.isAltLocCapable())   return;
  bucketHash=buckets.getURNForBucket(bucketNumber);
  Assert.that(bucketHash != null,"String_Node_Str");
  Assert.that(bucketHash.equals(rfd.getSHA1Urn()),"String_Node_Str");
  if (validAlts == null)   validAlts=AlternateLocationCollection.create(bucketHash);
  try {
    loc=AlternateLocation.create(rfd);
    forFD=AlternateLocation.create(rfd);
  }
 catch (  IOException iox) {
    return;
  }
  for (Iterator iter=dloaders.iterator(); iter.hasNext(); ) {
    HTTPDownloader httpDloader=(HTTPDownloader)iter.next();
    RemoteFileDesc r=httpDloader.getRemoteFileDesc();
    if (r.getHost() == rfd.getHost() && r.getPort() == rfd.getPort())     continue;
    if (good)     httpDloader.addSuccessfulAltLoc(loc);
 else     httpDloader.addFailedAltLoc(loc);
  }
  FileDesc fd=fileManager.getFileDescForFile(incompleteFile);
  if (fd != null && fd instanceof IncompleteFileDesc) {
    ifd=(IncompleteFileDesc)fd;
    if (!bucketHash.equals(ifd.getSHA1Urn())) {
      Assert.silent(false,"String_Node_Str" + "String_Node_Str" + incompleteFile + "String_Node_Str"+ ifd.getFile()+ "String_Node_Str"+ bucketHash+ "String_Node_Str"+ DataUtils.listSet(ifd.getUrns())+ "String_Node_Str"+ incompleteFileManager.dumpHashes());
      fileManager.removeFileIfShared(incompleteFile);
      ifd=null;
    }
  }
  if (good) {
synchronized (altLock) {
      if (!validAlts.contains(loc)) {
        if (RECORD_STATS && rfd.isFromAlternateLocation())         DownloadStat.ALTERNATE_WORKED.incrementStat();
        validAlts.add(loc);
        if (ifd != null)         ifd.addVerified(forFD);
      }
 else {
        if (RECORD_STATS && rfd.isFromAlternateLocation())         DownloadStat.ALTERNATE_NOT_ADDED.incrementStat();
        validAlts.remove(loc);
        if (ifd != null)         ifd.remove(forFD);
        invalidAlts.add(rfd.getRemoteHostData());
        recentInvalidAlts.add(loc);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Notifies all existing HTTPDownloaders about this RFD. If good is true, it notifies them of a succesful alternate location, otherwise it notifies them of a failed alternate location. The internal validAlts is also updated if good is true, and invalidAlts is updated if good is false. The IncompleteFileDesc is also notified of new locations for this file.
 */
private synchronized void informMesh(RemoteFileDesc rfd,boolean good){
  URN bucketHash=null;
  IncompleteFileDesc ifd=null;
  AlternateLocation loc=null;
  AlternateLocation forFD=null;
  if (!rfd.isAltLocCapable())   return;
  bucketHash=buckets.getURNForBucket(bucketNumber);
  Assert.that(bucketHash != null,"String_Node_Str");
  Assert.that(bucketHash.equals(rfd.getSHA1Urn()),"String_Node_Str");
  if (validAlts == null)   validAlts=AlternateLocationCollection.create(bucketHash);
  try {
    loc=AlternateLocation.create(rfd);
    forFD=AlternateLocation.create(rfd);
  }
 catch (  IOException iox) {
    return;
  }
  for (Iterator iter=dloaders.iterator(); iter.hasNext(); ) {
    HTTPDownloader httpDloader=(HTTPDownloader)iter.next();
    RemoteFileDesc r=httpDloader.getRemoteFileDesc();
    if (r.getHost() == rfd.getHost() && r.getPort() == rfd.getPort())     continue;
    if (good)     httpDloader.addSuccessfulAltLoc(loc);
 else     httpDloader.addFailedAltLoc(loc);
  }
  FileDesc fd=fileManager.getFileDescForFile(incompleteFile);
  if (fd != null && fd instanceof IncompleteFileDesc) {
    ifd=(IncompleteFileDesc)fd;
    if (!bucketHash.equals(ifd.getSHA1Urn())) {
      Assert.silent(false,"String_Node_Str" + "String_Node_Str" + incompleteFile + "String_Node_Str"+ ifd.getFile()+ "String_Node_Str"+ bucketHash+ "String_Node_Str"+ DataUtils.listSet(ifd.getUrns())+ "String_Node_Str"+ incompleteFileManager.dumpHashes());
      fileManager.removeFileIfShared(incompleteFile);
      ifd=null;
    }
  }
synchronized (altLock) {
    if (good) {
      if (!validAlts.contains(loc)) {
        if (RECORD_STATS && rfd.isFromAlternateLocation())         DownloadStat.ALTERNATE_WORKED.incrementStat();
        validAlts.add(loc);
        if (ifd != null)         ifd.addVerified(forFD);
      }
    }
 else {
      if (RECORD_STATS && rfd.isFromAlternateLocation())       DownloadStat.ALTERNATE_NOT_ADDED.incrementStat();
      validAlts.remove(loc);
      if (ifd != null)       ifd.remove(forFD);
      invalidAlts.add(rfd.getRemoteHostData());
      recentInvalidAlts.add(loc);
    }
  }
}