nus-yam/ex-repair huggingface dataset:
Program: 143310
Project: 143310
Buggy source:
private void setFlying(EntityPlayer player,boolean bool,World world){
  if (bool) {
    player.capabilities.allowFlying=true;
    player.sendPlayerAbilities();
  }
 else {
    player.capabilities.allowFlying=false;
    player.capabilities.isFlying=false;
    player.sendPlayerAbilities();
  }
}

Fixed version (ground truth):
private void setFlying(EntityPlayer player,boolean bool,World world){
  if (bool) {
    if (player.capabilities.allowFlying == true) {
      return;
    }
    player.capabilities.allowFlying=true;
    player.sendPlayerAbilities();
  }
 else {
    if (player.capabilities.allowFlying == false) {
      return;
    }
    player.capabilities.allowFlying=false;
    player.capabilities.isFlying=false;
    player.sendPlayerAbilities();
  }
}
Program: 143311
Project: 143311
Buggy source:
@EventHandler public void init(FMLInitializationEvent event){
  MinecraftForge.EVENT_BUS.register(new GenericEventHandler());
  MinecraftForge.EVENT_BUS.register(proxy);
  FMLCommonHandler.instance().bus().register(new GenericEventHandler());
  ItemRegister.INSTANCE.init();
  for (  IUpgrade upgrade : UpgradeList.INSTANCE) {
    upgrade.registerConfigOptions();
  }
  NetworkRegistry.INSTANCE.registerGuiHandler(instance,guiHandler);
  proxy.registerKeyBinds();
}

Fixed version (ground truth):
@EventHandler public void init(FMLInitializationEvent event){
  if (developmentEnvironment) {
    MinecraftForge.EVENT_BUS.register(new DamageEventHandler());
  }
  MinecraftForge.EVENT_BUS.register(new GenericEventHandler());
  MinecraftForge.EVENT_BUS.register(proxy);
  FMLCommonHandler.instance().bus().register(new GenericEventHandler());
  ItemRegister.INSTANCE.init();
  for (  IUpgrade upgrade : UpgradeList.INSTANCE) {
    upgrade.registerConfigOptions();
  }
  NetworkRegistry.INSTANCE.registerGuiHandler(instance,guiHandler);
  proxy.registerKeyBinds();
}
Program: 143312
Project: 143312
Buggy source:
@Override protected void drawGuiContainerBackgroundLayer(float f,int x,int y){
  super.drawGuiContainerBackgroundLayer(f,x,y);
  if (this.container.recipe != null) {
    IUpgrade upgrade=this.container.recipe.getRecipeOutput();
    this.drawStringBounded(upgrade.getName(),70,this.guiLeft + 100,this.guiTop + 18,0xFFFFFF);
    this.drawStringBounded(upgrade.getInformation(),159,this.guiLeft + 11,this.guiTop + 80,0xFFFFFF);
    this.drawStringBounded(String.valueOf(upgrade.isCompatible(this.container.item,this.container.stack,this.container.item.getSlot())),70,this.guiLeft + 100,this.guiTop + 30,0xFFFFFF);
  }
}

Fixed version (ground truth):
@Override protected void drawGuiContainerBackgroundLayer(float f,int x,int y){
  super.drawGuiContainerBackgroundLayer(f,x,y);
  if (this.container.recipe != null) {
    IUpgrade upgrade=this.container.recipe.getRecipeOutput();
    this.drawStringBounded(upgrade.getName(),70,this.guiLeft + 100,this.guiTop + 18,0xFFFFFF);
    this.drawStringBounded(upgrade.getInformation(),159,this.guiLeft + 11,this.guiTop + 80,0xFFFFFF);
    if (upgrade.isCompatible(this.container.item,this.container.stack,this.container.item.getSlot())) {
      this.drawStringBounded(StringHelper.localize("String_Node_Str"),70,this.guiLeft + 100,this.guiTop + 50,0xFFFFFF);
    }
 else {
      this.drawStringBounded(StringHelper.localize("String_Node_Str"),70,this.guiLeft + 100,this.guiTop + 50,0xFFFFFF);
    }
  }
}
Program: 143313
Project: 143313
Buggy source:
@Override public int getSlot(){
  return 0;
}

Fixed version (ground truth):
@Override public int getSlot(){
  return this.armorType;
}
Program: 143314
Project: 143314
Buggy source:
public IUpgrade next(){
  this.index++;
  return list.get(index);
}

Fixed version (ground truth):
public IUpgrade next(){
  return list.get(index++);
}
Program: 143315
Project: 143315
Buggy source:
public IUpgrade get(int index){
  NBTTagCompound nbt=list.getCompoundTagAt(index);
  if (nbt == null) {
    return null;
  }
  try {
    IUpgrade upgrade=UpgradeList.list.get(nbt.getInteger("String_Node_Str"));
    return upgrade;
  }
 catch (  IndexOutOfBoundsException e) {
    return null;
  }
}

