Program: 143398
Project: 143398
Buggy source:
@Override public Object executeMethod(String methodName,JSONObject args) throws Exception {
switch (methodName) {
case "String_Node_Str":
{
      String formName=args.getString("String_Node_Str");
      IWebFormUI form=(IWebFormUI)NGClientWindow.getCurrentWindow().getForm(formName);
      if (form == null) {
        log.warn("String_Node_Str" + formName + "String_Node_Str");
      }
 else {
        dataPush(args);
        WebFormComponent webComponent=form.getWebComponent(args.getString("String_Node_Str"));
        form.getDataAdapterList().pushChanges(webComponent,args.getString("String_Node_Str"));
      }
      break;
    }
case "String_Node_Str":
{
    IWebFormUI form=getApplication().getFormManager().getFormAndSetCurrentWindow(args.optString("String_Node_Str")).getFormUI();
    form.getDataAdapterList().startEdit(form.getWebComponent(args.optString("String_Node_Str")),args.optString("String_Node_Str"));
    break;
  }
case "String_Node_Str":
{
  try {
    String formName=args.optString("String_Node_Str",null);
    if (formName == null) {
      formName=getApplication().getFormManager().getCurrentForm().getName();
    }
 else {
      formName=SecuritySupport.decrypt(Settings.getInstance(),formName);
    }
    IWebFormUI form=getApplication().getFormManager().getFormAndSetCurrentWindow(formName).getFormUI();
    form.getDataAdapterList().executeInlineScript(args.optString("String_Node_Str"),args.optJSONObject("String_Node_Str"),args.optJSONArray("String_Node_Str"));
  }
 catch (  Exception ex) {
    Debug.error("String_Node_Str",ex);
  }
  break;
}
case "String_Node_Str":
{
IWebFormController parentForm=null;
IWebFormController controller=null;
String formName=args.optString("String_Node_Str");
if (args.has("String_Node_Str") && !args.isNull("String_Node_Str")) {
  parentForm=getApplication().getFormManager().getFormAndSetCurrentWindow(args.optString("String_Node_Str"));
  controller=getApplication().getFormManager().getForm(formName);
}
 else {
  controller=getApplication().getFormManager().getFormAndSetCurrentWindow(formName);
}
if (controller == null) return Boolean.valueOf(true);
List<Runnable> invokeLaterRunnables=new ArrayList<Runnable>();
boolean isVisible=args.getBoolean("String_Node_Str");
WebFormComponent containerComponent=null;
if (parentForm != null) {
  containerComponent=parentForm.getFormUI().getWebComponent(args.getString("String_Node_Str"));
  if (isVisible && containerComponent != null) {
    containerComponent.updateVisibleForm(controller.getFormUI(),isVisible,args.optInt("String_Node_Str"));
  }
}
boolean ok=controller.notifyVisible(isVisible,invokeLaterRunnables);
if (ok && parentForm != null) {
  if (!isVisible && containerComponent != null) {
    containerComponent.updateVisibleForm(controller.getFormUI(),isVisible,args.optInt("String_Node_Str"));
  }
  if (isVisible && args.has("String_Node_Str") && !args.isNull("String_Node_Str")) {
    String relation=args.getString("String_Node_Str");
    FoundSet parentFs=parentForm.getFormModel();
    IRecordInternal selectedRecord=(IRecordInternal)parentFs.getSelectedRecord();
    if (selectedRecord != null) {
      controller.loadRecords(selectedRecord.getRelatedFoundSet(relation));
    }
 else {
      controller.loadRecords(parentFs.getPrototypeState().getRelatedFoundSet(relation));
    }
    parentForm.getFormUI().getDataAdapterList().addRelatedForm(controller,relation,true);
  }
}
Utils.invokeLater(getApplication(),invokeLaterRunnables);
Form form=getApplication().getFormManager().getPossibleForm(formName);
if (form != null) NGClientWindow.getCurrentWindow().touchForm(getApplication().getFlattenedSolution().getFlattenedForm(form),formName,true);
return Boolean.valueOf(ok);
}
case "String_Node_Str":
{
NGClientWindow.getCurrentWindow().formCreated(args.optString("String_Node_Str"));
break;
}
case "String_Node_Str":
{
String formName=args.optString("String_Node_Str");
IWebFormController form=getApplication().getFormManager().getForm(formName);
if (form != null) {
String windowName=form.getFormUI().getParentWindowName();
NGRuntimeWindow window=null;
if (windowName != null && (window=getApplication().getRuntimeWindowManager().getWindow(windowName)) != null) {
History history=window.getHistory();
if (history.getFormIndex(formName) != -1) {
  history.go(history.getFormIndex(formName) - history.getIndex());
}
 else {
  Debug.log("String_Node_Str" + formName + "String_Node_Str"+ windowName);
}
}
 else {
Debug.error("String_Node_Str" + formName);
}
}
 else {
Debug.error("String_Node_Str" + formName + "String_Node_Str");
}
break;
}
default :
{
return super.executeMethod(methodName,args);
}
}
return null;
}

