nus-yam/ex-repair huggingface dataset:
Program: 96298
Project: 96298
Buggy source:
/** 
 * Gets the 'status' string assigned to the system tray
 */
public String getStatus(){
  final Menu menu=systemTrayMenu;
  if (menu instanceof _AppIndicatorTray) {
    return ((_AppIndicatorTray)menu).getStatus();
  }
 else   if (menu instanceof _AppIndicatorNativeTray) {
    return ((_AppIndicatorNativeTray)menu).getStatus();
  }
 else   if (menu instanceof _GtkStatusIconTray) {
    return ((_GtkStatusIconTray)menu).getStatus();
  }
 else   if (menu instanceof _GtkStatusIconNativeTray) {
    return ((_GtkStatusIconNativeTray)menu).getStatus();
  }
 else   if (menu instanceof _AwtTray) {
    return ((_AwtTray)menu).getStatus();
  }
 else {
    return ((_SwingTray)menu).getStatus();
  }
}

Fixed version (ground truth):
/** 
 * Gets the 'status' string assigned to the system tray
 */
public String getStatus(){
  final Menu menu=systemTrayMenu;
  if (menu instanceof _AppIndicatorTray) {
    return ((_AppIndicatorTray)menu).getStatus();
  }
 else   if (menu instanceof _AppIndicatorNativeTray) {
    return ((_AppIndicatorNativeTray)menu).getStatus();
  }
 else   if (menu instanceof _GtkStatusIconTray) {
    return ((_GtkStatusIconTray)menu).getStatus();
  }
 else   if (menu instanceof _GtkStatusIconNativeTray) {
    return ((_GtkStatusIconNativeTray)menu).getStatus();
  }
 else   if (menu instanceof _AwtTray) {
    return ((_AwtTray)menu).getStatus();
  }
 else   if (menu instanceof _SwingTray) {
    return ((_SwingTray)menu).getStatus();
  }
 else {
    return "String_Node_Str";
  }
}
Program: 96299
Project: 96299
Buggy source:
/** 
 * Sets a 'status' string at the first position in the popup menu. This 'status' string appears as a disabled menu entry.
 * @param statusText the text you want displayed, null if you want to remove the 'status' string
 */
public void setStatus(String statusText){
  final Menu menu=systemTrayMenu;
  if (menu instanceof _AppIndicatorTray) {
    ((_AppIndicatorTray)menu).setStatus(statusText);
  }
 else   if (menu instanceof _AppIndicatorNativeTray) {
    ((_AppIndicatorNativeTray)menu).setStatus(statusText);
  }
 else   if (menu instanceof _GtkStatusIconTray) {
    ((_GtkStatusIconTray)menu).setStatus(statusText);
  }
 else   if (menu instanceof _GtkStatusIconNativeTray) {
    ((_GtkStatusIconNativeTray)menu).setStatus(statusText);
  }
 else   if (menu instanceof _AwtTray) {
    ((_AwtTray)menu).setStatus(statusText);
  }
 else {
    ((_SwingTray)menu).setStatus(statusText);
  }
}

Fixed version (ground truth):
/** 
 * Sets a 'status' string at the first position in the popup menu. This 'status' string appears as a disabled menu entry.
 * @param statusText the text you want displayed, null if you want to remove the 'status' string
 */
public void setStatus(String statusText){
  final Menu menu=systemTrayMenu;
  if (menu instanceof _AppIndicatorTray) {
    ((_AppIndicatorTray)menu).setStatus(statusText);
  }
 else   if (menu instanceof _AppIndicatorNativeTray) {
    ((_AppIndicatorNativeTray)menu).setStatus(statusText);
  }
 else   if (menu instanceof _GtkStatusIconTray) {
    ((_GtkStatusIconTray)menu).setStatus(statusText);
  }
 else   if (menu instanceof _GtkStatusIconNativeTray) {
    ((_GtkStatusIconNativeTray)menu).setStatus(statusText);
  }
 else   if (menu instanceof _AwtTray) {
    ((_AwtTray)menu).setStatus(statusText);
  }
 else   if (menu instanceof _SwingTray) {
    ((_SwingTray)menu).setStatus(statusText);
  }
}
Program: 96300
Project: 96300
Buggy source:
/** 
 * Shuts-down the SystemTray, by removing the menus + tray icon.
 */
public void shutdown(){
  final Menu menu=systemTrayMenu;
  if (menu instanceof _AppIndicatorTray) {
    ((_AppIndicatorTray)menu).shutdown();
  }
 else   if (menu instanceof _AppIndicatorNativeTray) {
    ((_AppIndicatorNativeTray)menu).shutdown();
  }
 else   if (menu instanceof _GtkStatusIconTray) {
    ((_GtkStatusIconTray)menu).shutdown();
  }
 else   if (menu instanceof _GtkStatusIconNativeTray) {
    ((_GtkStatusIconNativeTray)menu).shutdown();
  }
 else   if (menu instanceof _AwtTray) {
    ((_AwtTray)menu).shutdown();
  }
 else {
    ((_SwingTray)menu).shutdown();
  }
  systemTrayMenu=null;
}

Fixed version (ground truth):
/** 
 * Shuts-down the SystemTray, by removing the menus + tray icon. After calling this method, you MUST call `get()` or `getNative()` again to obtain a new reference to the SystemTray.
 */
public void shutdown(){
  final Menu menu=systemTrayMenu;
  if (menu instanceof _AppIndicatorTray) {
    ((_AppIndicatorTray)menu).shutdown();
  }
 else   if (menu instanceof _AppIndicatorNativeTray) {
    ((_AppIndicatorNativeTray)menu).shutdown();
  }
 else   if (menu instanceof _GtkStatusIconTray) {
    ((_GtkStatusIconTray)menu).shutdown();
  }
 else   if (menu instanceof _GtkStatusIconNativeTray) {
    ((_GtkStatusIconNativeTray)menu).shutdown();
  }
 else   if (menu instanceof _AwtTray) {
    ((_AwtTray)menu).shutdown();
  }
 else   if (menu instanceof _SwingTray) {
    ((_SwingTray)menu).shutdown();
  }
  systemTrayMenu=null;
}
Program: 96301
Project: 96301
Buggy source:
public static void shutdownGui(){
  dispatch(new Runnable(){
    @Override public void run(){
      if (!alreadyRunningGTK) {
        gtk_main_quit();
      }
      started=false;
    }
  }
);
}

Fixed version (ground truth):
public static void shutdownGui(){
  dispatchAndWait(new Runnable(){
    @Override public void run(){
      if (!alreadyRunningGTK) {
        gtk_main_quit();
      }
      started=false;
    }
  }
);
}
Program: 96302
Project: 96302
Buggy source:
/** 
 * Necessary to guarantee all updates occur on the dispatch thread
 */
