nus-yam/ex-repair huggingface dataset:
Program: 96230
Project: 96230
Buggy source:
@SuppressWarnings("String_Node_Str") SwingMenu(final SwingMenu parent,final Menu entry){
  this.parent=parent;
  if (parent == null) {
    TrayPopup trayPopup=new TrayPopup();
    if (ImageUtils.ENTRY_FONT != null) {
      trayPopup.setFont(ImageUtils.ENTRY_FONT);
    }
    if (SystemTray.SWING_UI != null) {
      trayPopup.setUI(SystemTray.SWING_UI.getMenuUI(trayPopup,null));
    }
    this._native=trayPopup;
  }
 else {
    JMenu jMenu=new JMenu();
    JPopupMenu popupMenu=jMenu.getPopupMenu();
    jMenu.setFont(ImageUtils.ENTRY_FONT);
    if (SystemTray.SWING_UI != null) {
      jMenu.setUI(SystemTray.SWING_UI.getItemUI(jMenu,entry));
      popupMenu.setUI(SystemTray.SWING_UI.getMenuUI(popupMenu,entry));
    }
    this._native=jMenu;
    parent._native.add(jMenu);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") SwingMenu(final SwingMenu parent,final Menu entry){
  this.parent=parent;
  if (parent == null) {
    TrayPopup trayPopup=new TrayPopup();
    if (SystemTray.SWING_UI != null) {
      trayPopup.setUI(SystemTray.SWING_UI.getMenuUI(trayPopup,null));
    }
    this._native=trayPopup;
  }
 else {
    JMenu jMenu=new JMenu();
    JPopupMenu popupMenu=jMenu.getPopupMenu();
    if (SystemTray.SWING_UI != null) {
      jMenu.setUI(SystemTray.SWING_UI.getItemUI(jMenu,entry));
      popupMenu.setUI(SystemTray.SWING_UI.getMenuUI(popupMenu,entry));
    }
    this._native=jMenu;
    parent._native.add(jMenu);
  }
}
Program: 96231
Project: 96231
Buggy source:
SwingMenuItem(final SwingMenu parent,Entry entry){
  this.parent=parent;
  if (ImageUtils.ENTRY_FONT != null) {
    _native.setFont(ImageUtils.ENTRY_FONT);
  }
  if (SystemTray.SWING_UI != null) {
    _native.setUI(SystemTray.SWING_UI.getItemUI(_native,entry));
  }
  parent._native.add(_native);
  if (transparentIcon == null) {
    File uncheckedFile=ImageUtils.getTransparentImage(ImageUtils.ENTRY_SIZE);
    transparentIcon=new ImageIcon(uncheckedFile.getAbsolutePath());
  }
  _native.setIcon(transparentIcon);
}

Fixed version (ground truth):
SwingMenuItem(final SwingMenu parent,Entry entry){
  this.parent=parent;
  if (SystemTray.SWING_UI != null) {
    _native.setUI(SystemTray.SWING_UI.getItemUI(_native,entry));
  }
  parent._native.add(_native);
  if (transparentIcon == null) {
    File uncheckedFile=ImageUtils.getTransparentImage(ImageUtils.ENTRY_SIZE);
    transparentIcon=new ImageIcon(uncheckedFile.getAbsolutePath());
  }
  _native.setIcon(transparentIcon);
}
Program: 96232
Project: 96232
Buggy source:
SwingMenuItemCheckbox(final SwingMenu parent,final Entry entry){
  this.parent=parent;
  if (ImageUtils.ENTRY_FONT != null) {
    _native.setFont(ImageUtils.ENTRY_FONT);
  }
  if (SystemTray.SWING_UI != null) {
    _native.setUI(SystemTray.SWING_UI.getItemUI(_native,entry));
  }
  parent._native.add(_native);
  if (checkedIcon == null) {
    File checkedFile=ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE,ImageUtils.class.getResource("String_Node_Str"));
    checkedIcon=new ImageIcon(checkedFile.getAbsolutePath());
    File uncheckedFile=ImageUtils.getTransparentImage(ImageUtils.ENTRY_SIZE);
    uncheckedIcon=new ImageIcon(uncheckedFile.getAbsolutePath());
  }
  _native.setIcon(uncheckedIcon);
}

Fixed version (ground truth):
SwingMenuItemCheckbox(final SwingMenu parent,final Entry entry){
  this.parent=parent;
  if (SystemTray.SWING_UI != null) {
    _native.setUI(SystemTray.SWING_UI.getItemUI(_native,entry));
  }
  parent._native.add(_native);
  if (checkedIcon == null) {
    File checkedFile=ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE,ImageUtils.class.getResource("String_Node_Str"));
    checkedIcon=new ImageIcon(checkedFile.getAbsolutePath());
    File uncheckedFile=ImageUtils.getTransparentImage(ImageUtils.ENTRY_SIZE);
    uncheckedIcon=new ImageIcon(uncheckedFile.getAbsolutePath());
  }
  _native.setIcon(uncheckedIcon);
}
Program: 96233
Project: 96233
Buggy source:
SwingMenuItemStatus(final SwingMenu parent,final Entry entry){
  this.parent=parent;
  if (ImageUtils.ENTRY_FONT != null) {
    _native.setFont(ImageUtils.ENTRY_FONT);
  }
  if (SystemTray.SWING_UI != null) {
    _native.setUI(SystemTray.SWING_UI.getItemUI(_native,entry));
  }
  parent._native.add(_native,0);
  Font font=_native.getFont();
  Font font1=font.deriveFont(Font.BOLD);
  _native.setFont(font1);
  _native.setEnabled(false);
}

Fixed version (ground truth):
SwingMenuItemStatus(final SwingMenu parent,final Entry entry){
  this.parent=parent;
  if (SystemTray.SWING_UI != null) {
    _native.setUI(SystemTray.SWING_UI.getItemUI(_native,entry));
  }
  parent._native.add(_native,0);
  Font font=_native.getFont();
  Font font1=font.deriveFont(Font.BOLD);
  _native.setFont(font1);
  _native.setEnabled(false);
}
Program: 96235
Project: 96235
Buggy source:
SwingMenuItem(final SwingMenu parent){
  this.parent=parent;
  parent._native.add(_native);
}

Fixed version (ground truth):
SwingMenuItem(final SwingMenu parent){
  this.parent=parent;
  parent._native.add(_native);
  if (transparentIcon == null) {
    File uncheckedFile=ImageUtils.getTransparentImage(ImageUtils.ENTRY_SIZE);
    transparentIcon=new ImageIcon(uncheckedFile.getAbsolutePath());
  }
  _native.setIcon(transparentIcon);
}
Program: 96236
Project: 96236
Buggy source:
@Override public void setImage(final MenuItem menuItem){
  SwingUtil.invokeLater(new Runnable(){
    @Override public void run(){
      File imageFile=menuItem.getImage();
      if (imageFile != null) {
        ImageIcon origIcon=new ImageIcon(imageFile.getAbsolutePath());
        _native.setIcon(origIcon);
      }
 else {
        _native.setIcon(null);
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public void setImage(final MenuItem menuItem){
  SwingUtil.invokeLater(new Runnable(){
    @Override public void run(){
      File imageFile=menuItem.getImage();
      if (imageFile != null) {
        ImageIcon origIcon=new ImageIcon(imageFile.getAbsolutePath());
        _native.setIcon(origIcon);
      }
 else {
        _native.setIcon(transparentIcon);
      }
    }
  }
);
}
Program: 96238
Project: 96238
Buggy source:
public static void unInstall(){
  if (!ENABLE_EXTENSION_INSTALL || !OSUtil.Linux.DesktopEnv.isGnome()) {
    return;
  }
  List<String> enabledExtensions=getEnabledExtensions();
  if (enabledExtensions.contains(UID)) {
    enabledExtensions.remove(UID);
    setEnabledExtensions(enabledExtensions);
    restartShell();
  }
}

Fixed version (ground truth):
public static void unInstall(){
  if (!ENABLE_EXTENSION_INSTALL || !OSUtil.DesktopEnv.isGnome()) {
    return;
  }
  List<String> enabledExtensions=getEnabledExtensions();
  if (enabledExtensions.contains(UID)) {
    enabledExtensions.remove(UID);
    setEnabledExtensions(enabledExtensions);
    restartShell();
  }
}
Program: 96240
Project: 96240
Buggy source:
SwingMenuItemCheckbox(final SwingMenu parent){
  this.parent=parent;
  parent._native.add(_native);
  if (checkedIcon == null) {
    File checkedFile=ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE,ImageUtils.class.getResource("String_Node_Str"));
    checkedIcon=new ImageIcon(checkedFile.getAbsolutePath());
    File uncheckedFile=ImageUtils.getTransparentImage(ImageUtils.ENTRY_SIZE);
    uncheckedIcon=new ImageIcon(uncheckedFile.getAbsolutePath());
  }
}

Fixed version (ground truth):
SwingMenuItemCheckbox(final SwingMenu parent){
  this.parent=parent;
  parent._native.add(_native);
  if (checkedIcon == null) {
    File checkedFile=ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE,ImageUtils.class.getResource("String_Node_Str"));
    checkedIcon=new ImageIcon(checkedFile.getAbsolutePath());
    File uncheckedFile=ImageUtils.getTransparentImage(ImageUtils.ENTRY_SIZE);
    uncheckedIcon=new ImageIcon(uncheckedFile.getAbsolutePath());
  }
  _native.setIcon(uncheckedIcon);
}
Program: 96241
Project: 96241
Buggy source:
public static native NativeLong g_signal_connect_object(Pointer instance,String detailed_signal,Callback c_handler,Pointer object,int connect_flags);

Fixed version (ground truth):
public static native void g_signal_connect_object(Pointer instance,String detailed_signal,Callback c_handler,Pointer object,int connect_flags);
Program: 96242
Project: 96242
Buggy source:
/** 
 * called from inside dispatch thread. ONLY creates the menu item, but DOES NOT attach it! this is a FLOATING reference. See: https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#floating-ref
 */
GtkMenuItem(final GtkMenu parent){
  super(Gtk.gtk_image_menu_item_new_with_mnemonic("String_Node_Str"));
  this.parent=parent;
  nativeLong=Gobject.g_signal_connect_object(_native,"String_Node_Str",this,null,0);
}

Fixed version (ground truth):
/** 
 * called from inside dispatch thread. ONLY creates the menu item, but DOES NOT attach it! this is a FLOATING reference. See: https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#floating-ref
 */
GtkMenuItem(final GtkMenu parent){
  super(Gtk.gtk_image_menu_item_new_with_mnemonic("String_Node_Str"));
  this.parent=parent;
  Gobject.g_signal_connect_object(_native,"String_Node_Str",this,null,0);
}
Program: 96243
Project: 96243
Buggy source:
/** 
 * called from inside dispatch thread. ONLY creates the menu item, but DOES NOT attach it! this is a FLOATING reference. See: https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#floating-ref
 */
GtkMenuItemCheckbox(final GtkMenu parent){
  super(Gtk.gtk_check_menu_item_new_with_mnemonic("String_Node_Str"));
  this.parent=parent;
  nativeLong=Gobject.g_signal_connect_object(_native,"String_Node_Str",this,null,0);
}

Fixed version (ground truth):
/** 
 * called from inside dispatch thread. ONLY creates the menu item, but DOES NOT attach it! this is a FLOATING reference. See: https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#floating-ref
 */
GtkMenuItemCheckbox(final GtkMenu parent){
  super(Gtk.gtk_check_menu_item_new_with_mnemonic("String_Node_Str"));
  this.parent=parent;
  Gobject.g_signal_connect_object(_native,"String_Node_Str",this,null,0);
}
Program: 96245
Project: 96245
Buggy source:
@Override public void remove(){
  if (!shuttingDown.getAndSet(true)) {
    Gtk.dispatch(new Runnable(){
      @Override public void run(){
        Gtk.gtk_status_icon_set_visible(trayIcon,false);
        Gobject.g_object_unref(trayIcon);
        trayIcon=null;
        gtkCallbacks.clear();
      }
    }
);
    super.remove();
    Gtk.shutdownGui();
  }
}

Fixed version (ground truth):
@Override public void remove(){
  if (!shuttingDown.getAndSet(true)) {
    Gtk.dispatch(new Runnable(){
      @Override public void run(){
        Gtk.gtk_status_icon_set_visible(trayIcon,false);
        Gobject.g_object_unref(trayIcon);
        trayIcon=null;
        gtkCallback=null;
      }
    }
);
    super.remove();
    Gtk.shutdownGui();
  }
}
Program: 96246
Project: 96246
Buggy source:
private void hookMenuOpen(){
  PointerByReference menuServer=new PointerByReference();
  PointerByReference rootMenuItem=new PointerByReference();
  Gobject.g_object_get(appIndicator.getPointer(),"String_Node_Str",menuServer,null);
  Gobject.g_object_get(menuServer.getValue(),"String_Node_Str",rootMenuItem,null);
  gtkCallback=new GEventCallback(){
    @Override public void callback(    Pointer notUsed,    final GdkEventButton event){
      Gtk.gtk_menu_shell_deactivate(dummyMenu);
      SwingUtil.invokeLater(popupRunnable);
    }
  }
;
  nativeLong=Gobject.g_signal_connect_object(rootMenuItem.getValue(),"String_Node_Str",gtkCallback,null,0);
}

Fixed version (ground truth):
private void hookMenuOpen(){
  PointerByReference menuServer=new PointerByReference();
  PointerByReference rootMenuItem=new PointerByReference();
  Gobject.g_object_get(appIndicator.getPointer(),"String_Node_Str",menuServer,null);
  Gobject.g_object_get(menuServer.getValue(),"String_Node_Str",rootMenuItem,null);
  gtkCallback=new GEventCallback(){
    @Override public void callback(    Pointer notUsed,    final GdkEventButton event){
      Gtk.gtk_menu_shell_deactivate(dummyMenu);
      SwingUtil.invokeLater(popupRunnable);
    }
  }
;
  Gobject.g_signal_connect_object(rootMenuItem.getValue(),"String_Node_Str",gtkCallback,null,0);
}
Program: 96248
Project: 96248
Buggy source:
@Override public void remove(){
  if (!shuttingDown.getAndSet(true)) {
    Gtk.dispatch(new Runnable(){
      @Override public void run(){
        Gtk.gtk_status_icon_set_visible(trayIcon,false);
        Gobject.g_object_unref(trayIcon);
        trayIcon=null;
        gtkCallbacks.clear();
      }
    }
);
    Gtk.shutdownGui();
    super.remove();
  }
}

Fixed version (ground truth):
@Override public void remove(){
  if (!shuttingDown.getAndSet(true)) {
    Gtk.dispatch(new Runnable(){
      @Override public void run(){
        Gtk.gtk_status_icon_set_visible(trayIcon,false);
        Gobject.g_object_unref(trayIcon);
        trayIcon=null;
      }
    }
);
    Gtk.shutdownGui();
    super.remove();
  }
}
Program: 96250
Project: 96250
Buggy source:
/** 
 * MUST BE AFTER THE ITEM IS ADDED/CHANGED from the menu ALWAYS CALLED ON THE EDT
 */
protected final void onMenuAdded(final Pointer menu){
  AppIndicator.app_indicator_set_menu(appIndicator,menu);
}

Fixed version (ground truth):
/** 
 * MUST BE AFTER THE ITEM IS ADDED/CHANGED from the menu ALWAYS CALLED ON THE EDT
 */
protected final void onMenuAdded(final Pointer menu){
  AppIndicator.app_indicator_set_menu(appIndicator,menu);
  if (!setName) {
    setName=true;
    AppIndicator.app_indicator_set_title(appIndicator,"String_Node_Str");
  }
}
Program: 96251
Project: 96251
Buggy source:
@Override public void run(){
  AppIndicator.app_indicator_set_status(appIndicator,AppIndicator.STATUS_ACTIVE);
  AppIndicator.app_indicator_set_title(appIndicator,"String_Node_Str");
}

Fixed version (ground truth):
@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);
}
Program: 96253
Project: 96253
Buggy source:
@Override public void run(){
  AppIndicator.app_indicator_set_status(appIndicator,AppIndicator.STATUS_ACTIVE);
  AppIndicator.app_indicator_set_title(appIndicator,"String_Node_Str");
}

Fixed version (ground truth):
@Override public void run(){
  Point point=MouseInfo.getPointerInfo().getLocation();
  TrayPopup popupMenu=(TrayPopup)swingMenu._native;
  popupMenu.doShow(point,SystemTray.DEFAULT_TRAY_SIZE);
}
Program: 96254
Project: 96254
Buggy source:
private void createAppIndicatorMenu(){
  dummyMenu=Gtk.gtk_menu_new();
  Pointer item=Gtk.gtk_image_menu_item_new_with_mnemonic("String_Node_Str");
  Gtk.gtk_menu_shell_append(dummyMenu,item);
  Gtk.gtk_widget_show_all(item);
  AppIndicator.app_indicator_set_menu(appIndicator,dummyMenu);
}

Fixed version (ground truth):
private void createAppIndicatorMenu(){
  dummyMenu=Gtk.gtk_menu_new();
  Pointer item=Gtk.gtk_image_menu_item_new_with_mnemonic("String_Node_Str");
  Gtk.gtk_menu_shell_append(dummyMenu,item);
  Gtk.gtk_widget_show_all(item);
  AppIndicator.app_indicator_set_menu(appIndicator,dummyMenu);
  if (!setName) {
    setName=true;
    AppIndicator.app_indicator_set_title(appIndicator,"String_Node_Str");
  }
}
Program: 96255
Project: 96255
Buggy source:
private void setImage_(final File imageFile){
  this.imageFile=imageFile;
  if (peer != null) {
    ((MenuItemPeer)peer).setImage(this);
  }
}

Fixed version (ground truth):
protected void setImage_(final File imageFile){
  this.imageFile=imageFile;
  if (peer != null) {
    ((MenuItemPeer)peer).setImage(this);
  }
}
Program: 96256
Project: 96256
Buggy source:
public static native void gtk_menu_shell_deactivate(Pointer menu_shell,Pointer child);

Fixed version (ground truth):
public static native void gtk_menu_shell_deactivate(Pointer menuShell);
Program: 96257
Project: 96257
Buggy source:
public static native void gtk_container_remove(Pointer menu,Pointer subItem);

Fixed version (ground truth):
public static native void gtk_container_remove(Pointer parentWidget,Pointer widget);
Program: 96258
Project: 96258
Buggy source:
GtkBaseMenuItem(){
  if (transparentIcon == null) {
    transparentIcon=ImageUtils.getTransparentImage(ImageUtils.ENTRY_SIZE);
  }
}

Fixed version (ground truth):
GtkBaseMenuItem(final Pointer _native){
  this._native=_native;
  if (transparentIcon == null) {
    transparentIcon=ImageUtils.getTransparentImage(ImageUtils.ENTRY_SIZE);
  }
}
Program: 96259
Project: 96259
Buggy source:
@Override public void run(){
  if (spacerImage != null) {
    Gtk.gtk_widget_destroy(spacerImage);
    spacerImage=null;
  }
}

Fixed version (ground truth):
@Override public void run(){
  if (spacerImage != null) {
    Gtk.gtk_container_remove(_native,spacerImage);
    spacerImage=null;
  }
}
Program: 96260
Project: 96260
Buggy source:
/** 
 * the menu entry looks FUNKY when there are a mis-match of entries WITH and WITHOUT images. This is primarily only with AppIndicators, although not always. <p> called on the DISPATCH thread
 */
public void setSpacerImage(final Pointer _native,final boolean everyoneElseHasImages){
  if (hasLegitImage) {
    return;
  }
  if (spacerImage != null) {
    Gtk.gtk_widget_destroy(spacerImage);
    spacerImage=null;
    Gtk.gtk_widget_show_all(_native);
  }
  if (everyoneElseHasImages) {
    spacerImage=Gtk.gtk_image_new_from_file(transparentIcon.getAbsolutePath());
    Gtk.gtk_image_menu_item_set_image(_native,spacerImage);
    Gtk.gtk_image_menu_item_set_always_show_image(_native,true);
  }
  Gtk.gtk_widget_show_all(_native);
}

Fixed version (ground truth):
/** 
 * the menu entry looks FUNKY when there are a mis-match of entries WITH and WITHOUT images. This is primarily only with AppIndicators, although not always. <p> called on the DISPATCH thread
 */
public void setSpacerImage(final boolean everyoneElseHasImages){
  if (hasLegitImage) {
    return;
  }
  if (spacerImage != null) {
    Gtk.gtk_container_remove(_native,spacerImage);
    spacerImage=null;
    Gtk.gtk_widget_show_all(_native);
  }
  if (everyoneElseHasImages) {
    spacerImage=Gtk.gtk_image_new_from_file(transparentIcon.getAbsolutePath());
    Gtk.gtk_image_menu_item_set_image(_native,spacerImage);
    Gtk.gtk_image_menu_item_set_always_show_image(_native,true);
  }
  Gtk.gtk_widget_show_all(_native);
}
Program: 96261
Project: 96261
Buggy source:
void onCreateMenu(final Pointer parentNative,final Pointer _native,final boolean hasImagesInMenu){
  setSpacerImage(_native,hasImagesInMenu);
  Gtk.gtk_menu_shell_append(parentNative,_native);
  Gobject.g_object_ref_sink(_native);
  Gtk.gtk_widget_show_all(_native);
}

Fixed version (ground truth):
void onCreateMenu(final Pointer parentNative,final boolean hasImagesInMenu){
  setSpacerImage(hasImagesInMenu);
  Gtk.gtk_menu_shell_append(parentNative,_native);
  Gobject.g_object_ref_sink(_native);
  Gtk.gtk_widget_show_all(_native);
}
Program: 96262
Project: 96262
Buggy source:
void onDeleteMenu(final Pointer parentNative,final Pointer _native){
  Gobject.g_object_force_floating(_native);
  Gtk.gtk_container_remove(parentNative,_native);
}

Fixed version (ground truth):
void onDeleteMenu(final Pointer parentNative){
  Gobject.g_object_force_floating(_native);
  Gtk.gtk_container_remove(parentNative,_native);
}
Program: 96263
Project: 96263
Buggy source:
@Override public void remove(){
  Gtk.dispatch(new Runnable(){
    @Override public void run(){
      if (spacerImage != null) {
        Gtk.gtk_widget_destroy(spacerImage);
        spacerImage=null;
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public void remove(){
  Gtk.dispatch(new Runnable(){
    @Override public void run(){
      if (spacerImage != null) {
        Gtk.gtk_container_remove(_native,spacerImage);
        spacerImage=null;
      }
    }
  }
);
}
Program: 96265
Project: 96265
Buggy source:
@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):
@Override public void run(){
  Gtk.gtk_status_icon_set_title(trayIcon,"String_Node_Str");
  if (System.getProperty("String_Node_Str","String_Node_Str").equals("String_Node_Str")) {
    Gtk.gtk_status_icon_set_name(trayIcon,"String_Node_Str");
  }
}
Program: 96267
Project: 96267
Buggy source:
/** 
 * Best practices for GTK, is to call EVERYTHING for it on the GTK THREAD. This accomplishes that.
 */
public static void dispatch(final Runnable runnable){
  if (alreadyRunningGTK) {
    if (SystemTray.isJavaFxLoaded) {
      if (JavaFX.isEventThread()) {
        runnable.run();
      }
 else {
        JavaFX.dispatch(runnable);
      }
      return;
    }
    if (SystemTray.isSwtLoaded) {
      if (Swt.isEventThread()) {
        runnable.run();
        return;
      }
    }
  }
  if (isDispatch) {
    runnable.run();
  }
 else {
    final FuncCallback callback=new FuncCallback(){
      @Override public int callback(      final Pointer data){
synchronized (gtkCallbacks) {
          gtkCallbacks.removeFirst();
          isDispatch=true;
          try {
            runnable.run();
          }
  finally {
            isDispatch=false;
            return Gtk.FALSE;
          }
        }
      }
    }
;
synchronized (gtkCallbacks) {
      gtkCallbacks.offer(callback);
      gdk_threads_add_idle_full(100,callback,null,null);
    }
  }
}

Fixed version (ground truth):
/** 
 * Best practices for GTK, is to call EVERYTHING for it on the GTK THREAD. This accomplishes that.
 */
public static void dispatch(final Runnable runnable){
  if (alreadyRunningGTK) {
    if (SystemTray.isJavaFxLoaded) {
      if (JavaFX.isEventThread()) {
        runnable.run();
      }
 else {
        JavaFX.dispatch(runnable);
      }
      return;
    }
    if (SystemTray.isSwtLoaded) {
      if (Swt.isEventThread()) {
        runnable.run();
        return;
      }
    }
  }
  if (isDispatch.get()) {
    runnable.run();
  }
 else {
    final FuncCallback callback=new FuncCallback(){
      @Override public int callback(      final Pointer data){
synchronized (gtkCallbacks) {
          gtkCallbacks.removeFirst();
        }
        isDispatch.set(true);
        try {
          runnable.run();
        }
  finally {
          isDispatch.set(false);
        }
        return Gtk.FALSE;
      }
    }
;
synchronized (gtkCallbacks) {
      gtkCallbacks.offer(callback);
    }
    gdk_threads_add_idle_full(100,callback,null,null);
  }
}
Program: 96268
Project: 96268
Buggy source:
public static 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",new RuntimeException());
      }
 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):
public static 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",new Exception());
      }
 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());
  }
}
Program: 96270
Project: 96270
Buggy source:
@Override public int callback(final Pointer data){
synchronized (gtkCallbacks) {
    gtkCallbacks.removeFirst();
    isDispatch=true;
    try {
      runnable.run();
    }
  finally {
      isDispatch=false;
      return Gtk.FALSE;
    }
  }
}

