Program: 101169
Project: 101169
Buggy source:
/** 
 * The processrender() method handles the creation of the returned HTML either for a full page render or in the case of an AJAX call The first request, Ajax is not enabled (means no ajaxRequest parameter in the request) and  hence the super.processRender() method is called. This will hence call the processrender() of  the Lifecycle object as this method is not overidden in UIPortalApplicationLifecycle. There we  simply render the bounded template (groovy usually). Note that bounded template are also defined in component annotations, so for the current class it is UIPortalApplication.gtmpl On second calls, request have the "ajaxRequest" parameter set to true in the URL. In that case  the algorithm is a bit more complex: a) The list of components that should be updated is extracted using the  context.getUIComponentToUpdateByAjax() method. That list was setup during the process action phase b) Portlets and other UI components to update are split in 2 different lists c) Portlets full content are returned and set with the tag <div class="PortalResponse"> d) Block to updates (which are UI components) are set within  the <div class="PortalResponseData"> tag e) Then the scripts and the skins to reload are set in the <div class="PortalResponseScript">
 */
public void processRender(WebuiRequestContext context) throws Exception {
  Writer w=context.getWriter();
  if (!context.useAjax()) {
    super.processRender(context);
  }
 else {
    PortalRequestContext pcontext=(PortalRequestContext)context;
    UIMaskWorkspace uiMaskWS=getChildById(UIPortalApplication.UI_MASK_WS_ID);
    if (uiMaskWS.isUpdated())     pcontext.addUIComponentToUpdateByAjax(uiMaskWS);
    List<UIComponent> list=context.getUIComponentToUpdateByAjax();
    List<UIPortlet> uiPortlets=new ArrayList<UIPortlet>(3);
    List<UIComponent> uiDataComponents=new ArrayList<UIComponent>(5);
    if (list != null) {
      for (      UIComponent uicomponent : list) {
        if (uicomponent instanceof UIPortlet)         uiPortlets.add((UIPortlet)uicomponent);
 else         uiDataComponents.add(uicomponent);
      }
    }
    w.write("String_Node_Str");
    if (!context.getFullRender()) {
      for (      UIPortlet uiPortlet : uiPortlets) {
        if (log.isDebugEnabled())         log.debug("String_Node_Str" + uiPortlet.getWindowId());
        w.write("String_Node_Str");
        w.append("String_Node_Str" + uiPortlet.getExoWindowID().getUniqueID() + "String_Node_Str");
        w.append("String_Node_Str");
        w.append("String_Node_Str");
        w.append("String_Node_Str");
        w.append("String_Node_Str");
        uiPortlet.processRender(context);
        w.append("String_Node_Str");
        w.append("String_Node_Str");
        w.write("String_Node_Str");
      }
    }
    w.write("String_Node_Str");
    for (    UIComponent uicomponent : uiDataComponents) {
      if (log.isDebugEnabled())       log.debug("String_Node_Str" + uicomponent.getName());
      renderBlockToUpdate(uicomponent,context,w);
    }
    w.write("String_Node_Str");
    w.write("String_Node_Str");
    w.write(pcontext.getJavascriptManager().getJavascript());
    w.write("String_Node_Str");
    w.write(pcontext.getJavascriptManager().getCustomizedOnLoadScript());
    String skin=getAddSkinScript(list);
    if (skin != null) {
      w.write(skin);
    }
    w.write("String_Node_Str");
    w.write("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * The processrender() method handles the creation of the returned HTML either for a full page render or in the case of an AJAX call The first request, Ajax is not enabled (means no ajaxRequest parameter in the request) and  hence the super.processRender() method is called. This will hence call the processrender() of  the Lifecycle object as this method is not overidden in UIPortalApplicationLifecycle. There we  simply render the bounded template (groovy usually). Note that bounded template are also defined in component annotations, so for the current class it is UIPortalApplication.gtmpl On second calls, request have the "ajaxRequest" parameter set to true in the URL. In that case  the algorithm is a bit more complex: a) The list of components that should be updated is extracted using the  context.getUIComponentToUpdateByAjax() method. That list was setup during the process action phase b) Portlets and other UI components to update are split in 2 different lists c) Portlets full content are returned and set with the tag <div class="PortalResponse"> d) Block to updates (which are UI components) are set within  the <div class="PortalResponseData"> tag e) Then the scripts and the skins to reload are set in the <div class="PortalResponseScript">
 */
public void processRender(WebuiRequestContext context) throws Exception {
  Writer w=context.getWriter();
  if (!context.useAjax()) {
    super.processRender(context);
  }
 else {
    PortalRequestContext pcontext=(PortalRequestContext)context;
    UIMaskWorkspace uiMaskWS=getChildById(UIPortalApplication.UI_MASK_WS_ID);
    if (uiMaskWS.isUpdated())     pcontext.addUIComponentToUpdateByAjax(uiMaskWS);
    List<UIComponent> list=context.getUIComponentToUpdateByAjax();
    List<UIPortlet> uiPortlets=new ArrayList<UIPortlet>(3);
    List<UIComponent> uiDataComponents=new ArrayList<UIComponent>(5);
    if (list != null) {
      for (      UIComponent uicomponent : list) {
        if (uicomponent instanceof UIPortlet)         uiPortlets.add((UIPortlet)uicomponent);
 else         uiDataComponents.add(uicomponent);
      }
    }
    w.write("String_Node_Str");
    w.write("String_Node_Str");
    for (    UIComponent uicomponent : uiDataComponents) {
      if (log.isDebugEnabled())       log.debug("String_Node_Str" + uicomponent.getName());
      renderBlockToUpdate(uicomponent,context,w);
    }
    w.write("String_Node_Str");
    if (!context.getFullRender()) {
      for (      UIPortlet uiPortlet : uiPortlets) {
        if (log.isDebugEnabled())         log.debug("String_Node_Str" + uiPortlet.getWindowId());
        w.write("String_Node_Str");
        w.append("String_Node_Str" + uiPortlet.getExoWindowID().getUniqueID() + "String_Node_Str");
        w.append("String_Node_Str");
        w.append("String_Node_Str");
        w.append("String_Node_Str");
        w.append("String_Node_Str");
        uiPortlet.processRender(context);
        w.append("String_Node_Str");
        w.append("String_Node_Str");
        w.write("String_Node_Str");
      }
    }
    w.write("String_Node_Str");
    w.write(pcontext.getJavascriptManager().getJavascript());
    w.write("String_Node_Str");
    w.write(pcontext.getJavascriptManager().getCustomizedOnLoadScript());
    String skin=getAddSkinScript(list);
    if (skin != null) {
      w.write(skin);
    }
    w.write("String_Node_Str");
    w.write("String_Node_Str");
  }
}