Program: 136154
Project: 136154
Buggy source:
/** 
 * Update all the type users (children) to the latest version of the parent library. Also update extension owners. <p> Library Provider node lists all of the parent's type users that are assigned types from the owner library.
 * @param providerLibNode
 */
private void updateLibrary(LibraryProviderNode providerLibNode){
  DefaultRepositoryController rc=(DefaultRepositoryController)mc.getRepositoryController();
  LibraryNode libToUpdate=(LibraryNode)providerLibNode.getParent();
  LibraryNode libProvidingTypes=providerLibNode.getOwner();
  List<TypeUser> usersToUpdate=new ArrayList<TypeUser>();
  List<ExtensionOwner> extensionsToUpdate=new ArrayList<ExtensionOwner>();
  List<ContextualFacetNode> facetsToUpdate=new ArrayList<ContextualFacetNode>();
  for (  Node user : providerLibNode.getChildren(false))   if (user instanceof TypeUserNode) {
    if (!usersToUpdate.contains(((TypeUserNode)user).getOwner()))     usersToUpdate.add(((TypeUserNode)user).getOwner());
  }
 else   if (user instanceof ExtensionUserNode) {
    if (!extensionsToUpdate.contains(((ExtensionUserNode)user).getOwner()))     extensionsToUpdate.add(((ExtensionUserNode)user).getOwner());
  }
 else   if (user instanceof ContextualFacetUserNode) {
    if (!facetsToUpdate.contains(((ContextualFacetUserNode)user).getOwner()))     facetsToUpdate.add(((ContextualFacetUserNode)user).getOwner());
  }
  if (usersToUpdate.isEmpty() && extensionsToUpdate.isEmpty() && facetsToUpdate.isEmpty()) {
    DialogUserNotifier.openWarning("String_Node_Str","String_Node_Str");
    return;
  }
  String question="String_Node_Str";
  String[] buttons={"String_Node_Str","String_Node_Str","String_Node_Str"};
  int result=DialogUserNotifier.openQuestionWithButtons("String_Node_Str",question,buttons);
  boolean includeDrafts=false;
  if (result == 0)   includeDrafts=true;
 else   if (result == 2)   return;
  LibraryNode replacement=null;
  try {
    replacement=rc.getLatestVersion(libProvidingTypes,includeDrafts);
  }
 catch (  RepositoryException e1) {
    if (replacement == null)     try {
      replacement=rc.getLatestVersion(libProvidingTypes,includeDrafts);
    }
 catch (    RepositoryException e) {
      DialogUserNotifier.openWarning("String_Node_Str",e.getLocalizedMessage());
      return;
    }
  }
  if (replacement == null || replacement == libProvidingTypes) {
    DialogUserNotifier.openWarning("String_Node_Str","String_Node_Str");
    return;
  }
  question="String_Node_Str" + libProvidingTypes.getNameWithPrefix() + "String_Node_Str"+ replacement.getNameWithPrefix()+ "String_Node_Str";
  if (DialogUserNotifier.openQuestion("String_Node_Str",question)) {
    replacement.replaceAllUsers(usersToUpdate);
    replacement.replaceAllExtensions(extensionsToUpdate);
    replacement.replaceAllContributors(facetsToUpdate);
  }
  libToUpdate.getWhereUsedHandler().refreshUsedByNode();
  mc.refresh(libToUpdate);
}

Fixed version (ground truth):
/** 
 * Update all the type users (children) to the latest version of the parent library. Also update extension owners. <p> Library Provider node lists all of the parent's type users that are assigned types from the owner library.
 * @param providerLibNode - owner is the library that provides types to the parent lib
 */
private void updateLibrary(LibraryProviderNode providerLibNode){
  DefaultRepositoryController rc=(DefaultRepositoryController)mc.getRepositoryController();
  LibraryNode libToUpdate=(LibraryNode)providerLibNode.getParent();
  LibraryNode libProvidingTypes=providerLibNode.getOwner();
  LibraryUsersToUpdateHelper toUpdate=new LibraryUsersToUpdateHelper(providerLibNode);
  if (toUpdate.isEmpty()) {
    DialogUserNotifier.openWarning("String_Node_Str","String_Node_Str");
    return;
  }
  String question="String_Node_Str";
  String[] buttons={"String_Node_Str","String_Node_Str","String_Node_Str"};
  int result=DialogUserNotifier.openQuestionWithButtons("String_Node_Str",question,buttons);
  boolean includeDrafts=false;
  if (result == 0)   includeDrafts=true;
 else   if (result == 2)   return;
  LibraryNode replacement=null;
  try {
    replacement=rc.getLatestVersion(libProvidingTypes,includeDrafts);
  }
 catch (  RepositoryException e1) {
    if (replacement == null)     try {
      replacement=rc.getLatestVersion(libProvidingTypes,includeDrafts);
    }
 catch (    RepositoryException e) {
      DialogUserNotifier.openWarning("String_Node_Str",e.getLocalizedMessage());
      return;
    }
  }
  if (replacement == null || replacement == libProvidingTypes) {
    DialogUserNotifier.openWarning("String_Node_Str","String_Node_Str");
    return;
  }
  question="String_Node_Str" + libProvidingTypes.getNameWithPrefix() + "String_Node_Str"+ replacement.getNameWithPrefix()+ "String_Node_Str";
  if (DialogUserNotifier.openQuestion("String_Node_Str",question)) {
    toUpdate.replace(replacement);
  }
  libToUpdate.getWhereUsedHandler().refreshUsedByNode();
  mc.refresh(libToUpdate);
}