Fixed version (ground truth):
@Override public int callback(final Pointer data){
synchronized (gtkCallbacks) {
    gtkCallbacks.removeFirst();
  }
  isDispatch.set(true);
  try {
    runnable.run();
  }
  finally {
    isDispatch.set(false);
  }
  return Gtk.FALSE;
}
Program: 96271
Project: 96271
Buggy source:
/** 
 * required to properly setup the dispatch flag when using native menus
 * @param callback will never be null.
 */
public static void proxyClick(final Entry menuEntry,final ActionListener callback){
  Gtk.isDispatch=true;
  try {
    callback.actionPerformed(new ActionEvent(menuEntry,ActionEvent.ACTION_PERFORMED,"String_Node_Str"));
  }
  finally {
    Gtk.isDispatch=false;
  }
}

Fixed version (ground truth):
/** 
 * required to properly setup the dispatch flag when using native menus
 * @param callback will never be null.
 */
public static void proxyClick(final Entry menuEntry,final ActionListener callback){
  Gtk.isDispatch.set(true);
  try {
    callback.actionPerformed(new ActionEvent(menuEntry,ActionEvent.ACTION_PERFORMED,"String_Node_Str"));
  }
  finally {
    Gtk.isDispatch.set(false);
  }
}
Program: 96272
Project: 96272
Buggy source:
public static List<String> getEnabledExtensions(){
  ByteArrayOutputStream byteArrayOutputStream=new ByteArrayOutputStream(8196);
  PrintStream outputStream=new PrintStream(byteArrayOutputStream);
  final ShellProcessBuilder gsettings=new ShellProcessBuilder(outputStream);
  gsettings.setExecutable("String_Node_Str");
  gsettings.addArgument("String_Node_Str");
  gsettings.addArgument("String_Node_Str");
  gsettings.addArgument("String_Node_Str");
  gsettings.start();
  String output=ShellProcessBuilder.getOutput(byteArrayOutputStream);
  final StringBuilder stringBuilder=new StringBuilder(output);
  int extensionIndex=output.indexOf("String_Node_Str");
  if (extensionIndex > 0) {
    stringBuilder.delete(extensionIndex,stringBuilder.length());
  }
  extensionIndex=output.indexOf("String_Node_Str");
  if (extensionIndex > 0) {
    stringBuilder.delete(0,extensionIndex + 1);
  }
  String installedExtensions=stringBuilder.toString();
  if (SystemTray.DEBUG) {
    logger.debug("String_Node_Str",installedExtensions);
  }
  String[] split=installedExtensions.split("String_Node_Str");
  for (int i=0; i < split.length; i++) {
    final String s=split[i];
    int i1=s.indexOf("String_Node_Str");
    int i2=s.lastIndexOf("String_Node_Str");
    if (i1 == 1 && i2 == s.length() - 1) {
      split[i]=s.substring(1,s.length() - 2);
    }
  }
  return Arrays.asList(split);
}

