Uploaded image for project: 'Pluto'
  1. Pluto
  2. PLUTO-770

PortletSessionScopedBeanMap.remove() does not remove bean instances from the underlying map

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.0, 3.0.1
    • 3.1.0
    • portlet container
    • None

    Description

      The PortletSessionScopedBeanMap.remove() method contains the following code:

      PortletSessionScopedBeanMap.java
      if (bi != null) {
          beans.remove(bean);
          bi.crco.release();
          bean.destroy((T)bi.instance, (CreationalContext<T>)bi.crco);
      }
      

      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:

      PortletSessionScopedBeanMap.java
      if (bi != null) {
          beans.remove(id);
          bi.crco.release();
          bean.destroy((T)bi.instance, (CreationalContext<T>)bi.crco);
      }
      

      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.

      Attachments

        Activity

          People

            ngriffin7a Neil Griffin (Inactive)
            ngriffin7a Neil Griffin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: