Program: 4353
Project: 4353
Buggy source:
/** 
 * If oldName isn't shared, returns false.  Otherwise removes "oldName", adds "newName", and returns true iff newName is actually shared.  The new file may or may not have the same index as the original. This assumes that oldName has been deleted & newName exists now.
 * @modifies this 
 */
public synchronized void renameFileIfShared(File oldName,final File newName,final FileEventListener callback){
  FileDesc toRemove=getFileDescForFile(oldName);
  if (toRemove == null) {
    FileManagerEvent evt=new FileManagerEvent(this,FileManagerEvent.FAILED,oldName);
    dispatchFileEvent(evt);
    if (callback != null)     callback.handleFileEvent(evt);
    return;
  }
  if (LOG.isDebugEnabled())   LOG.debug("String_Node_Str" + oldName + "String_Node_Str"+ newName);
  List xmlDocs=new LinkedList(toRemove.getLimeXMLDocuments());
  final FileDesc removed=removeFileIfShared(oldName,false);
  Assert.that(removed == toRemove,"String_Node_Str");
  if (_data.SPECIAL_FILES_TO_SHARE.remove(oldName) && !isFileInCompletelySharedDirectory(newName))   _data.SPECIAL_FILES_TO_SHARE.add(newName);
  UrnCache.instance().addUrns(newName,removed.getUrns());
  addFileIfShared(newName,xmlDocs,false,_revision,new FileEventListener(){
    public void handleFileEvent(    FileManagerEvent evt){
      if (LOG.isDebugEnabled())       LOG.debug("String_Node_Str" + evt);
      FileManagerEvent newEvt=null;
      if (evt.isAddEvent()) {
        FileDesc fd=evt.getFileDescs()[0];
        newEvt=new FileManagerEvent(FileManager.this,FileManagerEvent.RENAME,new FileDesc[]{removed,fd});
      }
 else {
        newEvt=new FileManagerEvent(FileManager.this,FileManagerEvent.REMOVE,removed);
      }
      dispatchFileEvent(evt);
      if (callback != null)       callback.handleFileEvent(newEvt);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * If oldName isn't shared, returns false.  Otherwise removes "oldName", adds "newName", and returns true iff newName is actually shared.  The new file may or may not have the same index as the original. This assumes that oldName has been deleted & newName exists now.
 * @modifies this 
 */
public synchronized void renameFileIfShared(File oldName,final File newName,final FileEventListener callback){
  FileDesc toRemove=getFileDescForFile(oldName);
  if (toRemove == null) {
    FileManagerEvent evt=new FileManagerEvent(this,FileManagerEvent.FAILED,oldName);
    dispatchFileEvent(evt);
    if (callback != null)     callback.handleFileEvent(evt);
    return;
  }
  if (LOG.isDebugEnabled())   LOG.debug("String_Node_Str" + oldName + "String_Node_Str"+ newName);
  List xmlDocs=new LinkedList(toRemove.getLimeXMLDocuments());
  final FileDesc removed=removeFileIfShared(oldName,false);
  Assert.that(removed == toRemove,"String_Node_Str");
  if (_data.SPECIAL_FILES_TO_SHARE.remove(oldName) && !isFileInCompletelySharedDirectory(newName))   _data.SPECIAL_FILES_TO_SHARE.add(newName);
  UrnCache.instance().addUrns(newName,removed.getUrns());
  addFileIfShared(newName,xmlDocs,false,_revision,new FileEventListener(){
    public void handleFileEvent(    FileManagerEvent evt){
      if (LOG.isDebugEnabled())       LOG.debug("String_Node_Str" + evt);
      FileManagerEvent newEvt=null;
      if (evt.isAddEvent()) {
        FileDesc fd=evt.getFileDescs()[0];
        newEvt=new FileManagerEvent(FileManager.this,FileManagerEvent.RENAME,new FileDesc[]{removed,fd});
      }
 else {
        newEvt=new FileManagerEvent(FileManager.this,FileManagerEvent.REMOVE,removed);
      }
      dispatchFileEvent(newEvt);
      if (callback != null)       callback.handleFileEvent(newEvt);
    }
  }
);
}