Program: 69526
Project: 69526
Buggy source:
/** 
 * @param ureq
 * @param renderOnly
 */
public void dispatchRequest(UserRequest ureq,boolean renderOnly){
  final HttpServletRequest request=ureq.getHttpReq();
  final HttpServletResponse response=ureq.getHttpResp();
  final String timestampID=ureq.getTimestampID() == null ? "String_Node_Str" : ureq.getTimestampID();
  final String componentID=ureq.getComponentID();
  boolean inline=false;
  boolean validate=false;
  boolean checkNewWindow=false;
  boolean dispatch=false;
  boolean incTimestamp=false;
  MediaResource mr=null;
  final boolean isDebugLog=log.isDebug();
  StringBuilder debugMsg=null;
  long debug_start=0;
  if (isDebugLog) {
    debug_start=System.currentTimeMillis();
    debugMsg=new StringBuilder("String_Node_Str");
  }
synchronized (this) {
    GlobalSettings gsettings=wbackofficeImpl.getGlobalSettings();
    boolean bgEnab=gsettings.getAjaxFlags().isIframePostEnabled();
    if (bgEnab && (ureq.getMode() & 1) == 1) {
      if (ureq.getParameter("String_Node_Str") != null) {
        renderOnly=true;
      }
 else {
        try {
          String s_compID=ureq.getComponentID();
          if (s_compID == null) {
            throw new AssertException("String_Node_Str" + ureq.toString());
          }
          List<Component> foundPath=new ArrayList<Component>(10);
          Component target=ComponentHelper.findDescendantOrSelfByID(getContentPane(),s_compID,foundPath);
          final boolean validForDispatching;
          if (target != null) {
            String cTimest=target.getTimestamp();
            String urlCTimest=ureq.getComponentTimestamp();
            validForDispatching=cTimest.equals(urlCTimest);
            if (!validForDispatching && isDebugLog) {
              log.debug("String_Node_Str" + ureq.getComponentID() + "String_Node_Str"+ ureq.getTimestampID()+ "String_Node_Str"+ ureq.getComponentTimestamp()+ "String_Node_Str"+ cTimest+ "String_Node_Str"+ target);
            }
          }
 else {
            if (isDebugLog)             log.debug("String_Node_Str");
            validForDispatching=false;
          }
          boolean didDispatch=false;
          boolean forceReload=false;
          if (validForDispatching) {
            DispatchResult dispatchResult=doDispatchToComponent(ureq,null);
            didDispatch=dispatchResult.isDispatch();
            incTimestamp=dispatchResult.isIncTimestamp();
            forceReload=dispatchResult.isForceReload();
            if (isDebugLog) {
              long durationAfterDoDispatchToComponent=System.currentTimeMillis() - debug_start;
              log.debug("String_Node_Str" + durationAfterDoDispatchToComponent);
            }
          }
          MediaResource mmr=null;
          if (forceReload) {
            String reRenderUri=buildURIFor(this,timestampID,null);
            Command rmrcom=CommandFactory.createParentRedirectTo(reRenderUri);
            wbackofficeImpl.sendCommandTo(rmrcom);
          }
 else           if (didDispatch || !validForDispatching) {
            if (validForDispatching) {
              Window ww=ureq.getDispatchResult().getResultingWindow();
              if (ww != null) {
                throw new AssertException("String_Node_Str");
              }
              mmr=ureq.getDispatchResult().getResultingMediaResource();
              if (mmr == null) {
                inline=true;
              }
 else {
                inline=false;
              }
            }
            if (inline || !validForDispatching) {
              if (!validForDispatching) {
                fireEvent(ureq,OLDTIMESTAMPCALL);
              }
              ComponentCollection top=getContentPane();
              ValidatingVisitor vv=new ValidatingVisitor(gsettings,jsAndCssAdder);
              ComponentTraverser ct=new ComponentTraverser(vv,top,false);
              if (isDebugLog) {
                long durationBeforeVisitAll=System.currentTimeMillis() - debug_start;
                log.debug("String_Node_Str" + durationBeforeVisitAll);
              }
              ct.visitAll(ureq);
              if (isDebugLog) {
                long durationAfterVisitAll=System.currentTimeMillis() - debug_start;
                log.debug("String_Node_Str" + durationAfterVisitAll);
              }
              wbackofficeImpl.fireCycleEvent(Window.AFTER_VALIDATING);
              ValidationResult vr=vv.getValidationResult();
              boolean newJsCssAdded=vr.getJsAndCSSAdder().finishAndCheckChange();
              String newModUri=vr.getNewModuleURI();
              if (newJsCssAdded || newModUri != null) {
                String uri=buildURIForRedirect(newModUri);
                validatingCausedRerendering=true;
                Command rmrcom=CommandFactory.createParentRedirectTo(uri);
                wbackofficeImpl.sendCommandTo(rmrcom);
                setDirty(false);
              }
 else {
                wbackofficeImpl.fireCycleEvent(Window.BEFORE_INLINE_RENDERING);
                if (!this.isDirty()) {
                  wbackofficeImpl.sendCommandTo(CommandFactory.createPrepareClientCommand(null));
                }
                Command jscsscom=jsAndCssAdder.extractJSCSSCommand();
                wbackofficeImpl.sendCommandTo(jscsscom);
                if (this.isDirty()) {
                  String reRenderUri=buildURIFor(this,timestampID,null);
                  Command rmrcom=CommandFactory.createParentRedirectTo(reRenderUri);
                  wbackofficeImpl.sendCommandTo(rmrcom);
                  this.setDirty(false);
                }
 else {
                  if (isDebugLog) {
                    long durationBeforeHandleDirties=System.currentTimeMillis() - debug_start;
                    log.debug("String_Node_Str" + durationBeforeHandleDirties);
                  }
                  Command co;
                  try {
                    co=handleDirties();
                  }
 catch (                  CannotReplaceDOMFragmentException e) {
                    String reRenderUri=buildURIFor(this,timestampID,null);
                    co=CommandFactory.createParentRedirectTo(reRenderUri);
                  }
                  Command co2=handleBusinessPath(ureq);
                  if (isDebugLog) {
                    long durationAfterHandleDirties=System.currentTimeMillis() - debug_start;
                    log.debug("String_Node_Str" + durationAfterHandleDirties);
                  }
                  wbackofficeImpl.fireCycleEvent(AFTER_INLINE_RENDERING);
                  if (co != null) {
                    wbackofficeImpl.sendCommandTo(co);
                  }
                  if (co2 != null) {
                    wbackofficeImpl.sendCommandTo(co2);
                  }
                }
              }
            }
 else {
              if (!validForDispatching) {
                fireEvent(ureq,OLDTIMESTAMPCALL);
                throw new AssertException("String_Node_Str");
              }
              if (isDebugLog) {
                long durationBeforeCreateMediaResourceMapper=System.currentTimeMillis() - debug_start;
                log.debug("String_Node_Str" + durationBeforeCreateMediaResourceMapper);
              }
              MediaResourceMapper extMRM=new MediaResourceMapper();
              extMRM.setMediaResource(mmr);
              String res=CoreSpringFactory.getImpl(MapperService.class).register(ureq.getUserSession(),extMRM) + "String_Node_Str";
              Command rmrcom=CommandFactory.createParentRedirectForExternalResource(res);
              wbackofficeImpl.sendCommandTo(rmrcom);
              if (isDebugLog) {
                long durationAfterCreateMediaResourceMapper=System.currentTimeMillis() - debug_start;
                log.debug("String_Node_Str" + durationAfterCreateMediaResourceMapper);
              }
            }
          }
 else {
            if (isDebugLog) {
              long durationBeforeBuildURIFor=System.currentTimeMillis() - debug_start;
              log.debug("String_Node_Str" + durationBeforeBuildURIFor);
              log.debug("String_Node_Str" + ureq.getComponentID() + "String_Node_Str"+ ureq.getTimestampID()+ "String_Node_Str"+ ureq.getComponentTimestamp()+ "String_Node_Str"+ target.getTimestamp()+ "String_Node_Str"+ target);
            }
            String reRenderUri=buildURIFor(this,timestampID,null);
            Command rmrcom=CommandFactory.createParentRedirectTo(reRenderUri);
            wbackofficeImpl.sendCommandTo(rmrcom);
          }
          if (isDebugLog) {
            long durationBeforeServeResource=System.currentTimeMillis() - debug_start;
            log.debug("String_Node_Str" + durationBeforeServeResource);
          }
          wbackofficeImpl.pushCommands(request,response);
        }
 catch (        InvalidRequestParameterException e) {
          try {
            response.sendError(HttpServletResponse.SC_BAD_REQUEST);
          }
 catch (          IOException e1) {
            log.error("String_Node_Str",e1);
          }
        }
catch (        Throwable th) {
          try {
            log.debug("String_Node_Str");
            DBFactory.getInstance().rollback();
            ChiefController msgcc=MsgFactory.createMessageChiefController(ureq,th);
            Window errWindow=msgcc.getWindow();
            errWindow.setUriPrefix(getUriPrefix());
            Windows.getWindows(ureq).registerWindow(errWindow);
            String newWinUri=buildRenderOnlyURIFor(errWindow);
            Command rmrcom=CommandFactory.createParentRedirectTo(newWinUri);
            wbackofficeImpl.sendCommandTo(rmrcom);
            MediaResource jsonmr=wbackofficeImpl.extractCommands(true);
            ServletUtil.serveResource(request,response,jsonmr);
          }
 catch (          Throwable anotherTh) {
            log.error("String_Node_Str",anotherTh);
          }
        }
        if (isDebugLog) {
          long durationDispatchRequest=System.currentTimeMillis() - debug_start;
          log.debug("String_Node_Str" + durationDispatchRequest);
        }
        return;
      }
    }
    if (renderOnly || timestampID == null) {
      inline=true;
      validate=true;
      wbackofficeImpl.fireCycleEvent(BEFORE_RENDER_ONLY);
    }
 else     if (validatingCausedRerendering && timestampID.equals("String_Node_Str")) {
      validatingCausedRerendering=false;
      inline=true;
      validate=false;
      checkNewWindow=false;
      dispatch=false;
    }
 else {
      if (latestTimestamp != null && !timestampID.equals(latestTimestamp)) {
        if (asyncMediaResponsible == null) {
          if ((componentID != null && componentID.equals("String_Node_Str")) || (ureq.getParameter("String_Node_Str") != null)) {
          }
 else {
            if (isDebugLog)             log.debug("String_Node_Str");
          }
          inline=true;
          incTimestamp=false;
        }
 else {
          mr=asyncMediaResponsible.getAsyncMediaResource(ureq);
          if (mr == null) {
            inline=true;
            checkNewWindow=true;
            validate=true;
          }
 else {
          }
        }
      }
 else {
        dispatch=true;
        checkNewWindow=true;
        validate=true;
      }
    }
    long dstart=0;
    if (isDebugLog) {
      dstart=System.currentTimeMillis();
      long syncIntroDiff=dstart - debug_start;
      debugMsg.append("String_Node_Str").append(syncIntroDiff).append(LOG_SEPARATOR);
    }
    boolean forceReload=false;
    if (dispatch) {
      DispatchResult dispatchResult=doDispatchToComponent(ureq,debugMsg);
      boolean didDispatch=dispatchResult.isDispatch();
      forceReload=dispatchResult.isForceReload();
      incTimestamp=dispatchResult.isIncTimestamp();
      if (isDebugLog) {
        long dstop=System.currentTimeMillis();
        long diff=dstop - dstart;
        debugMsg.append("String_Node_Str").append(diff).append(LOG_SEPARATOR);
      }
      if (didDispatch) {
        mr=ureq.getDispatchResult().getResultingMediaResource();
        if (mr == null) {
          inline=true;
        }
 else {
          inline=false;
        }
      }
 else {
        inline=true;
        dispatch=false;
        checkNewWindow=false;
        validate=true;
      }
    }
    if (checkNewWindow) {
      Window resWindow=ureq.getDispatchResult().getResultingWindow();
      if (resWindow != null) {
        Windows ws=Windows.getWindows(ureq);
        if (!ws.isRegistered(resWindow)) {
          resWindow.setUriPrefix(uriPrefix);
          ws.registerWindow(resWindow);
        }
        URLBuilder ubu=new URLBuilder(uriPrefix,resWindow.getInstanceId(),String.valueOf(resWindow.timestamp),resWindow.wbackofficeImpl);
        StringOutput sout=new StringOutput(30);
        ubu.buildURI(sout,null,null);
        mr=new RedirectMediaResource(sout.toString());
        ServletUtil.serveResource(request,response,mr);
        if (isDebugLog) {
          long diff=System.currentTimeMillis() - debug_start;
          debugMsg.append("String_Node_Str").append(diff).append(LOG_SEPARATOR);
          log.debug(debugMsg.toString());
          long durationDispatchRequest=System.currentTimeMillis() - debug_start;
          log.debug("String_Node_Str" + durationDispatchRequest);
        }
        return;
      }
    }
    if (forceReload) {
      String reRenderUri=buildURIFor(this,timestampID,null);
      String url=reRenderUri;
      DispatcherModule.redirectTo(response,url);
    }
 else     if (inline) {
      ComponentCollection top=getContentPane();
      if (validate) {
        ValidatingVisitor vv=new ValidatingVisitor(gsettings,jsAndCssAdder);
        ComponentTraverser ct=new ComponentTraverser(vv,top,false);
        ct.visitAll(ureq);
        wbackofficeImpl.fireCycleEvent(Window.AFTER_VALIDATING);
        ValidationResult vr=vv.getValidationResult();
        String newModUri=vr.getNewModuleURI();
        vr.getJsAndCSSAdder().finishAndCheckChange();
        if (newModUri != null) {
          String uri=buildURIForRedirect(newModUri);
          MediaResource mrr=new RedirectMediaResource(uri);
          validatingCausedRerendering=true;
          ServletUtil.serveResource(request,response,mrr);
          if (isDebugLog) {
            long diff=System.currentTimeMillis() - debug_start;
            debugMsg.append("String_Node_Str").append(diff).append(LOG_SEPARATOR);
            log.debug(debugMsg.toString());
            long durationDispatchRequest=System.currentTimeMillis() - debug_start;
            log.debug("String_Node_Str" + durationDispatchRequest);
          }
          return;
        }
      }
      wbackofficeImpl.fireCycleEvent(BEFORE_INLINE_RENDERING);
      StringOutput result;
synchronized (render_mutex) {
        if (incTimestamp) {
          timestamp++;
        }
        final String newTimestamp=String.valueOf(timestamp);
        URLBuilder ubu=new URLBuilder(uriPrefix,getInstanceId(),newTimestamp,wbackofficeImpl);
        RenderResult renderResult=new RenderResult();
        InterceptHandler interceptHandler=wbackofficeImpl.getInterceptHandler();
        if (interceptHandler != null) {
          InterceptHandlerInstance dhri=interceptHandler.createInterceptHandlerInstance();
          renderResult.setInterceptHandlerRenderInstance(dhri);
        }
        Renderer fr=Renderer.getInstance(top,top.getTranslator(),ubu,renderResult,gsettings);
        long rstart=0;
        if (isDebugLog) {
          rstart=System.currentTimeMillis();
        }
        result=StringOutputPool.allocStringBuilder(100000);
        fr.render(top,result,null);
        if (isDebugLog) {
          long rstop=System.currentTimeMillis();
          long diff=rstop - rstart;
          debugMsg.append("String_Node_Str").append(diff).append(LOG_SEPARATOR);
        }
        if (renderResult.getRenderException() != null) {
          throw new OLATRuntimeException(Window.class,renderResult.getLogMsg(),renderResult.getRenderException());
        }
        AsyncMediaResponsible amr=renderResult.getAsyncMediaResponsible();
        setAsyncMediaResponsible(amr);
        latestTimestamp=newTimestamp;
      }
      if (isDebugLog) {
        long diff=System.currentTimeMillis() - debug_start;
        debugMsg.append("String_Node_Str").append(diff).append(LOG_SEPARATOR);
      }
      wbackofficeImpl.fireCycleEvent(AFTER_INLINE_RENDERING);
      ServletUtil.serveStringResource(response,result);
      StringOutputPool.free(result);
      if (isDebugLog) {
        long diff=System.currentTimeMillis() - debug_start;
        debugMsg.append("String_Node_Str").append(diff).append(LOG_SEPARATOR);
      }
    }
  }
  if (!inline) {
    if (isDebugLog) {
      long diff=System.currentTimeMillis() - debug_start;
      debugMsg.append("String_Node_Str").append(diff).append(LOG_SEPARATOR);
    }
    ServletUtil.serveResource(request,response,mr);
    if (isDebugLog) {
      long diff=System.currentTimeMillis() - debug_start;
      debugMsg.append("String_Node_Str").append(diff).append(LOG_SEPARATOR);
    }
  }
  if (isDebugLog) {
    log.info(debugMsg.toString());
    long durationDispatchRequest=System.currentTimeMillis() - debug_start;
    log.debug("String_Node_Str" + durationDispatchRequest);
  }
}

