Program: 69297
Project: 69297
Buggy source:
/** 
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,org.olat.core.gui.control.Controller,org.olat.core.gui.control.Event)
 */
protected void event(UserRequest ureq,Controller source,Event event){
  feedResource=feedManager.loadFeed(feedResource);
  accessibleItems=feedManager.loadFilteredAndSortedItems(feedResource,callback,ureq.getIdentity());
  if (source == cmc) {
    if (event.equals(CloseableModalController.CLOSE_MODAL_EVENT)) {
      removeAsListenerAndDispose(cmc);
      cmc=null;
      removeAsListenerAndDispose(itemFormCtr);
      itemFormCtr=null;
      cleanupTmpItemMediaDir(currentItem);
      if (!feedManager.hasItems(feedResource)) {
        feedResource=feedManager.updateFeedMode(null,feedResource);
        makeInternalAndExternalButtons();
      }
      feedManager.releaseLock(lock);
    }
  }
 else   if (source == confirmDialogCtr && DialogBoxUIFactory.isYesEvent(event)) {
    Item item=(Item)((DialogBoxController)source).getUserObject();
    lock=feedManager.acquireLock(feedResource,item,getIdentity());
    if (lock.isSuccess()) {
      naviCtr.remove(item);
      feedResource=feedManager.deleteItem(item);
      deleteButtons.remove(source);
      for (      Link editButton : editButtons) {
        if (item.equals(editButton.getUserObject())) {
          editButtons.remove(editButton);
          break;
        }
      }
      if (!feedManager.hasItems(feedResource)) {
        makeInternalAndExternalButtons();
        fireEvent(ureq,ItemsController.FEED_INFO_IS_DIRTY_EVENT);
      }
 else {
        if (callback.mayEditItems() || callback.mayCreateItems()) {
          createEditButtons(ureq,feedResource);
        }
        createCommentsAndRatingsLinks(ureq,feedResource);
      }
      vcItems.setDirty(true);
      mainPanel.setContent(vcItems);
      feedManager.releaseLock(lock);
      lock=null;
      ThreadLocalUserActivityLogger.log(FeedLoggingAction.FEED_ITEM_DELETE,getClass(),LoggingResourceable.wrap(item));
    }
 else {
      String fullName=userManager.getUserDisplayName(lock.getOwner());
      showInfo("String_Node_Str",fullName);
    }
  }
 else   if (source == itemFormCtr) {
    if (event.equals(Event.CHANGED_EVENT) || event.equals(Event.CANCELLED_EVENT)) {
      if (event.equals(Event.CHANGED_EVENT)) {
        FileElement mediaFile=currentItem.getMediaFile();
        if (feedManager.getItemContainer(currentItem) == null) {
          naviCtr.remove(currentItem);
        }
 else {
          if (!accessibleItems.contains(currentItem)) {
            feedResource=feedManager.createItem(feedResource,currentItem,mediaFile);
            if (feedResource == null) {
              feedResource=feedManager.loadFeed(feedResource);
              if (!feedResource.isInternal() && !feedResource.isExternal() && !feedManager.hasItems(feedResource)) {
                feedResource=feedManager.updateFeedMode(Boolean.FALSE,feedResource);
                feedResource=feedManager.createItem(feedResource,currentItem,mediaFile);
              }
            }
            if (feedResource != null) {
              createButtonsForItem(ureq,feedResource,currentItem);
              createItemLink(currentItem);
              String guid=currentItem.getGuid();
              if (currentItem.getDate() != null) {
                DateComponentFactory.createDateComponentWithYear("String_Node_Str" + guid,currentItem.getDate(),vcItems);
              }
              createCommentsAndRatingsLink(ureq,feedResource,currentItem);
              naviCtr.add(currentItem);
              accessibleItems=feedManager.loadFilteredAndSortedItems(feedResource,callback,ureq.getIdentity());
              if (accessibleItems != null && accessibleItems.size() == 1) {
                fireEvent(ureq,ItemsController.FEED_INFO_IS_DIRTY_EVENT);
                helper.setURIs();
              }
            }
          }
 else {
            currentItem=feedManager.updateItem(currentItem,mediaFile);
            if (itemCtr != null) {
              displayItemController(ureq,currentItem);
            }
            ThreadLocalUserActivityLogger.log(FeedLoggingAction.FEED_ITEM_EDIT,getClass(),LoggingResourceable.wrap(currentItem));
          }
        }
        vcItems.setDirty(true);
        if (itemCtr != null) {
          itemCtr.getInitialComponent().setDirty(true);
        }
      }
 else       if (event.equals(Event.CANCELLED_EVENT)) {
        cleanupTmpItemMediaDir(currentItem);
        if (!feedManager.hasItems(feedResource)) {
          feedResource=feedManager.updateFeedMode(null,feedResource);
          makeInternalAndExternalButtons();
        }
      }
      feedManager.releaseLock(lock);
      cmc.deactivate();
      removeAsListenerAndDispose(cmc);
      cmc=null;
      removeAsListenerAndDispose(itemFormCtr);
      itemFormCtr=null;
    }
  }
 else   if (source == naviCtr && event instanceof NavigationEvent) {
    List<? extends Dated> selItems=((NavigationEvent)event).getSelectedItems();
    List<Item> items=new ArrayList<>();
    for (    Dated item : selItems) {
      if (item instanceof Item) {
        items.add((Item)item);
      }
    }
    if (callback.mayEditItems() || callback.mayCreateItems()) {
      createEditButtons(ureq,feedResource);
    }
    createCommentsAndRatingsLinks(ureq,feedResource);
    vcItems.setDirty(true);
    mainPanel.setContent(vcItems);
  }
 else   if (source == itemCtr) {
    if (event == Event.BACK_EVENT) {
      mainPanel.setContent(vcItems);
      removeAsListenerAndDispose(itemCtr);
      itemCtr=null;
    }
  }
 else   if (source instanceof UserCommentsAndRatingsController) {
    UserCommentsAndRatingsController commentsRatingsCtr=(UserCommentsAndRatingsController)source;
    if (event == UserCommentsAndRatingsController.EVENT_COMMENT_LINK_CLICKED) {
      Item item=(Item)commentsRatingsCtr.getUserObject();
      if (item != null) {
        ItemController myItemCtr=displayItemController(ureq,item);
        List<ContextEntry> entries=BusinessControlFactory.getInstance().createCEListFromResourceType(ItemController.ACTIVATION_KEY_COMMENTS);
        myItemCtr.activate(ureq,entries,null);
      }
    }
  }
  if (feedResource != null) {
    resetItems(ureq,feedResource);
  }
}

