nus-yam/ex-repair huggingface dataset:
Program: 143362
Project: 143362
Buggy source:
private void refreshForms(Collection<IFormController> forms){
  if (forms != null && forms.size() > 0) {
    FormElementHelper.INSTANCE.reload();
    List<IFormController> cachedFormControllers=getFormManager().getCachedFormControllers();
    for (    IFormController formController : cachedFormControllers) {
      if (formController.getFormUI() instanceof WebFormUI) {
        ((WebFormUI)formController.getFormUI()).clearCachedFormElements();
      }
    }
    List<Runnable> invokeLaterRunnables=new ArrayList<Runnable>();
    for (    IFormController controller : forms) {
      boolean isVisible=controller.isFormVisible();
      if (isVisible)       controller.notifyVisible(false,invokeLaterRunnables);
      ((WebFormController)controller).initFormUI();
      if (isVisible)       controller.notifyVisible(true,invokeLaterRunnables);
    }
    WebsocketSessionWindows allendpoints=new NGClientWebsocketSessionWindows(getWebsocketSession());
    allendpoints.executeAsyncServiceCall(NGRuntimeWindowManager.WINDOW_SERVICE,"String_Node_Str",null,null);
    try {
      allendpoints.flush();
    }
 catch (    IOException e) {
      reportError("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
private void refreshForms(Collection<IFormController> forms){
  if (forms != null && forms.size() > 0) {
    FormElementHelper.INSTANCE.reload();
    List<IFormController> cachedFormControllers=getFormManager().getCachedFormControllers();
    for (    IFormController formController : cachedFormControllers) {
      if (formController.getFormUI() instanceof WebFormUI) {
        ((WebFormUI)formController.getFormUI()).clearCachedFormElements();
      }
    }
    List<Runnable> invokeLaterRunnables=new ArrayList<Runnable>();
    for (    IFormController controller : forms) {
      boolean isVisible=controller.isFormVisible();
      if (isVisible)       controller.notifyVisible(false,invokeLaterRunnables);
      if (!Utils.stringSafeEquals(controller.getDataSource(),controller.getFormModel().getDataSource())) {
        String name=controller.getName();
        controller.destroy();
        controller=getFormManager().leaseFormPanel(name);
        FoundSet foundset;
        try {
          foundset=(FoundSet)getFoundSetManager().getSharedFoundSet(controller.getDataSource());
          foundset.loadAllRecords();
          controller.loadRecords(foundset);
        }
 catch (        ServoyException e) {
          Debug.error(e);
        }
      }
 else {
        ((WebFormController)controller).initFormUI();
      }
      if (isVisible)       controller.notifyVisible(true,invokeLaterRunnables);
    }
    WebsocketSessionWindows allendpoints=new NGClientWebsocketSessionWindows(getWebsocketSession());
    allendpoints.executeAsyncServiceCall(NGRuntimeWindowManager.WINDOW_SERVICE,"String_Node_Str",null,null);
    try {
      allendpoints.flush();
    }
 catch (    IOException e) {
      reportError("String_Node_Str",e);
    }
  }
}
Program: 143363
Project: 143363
Buggy source:
private void reregister(){
  if (record == null) {
    return;
  }
  IRecordInternal currRecord=record;
  String[] parts=dataProviderID.split("String_Node_Str");
  List<IRecordInternal> newRelated=new ArrayList<IRecordInternal>(parts.length - 1);
  for (int i=0; currRecord != null && i < parts.length - 1; i++) {
    Object value=currRecord.getValue(parts[i]);
    if (value instanceof ISwingFoundSet) {
      currRecord=((ISwingFoundSet)value).getRecord(((ISwingFoundSet)value).getSelectedIndex());
      if (currRecord == null)       currRecord=((ISwingFoundSet)value).getPrototypeState();
      newRelated.add(currRecord);
    }
  }
  if (!newRelated.equals(relatedData)) {
    deregister();
    relatedData=newRelated;
    for (    IRecordInternal rec : relatedData) {
      rec.addModificationListener(this);
      ((ISwingFoundSet)rec.getParentFoundSet()).addTableModelListener(this);
      ((ISwingFoundSet)rec.getParentFoundSet()).getSelectionModel().addListSelectionListener(this);
    }
  }
}

Fixed version (ground truth):
private void reregister(){
  if (record == null) {
    return;
  }
  IRecordInternal currRecord=record;
  String[] parts=dataProviderID.split("String_Node_Str");
  List<IRecordInternal> newRelated=new ArrayList<IRecordInternal>(parts.length - 1);
  for (int i=0; currRecord != null && i < parts.length - 1; i++) {
    Object value=currRecord.getValue(parts[i]);
    if (value instanceof ISwingFoundSet) {
      currRecord=((ISwingFoundSet)value).getRecord(((ISwingFoundSet)value).getSelectedIndex());
      if (currRecord == null)       currRecord=((ISwingFoundSet)value).getPrototypeState();
      newRelated.add(currRecord);
    }
 else {
      currRecord=null;
    }
  }
  if (!newRelated.equals(relatedData)) {
    deregister();
    relatedData=newRelated;
    for (    IRecordInternal rec : relatedData) {
      rec.addModificationListener(this);
      ((ISwingFoundSet)rec.getParentFoundSet()).addTableModelListener(this);
      ((ISwingFoundSet)rec.getParentFoundSet()).getSelectionModel().addListSelectionListener(this);
    }
  }
}
Program: 143365
Project: 143365
Buggy source:
public boolean isValidRelation(String name){
  Relation[] relationSequence=fsm.getApplication().getFlattenedSolution().getRelationSequence(name);
  if (relationSequence != null && relationSequence.length > 0 && (relationSequence[0].isGlobal() || !relationSequence[0].getPrimaryDataSource().equals(getDataSource()))) {
    fsm.getApplication().reportJSError("String_Node_Str" + relationSequence[0].getName() + "String_Node_Str"+ getDataSource()+ "String_Node_Str"+ (relationSequence[0].isGlobal() ? "String_Node_Str" : "String_Node_Str" + relationSequence[0].getPrimaryDataSource() + "String_Node_Str"),new ServoyException());
  }
  return relationSequence != null;
}

Fixed version (ground truth):
public boolean isValidRelation(String name){
  Relation[] relationSequence=fsm.getApplication().getFlattenedSolution().getRelationSequence(name);
  if (relationSequence != null && relationSequence.length > 0 && !relationSequence[0].isGlobal() && !relationSequence[0].getPrimaryDataSource().equals(getDataSource())) {
    fsm.getApplication().reportJSError("String_Node_Str" + relationSequence[0].getName() + "String_Node_Str"+ getDataSource()+ "String_Node_Str"+ relationSequence[0].getPrimaryDataSource()+ "String_Node_Str",new ServoyException());
  }
  return relationSequence != null;
}
Program: 143368
Project: 143368
Buggy source:
@Override public ComponentTypeSabloValue fromJSON(Object newJSONValue,ComponentTypeSabloValue previousSabloValue,PropertyDescription pd,IBrowserConverterContext dataConverterContext){
  if (previousSabloValue != null) {
    previousSabloValue.browserUpdatesReceived(newJSONValue);
  }
  return previousSabloValue;
}

Fixed version (ground truth):
@Override public ComponentTypeSabloValue fromJSON(Object newJSONValue,ComponentTypeSabloValue previousSabloValue,PropertyDescription pd,IBrowserConverterContext dataConverterContext,ValueReference<Boolean> returnValueAdjustedIncommingValue){
  if (previousSabloValue != null) {
    previousSabloValue.browserUpdatesReceived(newJSONValue);
  }
  return previousSabloValue;
}
Program: 143369
Project: 143369
Buggy source:
@Override public FoundsetLinkedTypeSabloValue<YF,YT> fromJSON(Object newJSONValue,FoundsetLinkedTypeSabloValue<YF,YT> previousSabloValue,PropertyDescription pd,IBrowserConverterContext dataConverterContext){
  if (previousSabloValue != null) {
    previousSabloValue.browserUpdatesReceived(newJSONValue,getConfig(pd).wrappedPropertyDescription,pd,dataConverterContext);
  }
  return previousSabloValue;
}

Fixed version (ground truth):
@Override public FoundsetLinkedTypeSabloValue<YF,YT> fromJSON(Object newJSONValue,FoundsetLinkedTypeSabloValue<YF,YT> previousSabloValue,PropertyDescription pd,IBrowserConverterContext dataConverterContext,ValueReference<Boolean> returnValueAdjustedIncommingValue){
  if (previousSabloValue != null) {
    previousSabloValue.browserUpdatesReceived(newJSONValue,getConfig(pd).wrappedPropertyDescription,pd,dataConverterContext,returnValueAdjustedIncommingValue);
  }
  return previousSabloValue;
}
Program: 143372
Project: 143372
Buggy source:
@Override public FoundsetTypeSabloValue fromJSON(Object newJSONValue,FoundsetTypeSabloValue previousSabloValue,PropertyDescription pd,IBrowserConverterContext dataConverterContext){
  if (previousSabloValue != null) {
    previousSabloValue.browserUpdatesReceived(newJSONValue,pd,dataConverterContext);
  }
  return previousSabloValue;
}

Fixed version (ground truth):
@Override public FoundsetTypeSabloValue fromJSON(Object newJSONValue,FoundsetTypeSabloValue previousSabloValue,PropertyDescription pd,IBrowserConverterContext dataConverterContext,ValueReference<Boolean> returnValueAdjustedIncommingValue){
  if (previousSabloValue != null) {
    previousSabloValue.browserUpdatesReceived(newJSONValue,pd,dataConverterContext);
  }
  return previousSabloValue;
}
Program: 143374
Project: 143374
Buggy source:
@Override public Object toRhinoValue(Object value,PropertyDescription pd){
  Border border=fromJSON(value,null,pd,null);
  return ComponentFactoryHelper.createBorderString(border);
}

Fixed version (ground truth):
@Override public Object toRhinoValue(Object value,PropertyDescription pd){
  Border border=fromJSON(value,null,pd,null,null);
  return ComponentFactoryHelper.createBorderString(border);
}
Program: 143376
Project: 143376
Buggy source:
@Override public Border toFormElementValue(JSONObject designValue,PropertyDescription pd,FlattenedSolution flattenedSolution,INGFormElement formElement,PropertyPath propertyPath){
  return fromJSON(designValue,null,pd,null);
}

Fixed version (ground truth):
@Override public Border toFormElementValue(JSONObject designValue,PropertyDescription pd,FlattenedSolution flattenedSolution,INGFormElement formElement,PropertyPath propertyPath){
  return fromJSON(designValue,null,pd,null,null);
}
Program: 143377
Project: 143377
Buggy source:
@Override public byte[] fromJSON(Object newJSONValue,byte[] previousSabloValue,PropertyDescription pd,IBrowserConverterContext dataConverterContext){
  return previousSabloValue;
}

Fixed version (ground truth):
@Override public byte[] fromJSON(Object newJSONValue,byte[] previousSabloValue,PropertyDescription pd,IBrowserConverterContext dataConverterContext,ValueReference<Boolean> returnValueAdjustedIncommingValue){
  return previousSabloValue;
}
Program: 143378
Project: 143378
Buggy source:
@Override public DataproviderTypeSabloValue fromJSON(Object newJSONValue,DataproviderTypeSabloValue previousSabloValue,PropertyDescription pd,IBrowserConverterContext dataConverterContext){
  if (previousSabloValue != null) {
    previousSabloValue.browserUpdateReceived(newJSONValue,dataConverterContext);
  }
  return previousSabloValue;
}

Fixed version (ground truth):
@Override public DataproviderTypeSabloValue fromJSON(Object newJSONValue,DataproviderTypeSabloValue previousSabloValue,PropertyDescription pd,IBrowserConverterContext dataConverterContext,ValueReference<Boolean> returnValueAdjustedIncommingValue){
  if (previousSabloValue != null) {
    previousSabloValue.browserUpdateReceived(newJSONValue,dataConverterContext);
  }
  return previousSabloValue;
}
Program: 143379
Project: 143379
Buggy source:
public void browserUpdateReceived(Object newJSONValue,IBrowserConverterContext dataConverterContext){
  Object oldValue=value;
  if (!findMode && typeOfDP != null) {
    if (typeOfDP.getType() instanceof IPropertyConverterForBrowser<?>) {
      value=((IPropertyConverterForBrowser)typeOfDP.getType()).fromJSON(newJSONValue,value,typeOfDP,dataConverterContext);
    }
 else     value=newJSONValue;
  }
 else   value=newJSONValue;
  if (oldValue != value && (oldValue == null || !oldValue.equals(value))) {
    jsonValue=null;
  }
}

Fixed version (ground truth):
public void browserUpdateReceived(Object newJSONValue,IBrowserConverterContext dataConverterContext){
  Object oldValue=value;
  ValueReference<Boolean> serverSideValueIsNotTheSameAsClient=new ValueReference<>(Boolean.FALSE);
  if (!findMode && typeOfDP != null) {
    if (typeOfDP.getType() instanceof IPropertyConverterForBrowser<?>) {
      value=((IPropertyConverterForBrowser)typeOfDP.getType()).fromJSON(newJSONValue,value,typeOfDP,dataConverterContext,serverSideValueIsNotTheSameAsClient);
    }
 else     value=newJSONValue;
  }
 else   value=newJSONValue;
  if (oldValue != value && (oldValue == null || !oldValue.equals(value))) {
    jsonValue=null;
  }
  if (serverSideValueIsNotTheSameAsClient.value.booleanValue()) {
    jsonValue=null;
    changeMonitor.valueChanged();
  }
}
Program: 143380
Project: 143380
Buggy source:
@Override public Object executeMethod(String methodName,JSONObject args) throws Exception {
  if ("String_Node_Str".equals(methodName)) {
    JSONObject values=new JSONObject();
    for (int i=0; i < args.length(); i++) {
      String key=args.getString(Integer.toString(i));
      values.put(key,application.getI18NMessage(key));
    }
    return values;
  }
  return null;
}

Fixed version (ground truth):
@Override public Object executeMethod(String methodName,JSONObject args) throws Exception {
  if ("String_Node_Str".equals(methodName)) {
    JSONObject values=new JSONObject();
    for (int i=0; i < args.length(); i++) {
      String key=args.getString(Integer.toString(i));
      values.put(key,application.getI18NMessage(key));
    }
    return values;
  }
 else   if ("String_Node_Str".equals(methodName)) {
    String language=args.getString("String_Node_Str");
    String country=args.optString("String_Node_Str");
    Locale locale;
    if (country == null) {
      locale=new Locale(language);
    }
 else {
      locale=new Locale(language,country);
    }
    DecimalFormatSymbols dfs=RoundHalfUpDecimalFormat.getDecimalFormatSymbols(locale);
    JSONObject languageInfo=new JSONObject();
    JSONObject delimiters=new JSONObject();
    delimiters.put("String_Node_Str",String.valueOf(dfs.getGroupingSeparator()));
    delimiters.put("String_Node_Str",String.valueOf(dfs.getDecimalSeparator()));
    JSONObject abbreviations=new JSONObject();
    abbreviations.put("String_Node_Str","String_Node_Str");
    abbreviations.put("String_Node_Str","String_Node_Str");
    abbreviations.put("String_Node_Str","String_Node_Str");
    abbreviations.put("String_Node_Str","String_Node_Str");
    JSONObject currency=new JSONObject();
    currency.put("String_Node_Str",String.valueOf(dfs.getCurrencySymbol()));
    languageInfo.put("String_Node_Str",delimiters);
    languageInfo.put("String_Node_Str",abbreviations);
    languageInfo.put("String_Node_Str",currency);
    return languageInfo;
  }
  return null;
}
Program: 143381
Project: 143381
Buggy source:
public void browserUpdateReceived(Object newJSONValue,IBrowserConverterContext dataConverterContext){
  Object oldValue=value;
  if (!findMode && typeOfDP != null) {
    if (typeOfDP.getType() instanceof IPropertyConverterForBrowser<?>) {
      value=((IPropertyConverterForBrowser)typeOfDP.getType()).fromJSON(newJSONValue,value,typeOfDP,dataConverterContext);
    }
 else     value=newJSONValue;
  }
 else   value=newJSONValue;
  if (oldValue != value && (oldValue == null || !oldValue.equals(value))) {
    jsonValue=null;
  }
}

Fixed version (ground truth):
public void browserUpdateReceived(Object newJSONValue,IBrowserConverterContext dataConverterContext){
  Object oldValue=value;
  if (!findMode && typeOfDP != null) {
    if (typeOfDP.getType() instanceof IPropertyConverterForBrowser<?>) {
      value=((IPropertyConverterForBrowser)typeOfDP.getType()).fromJSON(newJSONValue,value,typeOfDP,dataConverterContext);
    }
 else     value=newJSONValue;
  }
 else   value=newJSONValue;
  try {
    Object newValueForJSON=getValueForToJSON(value,dataConverterContext);
    if (newValueForJSON != jsonValue || (newValueForJSON != null && !newValueForJSON.equals(jsonValue))) {
      jsonValue=newValueForJSON;
      changeMonitor.valueChanged();
    }
  }
 catch (  JSONException e) {
    Debug.error("String_Node_Str" + newJSONValue + "String_Node_Str"+ value+ "String_Node_Str"+ typeOfDP+ "String_Node_Str",e);
  }
}
Program: 143382
Project: 143382
Buggy source:
public void toJSON(JSONWriter writer,String key,DataConversion clientConversion,IBrowserConverterContext dataConverterContext) throws JSONException {
  if (value instanceof UUID) {
    value=value.toString();
  }
  JSONUtils.addKeyIfPresent(writer,key);
  if (jsonValue == null) {
    if (findMode) {
      jsonValue=value instanceof String ? value : (value != null ? String.valueOf(value) : "String_Node_Str");
    }
 else     if (typeOfDP != null) {
      EmbeddableJSONWriter ejw=new EmbeddableJSONWriter(true);
      DataConversion jsonDataConversion=new DataConversion();
      FullValueToJSONConverter.INSTANCE.toJSONValue(ejw,null,value,typeOfDP,jsonDataConversion,dataConverterContext);
      if (jsonDataConversion.getConversions().size() == 0)       jsonDataConversion=null;
      String str=ejw.toJSONString();
      if (str == null || str.trim().length() == 0) {
        Debug.error("String_Node_Str" + typeOfDP + "String_Node_Str"+ value+ "String_Node_Str");
        str="String_Node_Str";
      }
      jsonValue=new JSONStringWithConversions(str,jsonDataConversion);
    }
 else {
      jsonValue=value;
    }
  }
  writer.value(jsonValue);
  if (jsonValue instanceof IJSONStringWithConversions)   clientConversion.convert(((IJSONStringWithConversions)jsonValue).getDataConversions());
}

Fixed version (ground truth):
public void toJSON(JSONWriter writer,String key,DataConversion clientConversion,IBrowserConverterContext dataConverterContext) throws JSONException {
  if (value instanceof UUID) {
    value=value.toString();
  }
  JSONUtils.addKeyIfPresent(writer,key);
  if (jsonValue == null) {
    jsonValue=getValueForToJSON(value,dataConverterContext);
  }
  writer.value(jsonValue);
  if (jsonValue instanceof IJSONStringWithConversions)   clientConversion.convert(((IJSONStringWithConversions)jsonValue).getDataConversions());
}
Program: 143384
Project: 143384
Buggy source:
/** 
 * @param visible
 * @param invokeLaterRunnables
 */
boolean notifyVisible(boolean visible,List<Runnable> invokeLaterRunnables);

Fixed version (ground truth):
boolean notifyVisible(boolean visible,List<Runnable> invokeLaterRunnables);
Program: 143385
Project: 143385
Buggy source:
@Override public boolean recreateUI(){
  tabSequence=null;
  Form f=application.getFlattenedSolution().getForm(form.getName());
  form=application.getFlattenedSolution().getFlattenedForm(f);
  getFormUI().init();
  NGClientWindow.getCurrentWindow().updateForm(form,getName());
  return true;
}

Fixed version (ground truth):
@Override public boolean recreateUI(){
  List<Runnable> invokeLaterRunnables=new ArrayList<Runnable>();
  notifyVisibleOnChildren(false,invokeLaterRunnables);
  Utils.invokeLater(application,invokeLaterRunnables);
  tabSequence=null;
  Form f=application.getFlattenedSolution().getForm(form.getName());
  form=application.getFlattenedSolution().getFlattenedForm(f);
  getFormUI().init();
  NGClientWindow.getCurrentWindow().updateForm(form,getName());
  return true;
}
Program: 143386
Project: 143386
Buggy source:
@Override public boolean notifyVisible(boolean visible,List<Runnable> invokeLaterRunnables){
  boolean notifyVisibleSuccess=super.notifyVisible(visible,invokeLaterRunnables);
  if (notifyVisibleSuccess && getFormUI() != null) {
    getFormUI().notifyVisible(visible,invokeLaterRunnables);
  }
  return notifyVisibleSuccess;
}

Fixed version (ground truth):
@Override public boolean notifyVisible(boolean visible,List<Runnable> invokeLaterRunnables){
  boolean notifyVisibleSuccess=super.notifyVisible(visible,invokeLaterRunnables);
  if (notifyVisibleSuccess)   notifyVisibleOnChildren(visible,invokeLaterRunnables);
  return notifyVisibleSuccess;
}
Program: 143387
Project: 143387
Buggy source:
@Override public boolean notifyVisible(boolean visible,List<Runnable> invokeLaterRunnables){
  if (isFormVisible == visible || executingOnLoad)   return true;
  if (formModel == null) {
    isFormVisible=visible;
    return true;
  }
  boolean notifyVisible=super.notifyVisible(visible,invokeLaterRunnables);
  if (notifyVisible) {
    IDataRenderer[] array=getDataRenderers();
    for (    IDataRenderer dataRenderer : array) {
      if (dataRenderer != null) {
        dataRenderer.notifyVisible(visible,invokeLaterRunnables);
      }
    }
  }
  return notifyVisible;
}

Fixed version (ground truth):
@Override public boolean notifyVisible(boolean visible,List<Runnable> invokeLaterRunnables){
  if (isFormVisible == visible || executingOnLoad)   return true;
  if (formModel == null) {
    isFormVisible=visible;
    return true;
  }
  boolean notifyVisible=super.notifyVisible(visible,invokeLaterRunnables);
  if (notifyVisible) {
    notifyVisibleOnChildren(visible,invokeLaterRunnables);
  }
  return notifyVisible;
}
Program: 143388
Project: 143388
Buggy source:
@Override public boolean recreateUI(){
  getFormUI().touch();
  Rectangle scrollPosition=null;
  if (view != null)   scrollPosition=view.getVisibleRect();
  getFormUI().setDesignMode(null);
  Form f=application.getFlattenedSolution().getForm(form.getName());
  form=application.getFlattenedSolution().getFlattenedForm(f);
  initStylesAndBorder();
  int v=currentViewType;
  currentViewType=-1;
  setView(v);
  if (isFormVisible) {
    valueChanged(null);
    List<Runnable> invokeLaterRunnables=new ArrayList<Runnable>();
    IDataRenderer[] array=getDataRenderers();
    for (    IDataRenderer dataRenderer : array) {
      if (dataRenderer != null) {
        dataRenderer.notifyVisible(true,invokeLaterRunnables);
      }
    }
    Utils.invokeLater(application,invokeLaterRunnables);
  }
  if (designMode != null) {
    application.invokeLater(new Runnable(){
      public void run(){
        getFormUI().setDesignMode(designMode);
      }
    }
);
  }
  getFormUI().uiRecreated();
  application.getFlattenedSolution().deregisterLiveForm(form,namedInstance);
  application.getFlattenedSolution().registerLiveForm(form,namedInstance);
  if (view != null && scrollPosition != null)   view.setVisibleRect(scrollPosition);
  return true;
}

Fixed version (ground truth):
@Override public boolean recreateUI(){
  List<Runnable> ilr=new ArrayList<Runnable>();
  notifyVisibleOnChildren(false,ilr);
  Utils.invokeLater(application,ilr);
  getFormUI().touch();
  Rectangle scrollPosition=null;
  if (view != null)   scrollPosition=view.getVisibleRect();
  getFormUI().setDesignMode(null);
  Form f=application.getFlattenedSolution().getForm(form.getName());
  form=application.getFlattenedSolution().getFlattenedForm(f);
  initStylesAndBorder();
  int v=currentViewType;
  currentViewType=-1;
  setView(v);
  if (isFormVisible) {
    valueChanged(null);
    List<Runnable> invokeLaterRunnables=new ArrayList<Runnable>();
    IDataRenderer[] array=getDataRenderers();
    for (    IDataRenderer dataRenderer : array) {
      if (dataRenderer != null) {
        dataRenderer.notifyVisible(true,invokeLaterRunnables);
      }
    }
    Utils.invokeLater(application,invokeLaterRunnables);
  }
  if (designMode != null) {
    application.invokeLater(new Runnable(){
      public void run(){
        getFormUI().setDesignMode(designMode);
      }
    }
);
  }
  getFormUI().uiRecreated();
  application.getFlattenedSolution().deregisterLiveForm(form,namedInstance);
  application.getFlattenedSolution().registerLiveForm(form,namedInstance);
  if (view != null && scrollPosition != null)   view.setVisibleRect(scrollPosition);
  return true;
}
Program: 143389
Project: 143389
Buggy source:
public void addUninitializedRelatedForm(String formName,String relationName){
  uninitializedRelatedForms.put(formName,relationName);
}

Fixed version (ground truth):
public void addUninitializedRelatedForm(String formName,String relationName){
  uninitializedVisibleChildForms.put(formName,relationName);
}
Program: 143390
Project: 143390
Buggy source:
public void setRecord(IRecord record,boolean fireChangeEvent){
  if (settingRecord) {
    if (record != this.record) {
      throw new IllegalStateException("String_Node_Str" + record + "String_Node_Str"+ this.record+ "String_Node_Str");
    }
    return;
  }
  try {
    settingRecord=true;
    if (this.record != null) {
      this.record.removeModificationListener(this);
    }
    this.record=(IRecordInternal)record;
    if (this.record != null) {
      pushChangedValues(null,fireChangeEvent);
      this.record.addModificationListener(this);
    }
  }
  finally {
    settingRecord=false;
  }
  if (uninitializedRelatedForms.size() > 0) {
    for (    String formName : uninitializedRelatedForms.keySet()) {
      addRelatedForm(getApplication().getFormManager().getForm(formName),uninitializedRelatedForms.get(formName),true);
    }
    uninitializedRelatedForms.clear();
  }
  for (  IWebFormController form : relatedForms.keySet()) {
    if (relatedForms.get(form) != null) {
      form.loadRecords(record != null ? record.getRelatedFoundSet(relatedForms.get(form),((BasicFormController)form).getDefaultSortColumns()) : null);
    }
  }
}

Fixed version (ground truth):
public void setRecord(IRecord record,boolean fireChangeEvent){
  if (settingRecord) {
    if (record != this.record) {
      throw new IllegalStateException("String_Node_Str" + record + "String_Node_Str"+ this.record+ "String_Node_Str");
    }
    return;
  }
  try {
    settingRecord=true;
    if (this.record != null) {
      this.record.removeModificationListener(this);
    }
    this.record=(IRecordInternal)record;
    if (this.record != null) {
      pushChangedValues(null,fireChangeEvent);
      this.record.addModificationListener(this);
    }
  }
  finally {
    settingRecord=false;
  }
  if (uninitializedVisibleChildForms.size() > 0) {
    for (    String formName : uninitializedVisibleChildForms.keySet()) {
      addVisibleChildForm(getApplication().getFormManager().getForm(formName),uninitializedVisibleChildForms.get(formName),true);
    }
    uninitializedVisibleChildForms.clear();
  }
  for (  IWebFormController form : visibleChildForms.keySet()) {
    if (visibleChildForms.get(form) != null) {
      form.loadRecords(record != null ? record.getRelatedFoundSet(visibleChildForms.get(form),((BasicFormController)form).getDefaultSortColumns()) : null);
    }
  }
}
Program: 143391
Project: 143391
Buggy source:
@Override public void valueChanged(ModificationEvent e){
  if (record != null && e != null && e.getName() != null) {
    for (    Entry<IWebFormController,String> relatedFormEntry : relatedForms.entrySet()) {
      IWebFormController relatedForm=relatedFormEntry.getKey();
      String relatedFormRelation=relatedFormEntry.getValue();
      boolean depends=false;
      Relation[] relations=getApplication().getFlattenedSolution().getRelationSequence(relatedFormRelation);
      for (int r=0; !depends && relations != null && r < relations.length; r++) {
        try {
          IDataProvider[] primaryDataProviders=relations[r].getPrimaryDataProviders(getApplication().getFlattenedSolution());
          for (int p=0; !depends && primaryDataProviders != null && p < primaryDataProviders.length; p++) {
            depends=e.getName().equals(primaryDataProviders[p].getDataProviderID());
          }
        }
 catch (        RepositoryException ex) {
          Debug.log(ex);
        }
      }
      if (depends) {
        relatedForm.loadRecords(record.getRelatedFoundSet(relatedFormRelation,((BasicFormController)relatedForm).getDefaultSortColumns()));
      }
    }
  }
  if (getForm().isFormVisible()) {
    pushChangedValues(e.getName(),true);
  }
}

Fixed version (ground truth):
@Override public void valueChanged(ModificationEvent e){
  if (record != null && e != null && e.getName() != null) {
    for (    Entry<IWebFormController,String> relatedFormEntry : visibleChildForms.entrySet()) {
      IWebFormController relatedForm=relatedFormEntry.getKey();
      String relatedFormRelation=relatedFormEntry.getValue();
      boolean depends=false;
      Relation[] relations=getApplication().getFlattenedSolution().getRelationSequence(relatedFormRelation);
      for (int r=0; !depends && relations != null && r < relations.length; r++) {
        try {
          IDataProvider[] primaryDataProviders=relations[r].getPrimaryDataProviders(getApplication().getFlattenedSolution());
          for (int p=0; !depends && primaryDataProviders != null && p < primaryDataProviders.length; p++) {
            depends=e.getName().equals(primaryDataProviders[p].getDataProviderID());
          }
        }
 catch (        RepositoryException ex) {
          Debug.log(ex);
        }
      }
      if (depends) {
        relatedForm.loadRecords(record.getRelatedFoundSet(relatedFormRelation,((BasicFormController)relatedForm).getDefaultSortColumns()));
      }
    }
  }
  if (getForm().isFormVisible()) {
    pushChangedValues(e.getName(),true);
  }
}
Program: 143392
Project: 143392
Buggy source:
public boolean stopUIEditing(boolean looseFocus){
  for (  IWebFormController relatedController : relatedForms.keySet()) {
    if (!relatedController.stopUIEditing(looseFocus))     return false;
  }
  return true;
}

Fixed version (ground truth):
public boolean stopUIEditing(boolean looseFocus){
  for (  IWebFormController relatedController : visibleChildForms.keySet()) {
    if (!relatedController.stopUIEditing(looseFocus))     return false;
  }
  return true;
}
Program: 143393
Project: 143393
Buggy source:
public void destroy(){
  if (record != null) {
    setRecord(null,false);
  }
  if (formController != null && formController.getFormScope() != null) {
    formController.getFormScope().getModificationSubject().removeModificationListener(this);
  }
  if (formController != null && formController.getApplication() != null && formController.getApplication().getScriptEngine() != null) {
    IExecutingEnviroment er=formController.getApplication().getScriptEngine();
    if (er.getScopesScope() != null) {
      er.getScopesScope().getModificationSubject().removeModificationListener(this);
    }
  }
  dataProviderToLinkedComponentProperty.clear();
  allComponentPropertiesLinkedToData.clear();
  findModeAwareProperties.clear();
  parentRelatedForms.clear();
  relatedForms.clear();
  uninitializedRelatedForms.clear();
}

Fixed version (ground truth):
public void destroy(){
  if (record != null) {
    setRecord(null,false);
  }
  if (formController != null && formController.getFormScope() != null) {
    formController.getFormScope().getModificationSubject().removeModificationListener(this);
  }
  if (formController != null && formController.getApplication() != null && formController.getApplication().getScriptEngine() != null) {
    IExecutingEnviroment er=formController.getApplication().getScriptEngine();
    if (er.getScopesScope() != null) {
      er.getScopesScope().getModificationSubject().removeModificationListener(this);
    }
  }
  dataProviderToLinkedComponentProperty.clear();
  allComponentPropertiesLinkedToData.clear();
  findModeAwareProperties.clear();
  parentRelatedForms.clear();
  visibleChildForms.clear();
  uninitializedVisibleChildForms.clear();
}
Program: 143395
Project: 143395
Buggy source:
public Map<IWebFormController,String> getRelatedForms(){
  return relatedForms;
}

Fixed version (ground truth):
public Map<IWebFormController,String> getRelatedForms(){
  return visibleChildForms;
}
Program: 143396
Project: 143396
Buggy source:
@Override public void notifyVisible(boolean b,List<Runnable> invokeLaterRunnables){
  for (  IWebFormController relatedController : relatedForms.keySet()) {
    updateParentContainer(relatedController,relatedForms.get(relatedController),b);
    relatedController.notifyVisible(b,invokeLaterRunnables);
  }
}

Fixed version (ground truth):
public void notifyVisible(boolean b,List<Runnable> invokeLaterRunnables,Set<IWebFormController> childFormsThatWereAlreadyNotified){
  for (  IWebFormController relatedController : visibleChildForms.keySet()) {
    updateParentContainer(relatedController,visibleChildForms.get(relatedController),b);
    if (!childFormsThatWereAlreadyNotified.contains(relatedController))     relatedController.notifyVisible(b,invokeLaterRunnables);
  }
}
Program: 143397
Project: 143397
Buggy source:
void notifyVisible(boolean b,List<Runnable> invokeLaterRunnables);

Fixed version (ground truth):
void notifyVisible(boolean b,List<Runnable> invokeLaterRunnables,Set<IWebFormController> childFormsThatWereNotified);
Program: 143399
Project: 143399
Buggy source:
/** 
 * @param b
 */
public boolean notifyVisible(boolean visible,List<Runnable> invokeLaterRunnables){
  boolean retValue=true;
  for (  IWebFormUI webUI : visibleForms.keySet()) {
    retValue=retValue && webUI.getController().notifyVisible(visible,invokeLaterRunnables);
  }
  if (!visible && retValue) {
    visibleForms.clear();
  }
  return retValue;
}

Fixed version (ground truth):
public boolean notifyVisible(boolean visible,List<Runnable> invokeLaterRunnables,Set<IWebFormController> childFormsThatWereNotified){
  boolean retValue=true;
  for (  IWebFormUI webUI : visibleForms.keySet()) {
    IWebFormController fc=webUI.getController();
    childFormsThatWereNotified.add(fc);
    retValue=retValue && fc.notifyVisible(visible,invokeLaterRunnables);
  }
  if (!visible && retValue) {
    visibleForms.clear();
  }
  return retValue;
}
Program: 143400
Project: 143400
Buggy source:
@Override public boolean notifyVisible(boolean visible,List<Runnable> invokeLaterRunnables){
  boolean retValue=true;
  for (  WebComponent component : components.values()) {
    retValue=retValue && ((WebFormComponent)component).notifyVisible(visible,invokeLaterRunnables);
  }
  if (retValue)   setVisible(visible);
  dataAdapterList.notifyVisible(visible,invokeLaterRunnables);
  return retValue;
}

Fixed version (ground truth):
@Override public boolean notifyVisible(boolean visible,List<Runnable> invokeLaterRunnables){
  boolean retValue=true;
  Set<IWebFormController> childFormsThatWereNotified=new HashSet<>();
  for (  WebComponent component : components.values()) {
    retValue=retValue && ((WebFormComponent)component).notifyVisible(visible,invokeLaterRunnables,childFormsThatWereNotified);
  }
  if (retValue)   setVisible(visible);
  dataAdapterList.notifyVisible(visible,invokeLaterRunnables,childFormsThatWereNotified);
  return retValue;
}
Program: 143402
Project: 143402
Buggy source:
public void acceptVisitor(IVisitor visitor){
  keys=AbstractBaseQuery.acceptVisitor(keys,visitor);
  values=AbstractBaseQuery.acceptVisitor(values,visitor);
  if (visitor instanceof PlaceHolderSetter) {
    PlaceHolderSetter phs=(PlaceHolderSetter)visitor;
    Placeholder ph=null;
    Object phValue=null;
    if (values instanceof Placeholder) {
      ph=(Placeholder)values;
      phValue=phs.getValue();
    }
 else     if (values instanceof Object[] && ((Object[])values).length == 1) {
      Object values0=((Object[])values)[0];
      if (values0 instanceof Object[] && ((Object[])values0).length == 1 && ((Object[])values0)[0] instanceof QueryColumnValue) {
        QueryColumnValue colValue=(QueryColumnValue)((Object[])values0)[0];
        if (colValue.getValue() instanceof Placeholder && phs.getValue() instanceof Object[]) {
          ph=(Placeholder)colValue.getValue();
          phValue=new Object[][]{(Object[])phs.getValue()};
        }
      }
    }
    if (ph != null && ph.getKey().equals(phs.getKey())) {
      ph.setValue(validateValues(keys,phValue));
    }
  }
}

Fixed version (ground truth):
public void acceptVisitor(IVisitor visitor){
  keys=AbstractBaseQuery.acceptVisitor(keys,visitor);
  values=AbstractBaseQuery.acceptVisitor(values,visitor);
  if (values instanceof Placeholder && visitor instanceof PlaceHolderSetter) {
    PlaceHolderSetter phs=(PlaceHolderSetter)visitor;
    Placeholder ph=(Placeholder)values;
    if (ph.getKey().equals(phs.getKey())) {
      ph.setValue(validateValues(keys,phs.getValue()));
    }
  }
}
Program: 143404
Project: 143404
Buggy source:
public RhinoNativeArrayWrapperList(List<Object> rhinoBasedList,PropertyDescription elementTypeDefinition,List<SabloT> previousComponentValue,BaseWebObject componentOrService,Scriptable rhinoScriptable){
  super(rhinoBasedList);
  this.previousValues=new HashMap<Integer,SabloT>();
  if (previousComponentValue != null) {
    for (int i=previousComponentValue.size(); i >= 0; i++)     this.previousValues.put(Integer.valueOf(i),previousComponentValue.get(i));
  }
  this.componentOrService=componentOrService;
  this.elementTypeDefinition=elementTypeDefinition;
  this.rhinoScriptable=rhinoScriptable;
}

Fixed version (ground truth):
public RhinoNativeArrayWrapperList(List<Object> rhinoBasedList,PropertyDescription elementTypeDefinition,List<SabloT> previousComponentValue,BaseWebObject componentOrService,Scriptable rhinoScriptable){
  super(rhinoBasedList);
  this.previousValues=new HashMap<Integer,SabloT>();
  if (previousComponentValue != null) {
    for (int i=previousComponentValue.size() - 1; i >= 0; i--)     this.previousValues.put(Integer.valueOf(i),previousComponentValue.get(i));
  }
  this.componentOrService=componentOrService;
  this.elementTypeDefinition=elementTypeDefinition;
  this.rhinoScriptable=rhinoScriptable;
}
Program: 143405
Project: 143405
Buggy source:
@Override public Object toSabloComponentValue(Object rhinoValue,Object previousComponentValue,PropertyDescription pd,BaseWebObject componentOrService){
  WebFormComponent wfc=(WebFormComponent)componentOrService;
  return getSabloValue(rhinoValue,pd,wfc.getFormElement(),wfc.getDataConverterContext().getApplication());
}

Fixed version (ground truth):
@Override public Object toSabloComponentValue(Object rhinoValue,Object previousComponentValue,PropertyDescription pd,BaseWebObject componentOrService){
  return getSabloValue(rhinoValue,pd,(WebFormComponent)componentOrService);
}
Program: 143407
Project: 143407
Buggy source:
@Override public Object toSabloComponentDefaultValue(PropertyDescription pd,FormElement formElement,WebFormComponent component,DataAdapterList dataAdapterList){
  return getSabloValue(null,pd,formElement,dataAdapterList.getApplication());
}

Fixed version (ground truth):
@Override public Object toSabloComponentDefaultValue(PropertyDescription pd,FormElement formElement,WebFormComponent component,DataAdapterList dataAdapterList){
  return getSabloValue(null,pd,component);
}
Program: 143408
Project: 143408
Buggy source:
@Override public JSONWriter toTemplateJSONValue(JSONWriter writer,String key,Object formElementValue,PropertyDescription pd,DataConversion browserConversionMarkers,FlattenedSolution fs,FormElementContext formElementContext) throws JSONException {
  if (fs != null) {
    String url=getMediaUrl(formElementValue,fs,null);
    if ("String_Node_Str".equals(url)) {
      int a=1 / 2;
    }
    if (url != null) {
      return toJSON(writer,key,new MediaWrapper(formElementValue,url),browserConversionMarkers,null);
    }
  }
  return writer;
}

Fixed version (ground truth):
@Override public JSONWriter toTemplateJSONValue(JSONWriter writer,String key,Object formElementValue,PropertyDescription pd,DataConversion browserConversionMarkers,FlattenedSolution fs,FormElementContext formElementContext) throws JSONException {
  if (fs != null) {
    String url=getMediaUrl(formElementValue,fs,null);
    if (url != null) {
      return toJSON(writer,key,new MediaWrapper(formElementValue,url),browserConversionMarkers,null);
    }
  }
  return writer;
}
Program: 143409
Project: 143409
Buggy source:
@Override public Object toSabloComponentValue(Object rhinoValue,Object previousComponentValue,PropertyDescription pd,BaseWebObject componentOrService){
  if (rhinoValue != null) {
    WebFormComponent wfc=(WebFormComponent)componentOrService;
    INGApplication application=wfc.getDataConverterContext().getApplication();
    IDataProviderLookup dataproviderLookup=wfc.getDataConverterContext().getSolution().getDataproviderLookup(application.getFoundSetManager(),wfc.getFormElement().getForm());
    String dataproviderId=(String)wfc.getFormElement().getPropertyValue((String)pd.getConfig());
    return ComponentFormat.getComponentFormat(rhinoValue.toString(),dataproviderId,dataproviderLookup,application);
  }
  return null;
}

Fixed version (ground truth):
@Override public Object toSabloComponentValue(Object rhinoValue,Object previousComponentValue,PropertyDescription pd,BaseWebObject componentOrService){
  WebFormComponent wfc=(WebFormComponent)componentOrService;
  return getSabloValue(rhinoValue,pd,wfc.getFormElement(),wfc.getDataConverterContext().getApplication());
}
Program: 143411
Project: 143411
Buggy source:
@Override public Object toSabloComponentDefaultValue(PropertyDescription pd,FormElement formElement,WebFormComponent component,DataAdapterList dataAdapterList){
  return getSabloValue(null,pd,formElement,dataAdapterList);
}

Fixed version (ground truth):
@Override public Object toSabloComponentDefaultValue(PropertyDescription pd,FormElement formElement,WebFormComponent component,DataAdapterList dataAdapterList){
  return getSabloValue(null,pd,formElement,dataAdapterList.getApplication());
}
Program: 143414
Project: 143414
Buggy source:
@Override public NGRuntimeWindow getCurrentWindow(){
  return (NGRuntimeWindow)super.getCurrentWindow();
}

Fixed version (ground truth):
@Override public NGRuntimeWindow getCurrentWindow(){
  NGRuntimeWindow currentWindow=(NGRuntimeWindow)super.getCurrentWindow();
  return currentWindow != null ? currentWindow : getWindow(lastCurrentWindow);
}
Program: 143417
Project: 143417
Buggy source:
@Override protected void doInvokeLater(Runnable r){
  wsSession.getEventDispatcher().addEvent(r);
}

Fixed version (ground truth):
@Override protected void doInvokeLater(Runnable r){
  wsSession.getEventDispatcher().postEvent(r);
}
Program: 143418
Project: 143418
Buggy source:
@Override protected IEventDispatcher createEventDispatcher(){
  return new IEventDispatcher(){
    @Override public void run(){
    }
    @Override public void suspend(    Object object){
    }
    @Override public void resume(    Object object){
    }
    @Override public boolean isEventDispatchThread(){
      return true;
    }
    @Override public void destroy(){
    }
    @Override public void addEvent(    Runnable event){
      event.run();
    }
    @Override public void addEvent(    Runnable event,    int eventLevel){
      event.run();
    }
    @Override public void suspend(    Object suspendID,    int minEventLevelToDispatch,    long timeout){
    }
    @Override public void cancelSuspend(    Integer suspendID,    String reason){
    }
  }
;
}

Fixed version (ground truth):
@Override protected IEventDispatcher createEventDispatcher(){
  return new IEventDispatcher(){
    @Override public void run(){
    }
    @Override public void suspend(    Object object){
    }
    @Override public void resume(    Object object){
    }
    @Override public boolean isEventDispatchThread(){
      return true;
    }
    @Override public void destroy(){
    }
    @Override public void addEvent(    Runnable event){
      event.run();
    }
    @Override public void addEvent(    Runnable event,    int eventLevel){
      event.run();
    }
    @Override public void suspend(    Object suspendID,    int minEventLevelToDispatch,    long timeout){
    }
    @Override public void cancelSuspend(    Integer suspendID,    String reason){
    }
    @Override public void postEvent(    Runnable event){
      event.run();
    }
  }
;
}
Program: 143419
Project: 143419
Buggy source:
/** 
 * @param wsSession
 * @param tr
 */
TestNGClient(TestRepository tr) throws Exception {
  super(new NGClientWebsocketSession("String_Node_Str"){
    @Override protected IEventDispatcher createEventDispatcher(){
      return new IEventDispatcher(){
        @Override public void run(){
        }
        @Override public void suspend(        Object object){
        }
        @Override public void resume(        Object object){
        }
        @Override public boolean isEventDispatchThread(){
          return true;
        }
        @Override public void destroy(){
        }
        @Override public void addEvent(        Runnable event){
          event.run();
        }
        @Override public void addEvent(        Runnable event,        int eventLevel){
          event.run();
        }
        @Override public void suspend(        Object suspendID,        int minEventLevelToDispatch,        long timeout){
        }
        @Override public void cancelSuspend(        Integer suspendID,        String reason){
        }
      }
;
    }
  }
);
  this.tr=tr;
  ((NGClientWebsocketSession)getWebsocketSession()).setClient(this);
  WebsocketSessionManager.addSession(getWebsocketSession());
}

Fixed version (ground truth):
/** 
 * @param wsSession
 * @param tr
 */
TestNGClient(TestRepository tr) throws Exception {
  super(new NGClientWebsocketSession("String_Node_Str"){
    @Override protected IEventDispatcher createEventDispatcher(){
      return new IEventDispatcher(){
        @Override public void run(){
        }
        @Override public void suspend(        Object object){
        }
        @Override public void resume(        Object object){
        }
        @Override public boolean isEventDispatchThread(){
          return true;
        }
        @Override public void destroy(){
        }
        @Override public void addEvent(        Runnable event){
          event.run();
        }
        @Override public void addEvent(        Runnable event,        int eventLevel){
          event.run();
        }
        @Override public void suspend(        Object suspendID,        int minEventLevelToDispatch,        long timeout){
        }
        @Override public void cancelSuspend(        Integer suspendID,        String reason){
        }
        @Override public void postEvent(        Runnable event){
          event.run();
        }
      }
;
    }
  }
);
  this.tr=tr;
  ((NGClientWebsocketSession)getWebsocketSession()).setClient(this);
  WebsocketSessionManager.addSession(getWebsocketSession());
}
Program: 143420
Project: 143420
Buggy source:
/** 
 * Returns the actual value that this dataProvider has.
 */
public Object getValue(){
  return value;
}

Fixed version (ground truth):
/** 
 * Returns the actual value (that is already full converted by an ui converter) that this dataProvider has.
 */
public Object getValue(){
  if (!findMode && fieldFormat != null) {
    return ComponentFormat.applyUIConverterFromObject(value,dataProviderID,servoyDataConverterContext.getApplication().getFoundSetManager(),fieldFormat);
  }
  return value;
}
Program: 143422
Project: 143422
Buggy source:
public DataproviderTypeSabloValue(String dataProviderID,DataAdapterList dataAdapterList,WebFormComponent component,PropertyDescription dpPD){
  if (dataProviderID.startsWith(ScriptVariable.GLOBALS_DOT_PREFIX)) {
    this.dataProviderID=ScriptVariable.SCOPES_DOT_PREFIX + dataProviderID;
  }
 else {
    this.dataProviderID=dataProviderID;
  }
  this.dataAdapterList=dataAdapterList;
  this.servoyDataConverterContext=component.getDataConverterContext();
  this.dpPD=dpPD;
}

Fixed version (ground truth):
public DataproviderTypeSabloValue(String dataProviderID,DataAdapterList dataAdapterList,WebFormComponent component,PropertyDescription dpPD){
  if (dataProviderID.startsWith(ScriptVariable.GLOBALS_DOT_PREFIX)) {
    this.dataProviderID=ScriptVariable.SCOPES_DOT_PREFIX + dataProviderID;
  }
 else {
    this.dataProviderID=dataProviderID;
  }
  this.dataAdapterList=dataAdapterList;
  this.servoyDataConverterContext=component.getDataConverterContext();
  this.dpPD=dpPD;
  this.formElement=component.getFormElement();
}