Program: 4869
Project: 4869
Buggy source:
/** 
 * @requires the given file exists and is in a shared directory
 * @modifies this
 * @effects adds the given file to this if it is of the proper extension andnot too big (>~2GB).  Returns true iff the file was actually added. <b>WARNING: this is a potential security hazard; caller must ensure the file is in the shared directory.</b> 
 */
private boolean addFile(File file){
  repOk();
  if (!hasExtension(file.getName())) {
    return false;
  }
  long fileLength=file.length();
  if (fileLength > Integer.MAX_VALUE || fileLength < 0)   return false;
  Set urns=FileDesc.calculateAndCacheURN(file);
  if (_loadThreadInterrupted)   return false;
synchronized (this) {
    _size+=fileLength;
    int fileIndex=_files.size();
    FileDesc fileDesc=new FileDesc(file,urns,fileIndex);
    _files.add(fileDesc);
    _numFiles++;
    File parent=getParentFile(file);
    Assert.that(parent != null,"String_Node_Str" + file + "String_Node_Str");
    IntSet siblings=(IntSet)_sharedDirectories.get(parent);
    Assert.that(siblings != null,"String_Node_Str" + parent + "String_Node_Str"+ _sharedDirectories);
    boolean added=siblings.add(fileIndex);
    Assert.that(added,"String_Node_Str" + fileIndex + "String_Node_Str"+ siblings);
    if (_callback != null)     _callback.addSharedFile(file,parent);
    String path=file.getAbsolutePath();
    String[] keywords=StringUtils.split(path,DELIMETERS);
    for (int i=0; i < keywords.length; i++) {
      String keyword=keywords[i];
      IntSet indices=(IntSet)_index.get(keyword);
      if (indices == null) {
        indices=new IntSet();
        _index.add(keyword,indices);
      }
      indices.add(fileIndex);
    }
    this.updateUrnIndex(fileDesc);
    repOk();
    return true;
  }
}

Fixed version (ground truth):
/** 
 * @requires the given file exists and is in a shared directory
 * @modifies this
 * @effects adds the given file to this if it is of the proper extension andnot too big (>~2GB).  Returns true iff the file was actually added. <b>WARNING: this is a potential security hazard; caller must ensure the file is in the shared directory.</b> 
 */
private boolean addFile(File file){
  repOk();
  if (!hasExtension(file.getName())) {
    return false;
  }
  long fileLength=file.length();
  if (fileLength > Integer.MAX_VALUE || fileLength < 0)   return false;
  Set urns=FileDesc.calculateAndCacheURN(file);
  if (loadThreadInterrupted())   return false;
synchronized (this) {
    _size+=fileLength;
    int fileIndex=_files.size();
    FileDesc fileDesc=new FileDesc(file,urns,fileIndex);
    _files.add(fileDesc);
    _numFiles++;
    File parent=getParentFile(file);
    Assert.that(parent != null,"String_Node_Str" + file + "String_Node_Str");
    IntSet siblings=(IntSet)_sharedDirectories.get(parent);
    Assert.that(siblings != null,"String_Node_Str" + parent + "String_Node_Str"+ _sharedDirectories);
    boolean added=siblings.add(fileIndex);
    Assert.that(added,"String_Node_Str" + fileIndex + "String_Node_Str"+ siblings);
    if (_callback != null)     _callback.addSharedFile(file,parent);
    String path=file.getAbsolutePath();
    String[] keywords=StringUtils.split(path,DELIMETERS);
    for (int i=0; i < keywords.length; i++) {
      String keyword=keywords[i];
      IntSet indices=(IntSet)_index.get(keyword);
      if (indices == null) {
        indices=new IntSet();
        _index.add(keyword,indices);
      }
      indices.add(fileIndex);
    }
    this.updateUrnIndex(fileDesc);
    repOk();
    return true;
  }
}