Fixed version (ground truth):
public IUpgrade get(int index){
  NBTTagCompound nbt=list.getCompoundTagAt(index);
  if (nbt == null) {
    return null;
  }
  try {
    if (nbt.hasKey("String_Node_Str")) {
      IUpgrade upgrade=UpgradeList.list.get(nbt.getInteger("String_Node_Str"));
      return upgrade;
    }
 else {
      return null;
    }
  }
 catch (  IndexOutOfBoundsException e) {
    return null;
  }
}
Program: 143316
Project: 143316
Buggy source:
public static boolean doesNBTListContainUpgrade(NBTUpgradeList list,IUpgrade upgrade){
  for (  IUpgrade up : list) {
    if (up != null && upgrade != null && up.getId() == upgrade.getId()) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public static boolean doesNBTListContainUpgrade(NBTUpgradeList list,IUpgrade upgrade){
  for (  IUpgrade up : list) {
    if (up.getId() == upgrade.getId()) {
      return true;
    }
  }
  return false;
}
Program: 143317
Project: 143317
Buggy source:
private void pickupSeasonalHolidays(final LocalDate month,final Map<LocalDate,Holiday> holidays){
  final List<SeasonalHoliday> seasonalHolidays=seasonalHolidaysMapping.get(month);
  if (seasonalHolidays == null) {
    return;
  }
  for (  final SeasonalHoliday seasonalHoliday : seasonalHolidays) {
    holidays.put(seasonalHoliday.getTargetDate(),seasonalHoliday);
  }
}

Fixed version (ground truth):
private void pickupSeasonalHolidays(final LocalDate month,final Map<LocalDate,Holiday> holidays){
  final List<SeasonalHoliday> seasonalHolidays=seasonalHolidaysMapping.get(month);
  if (seasonalHolidays == null) {
    return;
  }
  for (  final SeasonalHoliday seasonalHoliday : seasonalHolidays) {
    LocalDate targetDate=seasonalHoliday.getTargetDate();
    if (targetDate.getDayOfWeek() == DateTimeConstants.SUNDAY) {
      targetDate=targetDate.plusDays(1);
    }
    holidays.put(targetDate,seasonalHoliday);
  }
}
Program: 143319
Project: 143319
Buggy source:
int calculateWorkingMinute(final Interval workTimeInterval){
  int workingMinute=(int)toMinute(workTimeInterval) - calculateContainsBreakTimeMinute(workTimeInterval);
  return truncateWithTimeUnit(workingMinute);
}

Fixed version (ground truth):
int calculateWorkingMinute(final Interval workTimeInterval,final WorkPlace mainOffice){
  int workingMinute=(int)toMinute(workTimeInterval) - calculateContainsBreakTimeMinute(workTimeInterval);
  return truncateWithTimeUnit(workingMinute,mainOffice);
}
Program: 143320
Project: 143320
Buggy source:
int truncateWithTimeUnit(final int minute){
  int determinedMinute=0;
  int undeterminedMinute=minute;
  if (baseWorkTimeMinute <= minute) {
    determinedMinute=baseWorkTimeMinute;
    undeterminedMinute=minute - baseWorkTimeMinute;
  }
  final int unitTimeMinute=(getUnitTime().getHourOfDay() * 60) + getUnitTime().getMinuteOfHour();
  return determinedMinute + undeterminedMinute - (undeterminedMinute % unitTimeMinute);
}

Fixed version (ground truth):
int truncateWithTimeUnit(final int minute,final WorkPlace mainOffice){
  int determinedMinute=0;
  int undeterminedMinute=minute;
  int baseWorkTimeMinute=this.baseWorkTimeMinute;
  if (baseWorkTimeMinute < mainOffice.getBaseWorkTimeMinute() && mainOffice.getBaseWorkTimeMinute() <= minute) {
    baseWorkTimeMinute=mainOffice.getBaseWorkTimeMinute();
  }
  if (baseWorkTimeMinute <= minute) {
    determinedMinute=baseWorkTimeMinute;
    undeterminedMinute=minute - baseWorkTimeMinute;
  }
  final int unitTimeMinute=(getUnitTime().getHourOfDay() * 60) + getUnitTime().getMinuteOfHour();
  return determinedMinute + undeterminedMinute - (undeterminedMinute % unitTimeMinute);
}
Program: 143321
Project: 143321
Buggy source:
@RequestMapping(method=RequestMethod.GET,params="String_Node_Str") @ResponseBody @ResponseStatus(HttpStatus.OK) public DailyAttendanceResource getDefaultAttendanceResource(@RequestParam(value="String_Node_Str",required=false) String workPlaceUuid){
  WorkPlace defaultWorkPlace=workPlaceService.getWorkPlace(workPlaceUuid);
  DailyAttendance attendance=new DailyAttendance();
  attendance.setDefault(defaultWorkPlace);
  attendance.calculate(defaultWorkPlace);
  return beanMapper.map(attendance,DailyAttendanceResource.class);
}

Fixed version (ground truth):
@RequestMapping(method=RequestMethod.GET,params="String_Node_Str") @ResponseBody @ResponseStatus(HttpStatus.OK) public DailyAttendanceResource getDefaultAttendanceResource(@RequestParam(value="String_Node_Str",required=false) String workPlaceUuid){
  WorkPlace defaultWorkPlace=workPlaceService.getWorkPlace(workPlaceUuid);
  DailyAttendance attendance=new DailyAttendance();
  attendance.setDefault(defaultWorkPlace);
  attendance.calculate(defaultWorkPlace,workPlaceService.getMainOffice());
  return beanMapper.map(attendance,DailyAttendanceResource.class);
}
Program: 143322
Project: 143322
Buggy source:
@RequestMapping(method=RequestMethod.POST) @ResponseBody @ResponseStatus(HttpStatus.OK) public DailyAttendanceResource calculate(@RequestBody @Validated DailyAttendanceResource resource){
  DailyAttendance attendance=beanMapper.map(resource,DailyAttendance.class);
  attendance.setWorkPlace(workPlaceService.getWorkPlace(attendance.getWorkPlace().getWorkPlaceUuid()));
  attendance.calculate();
  return beanMapper.map(attendance,DailyAttendanceResource.class);
}

Fixed version (ground truth):
@RequestMapping(method=RequestMethod.POST) @ResponseBody @ResponseStatus(HttpStatus.OK) public DailyAttendanceResource calculate(@RequestBody @Validated DailyAttendanceResource resource){
  DailyAttendance attendance=beanMapper.map(resource,DailyAttendance.class);
  attendance.setWorkPlace(workPlaceService.getWorkPlace(attendance.getWorkPlace().getWorkPlaceUuid()));
  attendance.calculate(null,workPlaceService.getMainOffice());
  return beanMapper.map(attendance,DailyAttendanceResource.class);
}
Program: 143323
Project: 143323
Buggy source:
private long toMinute(Interval interval){
  return TimeUnit.MILLISECONDS.toMinutes(interval.toDuration().getMillis());
}

Fixed version (ground truth):
private long toMinute(final Interval interval){
  return TimeUnit.MILLISECONDS.toMinutes(interval.toDuration().getMillis());
}
Program: 143324
Project: 143324
Buggy source:
public int calculateContainsMinute(Interval workTimeInterval){
  long minute=0;
  for (  Interval midnightInterval : breakTimeIntervals) {
    if (workTimeInterval.overlaps(midnightInterval)) {
      minute+=toMinute(workTimeInterval.overlap(midnightInterval));
    }
  }
  return (int)minute;
}

Fixed version (ground truth):
int calculateContainsMinute(final Interval workTimeInterval){
  long minute=0;
  for (  final Interval breakTimeInterval : breakTimeIntervals) {
    if (workTimeInterval.overlaps(breakTimeInterval)) {
      minute+=toMinute(workTimeInterval.overlap(breakTimeInterval));
    }
  }
  return (int)minute;
}
Program: 143325
Project: 143325
Buggy source:
public BreakTime(String workPlaceUuid,LocalTime beginTime,LocalTime finishTime){
  this.workPlaceUuid=workPlaceUuid;
  this.beginTime=beginTime;
  this.finishTime=finishTime;
  breakTimeIntervals.add(new Interval(BASE_DATE.toDateTime(beginTime),BASE_DATE.toDateTime(finishTime)));
  breakTimeIntervals.add(new Interval(BASE_DATE.toDateTime(beginTime).plusDays(1),BASE_DATE.toDateTime(finishTime).plusDays(1)));
}

Fixed version (ground truth):
public BreakTime(final String workPlaceUuid,final LocalTime beginTime,final LocalTime finishTime){
  this.workPlaceUuid=workPlaceUuid;
  this.beginTime=beginTime;
  this.finishTime=finishTime;
  this.breakTimeBaseInterval=new Interval(BASE_DATE.toDateTime(beginTime),BASE_DATE.toDateTime(finishTime));
  breakTimeIntervals.add(breakTimeBaseInterval);
  breakTimeIntervals.add(new Interval(BASE_DATE.toDateTime(beginTime).plusDays(1),BASE_DATE.toDateTime(finishTime).plusDays(1)));
}
Program: 143326
Project: 143326
Buggy source:
public boolean isWorkDay(){
  if (targetDate == null) {
    return true;
  }
  return !((targetDate.getDayOfWeek() == DateTimeConstants.SATURDAY) || (targetDate.getDayOfWeek() == DateTimeConstants.SUNDAY));
}

Fixed version (ground truth):
private boolean isWorkDay(){
  if (targetDate == null) {
    return true;
  }
  return !((targetDate.getDayOfWeek() == DateTimeConstants.SATURDAY) || (targetDate.getDayOfWeek() == DateTimeConstants.SUNDAY));
}
Program: 143327
Project: 143327
Buggy source:
public void calculate(WorkPlace defaultWorkPlace){
  clearCalculate();
  WorkPlace actualWorkPlace=workPlace;
  if (actualWorkPlace == null) {
    actualWorkPlace=defaultWorkPlace;
  }
  if (beginTime != null && finishTime != null) {
    DateTime beginDateTime=BASE_DATE.toDateTime(beginTime);
    DateTime finishDateTime=BASE_DATE.toDateTime(finishTime);
    if (!beginTime.isBefore(finishTime)) {
      finishDateTime=finishDateTime.plusDays(1);
    }
    Interval workTimeInterval=new Interval(beginDateTime,finishDateTime);
    this.actualWorkingMinute=actualWorkPlace.calculateWorkingMinute(workTimeInterval);
    if (actualWorkingMinute < DEFAULT_ACTUAL_WORKING_MINUTE && isWorkDay()) {
      this.compensationMinute=DEFAULT_ACTUAL_WORKING_MINUTE - actualWorkingMinute;
    }
    this.midnightWorkingMinute=actualWorkPlace.truncateWithTimeUnit(MidnightTime.INSTANCE.calculateContainsMinute(workTimeInterval));
  }
 else {
    if (finishTime != null) {
      setFinishTime(null);
    }
  }
  if (isWorkDay()) {
    this.tardyOrEarlyLeaving=actualWorkPlace.isTardyOrEarlyLeaving(beginTime,finishTime);
    if (tardyOrEarlyLeaving) {
      this.compensationMinute=0;
    }
 else     if (beginTime == null && !StringUtils.hasLength(specialWorkCode)) {
      this.absence=true;
    }
  }
}

Fixed version (ground truth):
public void calculate(final WorkPlace defaultWorkPlace,final WorkPlace mainOffice){
  clearCalculate();
  if (paidLeave) {
    setBeginTime(mainOffice.getBaseBeginTime());
    setFinishTime(mainOffice.getBaseFinishTime());
    this.actualWorkingMinute=mainOffice.getBaseWorkTimeMinute();
    return;
  }
  WorkPlace actualWorkPlace=workPlace;
  if (actualWorkPlace == null) {
    actualWorkPlace=defaultWorkPlace;
  }
  DateTime beginDateTime=null;
  if (beginTime != null) {
    beginDateTime=BASE_DATE.toDateTime(beginTime);
  }
  DateTime finishDateTime=null;
  if (finishTime != null) {
    finishDateTime=BASE_DATE.toDateTime(finishTime);
  }
  if (beginDateTime != null && finishDateTime != null) {
    if (!beginDateTime.isBefore(finishDateTime)) {
      finishDateTime=finishDateTime.plusDays(1);
    }
    final Interval workTimeInterval=new Interval(beginDateTime,finishDateTime);
    this.actualWorkingMinute=actualWorkPlace.calculateWorkingMinute(workTimeInterval);
    if (actualWorkingMinute < mainOffice.getBaseWorkTimeMinute() && isWorkDay()) {
      this.compensationMinute=mainOffice.getBaseWorkTimeMinute() - actualWorkingMinute;
    }
    this.midnightWorkingMinute=MidnightTime.INSTANCE.calculateContainsMinute(workTimeInterval,actualWorkPlace);
  }
 else {
    if (finishDateTime != null) {
      finishDateTime=null;
      setFinishTime(null);
    }
  }
  if (isWorkDay()) {
    this.tardyOrEarlyLeaving=actualWorkPlace.isTardyOrEarlyLeaving(beginDateTime,finishDateTime);
    if (tardyOrEarlyLeaving) {
      this.compensationMinute=0;
    }
 else     if (beginDateTime == null && !StringUtils.hasLength(specialWorkCode)) {
      this.absence=true;
    }
  }
}
Program: 143328
Project: 143328
Buggy source:
public void setDefault(WorkPlace defaultWorkPlace){
  setBeginTime(defaultWorkPlace.getBaseBeginTime());
  setFinishTime(defaultWorkPlace.getBaseFinishTime());
}

Fixed version (ground truth):
public void setDefault(final WorkPlace defaultWorkPlace){
  setBeginTime(defaultWorkPlace.getBaseBeginTime());
  setFinishTime(defaultWorkPlace.getBaseFinishTime());
}
Program: 143329
Project: 143329
Buggy source:
private long toMinute(Interval interval){
  return TimeUnit.MILLISECONDS.toMinutes(interval.toDuration().getMillis());
}

Fixed version (ground truth):
private long toMinute(final Interval interval){
  return TimeUnit.MILLISECONDS.toMinutes(interval.toDuration().getMillis());
}
Program: 143330
Project: 143330
Buggy source:
int calculateContainsMinute(Interval workTimeInterval){
  long minute=0;
  for (  Interval midnightInterval : midnightIntervals) {
    if (workTimeInterval.overlaps(midnightInterval)) {
      minute+=toMinute(workTimeInterval.overlap(midnightInterval));
    }
  }
  return (int)minute;
}

Fixed version (ground truth):
int calculateContainsMinute(final Interval workTimeInterval,final WorkPlace workPlace){
  long minute=0;
  for (  final Interval midnightInterval : midnightIntervals) {
    if (workTimeInterval.overlaps(midnightInterval)) {
      final Interval overlappedInterval=workTimeInterval.overlap(midnightInterval);
      minute+=(toMinute(overlappedInterval) - workPlace.calculateContainsBreakTimeMinute(overlappedInterval));
    }
 else {
      if (midnightInterval.isAfter(workTimeInterval)) {
        break;
      }
    }
  }
  if (minute == 0) {
    return 0;
  }
 else {
    return workPlace.truncateWithTimeUnit((int)minute);
  }
}
Program: 143331
Project: 143331
Buggy source:
public TimeCard addAttendance(DailyAttendance attendance){
  if (attendances == null) {
    attendances=new ArrayList<>();
  }
  attendances.add(attendance);
  return this;
}

Fixed version (ground truth):
public TimeCard addAttendance(final DailyAttendance attendance){
  if (attendances == null) {
    attendances=new ArrayList<>();
  }
  attendances.add(attendance);
  return this;
}
Program: 143332
Project: 143332
Buggy source:
private int calculateContainsBreakTimeMinute(Interval workTimeInterval){
  int minute=0;
  for (  BreakTime breakTime : getBreakTimes()) {
    minute+=breakTime.calculateContainsMinute(workTimeInterval);
  }
  return minute;
}

Fixed version (ground truth):
int calculateContainsBreakTimeMinute(final Interval workTimeInterval){
  if (getBreakTimes() == null) {
    return 0;
  }
  int minute=0;
  for (  final BreakTime breakTime : getBreakTimes()) {
    final int containsMinute=breakTime.calculateContainsMinute(workTimeInterval);
    if (containsMinute == 0 && breakTime.isFuture(workTimeInterval)) {
      break;
    }
    minute+=containsMinute;
  }
  return minute;
}
Program: 143333
Project: 143333
Buggy source:
private long toMinute(Interval interval){
  return TimeUnit.MILLISECONDS.toMinutes(interval.toDuration().getMillis());
}

Fixed version (ground truth):
private long toMinute(final Interval interval){
  return TimeUnit.MILLISECONDS.toMinutes(interval.toDuration().getMillis());
}
Program: 143334
Project: 143334
Buggy source:
public int calculateWorkingMinute(Interval workTimeInterval){
  int workingMinute=(int)toMinute(workTimeInterval) - calculateContainsBreakTimeMinute(workTimeInterval);
  return truncateWithTimeUnit(workingMinute);
}

Fixed version (ground truth):
int calculateWorkingMinute(final Interval workTimeInterval){
  int workingMinute=(int)toMinute(workTimeInterval) - calculateContainsBreakTimeMinute(workTimeInterval);
  return truncateWithTimeUnit(workingMinute);
}
Program: 143335
Project: 143335
Buggy source:
public int truncateWithTimeUnit(int minute){
  int determinedMinute=0;
  int undeterminedMinute=minute;
  if (baseWorkTimeMinute <= minute) {
    determinedMinute=baseWorkTimeMinute;
    undeterminedMinute=minute - baseWorkTimeMinute;
  }
  return determinedMinute + undeterminedMinute - (undeterminedMinute % getUnitTime().getMinuteOfHour());
}

Fixed version (ground truth):
int truncateWithTimeUnit(final int minute){
  int determinedMinute=0;
  int undeterminedMinute=minute;
  if (baseWorkTimeMinute <= minute) {
    determinedMinute=baseWorkTimeMinute;
    undeterminedMinute=minute - baseWorkTimeMinute;
  }
  final int unitTimeMinute=(getUnitTime().getHourOfDay() * 60) + getUnitTime().getMinuteOfHour();
  return determinedMinute + undeterminedMinute - (undeterminedMinute % unitTimeMinute);
}
Program: 143336
Project: 143336
Buggy source:
public void initialize(){
  Interval baseWorkTimeInterval=new Interval(BASE_DATE.toDateTime(baseBeginTime),BASE_DATE.toDateTime(baseFinishTime));
  this.baseWorkTimeMinute=(int)toMinute(baseWorkTimeInterval) - calculateContainsBreakTimeMinute(baseWorkTimeInterval);
}

Fixed version (ground truth):
public void initialize(){
  this.baseWorkTimeInterval=new Interval(BASE_DATE.toDateTime(baseBeginTime),BASE_DATE.toDateTime(baseFinishTime));
  this.baseWorkTimeMinute=(int)toMinute(baseWorkTimeInterval) - calculateContainsBreakTimeMinute(baseWorkTimeInterval);
}
Program: 143337
Project: 143337
Buggy source:
public boolean isTardyOrEarlyLeaving(LocalTime beginTime,LocalTime finishTime){
  if (beginTime != null && beginTime.isAfter(baseBeginTime)) {
    return true;
  }
  if (finishTime != null && finishTime.isBefore(baseFinishTime)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
boolean isTardyOrEarlyLeaving(final DateTime beginTime,final DateTime finishTime){
  if (beginTime != null && beginTime.isAfter(baseWorkTimeInterval.getStart())) {
    return true;
  }
  if (finishTime != null && finishTime.isBefore(baseWorkTimeInterval.getEnd())) {
    return true;
  }
  return false;
}
Program: 143338
Project: 143338
Buggy source:
public void stop(BundleContext context) throws Exception {
  Set<BundleActivator> bundleActivators=loadActivators();
  for (  BundleActivator bundleActivator : bundleActivators) {
    bundleActivator.stop(context);
  }
  MBeanServer mbeanServer=findOrCreateMBeanServer();
  testRunner.unregisterMBean(mbeanServer);
}

Fixed version (ground truth):
public void stop(BundleContext context) throws Exception {
  for (  BundleActivator bundleActivator : bundleActivators) {
    bundleActivator.stop(context);
  }
  MBeanServer mbeanServer=findOrCreateMBeanServer();
  testRunner.unregisterMBean(mbeanServer);
}
Program: 143339
Project: 143339
Buggy source:
public void start(final BundleContext context) throws Exception {
  final TestClassLoader testClassLoader=new TestClassLoader(){
    @Override public Class<?> loadTestClass(    String className) throws ClassNotFoundException {
      return context.getBundle().loadClass(className);
    }
  }
;
  Set<BundleActivator> bundleActivators=loadActivators();
  for (  BundleActivator bundleActivator : bundleActivators) {
    bundleActivator.start(context);
  }
  MBeanServer mbeanServer=findOrCreateMBeanServer();
  testRunner=new JMXTestRunner(testClassLoader){
    @Override public byte[] runTestMethod(    String className,    String methodName){
      BundleAssociation.setBundle(context.getBundle());
      BundleContextAssociation.setBundleContext(context);
      return super.runTestMethod(className,methodName);
    }
  }
;
  testRunner.registerMBean(mbeanServer);
}

Fixed version (ground truth):
public void start(final BundleContext context) throws Exception {
  final TestClassLoader testClassLoader=new TestClassLoader(){
    @Override public Class<?> loadTestClass(    String className) throws ClassNotFoundException {
      return context.getBundle().loadClass(className);
    }
  }
;
  bundleActivators=loadActivators();
  for (  BundleActivator bundleActivator : bundleActivators) {
    bundleActivator.start(context);
  }
  MBeanServer mbeanServer=findOrCreateMBeanServer();
  testRunner=new JMXTestRunner(testClassLoader){
    @Override public byte[] runTestMethod(    String className,    String methodName){
      BundleAssociation.setBundle(context.getBundle());
      BundleContextAssociation.setBundleContext(context);
      return super.runTestMethod(className,methodName);
    }
  }
;
  testRunner.registerMBean(mbeanServer);
}
Program: 143342
Project: 143342
Buggy source:
public void updateFoundset(IFoundSetInternal newFoundset){
  if (newFoundset != foundset) {
    int oldServerSize=(foundset != null ? foundset.getSize() : 0);
    int newServerSize=(newFoundset != null ? newFoundset.getSize() : 0);
    if (foundset instanceof ISwingFoundSet) {
      ((ISwingFoundSet)foundset).getSelectionModel().removeListSelectionListener(getListSelectionListener());
      ((ISwingFoundSet)foundset).removeTableModelListener(this);
    }
    foundset=newFoundset;
    viewPort.setFoundset(foundset);
    if (oldServerSize != newServerSize)     changeMonitor.newFoundsetSize();
    changeMonitor.selectionChanged();
    changeMonitor.checkHadMoreRows();
    if (foundset != null && foundset.isMultiSelect())     changeMonitor.multiSelectChanged();
    if (updateColumnFormatsIfNeeded())     changeMonitor.columnFormatsUpdated();
    if (foundset instanceof ISwingFoundSet) {
      ((ISwingFoundSet)foundset).getSelectionModel().addListSelectionListener(getListSelectionListener());
      ((ISwingFoundSet)foundset).addTableModelListener(this);
    }
    if (foundset != null && getDataAdapterList() != null)     getDataAdapterList().setFindMode(foundset.isInFindMode());
    fireUnderlyingStateChangedListeners();
  }
}

Fixed version (ground truth):
public void updateFoundset(IFoundSetInternal newFoundset){
  if (newFoundset != foundset) {
    int oldServerSize=(foundset != null ? foundset.getSize() : 0);
    int newServerSize=(newFoundset != null ? newFoundset.getSize() : 0);
    if (foundset instanceof ISwingFoundSet) {
      ((ISwingFoundSet)foundset).getSelectionModel().removeListSelectionListener(getListSelectionListener());
      ((ISwingFoundSet)foundset).removeTableModelListener(this);
    }
    foundset=newFoundset;
    viewPort.setFoundset(foundset);
    if (oldServerSize != newServerSize)     changeMonitor.newFoundsetSize();
    changeMonitor.selectionChanged();
    changeMonitor.checkHadMoreRows();
    if (foundset != null && foundset.isMultiSelect())     changeMonitor.multiSelectChanged();
    if (updateColumnFormatsIfNeeded())     changeMonitor.columnFormatsUpdated();
    if (foundset instanceof ISwingFoundSet) {
      ((ISwingFoundSet)foundset).getSelectionModel().addListSelectionListener(getListSelectionListener());
      ((ISwingFoundSet)foundset).addTableModelListener(this);
    }
    if (chainedRelatedFoundsetSelectionMonitor != null && chainedRelatedFoundsetSelectionMonitor.getRelatedFoundset() != foundset) {
      chainedRelatedFoundsetSelectionMonitor.unregisterListeners();
      chainedRelatedFoundsetSelectionMonitor=null;
    }
    if (foundset != null && getDataAdapterList() != null)     getDataAdapterList().setFindMode(foundset.isInFindMode());
    fireUnderlyingStateChangedListeners();
  }
}
Program: 143343
Project: 143343
Buggy source:
@Override public void detach(){
  viewPort.dispose();
  if (foundset instanceof ISwingFoundSet) {
    ((ISwingFoundSet)foundset).getSelectionModel().removeListSelectionListener(getListSelectionListener());
    ((ISwingFoundSet)foundset).removeTableModelListener(this);
  }
}

Fixed version (ground truth):
@Override public void detach(){
  viewPort.dispose();
  if (foundset instanceof ISwingFoundSet) {
    ((ISwingFoundSet)foundset).getSelectionModel().removeListSelectionListener(getListSelectionListener());
    ((ISwingFoundSet)foundset).removeTableModelListener(this);
  }
  if (chainedRelatedFoundsetSelectionMonitor != null) {
    chainedRelatedFoundsetSelectionMonitor.unregisterListeners();
    chainedRelatedFoundsetSelectionMonitor=null;
  }
}
Program: 143344
Project: 143344
Buggy source:
@Override public void setParentScope(Scriptable parent){
  parentScope=parent;
}

Fixed version (ground truth):
@Override public void setParentScope(Scriptable parent){
  parentScope=parent;
  objectPrototype=ScriptableObject.getObjectPrototype(this);
}
Program: 143345
Project: 143345
Buggy source:
@Override public Scriptable getPrototype(){
  return null;
}

Fixed version (ground truth):
@Override public Scriptable getPrototype(){
  if (objectPrototype == null) {
    objectPrototype=ScriptableObject.getObjectPrototype(this);
  }
  return objectPrototype;
}
Program: 143346
Project: 143346
Buggy source:
@Override public boolean isInstance(String name){
  return name.equals(getRuntimeName());
}

Fixed version (ground truth):
@Override public boolean isInstance(String name){
  if (name.equals(getRuntimeName()))   return true;
  if (getPrototype() instanceof IInstanceOf) {
    return ((IInstanceOf)getPrototype()).isInstance(name);
  }
  return false;
}
Program: 143347
Project: 143347
Buggy source:
/** 
 * @return
 */
private boolean inServerSideScript(){
  return Context.getCurrentContext() != null && Context.getCurrentContext().getThreadLocal(RuntimeWebComponent.SERVER_SIDE_SCRIPT_EXECUTE) != null;
}

Fixed version (ground truth):
private boolean inServerSideScript(){
  return Context.getCurrentContext() != null && Context.getCurrentContext().getThreadLocal(RuntimeWebComponent.SERVER_SIDE_SCRIPT_EXECUTE) != null;
}
Program: 143348
Project: 143348
Buggy source:
public RuntimeLegacyComponent(WebFormComponent component){
  this.component=component;
  setParentScope(component.getDataConverterContext().getApplication().getScriptEngine().getSolutionScope());
  putCallable=new PutPropertyCallable(this);
  getCallable=new GetPropertyCallable(this);
  this.webComponentSpec=component.getFormElement().getWebComponentSpec();
}

Fixed version (ground truth):
public RuntimeLegacyComponent(WebFormComponent component){
  this.component=component;
  setParentScope(component.getDataConverterContext().getApplication().getScriptEngine().getSolutionScope());
  putCallable=new PutPropertyCallable(this);
  getCallable=new GetPropertyCallable(this);
  this.webComponentSpec=component.getSpecification();
}
Program: 143349
Project: 143349
Buggy source:
@Override public void setParentScope(Scriptable parent){
  parentScope=parent;
}

Fixed version (ground truth):
@Override public void setParentScope(Scriptable parent){
  parentScope=parent;
  objectPrototype=ScriptableObject.getObjectPrototype(this);
}
Program: 143350
Project: 143350
Buggy source:
@Override public Scriptable getPrototype(){
  return null;
}

Fixed version (ground truth):
@Override public Scriptable getPrototype(){
  if (objectPrototype == null) {
    objectPrototype=ScriptableObject.getObjectPrototype(this);
  }
  return objectPrototype;
}
Program: 143351
Project: 143351
Buggy source:
@Override public boolean isInstance(String name){
  return name.equals(getRuntimeName());
}

Fixed version (ground truth):
@Override public boolean isInstance(String name){
  if (name.equals(getRuntimeName()))   return true;
  if (getPrototype() instanceof IInstanceOf) {
    return ((IInstanceOf)getPrototype()).isInstance(name);
  }
  return false;
}
Program: 143352
Project: 143352
Buggy source:
/** 
 * @return
 */
private boolean inServerSideScript(){
  return Context.getCurrentContext() != null && Context.getCurrentContext().getThreadLocal(RuntimeWebComponent.SERVER_SIDE_SCRIPT_EXECUTE) != null;
}

Fixed version (ground truth):
private boolean inServerSideScript(){
  return Context.getCurrentContext() != null && Context.getCurrentContext().getThreadLocal(RuntimeWebComponent.SERVER_SIDE_SCRIPT_EXECUTE) != null;
}
Program: 143353
Project: 143353
Buggy source:
public RuntimeLegacyComponent(WebFormComponent component){
  this.component=component;
  setParentScope(component.getDataConverterContext().getApplication().getScriptEngine().getSolutionScope());
  putCallable=new PutPropertyCallable(this);
  getCallable=new GetPropertyCallable(this);
  this.webComponentSpec=component.getFormElement().getWebComponentSpec();
}

Fixed version (ground truth):
public RuntimeLegacyComponent(WebFormComponent component){
  this.component=component;
  setParentScope(component.getDataConverterContext().getApplication().getScriptEngine().getSolutionScope());
  putCallable=new PutPropertyCallable(this);
  getCallable=new GetPropertyCallable(this);
  this.webComponentSpec=component.getSpecification();
}
Program: 143354
Project: 143354
Buggy source:
private String[] getAllDependantDataProviders(String[] dataproviders){
  ArrayList<String> returnDP=new ArrayList<>();
  for (  String dp : dataproviders) {
    if (dp != null && !ScopesUtils.isVariableScope(dp)) {
      int idx=dp.lastIndexOf('.');
      if (idx != -1) {
        Relation[] relations=getApplication().getFlattenedSolution().getRelationSequence(dp.substring(0,idx));
        if (relations != null) {
          for (int i=0; i < relations.length; i++) {
            Relation relation=relations[i];
            if (Relation.isValid(relation,getApplication().getFlattenedSolution()) && (relation.isGlobal() || i == 0)) {
              try {
                IDataProvider[] dps=relation.getPrimaryDataProviders(getApplication().getFlattenedSolution());
                for (                IDataProvider idp : dps) {
                  returnDP.add(idp.getDataProviderID());
                }
              }
 catch (              RepositoryException ex) {
                Debug.error(ex);
              }
            }
          }
          continue;
        }
      }
    }
    returnDP.add(dp);
  }
  return returnDP.toArray(new String[returnDP.size()]);
}

Fixed version (ground truth):
private String[] getAllDependantDataProviders(String[] dataproviders){
  ArrayList<String> returnDP=new ArrayList<>();
  for (  String dp : dataproviders) {
    if (dp != null && !ScopesUtils.isVariableScope(dp)) {
      int idx=dp.lastIndexOf('.');
      if (idx != -1) {
        Relation[] relations=getApplication().getFlattenedSolution().getRelationSequence(dp.substring(0,idx));
        if (relations != null) {
          for (int i=0; i < relations.length; i++) {
            Relation relation=relations[i];
            if (Relation.isValid(relation,getApplication().getFlattenedSolution()) && (relation.isGlobal() || i == 0)) {
              try {
                IDataProvider[] dps=relation.getPrimaryDataProviders(getApplication().getFlattenedSolution());
                for (                IDataProvider idp : dps) {
                  if (!returnDP.contains(idp.getDataProviderID()))                   returnDP.add(idp.getDataProviderID());
                }
              }
 catch (              RepositoryException ex) {
                Debug.error(ex);
              }
            }
          }
          continue;
        }
      }
    }
    returnDP.add(dp);
  }
  return returnDP.toArray(new String[returnDP.size()]);
}
Program: 143355
Project: 143355
Buggy source:
@SuppressWarnings("String_Node_Str") public Object getInitValue(){
  String defaultValue=getDefaultValue();
switch (Column.mapToDefaultType(getVariableType())) {
case IColumnTypes.DATETIME:
    if ("String_Node_Str".equalsIgnoreCase(defaultValue)) {
      return new java.util.Date();
    }
  if (defaultValue != null) {
    return parseDate(defaultValue);
  }
return null;
case IColumnTypes.TEXT:
{
if ("String_Node_Str".equalsIgnoreCase(defaultValue)) {
  return null;
}
return (defaultValue == null ? "String_Node_Str" : defaultValue);
}
case IColumnTypes.NUMBER:
try {
double number=Utils.getAsDouble(defaultValue,true);
return ("String_Node_Str".equalsIgnoreCase(defaultValue) ? null : new Double(number));
}
 catch (RuntimeException e) {
return defaultValue;
}
case IColumnTypes.INTEGER:
try {
int number=Utils.getAsInteger(defaultValue,true);
return ("String_Node_Str".equalsIgnoreCase(defaultValue) ? null : new Integer(number));
}
 catch (RuntimeException e) {
return defaultValue;
}
case IColumnTypes.MEDIA:
if ("String_Node_Str".equalsIgnoreCase(defaultValue)) {
return null;
}
return defaultValue;
default :
return null;
}
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public Object getInitValue(){
  String defaultValue=getDefaultValue();
switch (Column.mapToDefaultType(getVariableType())) {
case IColumnTypes.DATETIME:
    if ("String_Node_Str".equalsIgnoreCase(defaultValue)) {
      return new java.util.Date();
    }
  if (defaultValue != null) {
    Date pd=parseDate(defaultValue);
    if (pd != null)     return pd;
  }
return defaultValue;
case IColumnTypes.TEXT:
{
if ("String_Node_Str".equalsIgnoreCase(defaultValue)) {
  return null;
}
return (defaultValue == null ? "String_Node_Str" : defaultValue);
}
case IColumnTypes.NUMBER:
try {
double number=Utils.getAsDouble(defaultValue,true);
return ("String_Node_Str".equalsIgnoreCase(defaultValue) ? null : new Double(number));
}
 catch (RuntimeException e) {
return defaultValue;
}
case IColumnTypes.INTEGER:
try {
int number=Utils.getAsInteger(defaultValue,true);
return ("String_Node_Str".equalsIgnoreCase(defaultValue) ? null : new Integer(number));
}
 catch (RuntimeException e) {
return defaultValue;
}
case IColumnTypes.MEDIA:
if ("String_Node_Str".equalsIgnoreCase(defaultValue)) {
return null;
}
return defaultValue;
default :
return null;
}
}
Program: 143356
Project: 143356
Buggy source:
public int getFlags(){
  return Column.NORMAL_COLUMN;
}

Fixed version (ground truth):
public int getFlags(){
  return IBaseColumn.NORMAL_COLUMN;
}
Program: 143358
Project: 143358
Buggy source:
@Override public void foundSetChanged(FoundSetEvent event){
  if (event.getType() == FoundSetEvent.FIND_MODE_CHANGE)   changeMonitor.findModeChanged(foundset.isInFindMode());
 else   if (event.getType() == FoundSetEvent.FOUNDSET_INVALIDATED)   changeMonitor.foundsetInvalidated();
 else   if (event.getType() == FoundSetEvent.CONTENTS_CHANGED) {
    if (event.getChangeType() == FoundSetEvent.CHANGE_DELETE) {
      changeMonitor.recordsDeleted(event.getFirstRow(),event.getLastRow(),FoundsetTypeViewport.this);
    }
 else     if (event.getChangeType() == FoundSetEvent.CHANGE_INSERT) {
      if (size == 0) {
        setPreferredViewportBounds();
        changeMonitor.viewPortCompletelyChanged();
        changeMonitor.foundSetSizeChanged();
      }
 else {
        if (size < preferredViewPortSize && (foundset.getSize() - startIndex) > size) {
          setBounds(startIndex,Math.min(preferredViewPortSize,(foundset.getSize() - startIndex)));
        }
        changeMonitor.recordsInserted(event.getFirstRow(),event.getLastRow(),FoundsetTypeViewport.this);
      }
    }
 else     if (event.getChangeType() == FoundSetEvent.CHANGE_UPDATE) {
      changeMonitor.recordsUpdated(event.getFirstRow(),event.getLastRow(),foundset.getSize(),FoundsetTypeViewport.this,event.getDataProviders());
    }
    changeMonitor.checkHadMoreRows();
  }
 else   if (event.getType() == FoundSetEvent.SELECTION_MODE_CHANGE)   changeMonitor.multiSelectChanged();
}

Fixed version (ground truth):
@Override public void foundSetChanged(FoundSetEvent event){
  if (event.getType() == FoundSetEvent.FIND_MODE_CHANGE)   changeMonitor.findModeChanged(foundset.isInFindMode());
 else   if (event.getType() == FoundSetEvent.CONTENTS_CHANGED) {
    if (event.getChangeType() == FoundSetEvent.CHANGE_DELETE) {
      changeMonitor.recordsDeleted(event.getFirstRow(),event.getLastRow(),FoundsetTypeViewport.this);
    }
 else     if (event.getChangeType() == FoundSetEvent.CHANGE_INSERT) {
      if (size == 0) {
        setPreferredViewportBounds();
        changeMonitor.viewPortCompletelyChanged();
        changeMonitor.foundSetSizeChanged();
      }
 else {
        if (size < preferredViewPortSize && (foundset.getSize() - startIndex) > size) {
          setBounds(startIndex,Math.min(preferredViewPortSize,(foundset.getSize() - startIndex)));
        }
        changeMonitor.recordsInserted(event.getFirstRow(),event.getLastRow(),FoundsetTypeViewport.this);
      }
    }
 else     if (event.getChangeType() == FoundSetEvent.CHANGE_UPDATE) {
      changeMonitor.recordsUpdated(event.getFirstRow(),event.getLastRow(),foundset.getSize(),FoundsetTypeViewport.this,event.getDataProviders());
    }
 else     if (event.getChangeType() == FoundSetEvent.FOUNDSET_INVALIDATED)     foundset.getSize();
    changeMonitor.checkHadMoreRows();
  }
 else   if (event.getType() == FoundSetEvent.SELECTION_MODE_CHANGE)   changeMonitor.multiSelectChanged();
}
Program: 143359
Project: 143359
Buggy source:
/** 
 * Removes the relation specified by name. You cannot remove the the relation if it is touched within the application. So even if you remove all the ui elements using it, like tabs, it still can't be removed, because of underlying created and cached data.
 * @sample var success = solutionModel.removeRelation('myRelation'); if (success) { application.output("Relation has been removed");} else {application.output("Relation could not be removed");}
 * @param name the name of the relation to be removed
 * @return true if the removal was successful, false otherwise
 */
@JSFunction public boolean removeRelation(String name){
  FlattenedSolution fs=application.getFlattenedSolution();
  Relation rel=fs.getRelation(name);
  if (rel != null) {
    try {
      if (((FoundSetManager)application.getFoundSetManager()).getSQLGenerator().getCachedTableSQLSheet(rel.getForeignDataSource()).getRelatedSQLDescription(name) != null) {
        return false;
      }
      fs.deletePersistCopy(rel,false);
    }
 catch (    ServoyException e) {
      Debug.error(e);
      return false;
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Removes the relation specified by name. You cannot remove the relation if it is touched within the application. So even if you remove all the ui elements using it, like tabs, it still can't be removed, because of underlying created and cached data.
 * @sample var success = solutionModel.removeRelation('myRelation'); if (success) { application.output("Relation has been removed");} else {application.output("Relation could not be removed");}
 * @param name the name of the relation to be removed
 * @return true if the removal was successful, false otherwise
 */
@JSFunction public boolean removeRelation(String name){
  FlattenedSolution fs=application.getFlattenedSolution();
  Relation rel=fs.getRelation(name);
  if (rel != null) {
    try {
      if (((FoundSetManager)application.getFoundSetManager()).getSQLGenerator().getCachedTableSQLSheet(rel.getForeignDataSource()).getRelatedSQLDescription(name) != null) {
        return false;
      }
      fs.deletePersistCopy(rel,false);
    }
 catch (    ServoyException e) {
      Debug.error(e);
      return false;
    }
    return true;
  }
  return false;
}
Program: 143360
Project: 143360
Buggy source:
/** 
 * @see com.servoy.j2db.smart.J2DBClient#closeSolution(boolean,java.lang.Object[])
 */
@Override public boolean closeSolution(boolean force,Object[] args){
  boolean b=super.closeSolution(force,args);
  if (b) {
    if (actions != null) {
      createMenuBar(actions);
      fillToolbar(actions);
      String showMenuBar=settings.getProperty("String_Node_Str");
      if (showMenuBar != null && showMenuBar.equals("String_Node_Str"))       frame.getJMenuBar().setVisible(false);
 else       frame.getJMenuBar().setVisible(true);
      String showToolBar=settings.getProperty("String_Node_Str");
      if (showToolBar != null && showToolBar.equals("String_Node_Str"))       toolbarsPanel.setVisible(false);
 else       toolbarsPanel.setVisible(true);
    }
    if (getPreferedSolutionNameToLoadOnInit() == null && getMainApplicationFrame().isVisible()) {
      invokeLater(new Runnable(){
        public void run(){
          invokeLater(new Runnable(){
            public void run(){
              if (solutionRoot.getMainSolutionMetaData() == null) {
                selectAndOpenSolution();
              }
            }
          }
);
        }
      }
);
    }
  }
  return b;
}

Fixed version (ground truth):
/** 
 * @see com.servoy.j2db.smart.J2DBClient#closeSolution(boolean,java.lang.Object[])
 */
@Override public boolean closeSolution(boolean force,Object[] args){
  boolean b=super.closeSolution(force,args);
  if (b) {
    if (actions != null) {
      createMenuBar(actions);
      fillToolbar(actions);
      String showMenuBar=settings.getProperty("String_Node_Str");
      if (showMenuBar != null && showMenuBar.equals("String_Node_Str"))       frame.getJMenuBar().setVisible(false);
 else       frame.getJMenuBar().setVisible(true);
      String showToolBar=settings.getProperty("String_Node_Str");
      if (showToolBar != null && showToolBar.equals("String_Node_Str"))       toolbarsPanel.setVisible(false);
 else       toolbarsPanel.setVisible(true);
    }
    if (getPreferedSolutionNameToLoadOnInit() == null && getMainApplicationFrame().isVisible()) {
      isSelectAndOpenSolutionStarted=false;
      invokeLater(new Runnable(){
        public void run(){
          invokeLater(new Runnable(){
            public void run(){
              if (!isSelectAndOpenSolutionStarted && solutionRoot.getMainSolutionMetaData() == null) {
                selectAndOpenSolution();
              }
            }
          }
);
        }
      }
);
    }
  }
  return b;
}
Program: 143361
Project: 143361
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);
    }
  }
}