Fixed version (ground truth):
public static List<String> getEnabledExtensions(){
  ByteArrayOutputStream byteArrayOutputStream=new ByteArrayOutputStream(8196);
  PrintStream outputStream=new PrintStream(byteArrayOutputStream);
  final ShellProcessBuilder gsettings=new ShellProcessBuilder(outputStream);
  gsettings.setExecutable("String_Node_Str");
  gsettings.addArgument("String_Node_Str");
  gsettings.addArgument("String_Node_Str");
  gsettings.addArgument("String_Node_Str");
  gsettings.start();
  String output=ShellProcessBuilder.getOutput(byteArrayOutputStream);
  final StringBuilder stringBuilder=new StringBuilder(output);
  int extensionIndex=output.indexOf("String_Node_Str");
  if (extensionIndex > 0) {
    stringBuilder.delete(extensionIndex,stringBuilder.length());
  }
  extensionIndex=output.indexOf("String_Node_Str");
  if (extensionIndex >= 0) {
    stringBuilder.delete(0,extensionIndex + 1);
  }
  String installedExtensions=stringBuilder.toString();
  if (SystemTray.DEBUG) {
    logger.debug("String_Node_Str",installedExtensions);
  }
  String[] split=installedExtensions.split("String_Node_Str");
  for (int i=0; i < split.length; i++) {
    final String s=split[i];
    int i1=s.indexOf("String_Node_Str");
    int i2=s.lastIndexOf("String_Node_Str");
    if (i1 == 0 && i2 == s.length() - 1) {
      split[i]=s.substring(1,s.length() - 1);
    }
    if (SystemTray.DEBUG) {
      logger.debug("String_Node_Str",split[i]);
    }
  }
  return new ArrayList<String>(Arrays.asList(split));
}
Program: 96275
Project: 96275
Buggy source:
/** 
 * required to properly setup the dispatch flag when using native menus
 * @param callback will never be null.
 */
