Program: 77514
Project: 77514
Buggy source:
/** 
 * Reloads the library with the given file path. After reloading, acticity stack is cleared.
 * @param location the URL file path of the library file.
 * @throws DesignFileException if the file does no exist.
 * @throws SemanticException if the library is not included in the current module.
 */
public void reloadLibrary(String location) throws DesignFileException, SemanticException {
  Library library=module.getLibraryByLocation(location);
  if (!module.getLibraries().contains(library)) {
    throw new LibraryException(library,new String[]{library == null ? null : library.getNamespace()},LibraryException.DESIGN_EXCEPTION_LIBRARY_NOT_FOUND);
  }
  String namespace=library.getNamespace();
  IncludedLibrary includedItem=module.findIncludedLibrary(namespace);
  String path=includedItem.getFileName();
  URL url=module.findResource(path,IResourceLocator.LIBRARY);
  if (url == null) {
    DesignParserException ex=new DesignParserException(new String[]{path},DesignParserException.DESIGN_EXCEPTION_FILE_NOT_FOUND);
    List exceptionList=new ArrayList();
    exceptionList.add(ex);
    throw new DesignFileException(path,exceptionList);
  }
  Map overriddenValues=null;
  ActivityStack activityStack=getActivityStack();
  activityStack.startSilentTrans(true);
  try {
    overriddenValues=dealAllElementDecendents(library,RELOAD_ACTION);
    doDropLibrary(library);
    doAddLibrary(path,namespace,RELOAD_ACTION,overriddenValues);
  }
 catch (  SemanticException e) {
    activityStack.rollback();
    throw e;
  }
catch (  DesignFileException e) {
    activityStack.rollback();
    throw e;
  }
  LibraryReloadedEvent event=new LibraryReloadedEvent(module.getLibraryByLocation(url.toExternalForm()));
  module.broadcast(event);
  activityStack.commit();
  activityStack.flush();
}

Fixed version (ground truth):
/** 
 * Reloads the library with the given file path. After reloading, acticity stack is cleared.
 * @param location the URL file path of the library file.
 * @throws DesignFileException if the file does no exist.
 * @throws SemanticException if the library is not included in the current module.
 */
public void reloadLibrary(String location) throws DesignFileException, SemanticException {
  Library library=module.getLibraryByLocation(location,IAccessControl.ARBITARY_LEVEL);
  if (library == null)   throw new LibraryException(library,null,LibraryException.DESIGN_EXCEPTION_LIBRARY_NOT_FOUND);
  while (library != null) {
    if (library.getHost() == module)     break;
    library=(Library)library.getHost();
  }
  String namespace=library.getNamespace();
  IncludedLibrary includedItem=module.findIncludedLibrary(namespace);
  String path=includedItem.getFileName();
  URL url=module.findResource(path,IResourceLocator.LIBRARY);
  if (url == null) {
    DesignParserException ex=new DesignParserException(new String[]{path},DesignParserException.DESIGN_EXCEPTION_FILE_NOT_FOUND);
    List exceptionList=new ArrayList();
    exceptionList.add(ex);
    throw new DesignFileException(path,exceptionList);
  }
  Map overriddenValues=null;
  ActivityStack activityStack=getActivityStack();
  activityStack.startSilentTrans(true);
  try {
    overriddenValues=dealAllElementDecendents(library,RELOAD_ACTION);
    doDropLibrary(library);
    doAddLibrary(path,namespace,RELOAD_ACTION,overriddenValues);
  }
 catch (  SemanticException e) {
    activityStack.rollback();
    throw e;
  }
catch (  DesignFileException e) {
    activityStack.rollback();
    throw e;
  }
  LibraryReloadedEvent event=new LibraryReloadedEvent(module.getLibraryByLocation(url.toExternalForm()));
  module.broadcast(event);
  activityStack.commit();
  activityStack.flush();
}