protected void dispatchAndWait(final Runnable runnable){
  final CountDownLatch countDownLatch=new CountDownLatch(1);
  Gtk.dispatch(new Runnable(){
    @Override public void run(){
      try {
        runnable.run();
      }
  finally {
        countDownLatch.countDown();
      }
    }
  }
);
  try {
    if (!countDownLatch.await(TIMEOUT,TimeUnit.SECONDS)) {
      if (SystemTray.DEBUG) {
        SystemTray.logger.error("String_Node_Str" + TIMEOUT + "String_Node_Str"+ "String_Node_Str");
      }
 else {
        throw new RuntimeException("String_Node_Str" + TIMEOUT + "String_Node_Str"+ "String_Node_Str");
      }
    }
  }
 catch (  InterruptedException e) {
    SystemTray.logger.error("String_Node_Str",new Exception());
  }
}

Fixed version (ground truth):
/** 
 * Necessary to guarantee all updates occur on the dispatch thread
 */
protected void dispatchAndWait(final Runnable runnable){
  Gtk.dispatchAndWait(runnable);
}
Program: 96303
Project: 96303
Buggy source:
public void shutdown(){
  dispatch(new Runnable(){
    @Override public void run(){
      obliterateMenu();
      Gtk.shutdownGui();
    }
  }
);
}

