IPortletWindowId portletWindowId, HttpServletRequest httpRequest) {
final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(httpRequest, portletWindowId);
final IPortletEntityId entityId = portletWindow.getPortletEntityId();
final IPortletEntity entity = this.portletEntityRegistry.getPortletEntity(httpRequest, entityId);
final IPortletDefinitionId definitionId = entity.getPortletDefinitionId();
<BUG>Serializable publicCacheKey = generatePublicScopePortletDataCacheKey(definitionId, portletWindow.getRenderParameters(), portletWindow.getPublicRenderParameters(), RequestContextUtils.getLocale(httpRequest));
Element publicCacheElement = this.publicScopePortletRenderOutputCache.get(publicCacheKey);</BUG>
if(publicCacheElement != null) {
<BUG>if(publicCacheElement.isExpired()) {
this.publicScopePortletRenderOutputCache.remove(publicCacheKey);
return null;
} else {
return (CachedPortletData) publicCacheElement.getValue();</BUG>
}

IPortletWindowId portletWindowId, HttpServletRequest httpRequest) {
final IPortletWindow portletWindow = this.portletWindowRegistry.getPortletWindow(httpRequest, portletWindowId);
final IPortletEntityId entityId = portletWindow.getPortletEntityId();
final IPortletEntity entity = this.portletEntityRegistry.getPortletEntity(httpRequest, entityId);
final IPortletDefinitionId definitionId = entity.getPortletDefinitionId();
final Locale locale = RequestContextUtils.getLocale(httpRequest);
final PublicPortletCacheKey publicCacheKey = new PublicPortletCacheKey(definitionId, portletWindow, locale);
Element publicCacheElement = this.publicScopePortletRenderOutputCache.get(publicCacheKey);
if(publicCacheElement != null) {
CachedPortletData cachedPortletData = (CachedPortletData) publicCacheElement.getValue();
if(publicCacheElement.isExpired() && StringUtils.isBlank(cachedPortletData.getEtag())) {
this.publicScopePortletRenderOutputCache.remove(publicCacheKey);
logger.debug("Publicly cached render output for key {} is expired", publicCacheKey);
return null;
