LPS-43687 Use the same logic in PortletContainerImp._doPreparePortlet