Fixed version (ground truth):
public void shutdown(){
  dispatch(new Runnable(){
    @Override public void run(){
      obliterateMenu();
    }
  }
);
  Gtk.shutdownGui();
}
Program: 96304
Project: 96304
Buggy source:
@Override public final void setEnabled(final boolean setEnabled){
  visible=!setEnabled;
  Gtk.dispatch(new Runnable(){
    @Override public void run(){
      if (visible && !setEnabled) {
        AppIndicator.app_indicator_set_status(appIndicator,AppIndicator.STATUS_PASSIVE);
      }
 else       if (!visible && setEnabled) {
        AppIndicator.app_indicator_set_status(appIndicator,AppIndicator.STATUS_ACTIVE);
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public final void setEnabled(final boolean setEnabled){
  Gtk.dispatch(new Runnable(){
    @Override public void run(){
      if (visible && !setEnabled) {
        AppIndicator.app_indicator_set_status(appIndicator,AppIndicator.STATUS_PASSIVE);
        visible=false;
      }
 else       if (!visible && setEnabled) {
        AppIndicator.app_indicator_set_status(appIndicator,AppIndicator.STATUS_ACTIVE);
        visible=true;
      }
    }
  }
);
}
Program: 96305
Project: 96305
Buggy source:
@Override public void run(){
  if (visible && !setEnabled) {
    AppIndicator.app_indicator_set_status(appIndicator,AppIndicator.STATUS_PASSIVE);
  }
 else   if (!visible && setEnabled) {
    AppIndicator.app_indicator_set_status(appIndicator,AppIndicator.STATUS_ACTIVE);
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (visible && !setEnabled) {
    AppIndicator.app_indicator_set_status(appIndicator,AppIndicator.STATUS_PASSIVE);
    visible=false;
  }
 else   if (!visible && setEnabled) {
    AppIndicator.app_indicator_set_status(appIndicator,AppIndicator.STATUS_ACTIVE);
    visible=true;
  }
}
Program: 96306
Project: 96306
Buggy source:
@SuppressWarnings("String_Node_Str") public void setEnabled(final boolean setEnabled){
  visible=!setEnabled;
  dispatch(new Runnable(){
    @Override public void run(){
      if (visible && !setEnabled) {
        tray.remove(trayIcon);
      }
 else       if (!visible && setEnabled) {
        try {
          tray.add(trayIcon);
        }
 catch (        AWTException e) {
          dorkbox.systemTray.SystemTray.logger.error("String_Node_Str");
        }
      }
    }
  }
);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void setEnabled(final boolean setEnabled){
  if (OS.isMacOsX()) {
    if (keepAliveThread != null) {
synchronized (keepAliveLock) {
        keepAliveLock.notifyAll();
      }
    }
    keepAliveThread=null;
    if (visible && !setEnabled) {
      keepAliveThread=new Thread(new Runnable(){
        @Override public void run(){
synchronized (keepAliveLock) {
            keepAliveLock.notifyAll();
            try {
              keepAliveLock.wait();
            }
 catch (            InterruptedException ignored) {
            }
          }
        }
      }
,"String_Node_Str");
      keepAliveThread.start();
    }
synchronized (keepAliveLock) {
      try {
        keepAliveLock.wait();
      }
 catch (      InterruptedException e) {
        e.printStackTrace();
      }
    }
  }
  dispatch(new Runnable(){
    @Override public void run(){
      if (visible && !setEnabled) {
        tray.remove(trayIcon);
        visible=false;
      }
 else       if (!visible && setEnabled) {
        try {
          tray.add(trayIcon);
          visible=true;
        }
 catch (        AWTException e) {
          dorkbox.systemTray.SystemTray.logger.error("String_Node_Str");
        }
      }
    }
  }
);
}
Program: 96307
Project: 96307
Buggy source:
@Override public void run(){
  if (visible && !setEnabled) {
    tray.remove(trayIcon);
  }
 else   if (!visible && setEnabled) {
    try {
      tray.add(trayIcon);
    }
 catch (    AWTException e) {
      dorkbox.systemTray.SystemTray.logger.error("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (visible && !setEnabled) {
    tray.remove(trayIcon);
    visible=false;
  }
 else   if (!visible && setEnabled) {
    try {
      tray.add(trayIcon);
      visible=true;
    }
 catch (    AWTException e) {
      dorkbox.systemTray.SystemTray.logger.error("String_Node_Str");
    }
  }
}
Program: 96308
Project: 96308
Buggy source:
public void shutdown(){
  dispatch(new Runnable(){
    @Override public void run(){
      removeAll();
      remove();
      tray.remove(trayIcon);
    }
  }
);
}

Fixed version (ground truth):
public void shutdown(){
  dispatchAndWait(new Runnable(){
    @Override public void run(){
      removeAll();
      remove();
      tray.remove(trayIcon);
    }
  }
);
}
Program: 96309
Project: 96309
Buggy source:
@Override public final void setEnabled(final boolean setEnabled){
  visible=!setEnabled;
  Gtk.dispatch(new Runnable(){
    @Override public void run(){
      if (visible && !setEnabled) {
        Gtk.gtk_status_icon_set_visible(trayIcon,setEnabled);
      }
 else       if (!visible && setEnabled) {
        Gtk.gtk_status_icon_set_visible(trayIcon,setEnabled);
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public final void setEnabled(final boolean setEnabled){
  Gtk.dispatch(new Runnable(){
    @Override public void run(){
      if (visible && !setEnabled) {
        Gtk.gtk_status_icon_set_visible(trayIcon,setEnabled);
        visible=false;
      }
 else       if (!visible && setEnabled) {
        Gtk.gtk_status_icon_set_visible(trayIcon,setEnabled);
        visible=true;
      }
    }
  }
);
}
Program: 96310
Project: 96310
Buggy source:
@Override public void run(){
  if (visible && !setEnabled) {
    Gtk.gtk_status_icon_set_visible(trayIcon,setEnabled);
  }
 else   if (!visible && setEnabled) {
    Gtk.gtk_status_icon_set_visible(trayIcon,setEnabled);
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (visible && !setEnabled) {
    Gtk.gtk_status_icon_set_visible(trayIcon,setEnabled);
    visible=false;
  }
 else   if (!visible && setEnabled) {
    Gtk.gtk_status_icon_set_visible(trayIcon,setEnabled);
    visible=true;
  }
}
Program: 96311
Project: 96311
Buggy source:
@Override public final void setImage_(final File imageFile){
  dispatch(new Runnable(){
    @Override public void run(){
      AppIndicator.app_indicator_set_icon(appIndicator,imageFile.getAbsolutePath());
      if (!isActive) {
        isActive=true;
        AppIndicator.app_indicator_set_status(appIndicator,AppIndicator.STATUS_ACTIVE);
        hookMenuOpen();
      }
    }
  }
);
  dispatch(new Runnable(){
    @Override public void run(){
      ((TrayPopup)_native).setTitleBarImage(imageFile);
    }
  }
);
}

Fixed version (ground truth):
@Override public final void setImage_(final File imageFile){
  Gtk.dispatch(new Runnable(){
    @Override public void run(){
      AppIndicator.app_indicator_set_icon(appIndicator,imageFile.getAbsolutePath());
      if (!isActive) {
        isActive=true;
        AppIndicator.app_indicator_set_status(appIndicator,AppIndicator.STATUS_ACTIVE);
        hookMenuOpen();
      }
    }
  }
);
  dispatch(new Runnable(){
    @Override public void run(){
      ((TrayPopup)_native).setTitleBarImage(imageFile);
    }
  }
);
}
Program: 96312
Project: 96312
Buggy source:
@Override public final void setEnabled(final boolean setEnabled){
  visible=!setEnabled;
  Gtk.dispatch(new Runnable(){
    @Override public void run(){
      if (visible && !setEnabled) {
        AppIndicator.app_indicator_set_status(appIndicator,AppIndicator.STATUS_PASSIVE);
      }
 else       if (!visible && setEnabled) {
        AppIndicator.app_indicator_set_status(appIndicator,AppIndicator.STATUS_ACTIVE);
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public final void setEnabled(final boolean setEnabled){
  Gtk.dispatch(new Runnable(){
    @Override public void run(){
      if (visible && !setEnabled) {
        AppIndicator.app_indicator_set_status(appIndicator,AppIndicator.STATUS_PASSIVE);
        visible=false;
      }
 else       if (!visible && setEnabled) {
        AppIndicator.app_indicator_set_status(appIndicator,AppIndicator.STATUS_ACTIVE);
        visible=true;
      }
    }
  }
);
}
Program: 96313
Project: 96313
Buggy source:
@Override public void run(){
  if (visible && !setEnabled) {
    AppIndicator.app_indicator_set_status(appIndicator,AppIndicator.STATUS_PASSIVE);
  }
 else   if (!visible && setEnabled) {
    AppIndicator.app_indicator_set_status(appIndicator,AppIndicator.STATUS_ACTIVE);
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (visible && !setEnabled) {
    AppIndicator.app_indicator_set_status(appIndicator,AppIndicator.STATUS_PASSIVE);
    visible=false;
  }
 else   if (!visible && setEnabled) {
    AppIndicator.app_indicator_set_status(appIndicator,AppIndicator.STATUS_ACTIVE);
    visible=true;
  }
}
Program: 96314
Project: 96314
Buggy source:
public static void startGui(){
  if (!started) {
    started=true;
    if (!alreadyRunningGTK) {
      if (SystemTray.DEBUG) {
        logger.error("String_Node_Str");
      }
      gtkUpdateThread=new Thread(){
        @Override public void run(){
          GThread.g_thread_init(null);
          if (!gtk_init_check(0)) {
            if (SystemTray.DEBUG) {
              logger.error("String_Node_Str");
            }
            return;
          }
          gdk_threads_enter();
          gtk_main();
          gdk_threads_leave();
        }
      }
;
      gtkUpdateThread.setName("String_Node_Str");
      gtkUpdateThread.start();
    }
  }
}

Fixed version (ground truth):
public static void startGui(){
  if (!started) {
    started=true;
    if (!alreadyRunningGTK) {
      if (SystemTray.DEBUG) {
        logger.error("String_Node_Str");
      }
      gtkUpdateThread=new Thread(){
        @Override public void run(){
          if (!gtk_init_check(0)) {
            if (SystemTray.DEBUG) {
              logger.error("String_Node_Str");
            }
            return;
          }
          gtk_main();
        }
      }
;
      gtkUpdateThread.setName("String_Node_Str");
      gtkUpdateThread.start();
    }
  }
}
Program: 96315
Project: 96315
Buggy source:
void createMenu(){
  if (obliterateInProgress) {
    return;
  }
  if (getParent() != null) {
    ((GtkMenu)getParent()).createMenu();
  }
  boolean hasImages=false;
synchronized (menuEntries) {
    for (int i=0, menuEntriesSize=menuEntries.size(); i < menuEntriesSize; i++) {
      final Entry menuEntry__=menuEntries.get(i);
      hasImages|=menuEntry__.hasImage();
    }
    for (int i=0, menuEntriesSize=menuEntries.size(); i < menuEntriesSize; i++) {
      final Entry menuEntry__=menuEntries.get(i);
      if (menuEntry__ instanceof GtkEntry) {
        GtkEntry entry=(GtkEntry)menuEntry__;
        entry.setSpacerImage(hasImages);
        Gtk.gtk_menu_shell_append(this._native,entry._native);
        Gobject.g_object_ref_sink(entry._native);
      }
 else       if (menuEntry__ instanceof GtkMenu) {
        GtkMenu subMenu=(GtkMenu)menuEntry__;
        Gtk.gtk_menu_shell_append(this._native,subMenu.menuEntry._native);
        Gobject.g_object_ref_sink(subMenu.menuEntry._native);
        if (subMenu.getParent() != GtkMenu.this) {
          subMenu.createMenu();
        }
      }
    }
    onMenuAdded(_native);
    Gtk.gtk_widget_show_all(_native);
  }
}

Fixed version (ground truth):
void createMenu(){
  if (obliterateInProgress) {
    return;
  }
  if (getParent() != null) {
    ((GtkMenu)getParent()).createMenu();
  }
  boolean hasImages=false;
synchronized (menuEntries) {
    for (int i=0, menuEntriesSize=menuEntries.size(); i < menuEntriesSize; i++) {
      final Entry menuEntry__=menuEntries.get(i);
      hasImages|=menuEntry__.hasImage();
    }
    for (int i=0, menuEntriesSize=menuEntries.size(); i < menuEntriesSize; i++) {
      final Entry menuEntry__=menuEntries.get(i);
      if (menuEntry__ instanceof GtkEntry) {
        GtkEntry entry=(GtkEntry)menuEntry__;
        entry.setSpacerImage(hasImages);
        Gtk.gtk_menu_shell_append(this._native,entry._native);
        Gobject.g_object_ref_sink(entry._native);
        Gtk.gtk_widget_show_all(entry._native);
      }
 else       if (menuEntry__ instanceof GtkMenu) {
        GtkMenu subMenu=(GtkMenu)menuEntry__;
        Gtk.gtk_menu_shell_append(this._native,subMenu.menuEntry._native);
        Gobject.g_object_ref_sink(subMenu.menuEntry._native);
        Gtk.gtk_widget_show_all(subMenu.menuEntry._native);
        if (subMenu.getParent() != GtkMenu.this) {
          subMenu.createMenu();
        }
      }
    }
    onMenuAdded(_native);
    Gtk.gtk_widget_show_all(_native);
  }
}
Program: 96316
Project: 96316
Buggy source:
public void shutdown(){
  dispatchAndWait(new Runnable(){
    @Override public void run(){
      obliterateMenu();
      Gtk.shutdownGui();
    }
  }
);
}

Fixed version (ground truth):
public void shutdown(){
  dispatch(new Runnable(){
    @Override public void run(){
      obliterateMenu();
      Gtk.shutdownGui();
    }
  }
);
}
Program: 96317
Project: 96317
Buggy source:
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) private static void init(final boolean useNativeMenus){
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) private static void init(boolean useNativeMenus){
}
Program: 96318
Project: 96318
Buggy source:
public static void onShutdown(final Runnable runnable){
  currentDisplay.getShells()[0].addListener(org.eclipse.swt.SWT.Close,new org.eclipse.swt.widgets.Listener(){
    @Override public void handleEvent(    final org.eclipse.swt.widgets.Event event){
      runnable.run();
    }
  }
);
}

Fixed version (ground truth):
public static void onShutdown(final Runnable runnable){
  if (isEventThread()) {
    currentDisplay.getShells()[0].addListener(org.eclipse.swt.SWT.Close,new org.eclipse.swt.widgets.Listener(){
      @Override public void handleEvent(      final org.eclipse.swt.widgets.Event event){
        runnable.run();
      }
    }
);
  }
 else {
    dispatch(new Runnable(){
      @Override public void run(){
        currentDisplay.getShells()[0].addListener(org.eclipse.swt.SWT.Close,new org.eclipse.swt.widgets.Listener(){
          @Override public void handleEvent(          final org.eclipse.swt.widgets.Event event){
            runnable.run();
          }
        }
);
      }
    }
);
  }
}
Program: 96319
Project: 96319
Buggy source:
public static void dispatch(final Runnable runnable){
  try {
    if (dispatchMethod == null) {
      Class<?> clazz=Class.forName("String_Node_Str");
      dispatchMethod=clazz.getMethod("String_Node_Str");
    }
    dispatchMethod.invoke(null,runnable);
  }
 catch (  Throwable e) {
    if (SystemTray.DEBUG) {
      SystemTray.logger.error("String_Node_Str",e);
    }
    SystemTray.logger.error("String_Node_Str" + "String_Node_Str");
  }
}

Fixed version (ground truth):
public static void dispatch(final Runnable runnable){
  try {
    dispatchMethod.invoke(null,runnable);
  }
 catch (  Throwable e) {
    SystemTray.logger.error("String_Node_Str" + "String_Node_Str");
  }
}
Program: 96320
Project: 96320
Buggy source:
public static boolean isEventThread(){
  try {
    if (isEventThread == null) {
      Class<?> clazz=Class.forName("String_Node_Str");
      isEventThread=clazz.getMethod("String_Node_Str");
    }
    return (Boolean)isEventThread.invoke(null);
  }
 catch (  Throwable e) {
    if (SystemTray.DEBUG) {
      SystemTray.logger.error("String_Node_Str",e);
    }
    SystemTray.logger.error("String_Node_Str" + "String_Node_Str");
  }
  return false;
}

Fixed version (ground truth):
public static boolean isEventThread(){
  try {
    return (Boolean)isEventThreadMethod.invoke(null);
  }
 catch (  Throwable e) {
    SystemTray.logger.error("String_Node_Str" + "String_Node_Str");
  }
  return false;
}
Program: 96321
Project: 96321
Buggy source:
public static void dispatch(final Runnable runnable){
  org.eclipse.swt.widgets.Display.getCurrent().syncExec(runnable);
}

Fixed version (ground truth):
public static void dispatch(final Runnable runnable){
  currentDisplay.syncExec(runnable);
}
Program: 96322
Project: 96322
Buggy source:
public static void onShutdown(final Runnable runnable){
  org.eclipse.swt.widgets.Display.getCurrent().getShells()[0].addListener(org.eclipse.swt.SWT.Close,new org.eclipse.swt.widgets.Listener(){
    @Override public void handleEvent(    final org.eclipse.swt.widgets.Event event){
      runnable.run();
    }
  }
);
}

Fixed version (ground truth):
public static void onShutdown(final Runnable runnable){
  currentDisplay.getShells()[0].addListener(org.eclipse.swt.SWT.Close,new org.eclipse.swt.widgets.Listener(){
    @Override public void handleEvent(    final org.eclipse.swt.widgets.Event event){
      runnable.run();
    }
  }
);
}
Program: 96323
Project: 96323
Buggy source:
void doShow(final Point point,int offset){
  Dimension size=getPreferredSize();
  Rectangle bounds=ScreenUtil.getScreenBoundsAt(point);
  int x=point.x;
  int y=point.y;
  if (y < bounds.y) {
    y=bounds.y;
  }
 else   if (y + size.height > bounds.y + bounds.height) {
    y-=size.height;
  }
  if (x < bounds.x) {
    x=bounds.x;
  }
 else   if (x + size.width > bounds.x + bounds.width) {
    x-=size.width;
    offset=-offset;
  }
  x-=offset;
  setInvoker(hiddenDialog.getContentPane());
  hiddenDialog.setLocation(x,y);
  hiddenDialog.setVisible(true);
  setLocation(x,y);
  setVisible(true);
  requestFocusInWindow();
}

Fixed version (ground truth):
void doShow(final Point point,int offset){
  invalidate();
  revalidate();
  doLayout();
  Dimension size=getPreferredSize();
  Rectangle bounds=ScreenUtil.getScreenBoundsAt(point);
  int x=point.x;
  int y=point.y;
  if (y < bounds.y) {
    y=bounds.y;
  }
 else   if (y + size.height > bounds.y + bounds.height) {
    y-=size.height;
  }
  if (x < bounds.x) {
    x=bounds.x;
  }
 else   if (x + size.width > bounds.x + bounds.width) {
    x-=size.width;
    offset=-offset;
  }
  x-=offset;
  setInvoker(hiddenDialog.getContentPane());
  hiddenDialog.setLocation(x,y);
  hiddenDialog.setVisible(true);
  setLocation(x,y);
  setVisible(true);
  requestFocusInWindow();
}
Program: 96324
Project: 96324
Buggy source:
@SuppressWarnings("String_Node_Str") TrayPopup(){
  super();
  setFocusable(true);
  setBorder(new EmptyBorder(1,1,1,1));
  hiddenDialog=new JDialog((Frame)null,"String_Node_Str");
  hiddenDialog.setUndecorated(true);
  hiddenDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
  hiddenDialog.setAlwaysOnTop(true);
  hiddenDialog.getContentPane().setLayout(null);
  if (OS.javaVersion >= 7) {
    try {
      Class<? extends JDialog> hiddenDialogClass=hiddenDialog.getClass();
      Method[] methods=hiddenDialogClass.getMethods();
      for (      Method method : methods) {
        if (method.getName().equals("String_Node_Str")) {
          Class<Enum> cl=(Class<Enum>)Class.forName("String_Node_Str");
          method.invoke(hiddenDialog,Enum.valueOf(cl,"String_Node_Str"));
          break;
        }
      }
    }
 catch (    Exception e) {
      SystemTray.logger.error("String_Node_Str");
    }
  }
  hiddenDialog.pack();
  hiddenDialog.setBounds(0,0,0,0);
  addPopupMenuListener(new PopupMenuListener(){
    public void popupMenuWillBecomeVisible(    PopupMenuEvent e){
    }
    public void popupMenuWillBecomeInvisible(    PopupMenuEvent e){
      hiddenDialog.setVisible(false);
      hiddenDialog.toBack();
    }
    public void popupMenuCanceled(    PopupMenuEvent e){
    }
  }
);
  hiddenDialog.addWindowFocusListener(new WindowFocusListener(){
    @Override public void windowLostFocus(    WindowEvent we){
      TrayPopup.this.setVisible(false);
    }
    @Override public void windowGainedFocus(    WindowEvent we){
    }
  }
);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") TrayPopup(){
  super();
  setFocusable(true);
  setBorder(new EmptyBorder(1,1,1,1));
  hiddenDialog=new JDialog((Frame)null,"String_Node_Str");
  hiddenDialog.setUndecorated(true);
  hiddenDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
  hiddenDialog.setAlwaysOnTop(true);
  hiddenDialog.getContentPane().setLayout(null);
  if (OS.javaVersion >= 7) {
    try {
      Class<? extends JDialog> hiddenDialogClass=hiddenDialog.getClass();
      Method[] methods=hiddenDialogClass.getMethods();
      for (      Method method : methods) {
        if (method.getName().equals("String_Node_Str")) {
          Class<Enum> cl=(Class<Enum>)Class.forName("String_Node_Str");
          method.invoke(hiddenDialog,Enum.valueOf(cl,"String_Node_Str"));
          break;
        }
      }
    }
 catch (    Exception e) {
      SystemTray.logger.error("String_Node_Str");
    }
  }
  hiddenDialog.pack();
  hiddenDialog.setBounds(0,0,0,0);
  addPopupMenuListener(new PopupMenuListener(){
    public void popupMenuWillBecomeVisible(    PopupMenuEvent e){
    }
    public void popupMenuWillBecomeInvisible(    PopupMenuEvent e){
      hiddenDialog.setVisible(false);
      hiddenDialog.toBack();
      Runnable r=runnable;
      if (r != null) {
        r.run();
      }
    }
    public void popupMenuCanceled(    PopupMenuEvent e){
    }
  }
);
}
Program: 96325
Project: 96325
Buggy source:
public void popupMenuWillBecomeInvisible(PopupMenuEvent e){
  hiddenDialog.setVisible(false);
  hiddenDialog.toBack();
}

Fixed version (ground truth):
public void popupMenuWillBecomeInvisible(PopupMenuEvent e){
  hiddenDialog.setVisible(false);
  hiddenDialog.toBack();
  Runnable r=runnable;
  if (r != null) {
    r.run();
  }
}
Program: 96326
Project: 96326
Buggy source:
public void setIcon_(final File iconFile){
  dispatch(new Runnable(){
    @Override public void run(){
      final Image trayImage=new ImageIcon(iconFile.getAbsolutePath()).getImage();
      trayImage.flush();
      if (trayIcon == null) {
        trayIcon=new TrayIcon(trayImage);
        trayIcon.addMouseListener(new MouseAdapter(){
          @Override public void mousePressed(          MouseEvent e){
            Dimension size=_native.getPreferredSize();
            Point point=e.getPoint();
            Rectangle bounds=ScreenUtil.getScreenBoundsAt(point);
            int x=point.x;
            int y=point.y;
            if (y < bounds.y) {
              y=bounds.y;
            }
 else             if (y + size.height > bounds.y + bounds.height) {
              y-=size.height;
            }
            if (x < bounds.x) {
              x=bounds.x;
            }
 else             if (x + size.width > bounds.x + bounds.width) {
              x-=size.width;
            }
            ((JPopupMenu)_native).setInvoker(_native);
            _native.setLocation(x,y);
            _native.setVisible(true);
            _native.setFocusable(true);
            _native.requestFocusInWindow();
          }
        }
);
        try {
          tray.add(trayIcon);
        }
 catch (        AWTException e) {
          dorkbox.systemTray.SystemTray.logger.error("String_Node_Str",e);
        }
      }
 else {
        trayIcon.setImage(trayImage);
      }
    }
  }
);
}

Fixed version (ground truth):
public void setIcon_(final File iconFile){
  dispatch(new Runnable(){
    @Override public void run(){
      final Image trayImage=new ImageIcon(iconFile.getAbsolutePath()).getImage();
      trayImage.flush();
      if (trayIcon == null) {
        trayIcon=new TrayIcon(trayImage);
        JPopupMenu popupMenu=(JPopupMenu)_native;
        popupMenu.pack();
        popupMenu.setFocusable(true);
        trayIcon.addMouseListener(new MouseAdapter(){
          @Override public void mousePressed(          MouseEvent e){
            Dimension size=_native.getPreferredSize();
            Point point=e.getPoint();
            Rectangle bounds=ScreenUtil.getScreenBoundsAt(point);
            int x=point.x;
            int y=point.y;
            if (y < bounds.y) {
              y=bounds.y;
            }
 else             if (y + size.height > bounds.y + bounds.height) {
              y-=size.height;
            }
            if (x < bounds.x) {
              x=bounds.x;
            }
 else             if (x + size.width > bounds.x + bounds.width) {
              x-=size.width;
            }
            SwingSystemTrayMenuWindowsPopup popupMenu=(SwingSystemTrayMenuWindowsPopup)_native;
            popupMenu.doShow(x,y);
          }
        }
);
        try {
          tray.add(trayIcon);
          ((SwingSystemTrayMenuWindowsPopup)_native).setIcon(iconFile);
        }
 catch (        AWTException e) {
          dorkbox.systemTray.SystemTray.logger.error("String_Node_Str",e);
        }
      }
 else {
        ((SwingSystemTrayMenuWindowsPopup)_native).setIcon(iconFile);
        trayIcon.setImage(trayImage);
      }
    }
  }
);
}
Program: 96327
Project: 96327
Buggy source:
@Override public void run(){
  final Image trayImage=new ImageIcon(iconFile.getAbsolutePath()).getImage();
  trayImage.flush();
  if (trayIcon == null) {
    trayIcon=new TrayIcon(trayImage);
    trayIcon.addMouseListener(new MouseAdapter(){
      @Override public void mousePressed(      MouseEvent e){
        Dimension size=_native.getPreferredSize();
        Point point=e.getPoint();
        Rectangle bounds=ScreenUtil.getScreenBoundsAt(point);
        int x=point.x;
        int y=point.y;
        if (y < bounds.y) {
          y=bounds.y;
        }
 else         if (y + size.height > bounds.y + bounds.height) {
          y-=size.height;
        }
        if (x < bounds.x) {
          x=bounds.x;
        }
 else         if (x + size.width > bounds.x + bounds.width) {
          x-=size.width;
        }
        ((JPopupMenu)_native).setInvoker(_native);
        _native.setLocation(x,y);
        _native.setVisible(true);
        _native.setFocusable(true);
        _native.requestFocusInWindow();
      }
    }
);
    try {
      tray.add(trayIcon);
    }
 catch (    AWTException e) {
      dorkbox.systemTray.SystemTray.logger.error("String_Node_Str",e);
    }
  }
 else {
    trayIcon.setImage(trayImage);
  }
}

Fixed version (ground truth):
@Override public void run(){
  final Image trayImage=new ImageIcon(iconFile.getAbsolutePath()).getImage();
  trayImage.flush();
  if (trayIcon == null) {
    trayIcon=new TrayIcon(trayImage);
    JPopupMenu popupMenu=(JPopupMenu)_native;
    popupMenu.pack();
    popupMenu.setFocusable(true);
    trayIcon.addMouseListener(new MouseAdapter(){
      @Override public void mousePressed(      MouseEvent e){
        Dimension size=_native.getPreferredSize();
        Point point=e.getPoint();
        Rectangle bounds=ScreenUtil.getScreenBoundsAt(point);
        int x=point.x;
        int y=point.y;
        if (y < bounds.y) {
          y=bounds.y;
        }
 else         if (y + size.height > bounds.y + bounds.height) {
          y-=size.height;
        }
        if (x < bounds.x) {
          x=bounds.x;
        }
 else         if (x + size.width > bounds.x + bounds.width) {
          x-=size.width;
        }
        SwingSystemTrayMenuWindowsPopup popupMenu=(SwingSystemTrayMenuWindowsPopup)_native;
        popupMenu.doShow(x,y);
      }
    }
);
    try {
      tray.add(trayIcon);
      ((SwingSystemTrayMenuWindowsPopup)_native).setIcon(iconFile);
    }
 catch (    AWTException e) {
      dorkbox.systemTray.SystemTray.logger.error("String_Node_Str",e);
    }
  }
 else {
    ((SwingSystemTrayMenuWindowsPopup)_native).setIcon(iconFile);
    trayIcon.setImage(trayImage);
  }
}
Program: 96328
Project: 96328
Buggy source:
@Override public void mousePressed(MouseEvent e){
  Dimension size=_native.getPreferredSize();
  Point point=e.getPoint();
  Rectangle bounds=ScreenUtil.getScreenBoundsAt(point);
  int x=point.x;
  int y=point.y;
  if (y < bounds.y) {
    y=bounds.y;
  }
 else   if (y + size.height > bounds.y + bounds.height) {
    y-=size.height;
  }
  if (x < bounds.x) {
    x=bounds.x;
  }
 else   if (x + size.width > bounds.x + bounds.width) {
    x-=size.width;
  }
  ((JPopupMenu)_native).setInvoker(_native);
  _native.setLocation(x,y);
  _native.setVisible(true);
  _native.setFocusable(true);
  _native.requestFocusInWindow();
}

Fixed version (ground truth):
@Override public void mousePressed(MouseEvent e){
  Dimension size=_native.getPreferredSize();
  Point point=e.getPoint();
  Rectangle bounds=ScreenUtil.getScreenBoundsAt(point);
  int x=point.x;
  int y=point.y;
  if (y < bounds.y) {
    y=bounds.y;
  }
 else   if (y + size.height > bounds.y + bounds.height) {
    y-=size.height;
  }
  if (x < bounds.x) {
    x=bounds.x;
  }
 else   if (x + size.width > bounds.x + bounds.width) {
    x-=size.width;
  }
  SwingSystemTrayMenuWindowsPopup popupMenu=(SwingSystemTrayMenuWindowsPopup)_native;
  popupMenu.doShow(x,y);
}
Program: 96329
Project: 96329
Buggy source:
SwingSystemTrayMenuWindowsPopup(){
  super();
  setFocusable(true);
  setBorder(new EmptyBorder(1,1,1,1));
  this.hiddenDialog=new JDialog((Frame)null);
  this.hiddenDialog.setEnabled(false);
  this.hiddenDialog.setUndecorated(true);
  this.hiddenDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
  this.hiddenDialog.setSize(1,1);
  this.hiddenDialog.addWindowFocusListener(new WindowFocusListener(){
    @Override public void windowLostFocus(    WindowEvent we){
      SwingSystemTrayMenuWindowsPopup.this.setVisible(false);
    }
    @Override public void windowGainedFocus(    WindowEvent we){
    }
  }
);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") SwingSystemTrayMenuWindowsPopup(){
  super();
  setFocusable(true);
  setBorder(new EmptyBorder(1,1,1,1));
  this.hiddenDialog=new JDialog((Frame)null,"String_Node_Str");
  this.hiddenDialog.setUndecorated(true);
  this.hiddenDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
  this.hiddenDialog.setAlwaysOnTop(true);
  this.hiddenDialog.getContentPane().setLayout(null);
  if (OS.javaVersion >= 7) {
    try {
      Class<? extends JDialog> hiddenDialogClass=this.hiddenDialog.getClass();
      Method[] methods=hiddenDialogClass.getMethods();
      for (      Method method : methods) {
        if (method.getName().equals("String_Node_Str")) {
          Class<Enum> cl=(Class<Enum>)Class.forName("String_Node_Str");
          method.invoke(this.hiddenDialog,Enum.valueOf(cl,"String_Node_Str"));
          break;
        }
      }
    }
 catch (    Exception e) {
      SystemTray.logger.error("String_Node_Str");
    }
  }
  this.hiddenDialog.pack();
  this.hiddenDialog.setBounds(0,0,0,0);
  addPopupMenuListener(new PopupMenuListener(){
    public void popupMenuWillBecomeVisible(    PopupMenuEvent e){
    }
    public void popupMenuWillBecomeInvisible(    PopupMenuEvent e){
      hiddenDialog.setVisible(false);
      hiddenDialog.toBack();
    }
    public void popupMenuCanceled(    PopupMenuEvent e){
    }
  }
);
  this.hiddenDialog.addWindowFocusListener(new WindowFocusListener(){
    @Override public void windowLostFocus(    WindowEvent we){
      SwingSystemTrayMenuWindowsPopup.this.setVisible(false);
    }
    @Override public void windowGainedFocus(    WindowEvent we){
    }
  }
);
}
Program: 96330
Project: 96330
Buggy source:
public void close(){
  this.hiddenDialog.setVisible(false);
  this.hiddenDialog.dispatchEvent(new WindowEvent(this.hiddenDialog,WindowEvent.WINDOW_CLOSING));
}

Fixed version (ground truth):
void close(){
  this.hiddenDialog.setVisible(false);
  this.hiddenDialog.dispatchEvent(new WindowEvent(this.hiddenDialog,WindowEvent.WINDOW_CLOSING));
}
Program: 96331
Project: 96331
Buggy source:
public AppIndicatorTray(final SystemTray systemTray){
  super(systemTray);
  if (SystemTray.FORCE_TRAY_TYPE == SystemTray.TYPE_GTK_STATUSICON) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  ImageUtils.determineIconSize(SystemTray.TYPE_APP_INDICATOR);
  Gtk.startGui();
  dispatch(new Runnable(){
    @Override public void run(){
      File image=ImageUtils.getTransparentImage(ImageUtils.ENTRY_SIZE);
      String id=System.nanoTime() + "String_Node_Str";
      appIndicator=AppIndicator.app_indicator_new(id,image.getAbsolutePath(),AppIndicator.CATEGORY_APPLICATION_STATUS);
    }
  }
);
  Gtk.waitForStartup();
}

Fixed version (ground truth):
public AppIndicatorTray(final SystemTray systemTray){
  super(systemTray);
  if (SystemTray.FORCE_TRAY_TYPE == SystemTray.TYPE_GTK_STATUSICON) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  ImageUtils.determineIconSize();
  Gtk.startGui();
  dispatch(new Runnable(){
    @Override public void run(){
      File image=ImageUtils.getTransparentImage(ImageUtils.ENTRY_SIZE);
      String id=System.nanoTime() + "String_Node_Str";
      appIndicator=AppIndicator.app_indicator_new(id,image.getAbsolutePath(),AppIndicator.CATEGORY_APPLICATION_STATUS);
    }
  }
);
  Gtk.waitForStartup();
}
Program: 96332
Project: 96332
Buggy source:
public GtkSystemTray(final SystemTray systemTray){
  super(systemTray);
  if (SystemTray.FORCE_TRAY_TYPE == SystemTray.TYPE_APP_INDICATOR) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  ImageUtils.determineIconSize(SystemTray.TYPE_GTK_STATUSICON);
  Gtk.startGui();
  dispatch(new Runnable(){
    @Override public void run(){
      final Pointer trayIcon_=Gtk.gtk_status_icon_new();
      trayIcon=trayIcon_;
      final GEventCallback gtkCallback=new GEventCallback(){
        @Override public void callback(        Pointer notUsed,        final GdkEventButton event){
          if (event.type == 4) {
            Gtk.gtk_menu_popup(_native,null,null,Gtk.gtk_status_icon_position_menu,trayIcon,0,event.time);
          }
        }
      }
;
      final NativeLong button_press_event=Gobject.g_signal_connect_object(trayIcon,"String_Node_Str",gtkCallback,null,0);
      gtkCallbacks.add(gtkCallback);
      gtkCallbacks.add(button_press_event);
    }
  }
);
  Gtk.waitForStartup();
  dispatch(new Runnable(){
    @Override public void run(){
      Gtk.gtk_status_icon_set_title(trayIcon,"String_Node_Str");
      if (SystemTray.isJavaFxLoaded) {
        Gtk.gtk_status_icon_set_name(trayIcon,"String_Node_Str");
      }
    }
  }
);
}

Fixed version (ground truth):
public GtkSystemTray(final SystemTray systemTray){
  super(systemTray);
  if (SystemTray.FORCE_TRAY_TYPE == SystemTray.TYPE_APP_INDICATOR) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  ImageUtils.determineIconSize();
  Gtk.startGui();
  dispatch(new Runnable(){
    @Override public void run(){
      final Pointer trayIcon_=Gtk.gtk_status_icon_new();
      trayIcon=trayIcon_;
      final GEventCallback gtkCallback=new GEventCallback(){
        @Override public void callback(        Pointer notUsed,        final GdkEventButton event){
          if (event.type == 4) {
            Gtk.gtk_menu_popup(_native,null,null,Gtk.gtk_status_icon_position_menu,trayIcon,0,event.time);
          }
        }
      }
;
      final NativeLong button_press_event=Gobject.g_signal_connect_object(trayIcon,"String_Node_Str",gtkCallback,null,0);
      gtkCallbacks.add(gtkCallback);
      gtkCallbacks.add(button_press_event);
    }
  }
);
  Gtk.waitForStartup();
  dispatch(new Runnable(){
    @Override public void run(){
      Gtk.gtk_status_icon_set_title(trayIcon,"String_Node_Str");
      if (SystemTray.isJavaFxLoaded) {
        Gtk.gtk_status_icon_set_name(trayIcon,"String_Node_Str");
      }
    }
  }
);
}
Program: 96333
Project: 96333
Buggy source:
AdjustedJMenu(final SwingSystemTrayLinuxMenuPopup mainPopup){
  this.mainPopup=mainPopup;
}

Fixed version (ground truth):
AdjustedJMenu(final SwingSystemTrayMenuPopup mainPopup){
  this.mainPopup=mainPopup;
}
Program: 96334
Project: 96334
Buggy source:
@Override public void run(){
  _native.setVisible(false);
  if (_native instanceof SwingSystemTrayMenuWindowsPopup) {
    ((SwingSystemTrayMenuWindowsPopup)_native).close();
  }
 else   if (_native instanceof SwingSystemTrayLinuxMenuPopup) {
    ((SwingSystemTrayLinuxMenuPopup)_native).close();
  }
  SwingMenu parent=(SwingMenu)getParent();
  if (parent != null) {
    parent._native.remove(_native);
  }
}

Fixed version (ground truth):
@Override public void run(){
  _native.setVisible(false);
  if (_native instanceof SwingSystemTrayMenuWindowsPopup) {
    ((SwingSystemTrayMenuWindowsPopup)_native).close();
  }
 else   if (_native instanceof SwingSystemTrayMenuPopup) {
    ((SwingSystemTrayMenuPopup)_native).close();
  }
  SwingMenu parent=(SwingMenu)getParent();
  if (parent != null) {
    parent._native.remove(_native);
  }
}
Program: 96335
Project: 96335
Buggy source:
@Override public final void remove(){
  dispatchAndWait(new Runnable(){
    @Override public void run(){
      _native.setVisible(false);
      if (_native instanceof SwingSystemTrayMenuWindowsPopup) {
        ((SwingSystemTrayMenuWindowsPopup)_native).close();
      }
 else       if (_native instanceof SwingSystemTrayLinuxMenuPopup) {
        ((SwingSystemTrayLinuxMenuPopup)_native).close();
      }
      SwingMenu parent=(SwingMenu)getParent();
      if (parent != null) {
        parent._native.remove(_native);
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public final void remove(){
  dispatchAndWait(new Runnable(){
    @Override public void run(){
      _native.setVisible(false);
      if (_native instanceof SwingSystemTrayMenuWindowsPopup) {
        ((SwingSystemTrayMenuWindowsPopup)_native).close();
      }
 else       if (_native instanceof SwingSystemTrayMenuPopup) {
        ((SwingSystemTrayMenuPopup)_native).close();
      }
      SwingMenu parent=(SwingMenu)getParent();
      if (parent != null) {
        parent._native.remove(_native);
      }
    }
  }
);
}
Program: 96336
Project: 96336
Buggy source:
/** 
 * @param systemTray the system tray (which is the object that sits in the system tray)
 * @param parent the parent of this menu, null if the parent is the system tray
 */
public SwingMenu(final SystemTray systemTray,final Menu parent){
  super(systemTray,parent);
  try {
    SwingUtil.invokeAndWait(new Runnable(){
      @Override public void run(){
        if (parent != null) {
          if (OS.isLinux()) {
            _native=new AdjustedJMenu((SwingSystemTrayLinuxMenuPopup)((SwingMenu)systemTray.getMenu())._native);
          }
 else {
            _native=new AdjustedJMenu(null);
          }
          ((SwingMenu)parent)._native.add(_native);
        }
 else {
          if (OS.isLinux()) {
            _native=new SwingSystemTrayLinuxMenuPopup();
          }
 else {
            _native=new SwingSystemTrayMenuWindowsPopup();
          }
        }
      }
    }
);
  }
 catch (  Exception e) {
    SystemTray.logger.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * @param systemTray the system tray (which is the object that sits in the system tray)
 * @param parent the parent of this menu, null if the parent is the system tray
 */
public SwingMenu(final SystemTray systemTray,final Menu parent){
  super(systemTray,parent);
  try {
    SwingUtil.invokeAndWait(new Runnable(){
      @Override public void run(){
        if (parent != null) {
          if (OS.isWindows()) {
            _native=new AdjustedJMenu(null);
          }
 else {
            _native=new AdjustedJMenu((SwingSystemTrayMenuPopup)((SwingMenu)systemTray.getMenu())._native);
          }
          ((SwingMenu)parent)._native.add(_native);
        }
 else {
          if (OS.isWindows()) {
            _native=new SwingSystemTrayMenuWindowsPopup();
          }
 else {
            _native=new SwingSystemTrayMenuPopup();
          }
        }
      }
    }
);
  }
 catch (  Exception e) {
    SystemTray.logger.error("String_Node_Str",e);
  }
}
Program: 96337
Project: 96337
Buggy source:
/** 
 * Creates a new system tray handler class.
 */
public SwingSystemTray(final dorkbox.systemTray.SystemTray systemTray){
  super(systemTray,null);
  ImageUtils.determineIconSize(dorkbox.systemTray.SystemTray.TYPE_SWING);
  dispatchAndWait(new Runnable(){
    @Override public void run(){
      SwingSystemTray.this.tray=SystemTray.getSystemTray();
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Creates a new system tray handler class.
 */
public SwingSystemTray(final dorkbox.systemTray.SystemTray systemTray){
  super(systemTray,null);
  ImageUtils.determineIconSize();
  dispatchAndWait(new Runnable(){
    @Override public void run(){
      SwingSystemTray.this.tray=SystemTray.getSystemTray();
    }
  }
);
}
Program: 96339
Project: 96339
Buggy source:
public static void dispatch(final Runnable runnable){
  org.eclipse.swt.widgets.Display.getCurrent().asyncExec(runnable);
}

Fixed version (ground truth):
public static void dispatch(final Runnable runnable){
  org.eclipse.swt.widgets.Display.getCurrent().syncExec(runnable);
}
Program: 96340
Project: 96340
Buggy source:
@Override public void run(){
synchronized (menuEntries) {
    MenuEntry menuEntry=get(menuText);
    if (menuEntry == null) {
      hasValue.set(false);
    }
 else {
      remove(menuEntry);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
synchronized (menuEntries) {
    MenuEntry menuEntry=get(menuText);
    if (menuEntry != null) {
      remove(menuEntry);
    }
  }
}