public static void proxyClick(final Entry menuEntry,final ActionListener callback){
  Gtk.isDispatch.set(true);
  try {
    callback.actionPerformed(new ActionEvent(menuEntry,ActionEvent.ACTION_PERFORMED,"String_Node_Str"));
  }
  finally {
    Gtk.isDispatch.set(false);
  }
}

Fixed version (ground truth):
/** 
 * required to properly setup the dispatch flag when using native menus
 * @param callback will never be null.
 */
public static void proxyClick(final Entry menuEntry,final ActionListener callback){
  Gtk.isDispatch.set(true);
  try {
    if (menuEntry != null) {
      callback.actionPerformed(new ActionEvent(menuEntry,ActionEvent.ACTION_PERFORMED,"String_Node_Str"));
    }
 else {
      callback.actionPerformed(null);
    }
  }
  finally {
    Gtk.isDispatch.set(false);
  }
}
Program: 96276
Project: 96276
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  ActionListener cb=menuItem.getCallback();
  if (cb != null) {
    try {
      cb.actionPerformed(new ActionEvent(menuItem,ActionEvent.ACTION_PERFORMED,"String_Node_Str"));
    }
 catch (    Throwable throwable) {
      SystemTray.logger.error("String_Node_Str",menuItem.getText(),throwable);
    }
  }
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  menuItem.setChecked(!isChecked);
  ActionListener cb=menuItem.getCallback();
  if (cb != null) {
    try {
      cb.actionPerformed(new ActionEvent(menuItem,ActionEvent.ACTION_PERFORMED,"String_Node_Str"));
    }
 catch (    Throwable throwable) {
      SystemTray.logger.error("String_Node_Str",menuItem.getText(),throwable);
    }
  }
}
Program: 96277
Project: 96277
Buggy source:
@Override public void setChecked(final Checkbox checkbox){
  SwingUtil.invokeLater(new Runnable(){
    @Override public void run(){
      _native.setState(checkbox.getChecked());
    }
  }
);
}

