Program: 143509
Project: 143509
Buggy source:
public void onBeforeRender(Component component){
  if (component instanceof IServoyAwareBean) {
    IModel model=component.getInnermostModel();
    WebForm webForm=component.findParent(WebForm.class);
    if (model instanceof RecordItemModel && webForm != null) {
      IRecord record=(IRecord)((RecordItemModel)model).getObject();
      FormScope fs=webForm.getController().getFormScope();
      if (record != null && fs != null) {
        ((IServoyAwareBean)component).setSelectedRecord(new ServoyBeanState(record,fs));
      }
    }
  }
 else {
    if (!component.isEnabled())     return;
    Component targetComponent=null;
    boolean hasFocus=false, hasBlur=false;
    if (component instanceof IFieldComponent && ((IFieldComponent)component).getEventExecutor() != null) {
      targetComponent=component;
      if (component instanceof WebBaseSelectBox) {
        Component[] cs=((WebBaseSelectBox)component).getFocusChildren();
        if (cs != null && cs.length == 1)         targetComponent=cs[0];
      }
      if (((IFieldComponent)component).getEventExecutor().hasEnterCmds() || component.findParent(WebCellBasedView.class) != null || (((IFieldComponent)component).getScriptObject() instanceof ISupportOnRenderCallback && ((ISupportOnRenderCallback)((IFieldComponent)component).getScriptObject()).getRenderEventExecutor().hasRenderCallback())) {
        hasFocus=true;
      }
      hasBlur=true;
    }
 else     if (component instanceof WebBaseLabel) {
      targetComponent=component;
      hasFocus=true;
    }
    if (targetComponent != null) {
      MainPage mainPage=targetComponent.findParent(MainPage.class);
      if (mainPage.isUsingAjax()) {
        AbstractAjaxBehavior eventCallback=mainPage.getPageContributor().getEventCallback();
        if (eventCallback != null) {
          String callback=eventCallback.getCallbackUrl().toString();
          if (component instanceof WebDataRadioChoice || component instanceof WebDataCheckBoxChoice || component instanceof WebDataLookupField|| component instanceof WebDataComboBox|| component instanceof WebDataListBox) {
            callback+="String_Node_Str";
          }
          for (          IBehavior behavior : targetComponent.getBehaviors()) {
            if (behavior instanceof EventCallbackModifier) {
              targetComponent.remove(behavior);
            }
          }
          if (hasFocus) {
            StringBuilder js=new StringBuilder();
            js.append("String_Node_Str").append(callback).append("String_Node_Str");
            targetComponent.add(new EventCallbackModifier("String_Node_Str",true,new Model<String>(js.toString())));
            targetComponent.add(new EventCallbackModifier("String_Node_Str",true,new Model<String>("String_Node_Str")));
          }
          if (hasBlur) {
            StringBuilder js=new StringBuilder();
            js.append("String_Node_Str").append(callback).append("String_Node_Str");
            targetComponent.add(new EventCallbackModifier("String_Node_Str",true,new Model<String>(js.toString())));
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public void onBeforeRender(Component component){
  if (component instanceof IServoyAwareBean) {
    IModel model=component.getInnermostModel();
    WebForm webForm=component.findParent(WebForm.class);
    if (model instanceof RecordItemModel && webForm != null) {
      IRecord record=(IRecord)((RecordItemModel)model).getObject();
      FormScope fs=webForm.getController().getFormScope();
      if (record != null && fs != null) {
        ((IServoyAwareBean)component).setSelectedRecord(new ServoyBeanState(record,fs));
      }
    }
  }
 else {
    if (!component.isEnabled())     return;
    Component targetComponent=null;
    boolean hasFocus=false, hasBlur=false;
    if (component instanceof IFieldComponent && ((IFieldComponent)component).getEventExecutor() != null) {
      targetComponent=component;
      if (component instanceof WebBaseSelectBox) {
        Component[] cs=((WebBaseSelectBox)component).getFocusChildren();
        if (cs != null && cs.length == 1)         targetComponent=cs[0];
      }
      if (component instanceof WebDataHtmlArea)       hasFocus=true;
      if (((IFieldComponent)component).getEventExecutor().hasEnterCmds() || component.findParent(WebCellBasedView.class) != null || (((IFieldComponent)component).getScriptObject() instanceof ISupportOnRenderCallback && ((ISupportOnRenderCallback)((IFieldComponent)component).getScriptObject()).getRenderEventExecutor().hasRenderCallback())) {
        hasFocus=true;
      }
      hasBlur=true;
    }
 else     if (component instanceof WebBaseLabel) {
      targetComponent=component;
      hasFocus=true;
    }
    if (targetComponent != null) {
      MainPage mainPage=targetComponent.findParent(MainPage.class);
      if (mainPage.isUsingAjax()) {
        AbstractAjaxBehavior eventCallback=mainPage.getPageContributor().getEventCallback();
        if (eventCallback != null) {
          String callback=eventCallback.getCallbackUrl().toString();
          if (component instanceof WebDataRadioChoice || component instanceof WebDataCheckBoxChoice || component instanceof WebDataLookupField|| component instanceof WebDataComboBox|| component instanceof WebDataListBox|| component instanceof WebDataHtmlArea) {
            callback+="String_Node_Str";
          }
          for (          IBehavior behavior : targetComponent.getBehaviors()) {
            if (behavior instanceof EventCallbackModifier) {
              targetComponent.remove(behavior);
            }
          }
          if (hasFocus) {
            StringBuilder js=new StringBuilder();
            js.append("String_Node_Str").append(callback).append("String_Node_Str");
            if (targetComponent instanceof WebDataHtmlArea) {
              js.insert(0,"String_Node_Str");
            }
            targetComponent.add(new EventCallbackModifier("String_Node_Str",true,new Model<String>(js.toString())));
            targetComponent.add(new EventCallbackModifier("String_Node_Str",true,new Model<String>("String_Node_Str")));
          }
          if (hasBlur) {
            StringBuilder js=new StringBuilder();
            js.append("String_Node_Str").append(callback).append("String_Node_Str");
            targetComponent.add(new EventCallbackModifier("String_Node_Str",true,new Model<String>(js.toString())));
          }
        }
      }
    }
  }
}