Program: 39540
Project: 39540
Buggy source:
/** 
 * Add init script to configure the dojo widget.
 * @param facesContext
 */
protected void addInitScriptToScriptBlock(FacesContext facesContext,UIComponent component){
  DojoWidget dojoWidget=(DojoWidget)component;
  StringBuilder widgetPostCreateInitializationScript=new StringBuilder();
  DojoType dojoType=dojoWidget.getWidgetType();
  StringBuilder widgetInitialization=new StringBuilder();
  String varName=null;
  DojoScriptBlockComponent initScriptBlock=DojoScriptBlockComponent.findInitBlockComponent(facesContext.getViewRoot());
  if (dojoWidget.getRenderChildrenType().equals(RendersChildren.YES_USE_ADD_CHILD)) {
    varName=component.getId();
    widgetInitialization.append("String_Node_Str").append(varName).append("String_Node_Str");
  }
  getWidgetInitializationScript(component,widgetInitialization,widgetPostCreateInitializationScript);
  if (dojoType.isDijit()) {
    if (dojoWidget.getRenderChildrenType().equals(RendersChildren.YES_USE_ADD_CHILD)) {
      widgetInitialization.append("String_Node_Str");
      addComponentChildren(initScriptBlock,component,widgetInitialization,widgetPostCreateInitializationScript,varName);
      widgetInitialization.append(varName);
    }
    widgetInitialization.append("String_Node_Str");
    initScriptBlock.addWidgetCreateScript(widgetInitialization.toString());
  }
 else {
    StringBuilder widgetCreation=new StringBuilder(DojoScriptBlockComponent.getGlobalReference((DojoWidget)component)).append("String_Node_Str").append(widgetInitialization.toString()).append(';');
    initScriptBlock.addCreateGlobalSpaceScript();
    initScriptBlock.addPreWidgetCreateScript(widgetCreation.toString());
  }
  addComponentRequires(initScriptBlock,component);
  if (widgetPostCreateInitializationScript.length() > 0) {
    initScriptBlock.addPostWidgetCreateScript(widgetPostCreateInitializationScript.toString());
  }
}

Fixed version (ground truth):
/** 
 * Add init script to configure the dojo widget.
 * @param facesContext
 */
protected void addInitScriptToScriptBlock(FacesContext facesContext,UIComponent component){
  DojoWidget dojoWidget=(DojoWidget)component;
  StringBuilder widgetPostCreateInitializationScript=new StringBuilder();
  DojoType dojoType=dojoWidget.getWidgetType();
  StringBuilder widgetInitialization=new StringBuilder();
  String varName=null;
  DojoScriptBlockComponent initScriptBlock=DojoScriptBlockComponent.findInitBlockComponent(facesContext.getViewRoot());
  if (dojoWidget.getRenderChildrenType().equals(RendersChildren.YES_USE_ADD_CHILD)) {
    varName=component.getId();
    widgetInitialization.append("String_Node_Str").append(varName).append("String_Node_Str");
  }
  getWidgetInitializationScript(component,widgetInitialization,widgetPostCreateInitializationScript);
  if (dojoType.isDijit()) {
    if (dojoWidget.getRenderChildrenType().equals(RendersChildren.YES_USE_ADD_CHILD)) {
      widgetInitialization.append("String_Node_Str");
      addComponentChildren(initScriptBlock,component,widgetInitialization,widgetPostCreateInitializationScript,varName);
      widgetInitialization.append(varName);
    }
    String startUpContainerId=(String)facesContext.getAttributes().get(START_UP_CONTAINER_ID);
    if (startUpContainerId == null || component.getId().equals(startUpContainerId)) {
      widgetInitialization.append("String_Node_Str");
    }
 else {
      widgetInitialization.append("String_Node_Str");
    }
    initScriptBlock.addWidgetCreateScript(widgetInitialization.toString());
  }
 else {
    StringBuilder widgetCreation=new StringBuilder(DojoScriptBlockComponent.getGlobalReference((DojoWidget)component)).append("String_Node_Str").append(widgetInitialization.toString()).append(';');
    initScriptBlock.addCreateGlobalSpaceScript();
    initScriptBlock.addPreWidgetCreateScript(widgetCreation.toString());
  }
  addComponentRequires(initScriptBlock,component);
  if (widgetPostCreateInitializationScript.length() > 0) {
    initScriptBlock.addPostWidgetCreateScript(widgetPostCreateInitializationScript.toString());
  }
}