Program: 16058
Project: 16058
Buggy source:
/** 
 * Process a portlet request.
 * @return false if the page is not found.
 * @since 3.0.0
 */
protected boolean process(Session sess,RenderRequest request,RenderResponse response,String path,boolean bRichlet) throws PortletException, IOException {
  final WebManager webman=getWebManager();
  final WebApp wapp=webman.getWebApp();
  final WebAppCtrl wappc=(WebAppCtrl)wapp;
  final HttpServletRequest httpreq=RenderHttpServletRequest.getInstance(request);
  final HttpServletResponse httpres=RenderHttpServletResponse.getInstance(response);
  final ServletContext svlctx=wapp.getServletContext();
  final DesktopRecycle dtrc=wapp.getConfiguration().getDesktopRecycle();
  Desktop desktop=dtrc != null ? DesktopRecycles.beforeService(dtrc,svlctx,sess,httpreq,httpres,path) : null;
  try {
    if (desktop != null) {
      final Page page=Utils.getMainPage(desktop);
      if (page != null) {
        final Execution exec=new ExecutionImpl(svlctx,httpreq,httpres,desktop,page);
        fixContentType(response);
        wappc.getUiEngine().recycleDesktop(exec,page,response.getWriter());
      }
 else       desktop=null;
    }
    if (desktop == null) {
      desktop=webman.getDesktop(sess,httpreq,httpres,path,true);
      if (desktop == null)       return true;
      final RequestInfo ri=new RequestInfoImpl(wapp,sess,desktop,httpreq,PageDefinitions.getLocator(wapp,path));
      ((SessionCtrl)sess).notifyClientRequest(true);
      final Page page;
      final PageRenderPatch patch=getRenderPatch();
      final Writer out=patch.beforeRender(ri);
      final UiFactory uf=wappc.getUiFactory();
      if (uf.isRichlet(ri,bRichlet)) {
        final Richlet richlet=uf.getRichlet(ri,path);
        if (richlet == null)         return false;
        page=WebManager.newPage(uf,ri,richlet,httpres,path);
        final Execution exec=new ExecutionImpl(svlctx,httpreq,httpres,desktop,page);
        fixContentType(response);
        if (isJSR286) {
          ResourceURL url=response.createResourceURL();
          page.setAttribute("String_Node_Str",response.encodeURL(url.toString()),Page.PAGE_SCOPE);
          page.setAttribute("String_Node_Str",response.getNamespace(),Page.PAGE_SCOPE);
        }
        wappc.getUiEngine().execNewPage(exec,richlet,page,out != null ? out : response.getWriter());
      }
 else       if (path != null) {
        final PageDefinition pagedef=uf.getPageDefinition(ri,path);
        if (pagedef == null)         return false;
        page=WebManager.newPage(uf,ri,pagedef,httpres,path);
        final Execution exec=new ExecutionImpl(svlctx,httpreq,httpres,desktop,page);
        fixContentType(response);
        if (isJSR286) {
          ResourceURL url=response.createResourceURL();
          page.setAttribute("String_Node_Str",response.encodeURL(url.toString()),Page.PAGE_SCOPE);
          page.setAttribute("String_Node_Str",response.getNamespace(),Page.PAGE_SCOPE);
        }
        wappc.getUiEngine().execNewPage(exec,pagedef,page,out != null ? out : response.getWriter());
      }
 else       return true;
      if (out != null)       patch.patchRender(ri,page,out,response.getWriter());
    }
  }
  finally {
    if (dtrc != null)     DesktopRecycles.afterService(dtrc,desktop);
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Process a portlet request.
 * @return false if the page is not found.
 * @since 3.0.0
 */
protected boolean process(Session sess,RenderRequest request,RenderResponse response,String path,boolean bRichlet) throws PortletException, IOException {
  final WebManager webman=getWebManager();
  final WebApp wapp=webman.getWebApp();
  final WebAppCtrl wappc=(WebAppCtrl)wapp;
  final HttpServletRequest httpreq=RenderHttpServletRequest.getInstance(request);
  final HttpServletResponse httpres=RenderHttpServletResponse.getInstance(response);
  final ServletContext svlctx=wapp.getServletContext();
  final DesktopRecycle dtrc=wapp.getConfiguration().getDesktopRecycle();
  Desktop desktop=dtrc != null ? DesktopRecycles.beforeService(dtrc,svlctx,sess,httpreq,httpres,path) : null;
  try {
    if (desktop != null) {
      final Page page=Utils.getMainPage(desktop);
      if (page != null) {
        final Execution exec=new ExecutionImpl(svlctx,httpreq,httpres,desktop,page);
        fixContentType(response);
        wappc.getUiEngine().recycleDesktop(exec,page,response.getWriter());
      }
 else       desktop=null;
    }
    if (desktop == null) {
      desktop=webman.getDesktop(sess,httpreq,httpres,path,true);
      if (desktop == null)       return true;
      final RequestInfo ri=new RequestInfoImpl(wapp,sess,desktop,httpreq,PageDefinitions.getLocator(wapp,path));
      ((SessionCtrl)sess).notifyClientRequest(true);
      final Page page;
      final PageRenderPatch patch=getRenderPatch();
      final Writer out=patch.beforeRender(ri);
      final UiFactory uf=wappc.getUiFactory();
      if (uf.isRichlet(ri,bRichlet)) {
        final Richlet richlet=uf.getRichlet(ri,path);
        if (richlet == null)         return false;
        page=WebManager.newPage(uf,ri,richlet,httpres,path);
        final Execution exec=new ExecutionImpl(svlctx,httpreq,httpres,desktop,page);
        fixContentType(response);
        if (isJSR286) {
          ResourceURL url=response.createResourceURL();
          page.setAttribute("String_Node_Str",response.encodeURL(url.toString()),Page.PAGE_SCOPE);
          page.setAttribute("String_Node_Str",getNamespace(response),Page.PAGE_SCOPE);
        }
        wappc.getUiEngine().execNewPage(exec,richlet,page,out != null ? out : response.getWriter());
      }
 else       if (path != null) {
        final PageDefinition pagedef=uf.getPageDefinition(ri,path);
        if (pagedef == null)         return false;
        page=WebManager.newPage(uf,ri,pagedef,httpres,path);
        final Execution exec=new ExecutionImpl(svlctx,httpreq,httpres,desktop,page);
        fixContentType(response);
        if (isJSR286) {
          ResourceURL url=response.createResourceURL();
          page.setAttribute("String_Node_Str",response.encodeURL(url.toString()),Page.PAGE_SCOPE);
          page.setAttribute("String_Node_Str",getNamespace(response),Page.PAGE_SCOPE);
        }
        wappc.getUiEngine().execNewPage(exec,pagedef,page,out != null ? out : response.getWriter());
      }
 else       return true;
      if (out != null)       patch.patchRender(ri,page,out,response.getWriter());
    }
  }
  finally {
    if (dtrc != null)     DesktopRecycles.afterService(dtrc,desktop);
  }
  return true;
}