docs: @SuppressWarnings("unchecked")
      protected Map<String, IPortletPreference> getSessionPreferences(
              IPortletEntityId portletEntityId, HttpServletRequest httpServletRequest) {
          final HttpSession session = httpServletRequest.getSession();
  
          final Map<IPortletEntityId, Map<String, IPortletPreference>> portletPreferences;
  
          // Sync on the session to ensure the Map isn't in the process of being created
          synchronized (session) {
              portletPreferences =
                      (Map<IPortletEntityId, Map<String, IPortletPreference>>)
                              session.getAttribute(PORTLET_PREFERENCES_MAP_ATTRIBUTE);
          }
  
          if (portletPreferences == null) {
              return null;
          }
  
          return portletPreferences.get(portletEntityId);
      }