Program: 90638
Project: 90638
Buggy source:
/** 
 * Dispatch the request to the appropriate portlet methods. This method assumes that the following attributes are set in the servlet request scope: <ul> <li>METHOD_ID: indicating which method to dispatch.</li> <li>PORTLET_REQUEST: the internal portlet request.</li> <li>PORTLET_RESPONSE: the internal portlet response.</li> </ul>
 * @param request the servlet request.
 * @param response the servlet response.
 * @throws ServletException
 * @throws IOException
 */
private void dispatch(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
  InternalPortletRequest portletRequest=null;
  InternalPortletResponse portletResponse=null;
  request.setAttribute(Constants.PORTLET_CONFIG,portletConfig);
  Integer methodId=(Integer)request.getAttribute(Constants.METHOD_ID);
  portletRequest=(InternalPortletRequest)request.getAttribute(Constants.PORTLET_REQUEST);
  portletResponse=(InternalPortletResponse)request.getAttribute(Constants.PORTLET_RESPONSE);
  FilterManager filterManager=(FilterManager)request.getAttribute(Constants.FILTER_MANAGER);
  portletRequest.init(portletContext,request);
  PortletWindow window=containerInvocationService.getInvocation().getPortletWindow();
  PortletInvocationEvent event=new PortletInvocationEvent(portletRequest,window,methodId.intValue());
  notify(event,true,null);
  ClassLoader loader=Thread.currentThread().getContextClassLoader();
  try {
    if (methodId == Constants.METHOD_RENDER) {
      RenderRequest renderRequest=(RenderRequest)portletRequest;
      RenderResponse renderResponse=(RenderResponse)portletResponse;
      filterManager.processFilter(renderRequest,renderResponse,loader,portlet,portletContext);
    }
 else     if (methodId == Constants.METHOD_RESOURCE) {
      ResourceRequest resourceRequest=(ResourceRequest)portletRequest;
      ResourceResponse resourceResponse=(ResourceResponse)portletResponse;
      filterManager.processFilter(resourceRequest,resourceResponse,loader,resourceServingPortlet,portletContext);
    }
 else     if (methodId == Constants.METHOD_ACTION) {
      ActionRequest actionRequest=(ActionRequest)portletRequest;
      ActionResponse actionResponse=(ActionResponse)portletResponse;
      filterManager.processFilter(actionRequest,actionResponse,loader,portlet,portletContext);
    }
 else     if (methodId == Constants.METHOD_EVENT) {
      EventRequest eventRequest=(EventRequest)portletRequest;
      EventResponse eventResponse=(EventResponse)portletResponse;
      filterManager.processFilter(eventRequest,eventResponse,loader,eventPortlet,portletContext);
    }
 else     if (methodId == Constants.METHOD_ADMIN) {
      ContainerInvocation inv=containerInvocationService.getInvocation();
      PortalAdministrationService pas=inv.getPortletContainer().getOptionalContainerServices().getPortalAdministrationService();
      Iterator it=pas.getAdministrativeRequestListeners().iterator();
      while (it.hasNext()) {
        AdministrativeRequestListener l=(AdministrativeRequestListener)it.next();
        l.administer(portletRequest,portletResponse);
      }
    }
 else     if (methodId == Constants.METHOD_NOOP) {
    }
    notify(event,false,null);
  }
 catch (  javax.portlet.UnavailableException ex) {
    System.err.println(ex.getMessage());
    try {
      portlet.destroy();
    }
 catch (    Throwable th) {
      System.err.println(ex.getMessage());
    }
    throw new javax.servlet.UnavailableException(ex.getMessage());
  }
catch (  PortletException ex) {
    notify(event,false,ex);
    System.err.println(ex.getMessage());
    throw new ServletException(ex);
  }
 finally {
    request.removeAttribute(Constants.PORTLET_CONFIG);
    if (portletRequest != null) {
      portletRequest.release();
    }
  }
}