Fixed version (ground truth):
/** 
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,org.olat.core.gui.control.Controller,org.olat.core.gui.control.Event)
 */
protected void event(UserRequest ureq,Controller source,Event event){
  feedResource=feedManager.loadFeed(feedResource);
  accessibleItems=feedManager.loadFilteredAndSortedItems(feedResource,callback,ureq.getIdentity());
  if (source == cmc) {
    if (event.equals(CloseableModalController.CLOSE_MODAL_EVENT)) {
      removeAsListenerAndDispose(cmc);
      cmc=null;
      removeAsListenerAndDispose(itemFormCtr);
      itemFormCtr=null;
      cleanupTmpItemMediaDir(currentItem);
      if (!feedManager.hasItems(feedResource)) {
        feedResource=feedManager.updateFeedMode(null,feedResource);
        makeInternalAndExternalButtons();
      }
      feedManager.releaseLock(lock);
    }
  }
 else   if (source == confirmDialogCtr && DialogBoxUIFactory.isYesEvent(event)) {
    Item item=(Item)((DialogBoxController)source).getUserObject();
    lock=feedManager.acquireLock(feedResource,item,getIdentity());
    if (lock.isSuccess()) {
      naviCtr.remove(item);
      feedResource=feedManager.deleteItem(item);
      deleteButtons.remove(source);
      for (      Link editButton : editButtons) {
        if (item.equals(editButton.getUserObject())) {
          editButtons.remove(editButton);
          break;
        }
      }
      if (!feedManager.hasItems(feedResource)) {
        makeInternalAndExternalButtons();
        fireEvent(ureq,ItemsController.FEED_INFO_IS_DIRTY_EVENT);
      }
 else {
        if (callback.mayEditItems() || callback.mayCreateItems()) {
          createEditButtons(ureq,feedResource);
        }
        createCommentsAndRatingsLinks(ureq,feedResource);
      }
      vcItems.setDirty(true);
      mainPanel.setContent(vcItems);
      feedManager.releaseLock(lock);
      lock=null;
      ThreadLocalUserActivityLogger.log(FeedLoggingAction.FEED_ITEM_DELETE,getClass(),LoggingResourceable.wrap(item));
    }
 else {
      String fullName=userManager.getUserDisplayName(lock.getOwner());
      showInfo("String_Node_Str",fullName);
    }
  }
 else   if (source == itemFormCtr) {
    if (event.equals(Event.CHANGED_EVENT) || event.equals(Event.CANCELLED_EVENT)) {
      if (event.equals(Event.CHANGED_EVENT)) {
        FileElement mediaFile=currentItem.getMediaFile();
        if (feedManager.getItemContainer(currentItem) == null) {
          naviCtr.remove(currentItem);
        }
 else {
          if (!accessibleItems.contains(currentItem)) {
            feedResource=feedManager.createItem(feedResource,currentItem,mediaFile);
            if (feedResource == null) {
              feedResource=feedManager.loadFeed(feedResource);
              if (!feedResource.isInternal() && !feedResource.isExternal() && !feedManager.hasItems(feedResource)) {
                feedResource=feedManager.updateFeedMode(Boolean.FALSE,feedResource);
                feedResource=feedManager.createItem(feedResource,currentItem,mediaFile);
              }
            }
            if (feedResource != null) {
              createButtonsForItem(ureq,feedResource,currentItem);
              createItemLink(currentItem);
              String guid=currentItem.getGuid();
              if (currentItem.getDate() != null) {
                DateComponentFactory.createDateComponentWithYear("String_Node_Str" + guid,currentItem.getDate(),vcItems);
              }
              createCommentsAndRatingsLink(ureq,feedResource,currentItem);
              naviCtr.add(currentItem);
              accessibleItems=feedManager.loadFilteredAndSortedItems(feedResource,callback,ureq.getIdentity());
              if (accessibleItems != null && accessibleItems.size() == 1) {
                fireEvent(ureq,ItemsController.FEED_INFO_IS_DIRTY_EVENT);
                helper.setURIs(currentItem.getFeed());
              }
            }
          }
 else {
            currentItem=feedManager.updateItem(currentItem,mediaFile);
            if (itemCtr != null) {
              displayItemController(ureq,currentItem);
            }
            ThreadLocalUserActivityLogger.log(FeedLoggingAction.FEED_ITEM_EDIT,getClass(),LoggingResourceable.wrap(currentItem));
          }
        }
        vcItems.setDirty(true);
        if (itemCtr != null) {
          itemCtr.getInitialComponent().setDirty(true);
        }
      }
 else       if (event.equals(Event.CANCELLED_EVENT)) {
        cleanupTmpItemMediaDir(currentItem);
        if (!feedManager.hasItems(feedResource)) {
          feedResource=feedManager.updateFeedMode(null,feedResource);
          makeInternalAndExternalButtons();
        }
      }
      feedManager.releaseLock(lock);
      cmc.deactivate();
      removeAsListenerAndDispose(cmc);
      cmc=null;
      removeAsListenerAndDispose(itemFormCtr);
      itemFormCtr=null;
    }
  }
 else   if (source == naviCtr && event instanceof NavigationEvent) {
    List<? extends Dated> selItems=((NavigationEvent)event).getSelectedItems();
    List<Item> items=new ArrayList<>();
    for (    Dated item : selItems) {
      if (item instanceof Item) {
        items.add((Item)item);
      }
    }
    if (callback.mayEditItems() || callback.mayCreateItems()) {
      createEditButtons(ureq,feedResource);
    }
    createCommentsAndRatingsLinks(ureq,feedResource);
    vcItems.setDirty(true);
    mainPanel.setContent(vcItems);
  }
 else   if (source == itemCtr) {
    if (event == Event.BACK_EVENT) {
      mainPanel.setContent(vcItems);
      removeAsListenerAndDispose(itemCtr);
      itemCtr=null;
    }
  }
 else   if (source instanceof UserCommentsAndRatingsController) {
    UserCommentsAndRatingsController commentsRatingsCtr=(UserCommentsAndRatingsController)source;
    if (event == UserCommentsAndRatingsController.EVENT_COMMENT_LINK_CLICKED) {
      Item item=(Item)commentsRatingsCtr.getUserObject();
      if (item != null) {
        ItemController myItemCtr=displayItemController(ureq,item);
        List<ContextEntry> entries=BusinessControlFactory.getInstance().createCEListFromResourceType(ItemController.ACTIVATION_KEY_COMMENTS);
        myItemCtr.activate(ureq,entries,null);
      }
    }
  }
  if (feedResource != null) {
    resetItems(ureq,feedResource);
  }
}