Fixed version (ground truth):
@Override public Object executeMethod(String methodName,JSONObject args) throws Exception {
switch (methodName) {
case "String_Node_Str":
{
      String formName=args.getString("String_Node_Str");
      IWebFormUI form=(IWebFormUI)NGClientWindow.getCurrentWindow().getForm(formName);
      if (form == null) {
        log.warn("String_Node_Str" + formName + "String_Node_Str");
      }
 else {
        dataPush(args);
        WebFormComponent webComponent=form.getWebComponent(args.getString("String_Node_Str"));
        form.getDataAdapterList().pushChanges(webComponent,args.getString("String_Node_Str"));
      }
      break;
    }
case "String_Node_Str":
{
    IWebFormUI form=getApplication().getFormManager().getFormAndSetCurrentWindow(args.optString("String_Node_Str")).getFormUI();
    form.getDataAdapterList().startEdit(form.getWebComponent(args.optString("String_Node_Str")),args.optString("String_Node_Str"));
    break;
  }
case "String_Node_Str":
{
  try {
    String formName=args.optString("String_Node_Str",null);
    if (formName == null) {
      formName=getApplication().getFormManager().getCurrentForm().getName();
    }
 else {
      formName=SecuritySupport.decrypt(Settings.getInstance(),formName);
    }
    IWebFormUI form=getApplication().getFormManager().getFormAndSetCurrentWindow(formName).getFormUI();
    form.getDataAdapterList().executeInlineScript(args.optString("String_Node_Str"),args.optJSONObject("String_Node_Str"),args.optJSONArray("String_Node_Str"));
  }
 catch (  Exception ex) {
    Debug.error("String_Node_Str",ex);
  }
  break;
}
case "String_Node_Str":
{
IWebFormController parentForm=null;
IWebFormController controller=null;
String formName=args.optString("String_Node_Str");
if (args.has("String_Node_Str") && !args.isNull("String_Node_Str")) {
  parentForm=getApplication().getFormManager().getFormAndSetCurrentWindow(args.optString("String_Node_Str"));
  controller=getApplication().getFormManager().getForm(formName);
}
 else {
  controller=getApplication().getFormManager().getFormAndSetCurrentWindow(formName);
}
if (controller == null) return Boolean.valueOf(true);
List<Runnable> invokeLaterRunnables=new ArrayList<Runnable>();
boolean isVisible=args.getBoolean("String_Node_Str");
WebFormComponent containerComponent=null;
if (parentForm != null) {
  containerComponent=parentForm.getFormUI().getWebComponent(args.getString("String_Node_Str"));
  if (isVisible && containerComponent != null) {
    containerComponent.updateVisibleForm(controller.getFormUI(),isVisible,args.optInt("String_Node_Str"));
  }
}
boolean ok=controller.notifyVisible(isVisible,invokeLaterRunnables);
if (ok && parentForm != null) {
  if (!isVisible && containerComponent != null) {
    containerComponent.updateVisibleForm(controller.getFormUI(),isVisible,args.optInt("String_Node_Str"));
  }
  String relation=null;
  if (isVisible && args.has("String_Node_Str") && !args.isNull("String_Node_Str")) {
    relation=args.getString("String_Node_Str");
    FoundSet parentFs=parentForm.getFormModel();
    IRecordInternal selectedRecord=(IRecordInternal)parentFs.getSelectedRecord();
    if (selectedRecord != null) {
      controller.loadRecords(selectedRecord.getRelatedFoundSet(relation));
    }
 else {
      controller.loadRecords(parentFs.getPrototypeState().getRelatedFoundSet(relation));
    }
  }
  if (isVisible) {
    parentForm.getFormUI().getDataAdapterList().addVisibleChildForm(controller,relation,true);
  }
 else {
    parentForm.getFormUI().getDataAdapterList().removeVisibleChildForm(controller,true);
  }
}
Utils.invokeLater(getApplication(),invokeLaterRunnables);
Form form=getApplication().getFormManager().getPossibleForm(formName);
if (form != null) NGClientWindow.getCurrentWindow().touchForm(getApplication().getFlattenedSolution().getFlattenedForm(form),formName,true);
return Boolean.valueOf(ok);
}
case "String_Node_Str":
{
NGClientWindow.getCurrentWindow().formCreated(args.optString("String_Node_Str"));
break;
}
case "String_Node_Str":
{
String formName=args.optString("String_Node_Str");
IWebFormController form=getApplication().getFormManager().getForm(formName);
if (form != null) {
String windowName=form.getFormUI().getParentWindowName();
NGRuntimeWindow window=null;
if (windowName != null && (window=getApplication().getRuntimeWindowManager().getWindow(windowName)) != null) {
History history=window.getHistory();
if (history.getFormIndex(formName) != -1) {
  history.go(history.getFormIndex(formName) - history.getIndex());
}
 else {
  Debug.log("String_Node_Str" + formName + "String_Node_Str"+ windowName);
}
}
 else {
Debug.error("String_Node_Str" + formName);
}
}
 else {
Debug.error("String_Node_Str" + formName + "String_Node_Str");
}
break;
}
default :
{
return super.executeMethod(methodName,args);
}
}
return null;
}