Program: 64207
Project: 64207
Buggy source:
/** 
 * Top level invocation for a slow scan. A slow scan builds up a full list of excluded/included files/directories, whereas a fast scan will only have full results for included files, as it ignores directories which can't possibly hold any included files/directories. <p> Returns immediately if a slow scan has already been completed.
 */
protected void slowScan(){
synchronized (slowScanLock) {
    if (haveSlowResults) {
      return;
    }
    if (slowScanning) {
      while (slowScanning) {
        try {
          slowScanLock.wait();
        }
 catch (        InterruptedException e) {
        }
      }
      return;
    }
    slowScanning=true;
  }
  try {
synchronized (this) {
      String[] excl=new String[dirsExcluded.size()];
      dirsExcluded.copyInto(excl);
      String[] notIncl=new String[dirsNotIncluded.size()];
      dirsNotIncluded.copyInto(notIncl);
      for (int i=0; i < excl.length; i++) {
        if (!couldHoldIncluded(excl[i])) {
          scandir(new File(basedir,excl[i]),excl[i] + File.separator,false);
        }
      }
      for (int i=0; i < notIncl.length; i++) {
        if (!couldHoldIncluded(notIncl[i])) {
          scandir(new File(basedir,notIncl[i]),notIncl[i] + File.separator,false);
        }
      }
    }
  }
  finally {
synchronized (slowScanLock) {
      haveSlowResults=true;
      slowScanning=false;
      slowScanLock.notifyAll();
    }
  }
}

Fixed version (ground truth):
/** 
 * Top level invocation for a slow scan. A slow scan builds up a full list of excluded/included files/directories, whereas a fast scan will only have full results for included files, as it ignores directories which can't possibly hold any included files/directories. <p> Returns immediately if a slow scan has already been completed.
 */
protected void slowScan(){
synchronized (slowScanLock) {
    if (haveSlowResults) {
      return;
    }
    if (slowScanning) {
      while (slowScanning) {
        try {
          slowScanLock.wait();
        }
 catch (        InterruptedException e) {
        }
      }
      return;
    }
    slowScanning=true;
  }
  try {
synchronized (this) {
      boolean nullIncludes=(includes == null);
      includes=nullIncludes ? new String[]{"String_Node_Str"} : includes;
      boolean nullExcludes=(excludes == null);
      excludes=nullExcludes ? new String[0] : excludes;
      String[] excl=new String[dirsExcluded.size()];
      dirsExcluded.copyInto(excl);
      String[] notIncl=new String[dirsNotIncluded.size()];
      dirsNotIncluded.copyInto(notIncl);
      for (int i=0; i < excl.length; i++) {
        if (!couldHoldIncluded(excl[i])) {
          scandir(new File(basedir,excl[i]),excl[i] + File.separator,false);
        }
      }
      for (int i=0; i < notIncl.length; i++) {
        if (!couldHoldIncluded(notIncl[i])) {
          scandir(new File(basedir,notIncl[i]),notIncl[i] + File.separator,false);
        }
      }
      clearCaches();
      includes=nullIncludes ? null : includes;
      excludes=nullExcludes ? null : excludes;
    }
  }
  finally {
synchronized (slowScanLock) {
      haveSlowResults=true;
      slowScanning=false;
      slowScanLock.notifyAll();
    }
  }
}