Fixed version (ground truth):
/** 
 * @param ureq
 * @param renderOnly
 */
public void dispatchRequest(UserRequest ureq,boolean renderOnly){
  final HttpServletRequest request=ureq.getHttpReq();
  final HttpServletResponse response=ureq.getHttpResp();
  final String timestampID=ureq.getTimestampID() == null ? "String_Node_Str" : ureq.getTimestampID();
  final String componentID=ureq.getComponentID();
  boolean inline=false;
  boolean validate=false;
  boolean checkNewWindow=false;
  boolean dispatch=false;
  boolean incTimestamp=false;
  MediaResource mr=null;
  final boolean isDebugLog=log.isDebug();
  StringBuilder debugMsg=null;
  long debug_start=0;
  if (isDebugLog) {
    debug_start=System.currentTimeMillis();
    debugMsg=new StringBuilder("String_Node_Str");
  }
synchronized (this) {
    GlobalSettings gsettings=wbackofficeImpl.getGlobalSettings();
    boolean bgEnab=gsettings.getAjaxFlags().isIframePostEnabled();
    if (bgEnab && (ureq.getMode() & 1) == 1) {
      if (ureq.getParameter("String_Node_Str") != null) {
        renderOnly=true;
      }
 else {
        try {
          String s_compID=ureq.getComponentID();
          if (s_compID == null) {
            throw new AssertException("String_Node_Str" + ureq.toString());
          }
          List<Component> foundPath=new ArrayList<Component>(10);
          Component target=ComponentHelper.findDescendantOrSelfByID(getContentPane(),s_compID,foundPath);
          final boolean validForDispatching;
          if (target != null) {
            String cTimest=target.getTimestamp();
            String urlCTimest=ureq.getComponentTimestamp();
            validForDispatching=cTimest.equals(urlCTimest);
            if (!validForDispatching && isDebugLog) {
              log.debug("String_Node_Str" + ureq.getComponentID() + "String_Node_Str"+ ureq.getTimestampID()+ "String_Node_Str"+ ureq.getComponentTimestamp()+ "String_Node_Str"+ cTimest+ "String_Node_Str"+ target);
            }
          }
 else {
            if (isDebugLog)             log.debug("String_Node_Str");
            validForDispatching=false;
          }
          boolean didDispatch=false;
          boolean forceReload=false;
          if (validForDispatching) {
            DispatchResult dispatchResult=doDispatchToComponent(ureq,null);
            didDispatch=dispatchResult.isDispatch();
            incTimestamp=dispatchResult.isIncTimestamp();
            forceReload=dispatchResult.isForceReload();
            if (isDebugLog) {
              long durationAfterDoDispatchToComponent=System.currentTimeMillis() - debug_start;
              log.debug("String_Node_Str" + durationAfterDoDispatchToComponent);
            }
          }
          MediaResource mmr=null;
          if (forceReload) {
            String reRenderUri=buildURIFor(this,timestampID,null);
            Command rmrcom=CommandFactory.createParentRedirectTo(reRenderUri);
            wbackofficeImpl.sendCommandTo(rmrcom);
          }
 else           if (didDispatch || !validForDispatching) {
            if (validForDispatching) {
              Window ww=ureq.getDispatchResult().getResultingWindow();
              if (ww != null) {
                throw new AssertException("String_Node_Str");
              }
              mmr=ureq.getDispatchResult().getResultingMediaResource();
              if (mmr == null) {
                inline=true;
              }
 else {
                inline=false;
              }
            }
            if (inline || !validForDispatching) {
              if (!validForDispatching) {
                fireEvent(ureq,OLDTIMESTAMPCALL);
              }
              ComponentCollection top=getContentPane();
              ValidatingVisitor vv=new ValidatingVisitor(gsettings,jsAndCssAdder);
              ComponentTraverser ct=new ComponentTraverser(vv,top,false);
              if (isDebugLog) {
                long durationBeforeVisitAll=System.currentTimeMillis() - debug_start;
                log.debug("String_Node_Str" + durationBeforeVisitAll);
              }
              ct.visitAll(ureq);
              if (isDebugLog) {
                long durationAfterVisitAll=System.currentTimeMillis() - debug_start;
                log.debug("String_Node_Str" + durationAfterVisitAll);
              }
              wbackofficeImpl.fireCycleEvent(Window.AFTER_VALIDATING);
              ValidationResult vr=vv.getValidationResult();
              boolean newJsCssAdded=vr.getJsAndCSSAdder().finishAndCheckChange();
              String newModUri=vr.getNewModuleURI();
              if (newJsCssAdded || newModUri != null) {
                String uri=buildURIForRedirect(newModUri);
                validatingCausedRerendering=true;
                Command rmrcom=CommandFactory.createParentRedirectTo(uri);
                wbackofficeImpl.sendCommandTo(rmrcom);
                setDirty(false);
              }
 else {
                wbackofficeImpl.fireCycleEvent(Window.BEFORE_INLINE_RENDERING);
                if (!this.isDirty()) {
                  wbackofficeImpl.sendCommandTo(CommandFactory.createPrepareClientCommand(null));
                }
                Command jscsscom=jsAndCssAdder.extractJSCSSCommand();
                wbackofficeImpl.sendCommandTo(jscsscom);
                if (this.isDirty()) {
                  String reRenderUri=buildURIFor(this,timestampID,null);
                  Command rmrcom=CommandFactory.createParentRedirectTo(reRenderUri);
                  wbackofficeImpl.sendCommandTo(rmrcom);
                  this.setDirty(false);
                }
 else {
                  if (isDebugLog) {
                    long durationBeforeHandleDirties=System.currentTimeMillis() - debug_start;
                    log.debug("String_Node_Str" + durationBeforeHandleDirties);
                  }
                  Command co;
                  try {
                    co=handleDirties();
                  }
 catch (                  CannotReplaceDOMFragmentException e) {
                    String reRenderUri=buildURIFor(this,timestampID,null);
                    co=CommandFactory.createParentRedirectTo(reRenderUri);
                  }
                  Command co2=handleBusinessPath(ureq);
                  if (isDebugLog) {
                    long durationAfterHandleDirties=System.currentTimeMillis() - debug_start;
                    log.debug("String_Node_Str" + durationAfterHandleDirties);
                  }
                  wbackofficeImpl.fireCycleEvent(AFTER_INLINE_RENDERING);
                  if (co != null) {
                    wbackofficeImpl.sendCommandTo(co);
                  }
                  if (co2 != null) {
                    wbackofficeImpl.sendCommandTo(co2);
                  }
                }
              }
            }
 else {
              if (!validForDispatching) {
                fireEvent(ureq,OLDTIMESTAMPCALL);
                throw new AssertException("String_Node_Str");
              }
              if (isDebugLog) {
                long durationBeforeCreateMediaResourceMapper=System.currentTimeMillis() - debug_start;
                log.debug("String_Node_Str" + durationBeforeCreateMediaResourceMapper);
              }
              MediaResourceMapper extMRM=new MediaResourceMapper();
              extMRM.setMediaResource(mmr);
              MapperKey mapperKey=CoreSpringFactory.getImpl(MapperService.class).register(ureq.getUserSession(),extMRM);
              String resUrl=mapperKey.getUrl() + "String_Node_Str";
              Command rmrcom=CommandFactory.createParentRedirectForExternalResource(resUrl);
              wbackofficeImpl.sendCommandTo(rmrcom);
              if (isDebugLog) {
                long durationAfterCreateMediaResourceMapper=System.currentTimeMillis() - debug_start;
                log.debug("String_Node_Str" + durationAfterCreateMediaResourceMapper);
              }
            }
          }
 else {
            if (isDebugLog) {
              long durationBeforeBuildURIFor=System.currentTimeMillis() - debug_start;
              log.debug("String_Node_Str" + durationBeforeBuildURIFor);
              log.debug("String_Node_Str" + ureq.getComponentID() + "String_Node_Str"+ ureq.getTimestampID()+ "String_Node_Str"+ ureq.getComponentTimestamp()+ "String_Node_Str"+ target.getTimestamp()+ "String_Node_Str"+ target);
            }
            String reRenderUri=buildURIFor(this,timestampID,null);
            Command rmrcom=CommandFactory.createParentRedirectTo(reRenderUri);
            wbackofficeImpl.sendCommandTo(rmrcom);
          }
          if (isDebugLog) {
            long durationBeforeServeResource=System.currentTimeMillis() - debug_start;
            log.debug("String_Node_Str" + durationBeforeServeResource);
          }
          wbackofficeImpl.pushCommands(request,response);
        }
 catch (        InvalidRequestParameterException e) {
          try {
            response.sendError(HttpServletResponse.SC_BAD_REQUEST);
          }
 catch (          IOException e1) {
            log.error("String_Node_Str",e1);
          }
        }
catch (        Throwable th) {
          try {
            log.debug("String_Node_Str");
            DBFactory.getInstance().rollback();
            ChiefController msgcc=MsgFactory.createMessageChiefController(ureq,th);
            Window errWindow=msgcc.getWindow();
            errWindow.setUriPrefix(getUriPrefix());
            Windows.getWindows(ureq).registerWindow(errWindow);
            String newWinUri=buildRenderOnlyURIFor(errWindow);
            Command rmrcom=CommandFactory.createParentRedirectTo(newWinUri);
            wbackofficeImpl.sendCommandTo(rmrcom);
            MediaResource jsonmr=wbackofficeImpl.extractCommands(true);
            ServletUtil.serveResource(request,response,jsonmr);
          }
 catch (          Throwable anotherTh) {
            log.error("String_Node_Str",anotherTh);
          }
        }
        if (isDebugLog) {
          long durationDispatchRequest=System.currentTimeMillis() - debug_start;
          log.debug("String_Node_Str" + durationDispatchRequest);
        }
        return;
      }
    }
    if (renderOnly || timestampID == null) {
      inline=true;
      validate=true;
      wbackofficeImpl.fireCycleEvent(BEFORE_RENDER_ONLY);
    }
 else     if (validatingCausedRerendering && timestampID.equals("String_Node_Str")) {
      validatingCausedRerendering=false;
      inline=true;
      validate=false;
      checkNewWindow=false;
      dispatch=false;
    }
 else {
      if (latestTimestamp != null && !timestampID.equals(latestTimestamp)) {
        if (asyncMediaResponsible == null) {
          if ((componentID != null && componentID.equals("String_Node_Str")) || (ureq.getParameter("String_Node_Str") != null)) {
          }
 else {
            if (isDebugLog)             log.debug("String_Node_Str");
          }
          inline=true;
          incTimestamp=false;
        }
 else {
          mr=asyncMediaResponsible.getAsyncMediaResource(ureq);
          if (mr == null) {
            inline=true;
            checkNewWindow=true;
            validate=true;
          }
 else {
          }
        }
      }
 else {
        dispatch=true;
        checkNewWindow=true;
        validate=true;
      }
    }
    long dstart=0;
    if (isDebugLog) {
      dstart=System.currentTimeMillis();
      long syncIntroDiff=dstart - debug_start;
      debugMsg.append("String_Node_Str").append(syncIntroDiff).append(LOG_SEPARATOR);
    }
    boolean forceReload=false;
    if (dispatch) {
      DispatchResult dispatchResult=doDispatchToComponent(ureq,debugMsg);
      boolean didDispatch=dispatchResult.isDispatch();
      forceReload=dispatchResult.isForceReload();
      incTimestamp=dispatchResult.isIncTimestamp();
      if (isDebugLog) {
        long dstop=System.currentTimeMillis();
        long diff=dstop - dstart;
        debugMsg.append("String_Node_Str").append(diff).append(LOG_SEPARATOR);
      }
      if (didDispatch) {
        mr=ureq.getDispatchResult().getResultingMediaResource();
        if (mr == null) {
          inline=true;
        }
 else {
          inline=false;
        }
      }
 else {
        inline=true;
        dispatch=false;
        checkNewWindow=false;
        validate=true;
      }
    }
    if (checkNewWindow) {
      Window resWindow=ureq.getDispatchResult().getResultingWindow();
      if (resWindow != null) {
        Windows ws=Windows.getWindows(ureq);
        if (!ws.isRegistered(resWindow)) {
          resWindow.setUriPrefix(uriPrefix);
          ws.registerWindow(resWindow);
        }
        URLBuilder ubu=new URLBuilder(uriPrefix,resWindow.getInstanceId(),String.valueOf(resWindow.timestamp),resWindow.wbackofficeImpl);
        StringOutput sout=new StringOutput(30);
        ubu.buildURI(sout,null,null);
        mr=new RedirectMediaResource(sout.toString());
        ServletUtil.serveResource(request,response,mr);
        if (isDebugLog) {
          long diff=System.currentTimeMillis() - debug_start;
          debugMsg.append("String_Node_Str").append(diff).append(LOG_SEPARATOR);
          log.debug(debugMsg.toString());
          long durationDispatchRequest=System.currentTimeMillis() - debug_start;
          log.debug("String_Node_Str" + durationDispatchRequest);
        }
        return;
      }
    }
    if (forceReload) {
      String reRenderUri=buildURIFor(this,timestampID,null);
      String url=reRenderUri;
      DispatcherModule.redirectTo(response,url);
    }
 else     if (inline) {
      ComponentCollection top=getContentPane();
      if (validate) {
        ValidatingVisitor vv=new ValidatingVisitor(gsettings,jsAndCssAdder);
        ComponentTraverser ct=new ComponentTraverser(vv,top,false);
        ct.visitAll(ureq);
        wbackofficeImpl.fireCycleEvent(Window.AFTER_VALIDATING);
        ValidationResult vr=vv.getValidationResult();
        String newModUri=vr.getNewModuleURI();
        vr.getJsAndCSSAdder().finishAndCheckChange();
        if (newModUri != null) {
          String uri=buildURIForRedirect(newModUri);
          MediaResource mrr=new RedirectMediaResource(uri);
          validatingCausedRerendering=true;
          ServletUtil.serveResource(request,response,mrr);
          if (isDebugLog) {
            long diff=System.currentTimeMillis() - debug_start;
            debugMsg.append("String_Node_Str").append(diff).append(LOG_SEPARATOR);
            log.debug(debugMsg.toString());
            long durationDispatchRequest=System.currentTimeMillis() - debug_start;
            log.debug("String_Node_Str" + durationDispatchRequest);
          }
          return;
        }
      }
      wbackofficeImpl.fireCycleEvent(BEFORE_INLINE_RENDERING);
      StringOutput result;
synchronized (render_mutex) {
        if (incTimestamp) {
          timestamp++;
        }
        final String newTimestamp=String.valueOf(timestamp);
        URLBuilder ubu=new URLBuilder(uriPrefix,getInstanceId(),newTimestamp,wbackofficeImpl);
        RenderResult renderResult=new RenderResult();
        InterceptHandler interceptHandler=wbackofficeImpl.getInterceptHandler();
        if (interceptHandler != null) {
          InterceptHandlerInstance dhri=interceptHandler.createInterceptHandlerInstance();
          renderResult.setInterceptHandlerRenderInstance(dhri);
        }
        Renderer fr=Renderer.getInstance(top,top.getTranslator(),ubu,renderResult,gsettings);
        long rstart=0;
        if (isDebugLog) {
          rstart=System.currentTimeMillis();
        }
        result=StringOutputPool.allocStringBuilder(100000);
        fr.render(top,result,null);
        if (isDebugLog) {
          long rstop=System.currentTimeMillis();
          long diff=rstop - rstart;
          debugMsg.append("String_Node_Str").append(diff).append(LOG_SEPARATOR);
        }
        if (renderResult.getRenderException() != null) {
          throw new OLATRuntimeException(Window.class,renderResult.getLogMsg(),renderResult.getRenderException());
        }
        AsyncMediaResponsible amr=renderResult.getAsyncMediaResponsible();
        setAsyncMediaResponsible(amr);
        latestTimestamp=newTimestamp;
      }
      if (isDebugLog) {
        long diff=System.currentTimeMillis() - debug_start;
        debugMsg.append("String_Node_Str").append(diff).append(LOG_SEPARATOR);
      }
      wbackofficeImpl.fireCycleEvent(AFTER_INLINE_RENDERING);
      ServletUtil.serveStringResource(response,result);
      StringOutputPool.free(result);
      if (isDebugLog) {
        long diff=System.currentTimeMillis() - debug_start;
        debugMsg.append("String_Node_Str").append(diff).append(LOG_SEPARATOR);
      }
    }
  }
  if (!inline) {
    if (isDebugLog) {
      long diff=System.currentTimeMillis() - debug_start;
      debugMsg.append("String_Node_Str").append(diff).append(LOG_SEPARATOR);
    }
    ServletUtil.serveResource(request,response,mr);
    if (isDebugLog) {
      long diff=System.currentTimeMillis() - debug_start;
      debugMsg.append("String_Node_Str").append(diff).append(LOG_SEPARATOR);
    }
  }
  if (isDebugLog) {
    log.info(debugMsg.toString());
    long durationDispatchRequest=System.currentTimeMillis() - debug_start;
    log.debug("String_Node_Str" + durationDispatchRequest);
  }
}