Program: 143478
Project: 143478
Buggy source:
@Override public Object executeMethod(String methodName,final JSONObject args) throws Exception {
  INGClientWebsocketSession websocketSession=getApplication().getWebsocketSession();
switch (methodName) {
case "String_Node_Str":
{
      IWebFormUI form=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=SecuritySupport.decrypt(Settings.getInstance(),args.optString("String_Node_Str"));
      IWebFormUI form=getFormAndSetCurrentWindow(formName).getFormUI();
      form.getDataAdapterList().executeInlineScript(args.optString("String_Node_Str"),args.optJSONObject("String_Node_Str"));
    }
 catch (    Exception ex) {
      Debug.error("String_Node_Str",ex);
    }
    break;
  }
case "String_Node_Str":
{
  final String formName=args.optString("String_Node_Str");
  websocketSession.formCreated(formName);
  IWebFormUI form=getFormAndSetCurrentWindow(formName).getFormUI();
  if (form instanceof WebGridFormUI) {
    WebGridFormUI grid=(WebGridFormUI)form;
    if (args.has("String_Node_Str"))     grid.setCurrentPage(args.optInt("String_Node_Str"));
    if (args.has("String_Node_Str"))     grid.setPageSize(args.optInt("String_Node_Str"));
  }
  Map<String,Map<String,Object>> properties=form.getAllComponentsProperties();
  Map<String,Map<String,Map<String,Object>>> formData=new HashMap<String,Map<String,Map<String,Object>>>();
  formData.put(formName,properties);
  try {
    WebsocketEndpoint.get().sendMessage(formData.size() == 0 ? null : Collections.singletonMap("String_Node_Str",formData),true,websocketSession.getForJsonConverter(),ConversionLocation.BROWSER);
  }
 catch (  IOException e) {
    Debug.error(e);
  }
  break;
}
case "String_Node_Str":
{
IWebFormController form=getForm(args.optString("String_Node_Str"));
if (form != null) {
  ((WebFormController)form).setReadOnly(args.optBoolean("String_Node_Str",false));
}
break;
}
case "String_Node_Str":
{
IWebFormController form=getForm(args.optString("String_Node_Str"));
if (form != null) {
((WebFormController)form).setComponentEnabled(args.optBoolean("String_Node_Str",true));
}
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=getFormAndSetCurrentWindow(args.optString("String_Node_Str"));
controller=getForm(formName);
}
 else {
controller=getFormAndSetCurrentWindow(formName);
}
List<Runnable> invokeLaterRunnables=new ArrayList<Runnable>();
boolean isVisible=args.getBoolean("String_Node_Str");
boolean ok=controller.notifyVisible(isVisible,invokeLaterRunnables);
if (ok && parentForm != null) {
WebFormComponent containerComponent=parentForm.getFormUI().getWebComponent(args.getString("String_Node_Str"));
if (containerComponent != null) {
containerComponent.updateVisibleForm(controller.getFormUI(),isVisible,args.optInt("String_Node_Str"));
}
if (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();
controller.loadRecords(selectedRecord.getRelatedFoundSet(relation));
parentForm.getFormUI().getDataAdapterList().addRelatedForm(controller,relation);
}
}
Utils.invokeLater(getApplication(),invokeLaterRunnables);
Form form=application.getFormManager().getPossibleForm(formName);
if (form != null) ((INGApplication)application).getWebsocketSession().touchForm(application.getFlattenedSolution().getFlattenedForm(form),formName,true);
return Boolean.valueOf(ok);
}
}
return null;
}

Fixed version (ground truth):
@Override public Object executeMethod(String methodName,final JSONObject args) throws Exception {
  INGClientWebsocketSession websocketSession=getApplication().getWebsocketSession();
switch (methodName) {
case "String_Node_Str":
{
      IWebFormUI form=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=SecuritySupport.decrypt(Settings.getInstance(),args.optString("String_Node_Str"));
      IWebFormUI form=getFormAndSetCurrentWindow(formName).getFormUI();
      form.getDataAdapterList().executeInlineScript(args.optString("String_Node_Str"),args.optJSONObject("String_Node_Str"));
    }
 catch (    Exception ex) {
      Debug.error("String_Node_Str",ex);
    }
    break;
  }
case "String_Node_Str":
{
  final String formName=args.optString("String_Node_Str");
  IWebFormUI form=getFormAndSetCurrentWindow(formName).getFormUI();
  if (form instanceof WebGridFormUI) {
    WebGridFormUI grid=(WebGridFormUI)form;
    if (args.has("String_Node_Str"))     grid.setCurrentPage(args.optInt("String_Node_Str"));
    if (args.has("String_Node_Str"))     grid.setPageSize(args.optInt("String_Node_Str"));
  }
  Map<String,Map<String,Object>> properties=form.getAllComponentsProperties();
  Map<String,Map<String,Map<String,Object>>> formData=new HashMap<String,Map<String,Map<String,Object>>>();
  formData.put(formName,properties);
  try {
    WebsocketEndpoint.get().sendMessage(formData.size() == 0 ? null : Collections.singletonMap("String_Node_Str",formData),true,websocketSession.getForJsonConverter(),ConversionLocation.BROWSER);
  }
 catch (  IOException e) {
    Debug.error(e);
  }
  break;
}
case "String_Node_Str":
{
IWebFormController form=getForm(args.optString("String_Node_Str"));
if (form != null) {
  ((WebFormController)form).setReadOnly(args.optBoolean("String_Node_Str",false));
}
break;
}
case "String_Node_Str":
{
IWebFormController form=getForm(args.optString("String_Node_Str"));
if (form != null) {
((WebFormController)form).setComponentEnabled(args.optBoolean("String_Node_Str",true));
}
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=getFormAndSetCurrentWindow(args.optString("String_Node_Str"));
controller=getForm(formName);
}
 else {
controller=getFormAndSetCurrentWindow(formName);
}
List<Runnable> invokeLaterRunnables=new ArrayList<Runnable>();
boolean isVisible=args.getBoolean("String_Node_Str");
boolean ok=controller.notifyVisible(isVisible,invokeLaterRunnables);
if (ok && parentForm != null) {
WebFormComponent containerComponent=parentForm.getFormUI().getWebComponent(args.getString("String_Node_Str"));
if (containerComponent != null) {
containerComponent.updateVisibleForm(controller.getFormUI(),isVisible,args.optInt("String_Node_Str"));
}
if (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();
controller.loadRecords(selectedRecord.getRelatedFoundSet(relation));
parentForm.getFormUI().getDataAdapterList().addRelatedForm(controller,relation);
}
}
Utils.invokeLater(getApplication(),invokeLaterRunnables);
Form form=application.getFormManager().getPossibleForm(formName);
if (form != null) ((INGApplication)application).getWebsocketSession().touchForm(application.getFlattenedSolution().getFlattenedForm(form),formName,true);
return Boolean.valueOf(ok);
}
}
return null;
}