Program: 90506
Project: 90506
Buggy source:
/** 
 * Returns the portlet session. <p> Note that since portlet request instance is created everytime the portlet container receives an incoming request, the portlet session instance held by the request instance is also re-created for each incoming request. </p>
 */
@Override public PortletSession getPortletSession(boolean create){
  if (isDebug) {
    LOG.debug("String_Node_Str" + create + "String_Node_Str");
  }
  if (portletConfig == null) {
    throw new IllegalStateException(EXCEPTIONS.getString("String_Node_Str"));
  }
  HttpSession httpSession=getServletRequest().getSession(create);
  if (httpSession != null) {
    int maxInactiveInterval=httpSession.getMaxInactiveInterval();
    long lastAccesstime=httpSession.getLastAccessedTime();
    if (maxInactiveInterval >= 0 && lastAccesstime > 0) {
      long maxInactiveTime=httpSession.getMaxInactiveInterval() * 1000L;
      long currentInactiveTime=System.currentTimeMillis() - lastAccesstime;
      if (currentInactiveTime > maxInactiveTime) {
        if (isDebug) {
          LOG.debug("String_Node_Str" + "String_Node_Str");
        }
        httpSession.invalidate();
        httpSession=getServletRequest().getSession(create);
      }
    }
  }
  if (httpSession == null) {
    if (isDebug) {
      LOG.debug("String_Node_Str" + "String_Node_Str");
    }
    return null;
  }
  final ContainerServices containerServices=container.getContainerServices();
  final PortletEnvironmentService portletEnvironmentService=containerServices.getPortletEnvironmentService();
  PortletSession portletSession=portletEnvironmentService.createPortletSession(portletConfig.getPortletContext(),getPortletWindow(),httpSession);
  return portletSession;
}

Fixed version (ground truth):
/** 
 * Returns the portlet session. <p> Note that since portlet request instance is created everytime the portlet container receives an incoming request, the portlet session instance held by the request instance is also re-created for each incoming request. </p>
 */
@Override public PortletSession getPortletSession(boolean create){
  if (isDebug) {
    LOG.debug("String_Node_Str" + create + "String_Node_Str");
  }
  if ((cachedPortletSession == null) || cachedPortletSession.isInvalidated()) {
    if (portletConfig == null) {
      throw new IllegalStateException(EXCEPTIONS.getString("String_Node_Str"));
    }
    HttpSession httpSession=getServletRequest().getSession(create);
    if (httpSession != null) {
      int maxInactiveInterval=httpSession.getMaxInactiveInterval();
      long lastAccesstime=httpSession.getLastAccessedTime();
      if (maxInactiveInterval >= 0 && lastAccesstime > 0) {
        long maxInactiveTime=httpSession.getMaxInactiveInterval() * 1000L;
        long currentInactiveTime=System.currentTimeMillis() - lastAccesstime;
        if (currentInactiveTime > maxInactiveTime) {
          if (isDebug) {
            LOG.debug("String_Node_Str" + "String_Node_Str");
          }
          httpSession.invalidate();
          httpSession=getServletRequest().getSession(create);
        }
      }
    }
    if (httpSession == null) {
      if (isDebug) {
        LOG.debug("String_Node_Str" + "String_Node_Str");
      }
      return null;
    }
    final ContainerServices containerServices=container.getContainerServices();
    final PortletEnvironmentService portletEnvironmentService=containerServices.getPortletEnvironmentService();
    cachedPortletSession=new CachedPortletSessionImpl(portletEnvironmentService.createPortletSession(portletConfig.getPortletContext(),getPortletWindow(),httpSession));
  }
  return cachedPortletSession;
}