Fixed version (ground truth):
@Override public void setChecked(final Checkbox menuItem){
  this.isChecked=menuItem.getChecked();
  SwingUtil.invokeLater(new Runnable(){
    @Override public void run(){
      _native.setState(isChecked);
    }
  }
);
}
Program: 96278
Project: 96278
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void setCallback(final Checkbox menuItem){
  if (swingCallback != null) {
    _native.removeActionListener(swingCallback);
  }
  if (menuItem.getCallback() != null) {
    swingCallback=new ActionListener(){
      @Override public void actionPerformed(      ActionEvent e){
        ActionListener cb=menuItem.getCallback();
        if (cb != null) {
          try {
            cb.actionPerformed(new ActionEvent(menuItem,ActionEvent.ACTION_PERFORMED,"String_Node_Str"));
          }
 catch (          Throwable throwable) {
            SystemTray.logger.error("String_Node_Str",menuItem.getText(),throwable);
          }
        }
      }
    }
;
    _native.addActionListener(swingCallback);
  }
 else {
    swingCallback=null;
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void setCallback(final Checkbox menuItem){
  if (callback != null) {
    _native.removeActionListener(callback);
  }
  callback=menuItem.getCallback();
  if (callback != null) {
    callback=new ActionListener(){
      @Override public void actionPerformed(      ActionEvent e){
        menuItem.setChecked(!isChecked);
        ActionListener cb=menuItem.getCallback();
        if (cb != null) {
          try {
            cb.actionPerformed(new ActionEvent(menuItem,ActionEvent.ACTION_PERFORMED,"String_Node_Str"));
          }
 catch (          Throwable throwable) {
            SystemTray.logger.error("String_Node_Str",menuItem.getText(),throwable);
          }
        }
      }
    }
;
    _native.addActionListener(callback);
  }
}
Program: 96279
Project: 96279
Buggy source:
@Override public void run(){
  _native.deleteShortcut();
  _native.setEnabled(false);
  if (swingCallback != null) {
    _native.removeActionListener(swingCallback);
    swingCallback=null;
  }
  parent._native.remove(_native);
  _native.removeNotify();
}

Fixed version (ground truth):
@Override public void run(){
  _native.deleteShortcut();
  _native.setEnabled(false);
  if (callback != null) {
    _native.removeActionListener(callback);
    callback=null;
  }
  parent._native.remove(_native);
  _native.removeNotify();
}
Program: 96280
Project: 96280
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void remove(){
  SwingUtil.invokeLater(new Runnable(){
    @Override public void run(){
      _native.deleteShortcut();
      _native.setEnabled(false);
      if (swingCallback != null) {
        _native.removeActionListener(swingCallback);
        swingCallback=null;
      }
      parent._native.remove(_native);
      _native.removeNotify();
    }
  }
);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void remove(){
  SwingUtil.invokeLater(new Runnable(){
    @Override public void run(){
      _native.deleteShortcut();
      _native.setEnabled(false);
      if (callback != null) {
        _native.removeActionListener(callback);
        callback=null;
      }
      parent._native.remove(_native);
      _native.removeNotify();
    }
  }
);
}
Program: 96281
Project: 96281
Buggy source:
@Override public void setShortcut(final Checkbox menuItem){
  this.mnemonicKey=Character.toLowerCase(menuItem.getShortcut());
  setText(menuItem);
}

Fixed version (ground truth):
@Override public void setShortcut(final Checkbox checkbox){
  this.mnemonicKey=Character.toLowerCase(checkbox.getShortcut());
  setText(checkbox);
}
Program: 96282
Project: 96282
Buggy source:
/** 
 * called from inside dispatch thread. ONLY creates the menu item, but DOES NOT attach it! this is a FLOATING reference. See: https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#floating-ref
 */
GtkMenuItemCheckbox(final GtkMenu parent){
  super(Gtk.gtk_check_menu_item_new_with_mnemonic("String_Node_Str"));
  this.parent=parent;
  if (transparentIcon == null) {
    transparentIcon=ImageUtils.getTransparentImage(ImageUtils.ENTRY_SIZE);
  }
  nativeLong=Gobject.g_signal_connect_object(_native,"String_Node_Str",this,null,0);
}

Fixed version (ground truth):
/** 
 * called from inside dispatch thread. ONLY creates the menu item, but DOES NOT attach it! this is a FLOATING reference. See: https://developer.gnome.org/gobject/stable/gobject-The-Base-Object-Type.html#floating-ref
 */
GtkMenuItemCheckbox(final GtkMenu parent){
  super(Gtk.gtk_check_menu_item_new_with_mnemonic("String_Node_Str"));
  this.parent=parent;
  nativeLong=Gobject.g_signal_connect_object(_native,"String_Node_Str",this,null,0);
}
Program: 96283
Project: 96283
Buggy source:
@Override public void setChecked(final Checkbox checkbox){
  Gtk.dispatch(new Runnable(){
    @Override public void run(){
      Gtk.gtk_check_menu_item_set_active(_native,checkbox.getChecked());
    }
  }
);
}

Fixed version (ground truth):
@Override public void setChecked(final Checkbox checkbox){
  this.isChecked=checkbox.getChecked();
  Gtk.dispatch(new Runnable(){
    @Override public void run(){
      Gtk.gtk_check_menu_item_set_active(_native,isChecked);
    }
  }
);
}
Program: 96284
Project: 96284
Buggy source:
@Override public int callback(final Pointer instance,final Pointer data){
  if (checkbox != null) {
    final ActionListener cb=checkbox.getCallback();
    if (cb != null) {
      try {
        Gtk.proxyClick(checkbox,cb);
      }
 catch (      Exception e) {
        SystemTray.logger.error("String_Node_Str",checkbox.getText(),e);
      }
    }
  }
  return Gtk.TRUE;
}

Fixed version (ground truth):
@Override public int callback(final Pointer instance,final Pointer data){
  if (callback != null) {
    Gtk.proxyClick(null,callback);
  }
  return Gtk.TRUE;
}
Program: 96285
Project: 96285
Buggy source:
@Override public void setCallback(final Checkbox checkbox){
  this.checkbox=checkbox;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void setCallback(final Checkbox menuItem){
  callback=menuItem.getCallback();
  if (callback != null) {
    callback=new ActionListener(){
      @Override public void actionPerformed(      ActionEvent e){
        menuItem.setChecked(!isChecked);
        ActionListener cb=menuItem.getCallback();
        if (cb != null) {
          try {
            cb.actionPerformed(new ActionEvent(menuItem,ActionEvent.ACTION_PERFORMED,"String_Node_Str"));
          }
 catch (          Throwable throwable) {
            SystemTray.logger.error("String_Node_Str",menuItem.getText(),throwable);
          }
        }
      }
    }
;
  }
}
Program: 96286
Project: 96286
Buggy source:
@Override public void run(){
  Gtk.gtk_container_remove(parent._nativeMenu,_native);
  GtkMenuItemCheckbox.super.remove();
  if (image != null) {
    Gtk.gtk_container_remove(_native,image);
    image=null;
  }
  checkbox=null;
  parent.remove(GtkMenuItemCheckbox.this);
}

Fixed version (ground truth):
@Override public void run(){
  Gtk.gtk_container_remove(parent._nativeMenu,_native);
  GtkMenuItemCheckbox.super.remove();
  if (image != null) {
    Gtk.gtk_container_remove(_native,image);
    image=null;
  }
  parent.remove(GtkMenuItemCheckbox.this);
}
Program: 96287
Project: 96287
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void remove(){
  Gtk.dispatch(new Runnable(){
    @Override public void run(){
      Gtk.gtk_container_remove(parent._nativeMenu,_native);
      GtkMenuItemCheckbox.super.remove();
      if (image != null) {
        Gtk.gtk_container_remove(_native,image);
        image=null;
      }
      checkbox=null;
      parent.remove(GtkMenuItemCheckbox.this);
    }
  }
);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void remove(){
  Gtk.dispatch(new Runnable(){
    @Override public void run(){
      Gtk.gtk_container_remove(parent._nativeMenu,_native);
      GtkMenuItemCheckbox.super.remove();
      if (image != null) {
        Gtk.gtk_container_remove(_native,image);
        image=null;
      }
      parent.remove(GtkMenuItemCheckbox.this);
    }
  }
);
}
Program: 96288
Project: 96288
Buggy source:
@Override public void setCallback(final Checkbox menuItem){
  if (swingCallback != null) {
    _native.removeActionListener(swingCallback);
  }
  swingCallback=new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      menuItem.setChecked(!isChecked);
      ActionListener cb=menuItem.getCallback();
      if (cb != null) {
        try {
          cb.actionPerformed(new ActionEvent(menuItem,ActionEvent.ACTION_PERFORMED,"String_Node_Str"));
        }
 catch (        Throwable throwable) {
          SystemTray.logger.error("String_Node_Str",menuItem.getText(),throwable);
        }
      }
    }
  }
;
  _native.addActionListener(swingCallback);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void setCallback(final Checkbox menuItem){
  if (callback != null) {
    _native.removeActionListener(callback);
  }
  callback=menuItem.getCallback();
  if (callback != null) {
    callback=new ActionListener(){
      @Override public void actionPerformed(      ActionEvent e){
        menuItem.setChecked(!isChecked);
        ActionListener cb=menuItem.getCallback();
        if (cb != null) {
          try {
            cb.actionPerformed(new ActionEvent(menuItem,ActionEvent.ACTION_PERFORMED,"String_Node_Str"));
          }
 catch (          Throwable throwable) {
            SystemTray.logger.error("String_Node_Str",menuItem.getText(),throwable);
          }
        }
      }
    }
;
    _native.addActionListener(callback);
  }
}
Program: 96289
Project: 96289
Buggy source:
@Override public void run(){
  if (swingCallback != null) {
    _native.removeActionListener(swingCallback);
    swingCallback=null;
  }
  parent._native.remove(_native);
  _native.removeAll();
}

Fixed version (ground truth):
@Override public void run(){
  if (callback != null) {
    _native.removeActionListener(callback);
    callback=null;
  }
  parent._native.remove(_native);
  _native.removeAll();
}
Program: 96290
Project: 96290
Buggy source:
@Override public void remove(){
  SwingUtil.invokeLater(new Runnable(){
    @Override public void run(){
      if (swingCallback != null) {
        _native.removeActionListener(swingCallback);
        swingCallback=null;
      }
      parent._native.remove(_native);
      _native.removeAll();
    }
  }
);
}

Fixed version (ground truth):
@Override public void remove(){
  SwingUtil.invokeLater(new Runnable(){
    @Override public void run(){
      if (callback != null) {
        _native.removeActionListener(callback);
        callback=null;
      }
      parent._native.remove(_native);
      _native.removeAll();
    }
  }
);
}
Program: 96291
Project: 96291
Buggy source:
public static void setEnabledExtensions(List<String> extensions){
  ByteArrayOutputStream byteArrayOutputStream=new ByteArrayOutputStream(8196);
  PrintStream outputStream=new PrintStream(byteArrayOutputStream);
  StringBuilder stringBuilder=new StringBuilder("String_Node_Str");
  for (int i=0, extensionsSize=extensions.size(), limit=extensionsSize - 1; i < extensionsSize; i++) {
    final String extension=extensions.get(i);
    stringBuilder.append("String_Node_Str").append(extension).append("String_Node_Str");
    if (i < limit) {
      stringBuilder.append("String_Node_Str");
    }
  }
  stringBuilder.append("String_Node_Str");
  if (SystemTray.DEBUG) {
    logger.debug("String_Node_Str",stringBuilder.toString());
  }
  final ShellProcessBuilder setGsettings=new ShellProcessBuilder(outputStream);
  setGsettings.setExecutable("String_Node_Str");
  setGsettings.addArgument("String_Node_Str");
  setGsettings.addArgument("String_Node_Str");
  setGsettings.addArgument("String_Node_Str");
  setGsettings.addArgument(stringBuilder.toString());
  setGsettings.start();
}

Fixed version (ground truth):
public static void setEnabledExtensions(List<String> extensions){
  ByteArrayOutputStream byteArrayOutputStream=new ByteArrayOutputStream(8196);
  PrintStream outputStream=new PrintStream(byteArrayOutputStream);
  StringBuilder stringBuilder=new StringBuilder("String_Node_Str");
  for (int i=0, extensionsSize=extensions.size(), limit=extensionsSize - 1; i < extensionsSize; i++) {
    final String extension=extensions.get(i);
    if (extension.isEmpty()) {
      continue;
    }
    stringBuilder.append("String_Node_Str").append(extension).append("String_Node_Str");
    if (i < limit) {
      stringBuilder.append("String_Node_Str");
    }
  }
  stringBuilder.append("String_Node_Str");
  if (SystemTray.DEBUG) {
    logger.debug("String_Node_Str",stringBuilder.toString());
  }
  final ShellProcessBuilder setGsettings=new ShellProcessBuilder(outputStream);
  setGsettings.setExecutable("String_Node_Str");
  setGsettings.addArgument("String_Node_Str");
  setGsettings.addArgument("String_Node_Str");
  setGsettings.addArgument("String_Node_Str");
  setGsettings.addArgument(stringBuilder.toString());
  setGsettings.start();
}
Program: 96292
Project: 96292
Buggy source:
public static List<String> getEnabledExtensions(){
  ByteArrayOutputStream byteArrayOutputStream=new ByteArrayOutputStream(8196);
  PrintStream outputStream=new PrintStream(byteArrayOutputStream);
  final ShellProcessBuilder gsettings=new ShellProcessBuilder(outputStream);
  gsettings.setExecutable("String_Node_Str");
  gsettings.addArgument("String_Node_Str");
  gsettings.addArgument("String_Node_Str");
  gsettings.addArgument("String_Node_Str");
  gsettings.start();
  String output=ShellProcessBuilder.getOutput(byteArrayOutputStream);
  final StringBuilder stringBuilder=new StringBuilder(output);
  int extensionIndex=output.indexOf("String_Node_Str");
  if (extensionIndex > 0) {
    stringBuilder.delete(extensionIndex,stringBuilder.length());
  }
  extensionIndex=output.indexOf("String_Node_Str");
  if (extensionIndex >= 0) {
    stringBuilder.delete(0,extensionIndex + 1);
  }
  String installedExtensions=stringBuilder.toString();
  if (SystemTray.DEBUG) {
    logger.debug("String_Node_Str",installedExtensions);
  }
  String[] split=installedExtensions.split("String_Node_Str");
  for (int i=0; i < split.length; i++) {
    final String s=split[i];
    int i1=s.indexOf("String_Node_Str");
    int i2=s.lastIndexOf("String_Node_Str");
    if (i1 == 0 && i2 == s.length() - 1) {
      split[i]=s.substring(1,s.length() - 1);
    }
    if (SystemTray.DEBUG) {
      logger.debug("String_Node_Str",split[i]);
    }
  }
  return new ArrayList<String>(Arrays.asList(split));
}

Fixed version (ground truth):
public static List<String> getEnabledExtensions(){
  ByteArrayOutputStream byteArrayOutputStream=new ByteArrayOutputStream(8196);
  PrintStream outputStream=new PrintStream(byteArrayOutputStream);
  final ShellProcessBuilder gsettings=new ShellProcessBuilder(outputStream);
  gsettings.setExecutable("String_Node_Str");
  gsettings.addArgument("String_Node_Str");
  gsettings.addArgument("String_Node_Str");
  gsettings.addArgument("String_Node_Str");
  gsettings.start();
  String output=ShellProcessBuilder.getOutput(byteArrayOutputStream);
  final StringBuilder stringBuilder=new StringBuilder(output);
  int extensionIndex=output.indexOf("String_Node_Str");
  if (extensionIndex > 0) {
    stringBuilder.delete(extensionIndex,stringBuilder.length());
  }
  extensionIndex=output.indexOf("String_Node_Str");
  if (extensionIndex >= 0) {
    stringBuilder.delete(0,extensionIndex + 1);
  }
  String installedExtensions=stringBuilder.toString();
  if (SystemTray.DEBUG) {
    logger.debug("String_Node_Str",installedExtensions);
  }
  String[] split=installedExtensions.split("String_Node_Str");
  for (int i=0; i < split.length; i++) {
    final String s=split[i];
    int i1=s.indexOf("String_Node_Str");
    int i2=s.lastIndexOf("String_Node_Str");
    if (i1 == 0 && i2 == s.length() - 1) {
      split[i]=s.substring(1,s.length() - 1);
    }
  }
  ArrayList<String> strings=new ArrayList<String>(Arrays.asList(split));
  for (Iterator<String> iterator=strings.iterator(); iterator.hasNext(); ) {
    final String string=iterator.next();
    if (string.trim().isEmpty()) {
      iterator.remove();
    }
  }
  return strings;
}
Program: 96294
Project: 96294
Buggy source:
public static void unInstall(){
  if (!OS.isGnome()) {
    return;
  }
  List<String> enabledExtensions=getEnabledExtensions();
  if (enabledExtensions.contains(UID)) {
    enabledExtensions.remove(UID);
    setEnabledExtensions(enabledExtensions);
    restartShell();
  }
}

Fixed version (ground truth):
public static void unInstall(){
  if (!ENABLE_EXTENSION_INSTALL || !OS.isGnome()) {
    return;
  }
  List<String> enabledExtensions=getEnabledExtensions();
  if (enabledExtensions.contains(UID)) {
    enabledExtensions.remove(UID);
    setEnabledExtensions(enabledExtensions);
    restartShell();
  }
}
Program: 96296
Project: 96296
Buggy source:
public static boolean isEventThread(){
  try {
    return (Boolean)isEventThreadMethod.invoke(null);
  }
 catch (  Throwable e) {
    SystemTray.logger.error("String_Node_Str" + "String_Node_Str");
  }
  return false;
}

Fixed version (ground truth):
public static boolean isEventThread(){
  try {
    if (OS.javaVersion <= 7) {
      return (Boolean)isEventThreadMethod.invoke(null);
    }
 else {
      return (Boolean)isEventThreadMethod.invoke(isEventThreadObject,null);
    }
  }
 catch (  Throwable e) {
    SystemTray.logger.error("String_Node_Str" + "String_Node_Str");
  }
  return false;
}