Program: 209
Project: 209
Buggy source:
/** 
 * Changes parent keymap for the Vim
 * @return true if document was changed successfully
 */
private static boolean configureVimParentKeymap(final String path,@NotNull final Document document,final boolean showNotification) throws IOException {
  final Element rootElement=document.getRootElement();
  final String parentKeymap=rootElement.getAttributeValue("String_Node_Str");
  final VimKeymapDialog vimKeymapDialog=new VimKeymapDialog(parentKeymap);
  vimKeymapDialog.show();
  if (vimKeymapDialog.getExitCode() != DialogWrapper.OK_EXIT_CODE) {
    return false;
  }
  rootElement.removeAttribute("String_Node_Str");
  final Keymap selectedKeymap=vimKeymapDialog.getSelectedKeymap();
  final String keymapName=selectedKeymap.getName();
  rootElement.setAttribute("String_Node_Str",keymapName);
  VimPlugin.getInstance().setPreviousKeyMap(keymapName);
  VimKeymapConflictResolveUtil.resolveConflicts(rootElement,selectedKeymap);
  JDOMUtil.writeDocument(document,path,"String_Node_Str");
  if (showNotification) {
    Notifications.Bus.notify(new Notification(VimPlugin.IDEAVIM_NOTIFICATION_ID,VimPlugin.IDEAVIM_NOTIFICATION_TITLE,"String_Node_Str" + selectedKeymap.getPresentableName(),NotificationType.INFORMATION));
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Changes parent keymap for the Vim
 * @return true if document was changed successfully
 */
private static boolean configureVimParentKeymap(final String path,@NotNull final Document document,final boolean showNotification) throws IOException, InvalidDataException {
  final Element rootElement=document.getRootElement();
  final String parentKeymapName=rootElement.getAttributeValue("String_Node_Str");
  final VimKeymapDialog vimKeymapDialog=new VimKeymapDialog(parentKeymapName);
  vimKeymapDialog.show();
  if (vimKeymapDialog.getExitCode() != DialogWrapper.OK_EXIT_CODE) {
    return false;
  }
  rootElement.removeAttribute("String_Node_Str");
  final Keymap parentKeymap=vimKeymapDialog.getSelectedKeymap();
  final String keymapName=parentKeymap.getName();
  VimKeymapConflictResolveUtil.resolveConflicts(rootElement,parentKeymap);
  if (parentKeymap.canModify()) {
    final KeymapImpl vimKeyMap=new KeymapImpl();
    final KeymapManager keymapManager=KeymapManager.getInstance();
    final KeymapManagerImpl keymapManagerImpl=(KeymapManagerImpl)keymapManager;
    final Keymap[] allKeymaps=keymapManagerImpl.getAllKeymaps();
    vimKeyMap.readExternal(rootElement,allKeymaps);
    final HashSet<String> ownActions=new HashSet<String>(Arrays.asList(vimKeyMap.getOwnActionIds()));
    final KeymapImpl parentKeymapImpl=(KeymapImpl)parentKeymap;
    for (    String parentAction : parentKeymapImpl.getOwnActionIds()) {
      if (!ownActions.contains(parentAction)) {
        final List<Shortcut> shortcuts=Arrays.asList(parentKeymap.getShortcuts(parentAction));
        rootElement.addContent(VimKeymapConflictResolveUtil.createActionElement(parentAction,shortcuts));
      }
    }
    final Keymap grandParentKeymap=parentKeymap.getParent();
    rootElement.setAttribute("String_Node_Str",grandParentKeymap.getName());
  }
 else {
    rootElement.setAttribute("String_Node_Str",keymapName);
  }
  VimPlugin.getInstance().setPreviousKeyMap(keymapName);
  JDOMUtil.writeDocument(document,path,"String_Node_Str");
  if (showNotification) {
    Notifications.Bus.notify(new Notification(VimPlugin.IDEAVIM_NOTIFICATION_ID,VimPlugin.IDEAVIM_NOTIFICATION_TITLE,"String_Node_Str" + parentKeymap.getPresentableName(),NotificationType.INFORMATION));
  }
  return true;
}