[jira] [Created] (PLUTO-770) PortletSessionScopedBeanMap.remove() does not remove bean instances from the underlying map

"Neil Griffin (JIRA)" <[email protected]> Thu, 4 Apr 2019 17:25:00 +0000 (UTC)
Newsgroups gmane.comp.jakarta.pluto.devel
Message-ID <[email protected]>
Neil Griffin created PLUTO-770:
----------------------------------

             Summary: 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.1, 3.0.0
            Reporter: Neil Griffin
            Assignee: Neil Griffin
             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}




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)