Program: 4131
Project: 4131
Buggy source:
/** 
 * Recursively adds this directory and all subdirectories to the shared directories as well as queueing their files for sharing.  Does nothing if <tt>directory</tt> doesn't exist, isn't a directory, or has already been added.  This method is thread-safe.  It acquires locks on a per-directory basis.  If the current revision ever changes from the expected revision, this returns immediately.
 * @requires directory is part of DIRECTORIES_TO_SHARE or one of itschildren, and parent is directory's shared parent or null if directory's parent is not shared.
 * @modifies this
 */
private void updateSharedDirectories(File directory,File parent,int revision){
  try {
    directory=FileUtils.getCanonicalFile(directory);
  }
 catch (  IOException e) {
    return;
  }
  if (!directory.exists())   return;
  if (!isFolderShareable(directory,true))   return;
  if (isSensitiveDirectory(directory)) {
    if (_data.SENSITIVE_DIRECTORIES_NOT_TO_SHARE.contains(directory))     return;
    if (_data.SENSITIVE_DIRECTORIES_VALIDATED.contains(directory)) {
      if (!fileManagerController.warnAboutSharingSensitiveDirectory(directory))       return;
    }
  }
  if (_revision != revision)   return;
  boolean isForcedShare=isForcedShareDirectory(directory);
synchronized (this) {
    if (_completelySharedDirectories.contains(directory))     return;
    if (!_storeDirectories.contains(directory))     _completelySharedDirectories.add(directory);
    if (!isForcedShare) {
      dispatchFileEvent(new FileManagerEvent(this,Type.ADD_FOLDER,directory,parent));
    }
  }
  File[] file_list=directory.listFiles(SHAREABLE_FILE_FILTER);
  if (file_list == null)   return;
  for (int i=0; i < file_list.length && _revision == revision; i++)   addFileIfSharedOrStore(file_list[i],EMPTY_DOCUMENTS,true,_revision,null,AddType.ADD_SHARE);
  if (_revision != revision)   return;
  if (isForcedShare)   return;
  File[] dir_list=directory.listFiles(DIRECTORY_FILTER);
  if (dir_list != null) {
    for (int i=0; i < dir_list.length && _revision == revision; i++)     updateSharedDirectories(dir_list[i],directory,revision);
  }
}

Fixed version (ground truth):
/** 
 * Recursively adds this directory and all subdirectories to the shared directories as well as queueing their files for sharing.  Does nothing if <tt>directory</tt> doesn't exist, isn't a directory, or has already been added.  This method is thread-safe.  It acquires locks on a per-directory basis.  If the current revision ever changes from the expected revision, this returns immediately.
 * @requires directory is part of DIRECTORIES_TO_SHARE or one of itschildren, and parent is directory's shared parent or null if directory's parent is not shared.
 * @modifies this
 */
private void updateSharedDirectories(File directory,File parent,int revision){
  try {
    directory=FileUtils.getCanonicalFile(directory);
  }
 catch (  IOException e) {
    return;
  }
  if (!directory.exists())   return;
  if (!isFolderShareable(directory,true))   return;
  if (isSensitiveDirectory(directory)) {
    if (_data.SENSITIVE_DIRECTORIES_NOT_TO_SHARE.contains(directory)) {
      return;
    }
    if (!_data.SENSITIVE_DIRECTORIES_VALIDATED.contains(directory)) {
      if (!fileManagerController.warnAboutSharingSensitiveDirectory(directory))       return;
    }
  }
  if (_revision != revision)   return;
  boolean isForcedShare=isForcedShareDirectory(directory);
synchronized (this) {
    if (_completelySharedDirectories.contains(directory))     return;
    if (!_storeDirectories.contains(directory))     _completelySharedDirectories.add(directory);
    if (!isForcedShare) {
      dispatchFileEvent(new FileManagerEvent(this,Type.ADD_FOLDER,directory,parent));
    }
  }
  File[] file_list=directory.listFiles(SHAREABLE_FILE_FILTER);
  if (file_list == null)   return;
  for (int i=0; i < file_list.length && _revision == revision; i++)   addFileIfSharedOrStore(file_list[i],EMPTY_DOCUMENTS,true,_revision,null,AddType.ADD_SHARE);
  if (_revision != revision)   return;
  if (isForcedShare)   return;
  File[] dir_list=directory.listFiles(DIRECTORY_FILTER);
  if (dir_list != null) {
    for (int i=0; i < dir_list.length && _revision == revision; i++)     updateSharedDirectories(dir_list[i],directory,revision);
  }
}