Fixed version (ground truth):
/** 
 * Dispatch the request to the appropriate portlet methods. This method assumes that the following attributes are set in the servlet request scope: <ul> <li>METHOD_ID: indicating which method to dispatch.</li> <li>PORTLET_REQUEST: the internal portlet request.</li> <li>PORTLET_RESPONSE: the internal portlet response.</li> </ul>
 * @param request the servlet request.
 * @param response the servlet response.
 * @throws ServletException
 * @throws IOException
 */
private void dispatch(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
  if (portlet == null) {
    throw new javax.servlet.UnavailableException("String_Node_Str" + portletName + "String_Node_Str");
  }
  InternalPortletRequest portletRequest=null;
  InternalPortletResponse portletResponse=null;
  request.setAttribute(Constants.PORTLET_CONFIG,portletConfig);
  Integer methodId=(Integer)request.getAttribute(Constants.METHOD_ID);
  portletRequest=(InternalPortletRequest)request.getAttribute(Constants.PORTLET_REQUEST);
  portletResponse=(InternalPortletResponse)request.getAttribute(Constants.PORTLET_RESPONSE);
  FilterManager filterManager=(FilterManager)request.getAttribute(Constants.FILTER_MANAGER);
  portletRequest.init(portletContext,request);
  PortletWindow window=containerInvocationService.getInvocation().getPortletWindow();
  PortletInvocationEvent event=new PortletInvocationEvent(portletRequest,window,methodId.intValue());
  notify(event,true,null);
  ClassLoader loader=Thread.currentThread().getContextClassLoader();
  try {
    if (methodId == Constants.METHOD_RENDER) {
      RenderRequest renderRequest=(RenderRequest)portletRequest;
      RenderResponse renderResponse=(RenderResponse)portletResponse;
      filterManager.processFilter(renderRequest,renderResponse,loader,portlet,portletContext);
    }
 else     if (methodId == Constants.METHOD_RESOURCE) {
      ResourceRequest resourceRequest=(ResourceRequest)portletRequest;
      ResourceResponse resourceResponse=(ResourceResponse)portletResponse;
      filterManager.processFilter(resourceRequest,resourceResponse,loader,resourceServingPortlet,portletContext);
    }
 else     if (methodId == Constants.METHOD_ACTION) {
      ActionRequest actionRequest=(ActionRequest)portletRequest;
      ActionResponse actionResponse=(ActionResponse)portletResponse;
      filterManager.processFilter(actionRequest,actionResponse,loader,portlet,portletContext);
    }
 else     if (methodId == Constants.METHOD_EVENT) {
      EventRequest eventRequest=(EventRequest)portletRequest;
      EventResponse eventResponse=(EventResponse)portletResponse;
      filterManager.processFilter(eventRequest,eventResponse,loader,eventPortlet,portletContext);
    }
 else     if (methodId == Constants.METHOD_ADMIN) {
      ContainerInvocation inv=containerInvocationService.getInvocation();
      PortalAdministrationService pas=inv.getPortletContainer().getOptionalContainerServices().getPortalAdministrationService();
      Iterator it=pas.getAdministrativeRequestListeners().iterator();
      while (it.hasNext()) {
        AdministrativeRequestListener l=(AdministrativeRequestListener)it.next();
        l.administer(portletRequest,portletResponse);
      }
    }
 else     if (methodId == Constants.METHOD_NOOP) {
    }
    notify(event,false,null);
  }
 catch (  javax.portlet.UnavailableException ex) {
    System.err.println(ex.getMessage());
    try {
      portlet.destroy();
    }
 catch (    Throwable th) {
      System.err.println(ex.getMessage());
    }
    portlet=null;
    throw new javax.servlet.UnavailableException(ex.getMessage());
  }
catch (  PortletException ex) {
    notify(event,false,ex);
    System.err.println(ex.getMessage());
    throw new ServletException(ex);
  }
 finally {
    request.removeAttribute(Constants.PORTLET_CONFIG);
    if (portletRequest != null) {
      portletRequest.release();
    }
  }
}