[jira] [Closed] (PLUTO-770) PortletSessionScopedBeanMap.remove() does not remove bean instances from the underlying map
"Neil Griffin (JIRA)" <[email protected]> Thu, 4 Apr 2019 17:28:00 +0000 (UTC)
| Newsgroups | gmane.comp.jakarta.pluto.devel |
|---|---|
| Message-ID | <[email protected]> |
[ https://issues.apache.org/jira/browse/PLUTO-770?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Neil Griffin closed PLUTO-770.
------------------------------
Resolution: Fixed
Fixed in commit [4c63c29ad58bf633ffb761c4ae07c00aa4b94bab|https://github.com/apache/portals-pluto/commit/4c63c29ad58bf633ffb761c4ae07c00aa4b94bab]
> PortletSessionScopedBeanMap.remove() does not remove bean instances from the underlying map
> -------------------------------------------------------------------------------------------
>
> Key: PLUTO-770
> URL: https://issues.apache.org/jira/browse/PLUTO-770
> Project: Pluto
> Issue Type: Task
> Components: portlet container
> Affects Versions: 3.0.0, 3.0.1
> Reporter: Neil Griffin
> Assignee: Neil Griffin
> Priority: Major
> Fix For: 3.0.2
>
>
> The {{PortletSessionScopedBeanMap.remove()}} method contains the following code:
> {code:java|title=PortletSessionScopedBeanMap.java}
> if (bi != null) {
> beans.remove(bean);
> bi.crco.release();
> bean.destroy((T)bi.instance, (CreationalContext<T>)bi.crco);
> }
> {code}
> The problem is that the {{beans}} variable is a {{java.util.Map}} whose keys are of type {{String}} (the windowId of the portlet) and not of type {{javax.enterprise.inject.spi.Bean}}. Therefore the call to {{beans.remove(bean)}} is incorrect and does not actually remove the bean from the underlying map.
> The fix would be to pass the windowId instead:
> {code:java|title=PortletSessionScopedBeanMap.java}
> if (bi != null) {
> beans.remove(id);
> bi.crco.release();
> bean.destroy((T)bi.instance, (CreationalContext<T>)bi.crco);
> }
> {code}
> The reason why this was not discovered earlier is because the {{PortletSessionScopedBeanMap.remove()}} method was only called by the {{valueUnbound(HttpSessionBindingEvent evt)}} method which includes a call to {{beans.clear()}} after iterating through all the beans.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)