nus-yam/ex-repair huggingface dataset:
Program: 188020
Project: 188020
Buggy source:
public void addFolder(){
  String resp=CustomDialog.showInputDialog(JOptionPane.PLAIN_MESSAGE,JOptionPane.OK_CANCEL_OPTION,panel,"String_Node_Str","String_Node_Str");
  if (resp != null && !resp.equals("String_Node_Str")) {
    try {
      Element rootElement=doc.createElement("String_Node_Str");
      doc.getFirstChild().appendChild(rootElement);
      Element fname=doc.createElement("String_Node_Str");
      rootElement.appendChild(fname);
      Node node=doc.createTextNode(resp);
      fname.appendChild(node);
      MyFolder folder=new MyFolder(node);
      DefaultMutableTreeNode temp=new DefaultMutableTreeNode(folder,true);
      ((DefaultTreeModel)tree.getModel()).insertNodeInto(temp,root,root.getChildCount());
      if (root.getChildCount() == 1) {
        ((DefaultTreeModel)tree.getModel()).reload();
      }
      writeXML();
      uploadFile();
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
public void addFolder(){
  String resp=CustomDialog.showInputDialog(JOptionPane.PLAIN_MESSAGE,JOptionPane.OK_CANCEL_OPTION,panel,"String_Node_Str","String_Node_Str");
  if (resp != null) {
    if (resp.equals("String_Node_Str")) {
      CustomDialog.showInfo(JOptionPane.WARNING_MESSAGE,main,"String_Node_Str","String_Node_Str");
      return;
    }
    for (int i=0; i < root.getChildCount(); i++) {
      Object node=((DefaultMutableTreeNode)root.getChildAt(i)).getUserObject();
      if (node.getClass() == MyFolder.class) {
        if (((MyFolder)node).toString().equals(resp)) {
          CustomDialog.showInfo(JOptionPane.WARNING_MESSAGE,main,"String_Node_Str","String_Node_Str");
          return;
        }
      }
    }
    try {
      Element rootElement=doc.createElement("String_Node_Str");
      doc.getFirstChild().appendChild(rootElement);
      Element fname=doc.createElement("String_Node_Str");
      rootElement.appendChild(fname);
      Node node=doc.createTextNode(resp);
      fname.appendChild(node);
      MyFolder folder=new MyFolder(node);
      DefaultMutableTreeNode temp=new DefaultMutableTreeNode(folder,true);
      ((DefaultTreeModel)tree.getModel()).insertNodeInto(temp,root,root.getChildCount());
      if (root.getChildCount() == 1) {
        ((DefaultTreeModel)tree.getModel()).reload();
      }
      writeXML();
      uploadFile();
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}
Program: 188021
Project: 188021
Buggy source:
public void changeParam(DefaultMutableTreeNode treenode,MyParam node){
  final JTextField name=new JTextField();
  name.addAncestorListener(new AncestorListener(){
    @Override public void ancestorRemoved(    AncestorEvent arg0){
    }
    @Override public void ancestorMoved(    AncestorEvent arg0){
    }
    @Override public void ancestorAdded(    AncestorEvent arg0){
      name.requestFocusInWindow();
    }
  }
);
  name.setText(node.getName().getNodeValue());
  JTextField value=new JTextField();
  value.setText(node.getValue().getNodeValue());
  JPanel p=getPropPanel(name,value);
  int r=(Integer)CustomDialog.showDialog(p,JOptionPane.PLAIN_MESSAGE,JOptionPane.OK_CANCEL_OPTION,panel,"String_Node_Str",null);
  if (r == JOptionPane.OK_OPTION && (!(name.getText() + value.getText()).equals("String_Node_Str"))) {
    node.getName().setNodeValue(name.getText());
    node.getValue().setNodeValue(value.getText());
    ((DefaultTreeModel)tree.getModel()).nodeChanged(treenode);
    writeXML();
    uploadFile();
  }
}

Fixed version (ground truth):
public void changeParam(DefaultMutableTreeNode treenode,MyParam node){
  final JTextField name=new JTextField();
  name.addAncestorListener(new AncestorListener(){
    @Override public void ancestorRemoved(    AncestorEvent arg0){
    }
    @Override public void ancestorMoved(    AncestorEvent arg0){
    }
    @Override public void ancestorAdded(    AncestorEvent arg0){
      name.requestFocusInWindow();
    }
  }
);
  try {
    name.setText(node.getName().getNodeValue());
  }
 catch (  Exception e) {
  }
  JTextField value=new JTextField();
  try {
    value.setText(node.getValue().getNodeValue());
  }
 catch (  Exception e) {
  }
  JPanel p=getPropPanel(name,value);
  int r=(Integer)CustomDialog.showDialog(p,JOptionPane.PLAIN_MESSAGE,JOptionPane.OK_CANCEL_OPTION,panel,"String_Node_Str",null);
  if (r == JOptionPane.OK_OPTION) {
    if (name.getText().equals("String_Node_Str")) {
      CustomDialog.showInfo(JOptionPane.WARNING_MESSAGE,main,"String_Node_Str","String_Node_Str");
      return;
    }
    for (int i=0; i < treenode.getParent().getChildCount(); i++) {
      Object ob=((DefaultMutableTreeNode)treenode.getParent().getChildAt(i)).getUserObject();
      if (ob.getClass() == MyParam.class && ob != node) {
        if (((MyParam)ob).getName().getNodeValue().equals(name.getText())) {
          CustomDialog.showInfo(JOptionPane.WARNING_MESSAGE,main,"String_Node_Str","String_Node_Str");
          return;
        }
      }
    }
    node.getName().setNodeValue(name.getText());
    node.getValue().setNodeValue(value.getText());
    ((DefaultTreeModel)tree.getModel()).nodeChanged(treenode);
    writeXML();
    uploadFile();
  }
}
Program: 188026
Project: 188026
Buggy source:
public String toString(){
  return name.getNodeValue() + "String_Node_Str" + value.getNodeValue();
}

Fixed version (ground truth):
public String toString(){
  String n="String_Node_Str";
  String v="String_Node_Str";
  try {
    n=name.getNodeValue();
  }
 catch (  Exception e) {
  }
  try {
    v=value.getNodeValue();
  }
 catch (  Exception e) {
  }
  return n + "String_Node_Str" + v;
}
Program: 188028
Project: 188028
Buggy source:
public void actionPerformed(ActionEvent ev){
  try {
    String s=client.execute("String_Node_Str",new Object[]{parent.getID() + "String_Node_Str" + jTextField1.getText()}).toString();
    if (s.equals("String_Node_Str")) {
      parent.getProperties().remove(jTextField1.getText());
      updateProperties();
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent ev){
  try {
    if (jTextField1.getText().equals("String_Node_Str"))     return;
    String s=client.execute("String_Node_Str",new Object[]{parent.getID() + "String_Node_Str" + jTextField1.getText()}).toString();
    if (s.equals("String_Node_Str")) {
      parent.getProperties().remove(jTextField1.getText());
      updateProperties();
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 188030
Project: 188030
Buggy source:
public void keyReleased(KeyEvent ev){
  String key=jTextField1.getText();
  String value=jTextField2.getText();
  parent.addProperty(key,value);
  String path=parent.getParent().getID();
  String name=parent.getName();
  String query="String_Node_Str" + key + "String_Node_Str"+ value+ "String_Node_Str";
  try {
    String resp=client.execute("String_Node_Str",new Object[]{name,path,query}).toString();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void keyReleased(KeyEvent ev){
  String key=jTextField1.getText();
  String value=jTextField2.getText();
  String path=parent.getParent().getID();
  String name=parent.getName();
  String query="String_Node_Str" + key + "String_Node_Str"+ value+ "String_Node_Str";
  try {
    String resp=client.execute("String_Node_Str",new Object[]{name,path,query}).toString();
    if (resp.equals("String_Node_Str")) {
      parent.addProperty(key,value);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 188035
Project: 188035
Buggy source:
public void actionPerformed(ActionEvent ev){
  DatabaseFrame frame=new DatabaseFrame(reference);
  frame.executeQuery();
  frame.setLocation((int)database.getLocationOnScreen().getX() - 100,(int)database.getLocationOnScreen().getY());
  frame.setVisible(true);
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent ev){
  String script=userDefinition.getText();
  if (script != null && !script.equals("String_Node_Str")) {
    try {
      String result=Repository.getRPCClient().execute("String_Node_Str",new Object[]{script}) + "String_Node_Str";
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}
Program: 188037
Project: 188037
Buggy source:
public void addRemovePlugin(MyButton addremove,String filename){
}

Fixed version (ground truth):
public void addRemovePlugin(MyButton addremove,String filename){
  File pluginfile=new File(Repository.PLUGINSDIRECTORY + Repository.getBar() + filename);
  if (addremove.getText().equals("String_Node_Str")) {
    GridBagLayout layout=(GridBagLayout)localtable.getLayout();
    GridBagConstraints constraints=layout.getConstraints(addremove);
    GridBagConstraints constraints1=layout.getConstraints(addremove.getMyLabel());
    localtable.remove(addremove);
    localtable.remove(addremove.getMyLabel());
    remotetable2.add(addremove,constraints);
    remotetable2.add(addremove.getMyLabel(),constraints1);
    MainPanel main=Repository.window.mainpanel;
    if (((TwisterPluginInterface)plugins.get(filename)).getContent() != null) {
      try {
        main.remove(((TwisterPluginInterface)plugins.get(filename)).getContent());
      }
 catch (      Exception e) {
        System.out.println("String_Node_Str" + "String_Node_Str" + filename);
        e.printStackTrace();
      }
    }
    try {
      ((TwisterPluginInterface)plugins.get(filename)).terminate();
    }
 catch (    Exception e) {
      System.out.println("String_Node_Str" + "String_Node_Str" + filename);
      e.printStackTrace();
    }
    main.revalidate();
    main.repaint();
    localtable.revalidate();
    localtable.repaint();
    remotetable2.revalidate();
    remotetable2.repaint();
    Repository.removePlugin(filename);
    plugins.remove(filename);
    addremove.setText("String_Node_Str");
    plugintable.removeAll();
    Iterator iterator=plugins.keySet().iterator();
    String name;
    String description;
    while (iterator.hasNext()) {
      name=iterator.next().toString();
      TwisterPluginInterface plugin=(TwisterPluginInterface)plugins.get(name);
      description=plugin.getDescription();
      addPlugin(name,description,plugin);
    }
    plugintable.revalidate();
    plugintable.repaint();
  }
 else {
    if (copyPlugin(filename)) {
      addremove.setText("String_Node_Str");
      GridBagLayout layout=(GridBagLayout)remotetable2.getLayout();
      GridBagConstraints constraints=layout.getConstraints(addremove);
      GridBagConstraints constraints1=layout.getConstraints(addremove.getMyLabel());
      remotetable2.remove(addremove);
      remotetable2.remove(addremove.getMyLabel());
      localtable.add(addremove,constraints);
      localtable.add(addremove.getMyLabel(),constraints1);
      localtable.revalidate();
      localtable.repaint();
      remotetable2.revalidate();
      remotetable2.repaint();
      plugintable.removeAll();
      Repository.addPlugin(filename);
      PluginsLoader.setClassPath();
      getPlugins();
      Iterator iterator=plugins.keySet().iterator();
      String name;
      String description;
      while (iterator.hasNext()) {
        name=iterator.next().toString();
        TwisterPluginInterface plugin=(TwisterPluginInterface)plugins.get(name);
        description=plugin.getDescription();
        addPlugin(name,description,plugin);
      }
    }
  }
}
Program: 188038
Project: 188038
Buggy source:
/** 
 * Helper method to trigger a widget refresh.
 * @param context The application context.
 */
public static void refreshAppWidgets(Context context){
  AppWidgetManager widgetManager=AppWidgetManager.getInstance(context);
  ComponentName widgetComponent=new ComponentName(context,RichPushWidgetProvider.class);
  int[] widgetIds=widgetManager.getAppWidgetIds(widgetComponent);
  if (Build.VERSION.SDK_INT >= 11) {
    widgetManager.notifyAppWidgetViewDataChanged(widgetIds,R.id.message_list);
  }
 else {
    Intent update=new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE).putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS,widgetIds);
    context.sendBroadcast(update);
  }
}

Fixed version (ground truth):
/** 
 * Helper method to trigger a widget refresh.
 * @param context The application context.
 */
@SuppressLint("String_Node_Str") public static void refreshAppWidgets(Context context){
  AppWidgetManager widgetManager=AppWidgetManager.getInstance(context);
  ComponentName widgetComponent=new ComponentName(context,RichPushWidgetProvider.class);
  int[] widgetIds=widgetManager.getAppWidgetIds(widgetComponent);
  if (Build.VERSION.SDK_INT >= 11) {
    widgetManager.notifyAppWidgetViewDataChanged(widgetIds,R.id.message_list);
  }
 else {
    Intent update=new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE).putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS,widgetIds);
    context.sendBroadcast(update);
  }
}
Program: 188039
Project: 188039
Buggy source:
/** 
 * Creates the widget layout. <p/> The small layout that only shows the unread count will be created on Gingerbread (10) or older devices, or devices running Jelly Bean (16) who configured the widget with a height smaller than   {@link #LARGE_LAYOUT_MIN_HEIGHT}. For all other devices, the large layout with a list view of message center messages will be created.
 * @param context Application context
 * @param appWidgetManager The app
 * @param appWidgetId Id of the widget
 * @return RemoteViews for the layout
 */
private RemoteViews createLayout(Context context,AppWidgetManager appWidgetManager,int appWidgetId){
  if (Build.VERSION.SDK_INT >= 16) {
    Bundle options=appWidgetManager.getAppWidgetOptions(appWidgetId);
    if (options.getInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT) >= LARGE_LAYOUT_MIN_HEIGHT) {
      return createLargeLayout(context,appWidgetId);
    }
    return createSmallLayout(context);
  }
  if (Build.VERSION.SDK_INT >= 11) {
    return createLargeLayout(context,appWidgetId);
  }
  return createSmallLayout(context);
}

Fixed version (ground truth):
/** 
 * Creates the widget layout. <p/> The small layout that only shows the unread count will be created on Gingerbread (10) or older devices, or devices running Jelly Bean (16) who configured the widget with a height smaller than   {@link #LARGE_LAYOUT_MIN_HEIGHT}. For all other devices, the large layout with a list view of message center messages will be created.
 * @param context Application context
 * @param appWidgetManager The app
 * @param appWidgetId Id of the widget
 * @return RemoteViews for the layout
 */
@SuppressLint("String_Node_Str") private RemoteViews createLayout(Context context,AppWidgetManager appWidgetManager,int appWidgetId){
  if (Build.VERSION.SDK_INT >= 16) {
    Bundle options=appWidgetManager.getAppWidgetOptions(appWidgetId);
    if (options.getInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT) >= LARGE_LAYOUT_MIN_HEIGHT) {
      return createLargeLayout(context,appWidgetId);
    }
    return createSmallLayout(context);
  }
  if (Build.VERSION.SDK_INT >= 11) {
    return createLargeLayout(context,appWidgetId);
  }
  return createSmallLayout(context);
}
Program: 188040
Project: 188040
Buggy source:
/** 
 * Creates a large layout for the app widget <p/> This layout is only supported in SDK >= 11 (Honeycomb)
 * @param context Application context
 * @param appWidgetId id of the widget
 * @return RemoteViews for the large layout
 */
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private RemoteViews createLargeLayout(Context context,int appWidgetId){
  RemoteViews remoteViews=new RemoteViews(context.getPackageName(),R.layout.widget_layout);
  Intent intent=new Intent(context,RichPushWidgetService.class).putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,appWidgetId);
  remoteViews.setRemoteAdapter(appWidgetId,R.id.message_list,intent);
  remoteViews.setEmptyView(R.id.message_list,R.id.empty_view);
  remoteViews.setPendingIntentTemplate(R.id.message_list,createMessageTemplateIntent(context,appWidgetId));
  remoteViews.setOnClickPendingIntent(R.id.widget_header,createMainActivityPendingIntent(context));
  return remoteViews;
}

Fixed version (ground truth):
/** 
 * Creates a large layout for the app widget <p/> This layout is only supported in SDK >= 11 (Honeycomb)
 * @param context Application context
 * @param appWidgetId id of the widget
 * @return RemoteViews for the large layout
 */
@SuppressLint("String_Node_Str") private RemoteViews createLargeLayout(Context context,int appWidgetId){
  RemoteViews remoteViews=new RemoteViews(context.getPackageName(),R.layout.widget_layout);
  Intent intent=new Intent(context,RichPushWidgetService.class).putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,appWidgetId);
  remoteViews.setRemoteAdapter(appWidgetId,R.id.message_list,intent);
  remoteViews.setEmptyView(R.id.message_list,R.id.empty_view);
  remoteViews.setPendingIntentTemplate(R.id.message_list,createMessageTemplateIntent(context,appWidgetId));
  remoteViews.setOnClickPendingIntent(R.id.widget_header,createMainActivityPendingIntent(context));
  return remoteViews;
}
Program: 188041
Project: 188041
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  AirshipConfigOptions options=UAirship.shared().getAirshipConfigOptions();
  this.addPreferencesFromResource(R.xml.push_preferences);
  this.addPreferencesFromResource(R.xml.location_preferences);
  this.addPreferencesFromResource(R.xml.advanced_preferences);
  preferenceAdapter=new UAPreferenceAdapter(getPreferenceScreen());
  if (Build.VERSION.SDK_INT >= 11) {
    ActionBar actionBar=getActionBar();
    if (actionBar != null) {
      actionBar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP,ActionBar.DISPLAY_HOME_AS_UP);
    }
  }
}

Fixed version (ground truth):
@Override @TargetApi(Build.VERSION_CODES.HONEYCOMB) protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  AirshipConfigOptions options=UAirship.shared().getAirshipConfigOptions();
  this.addPreferencesFromResource(R.xml.push_preferences);
  this.addPreferencesFromResource(R.xml.location_preferences);
  this.addPreferencesFromResource(R.xml.advanced_preferences);
  preferenceAdapter=new UAPreferenceAdapter(getPreferenceScreen());
  if (Build.VERSION.SDK_INT >= 11) {
    ActionBar actionBar=getActionBar();
    if (actionBar != null) {
      actionBar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP,ActionBar.DISPLAY_HOME_AS_UP);
    }
  }
}
Program: 188042
Project: 188042
Buggy source:
@Override protected void onStart(){
  super.onStart();
  PlayServicesUtils.handleAnyPlayServicesError(this);
  UAirship.shared().getAnalytics().activityStarted(this);
}

Fixed version (ground truth):
@Override protected void onStart(){
  super.onStart();
  if (PlayServicesUtils.isGooglePlayStoreAvailable()) {
    PlayServicesUtils.handleAnyPlayServicesError(this);
  }
  UAirship.shared().getAnalytics().activityStarted(this);
}
Program: 188043
Project: 188043
Buggy source:
/** 
 * Find and open the app
 * @param appName The name of the app to open
 * @param packageName The package name of the app to open
 * @return <code>true</code> if app was opened, otherwise <code>false</code>
 * @throws UiObjectNotFoundException
 */
public static boolean openApp(String appName,String packageName) throws UiObjectNotFoundException {
  UiDevice device=UiDevice.getInstance();
  try {
    device.wakeUp();
  }
 catch (  RemoteException e1) {
    e1.printStackTrace();
  }
  device.pressHome();
  device.pressHome();
  device.pressHome();
  UiObject okDismissHelpOverlayButton=new UiObject(new UiSelector().text("String_Node_Str"));
  if (okDismissHelpOverlayButton.exists()) {
    okDismissHelpOverlayButton.click();
  }
  UiObject allAppsButton=new UiObject(new UiSelector().description("String_Node_Str"));
  allAppsButton.clickAndWaitForNewWindow();
  UiObject appsTab=new UiObject(new UiSelector().text("String_Node_Str"));
  appsTab.click();
  UiObject okDismissHelpOverlayButton=new UiObject(new UiSelector().text("String_Node_Str"));
  if (okDismissHelpOverlayButton.exists()) {
    okDismissHelpOverlayButton.click();
  }
  UiScrollable appViews=new UiScrollable(new UiSelector().scrollable(true));
  appViews.setAsHorizontalList();
  UiObject settingsApp=appViews.getChildByText(new UiSelector().className(android.widget.TextView.class.getName()),appName);
  settingsApp.clickAndWaitForNewWindow();
  UiObject pushSampleValidation=new UiObject(new UiSelector().packageName(packageName));
  return pushSampleValidation.exists();
}

Fixed version (ground truth):
/** 
 * Find and open the app
 * @param appName The name of the app to open
 * @param packageName The package name of the app to open
 * @return <code>true</code> if app was opened, otherwise <code>false</code>
 * @throws UiObjectNotFoundException
 */
public static boolean openApp(String appName,String packageName) throws UiObjectNotFoundException {
  UiDevice device=UiDevice.getInstance();
  try {
    device.wakeUp();
  }
 catch (  RemoteException e1) {
    e1.printStackTrace();
  }
  device.pressHome();
  device.pressHome();
  device.pressHome();
  UiObject okDismissHelpOverlayButton=new UiObject(new UiSelector().text("String_Node_Str"));
  if (okDismissHelpOverlayButton.exists()) {
    okDismissHelpOverlayButton.click();
  }
  UiObject allAppsButton=new UiObject(new UiSelector().description("String_Node_Str"));
  allAppsButton.clickAndWaitForNewWindow();
  UiObject appsTab=new UiObject(new UiSelector().text("String_Node_Str"));
  appsTab.click();
  okDismissHelpOverlayButton=new UiObject(new UiSelector().text("String_Node_Str"));
  if (okDismissHelpOverlayButton.exists()) {
    okDismissHelpOverlayButton.click();
  }
  UiScrollable appViews=new UiScrollable(new UiSelector().scrollable(true));
  appViews.setAsHorizontalList();
  UiObject settingsApp=appViews.getChildByText(new UiSelector().className(android.widget.TextView.class.getName()),appName);
  settingsApp.clickAndWaitForNewWindow();
  UiObject pushSampleValidation=new UiObject(new UiSelector().packageName(packageName));
  return pushSampleValidation.exists();
}
Program: 188044
Project: 188044
Buggy source:
@Override protected void onStop(){
  super.onStop();
  InboxNotificationBuilder builder=(InboxNotificationBuilder)PushManager.shared().getNotificationBuilder();
  builder.updateInboxNotification();
  UAirship.shared().getAnalytics().activityStopped(this);
}

Fixed version (ground truth):
@Override protected void onStop(){
  super.onStop();
  UAirship.shared().getAnalytics().activityStopped(this);
}
Program: 188045
Project: 188045
Buggy source:
private void configureActionBar(){
  ActionBar actionBar=this.getSupportActionBar();
  actionBar.setHomeButtonEnabled(true);
  actionBar.setDisplayUseLogoEnabled(true);
  actionBar.setDisplayShowTitleEnabled(false);
  actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
  this.navAdapter=new ArrayAdapter<String>(this,R.layout.sherlock_spinner_dropdown_item,RichPushApplication.navList);
  actionBar.setListNavigationCallbacks(this.navAdapter,this);
  actionBar.setSelectedNavigationItem(this.navAdapter.getPosition(RichPushApplication.INBOX_ACTIVITY));
}

Fixed version (ground truth):
private void configureActionBar(){
  ActionBar actionBar=this.getSupportActionBar();
  actionBar.setHomeButtonEnabled(true);
  actionBar.setDisplayUseLogoEnabled(true);
  actionBar.setDisplayShowTitleEnabled(false);
  actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
  this.navAdapter=new ArrayAdapter<String>(this,R.layout.sherlock_spinner_dropdown_item,RichPushApplication.navList);
  actionBar.setListNavigationCallbacks(this.navAdapter,this);
}
Program: 188046
Project: 188046
Buggy source:
@Override protected void onResume(){
  super.onResume();
  RichPushManager.shared().addListener(this);
  RichPushManager.shared().getRichPushUser().getInbox().addListener(this);
  showPendingMessageId();
  startActionModeIfNecessary();
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  setNavigationToInboxActivity();
  RichPushManager.shared().addListener(this);
  RichPushManager.shared().getRichPushUser().getInbox().addListener(this);
  showPendingMessageId();
  startActionModeIfNecessary();
}
Program: 188047
Project: 188047
Buggy source:
@Override protected void onNewIntent(Intent intent){
  this.setPendingMessageIdFromIntent(intent);
  this.showPendingMessageId();
}

Fixed version (ground truth):
@Override protected void onNewIntent(Intent intent){
  this.setPendingMessageIdFromIntent(intent);
}
Program: 188048
Project: 188048
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  this.setContentView(R.layout.main);
  this.configureActionBar();
  this.user=RichPushManager.shared().getRichPushUser();
  String messageId=this.getIntent().getStringExtra(RichPushApplication.MESSAGE_ID_RECEIVED_KEY);
  if (savedInstanceState == null && !UAStringUtil.isEmpty(messageId)) {
    showRichPushMessage(messageId);
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  this.setContentView(R.layout.main);
  this.configureActionBar();
  this.user=RichPushManager.shared().getRichPushUser();
  if (savedInstanceState == null) {
    pendingMessageId=getIntent().getStringExtra(RichPushApplication.MESSAGE_ID_RECEIVED_KEY);
  }
}
Program: 188049
Project: 188049
Buggy source:
private void configureActionBar(){
  ActionBar actionBar=this.getSupportActionBar();
  actionBar.setDisplayUseLogoEnabled(true);
  actionBar.setDisplayShowTitleEnabled(false);
  actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
  this.navAdapter=new ArrayAdapter<String>(this,R.layout.sherlock_spinner_dropdown_item,RichPushApplication.navList);
  actionBar.setListNavigationCallbacks(this.navAdapter,this);
  actionBar.setSelectedNavigationItem(this.navAdapter.getPosition("String_Node_Str"));
}

Fixed version (ground truth):
private void configureActionBar(){
  ActionBar actionBar=this.getSupportActionBar();
  actionBar.setDisplayUseLogoEnabled(true);
  actionBar.setDisplayShowTitleEnabled(false);
  actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
  this.navAdapter=new ArrayAdapter<String>(this,R.layout.sherlock_spinner_dropdown_item,RichPushApplication.navList);
  actionBar.setListNavigationCallbacks(this.navAdapter,this);
}
Program: 188050
Project: 188050
Buggy source:
@Override protected void onNewIntent(Intent intent){
  String messageId=intent.getStringExtra(RichPushApplication.MESSAGE_ID_RECEIVED_KEY);
  if (!UAStringUtil.isEmpty(messageId)) {
    showRichPushMessage(messageId);
  }
}

Fixed version (ground truth):
@Override protected void onNewIntent(Intent intent){
  pendingMessageId=intent.getStringExtra(RichPushApplication.MESSAGE_ID_RECEIVED_KEY);
}
Program: 188051
Project: 188051
Buggy source:
@Override protected void onStop(){
  super.onStart();
  UAirship.shared().getAnalytics().activityStopped(this);
}

Fixed version (ground truth):
@Override protected void onStop(){
  super.onStop();
  UAirship.shared().getAnalytics().activityStopped(this);
}
Program: 188052
Project: 188052
Buggy source:
private void showMessage(String messageId){
  if (messagePager != null) {
    this.messagePager.setCurrentItem(RichPushMessageUtils.getMessagePosition(messageId,messages));
  }
 else {
    Intent intent=new Intent(this,MessageActivity.class);
    intent.putExtra(MessageActivity.EXTRA_MESSAGE_ID_KEY,messageId);
    this.startActivity(intent);
  }
}

Fixed version (ground truth):
private void showMessage(String messageId){
  if (richPushInbox.getMessage(messageId) == null) {
    return;
  }
  if (messagePager != null) {
    this.messagePager.setCurrentItem(RichPushMessageUtils.getMessagePosition(messageId,messages));
  }
 else {
    Intent intent=new Intent(this,MessageActivity.class);
    intent.putExtra(MessageActivity.EXTRA_MESSAGE_ID_KEY,messageId);
    this.startActivity(intent);
  }
}
Program: 188053
Project: 188053
Buggy source:
/** 
 * Sets the internal UAirship preferences
 * @param preferenceType UAPreference.PreferenceType type of preference to set
 * @param value Object Value of the preference
 */
private void setInternalPreference(UAPreference.PreferenceType preferenceType,Object value){
  Date[] quietTimes=null;
switch (preferenceType) {
case LOCATION_BACKGROUND_ENABLE:
    if ((Boolean)value) {
      UALocationManager.enableBackgroundLocation();
    }
 else {
      UALocationManager.disableBackgroundLocation();
    }
  break;
case LOCATION_ENABLE:
if ((Boolean)value) {
  UALocationManager.enableForegroundLocation();
}
 else {
  UALocationManager.disableForegroundLocation();
}
break;
case LOCATION_FOREGROUND_ENABLE:
if ((Boolean)value) {
UALocationManager.enableForegroundLocation();
}
 else {
UALocationManager.disableForegroundLocation();
}
break;
case PUSH_ENABLE:
if ((Boolean)value) {
PushManager.enablePush();
}
 else {
PushManager.disablePush();
}
break;
case QUIET_TIME_ENABLE:
pushPrefs.setQuietTimeEnabled((Boolean)value);
break;
case SOUND_ENABLE:
pushPrefs.setSoundEnabled((Boolean)value);
break;
case VIBRATE_ENABLE:
pushPrefs.setVibrateEnabled((Boolean)value);
break;
case QUIET_TIME_END:
quietTimes=pushPrefs.getQuietTimeInterval();
Date start=quietTimes != null ? quietTimes[0] : new Date();
pushPrefs.setQuietTimeInterval(start,new Date((Long)value));
break;
case QUIET_TIME_START:
quietTimes=pushPrefs.getQuietTimeInterval();
Date end=quietTimes != null ? quietTimes[1] : new Date();
pushPrefs.setQuietTimeInterval(new Date((Long)value),end);
break;
}
}

Fixed version (ground truth):
/** 
 * Sets the internal UAirship preferences
 * @param preferenceType UAPreference.PreferenceType type of preference to set
 * @param value Object Value of the preference
 */
private void setInternalPreference(UAPreference.PreferenceType preferenceType,Object value){
  Date[] quietTimes=null;
switch (preferenceType) {
case LOCATION_BACKGROUND_ENABLE:
    if ((Boolean)value) {
      UALocationManager.enableBackgroundLocation();
    }
 else {
      UALocationManager.disableBackgroundLocation();
    }
  break;
case LOCATION_ENABLE:
if ((Boolean)value) {
  UALocationManager.enableLocation();
}
 else {
  UALocationManager.disableLocation();
}
break;
case LOCATION_FOREGROUND_ENABLE:
if ((Boolean)value) {
UALocationManager.enableForegroundLocation();
}
 else {
UALocationManager.disableForegroundLocation();
}
break;
case PUSH_ENABLE:
if ((Boolean)value) {
PushManager.enablePush();
}
 else {
PushManager.disablePush();
}
break;
case QUIET_TIME_ENABLE:
pushPrefs.setQuietTimeEnabled((Boolean)value);
break;
case SOUND_ENABLE:
pushPrefs.setSoundEnabled((Boolean)value);
break;
case VIBRATE_ENABLE:
pushPrefs.setVibrateEnabled((Boolean)value);
break;
case QUIET_TIME_END:
quietTimes=pushPrefs.getQuietTimeInterval();
Date start=quietTimes != null ? quietTimes[0] : new Date();
pushPrefs.setQuietTimeInterval(start,new Date((Long)value));
break;
case QUIET_TIME_START:
quietTimes=pushPrefs.getQuietTimeInterval();
Date end=quietTimes != null ? quietTimes[1] : new Date();
pushPrefs.setQuietTimeInterval(new Date((Long)value),end);
break;
}
}
Program: 188054
Project: 188054
Buggy source:
/** 
 * Gets the internal UAirship preferences
 * @return Object value of the internal preference
 */
private Object getInternalPreference(UAPreference.PreferenceType preferenceType){
  Date[] quietTimes=null;
  Object value=null;
switch (preferenceType) {
case LOCATION_BACKGROUND_ENABLE:
    value=locPrefs.isLocationEnabled();
  break;
case LOCATION_ENABLE:
value=locPrefs.isLocationEnabled();
break;
case LOCATION_FOREGROUND_ENABLE:
value=locPrefs.isLocationEnabled();
break;
case PUSH_ENABLE:
value=pushPrefs.isPushEnabled();
break;
case QUIET_TIME_ENABLE:
value=pushPrefs.isQuietTimeEnabled();
break;
case QUIET_TIME_END:
quietTimes=pushPrefs.getQuietTimeInterval();
value=quietTimes != null ? quietTimes[1].getTime() : null;
break;
case QUIET_TIME_START:
quietTimes=pushPrefs.getQuietTimeInterval();
value=quietTimes != null ? quietTimes[0].getTime() : null;
break;
case SOUND_ENABLE:
value=pushPrefs.isVibrateEnabled();
break;
case VIBRATE_ENABLE:
value=pushPrefs.isVibrateEnabled();
break;
}
return value;
}

Fixed version (ground truth):
/** 
 * Gets the internal UAirship preferences
 * @return Object value of the internal preference
 */
private Object getInternalPreference(UAPreference.PreferenceType preferenceType){
  Date[] quietTimes=null;
  Object value=null;
switch (preferenceType) {
case LOCATION_BACKGROUND_ENABLE:
    value=locPrefs.isBackgroundLocationEnabled();
  break;
case LOCATION_ENABLE:
value=locPrefs.isLocationEnabled();
break;
case LOCATION_FOREGROUND_ENABLE:
value=locPrefs.isForegroundLocationEnabled();
break;
case PUSH_ENABLE:
value=pushPrefs.isPushEnabled();
break;
case QUIET_TIME_ENABLE:
value=pushPrefs.isQuietTimeEnabled();
break;
case QUIET_TIME_END:
quietTimes=pushPrefs.getQuietTimeInterval();
value=quietTimes != null ? quietTimes[1].getTime() : null;
break;
case QUIET_TIME_START:
quietTimes=pushPrefs.getQuietTimeInterval();
value=quietTimes != null ? quietTimes[0].getTime() : null;
break;
case SOUND_ENABLE:
value=pushPrefs.isSoundEnabled();
break;
case VIBRATE_ENABLE:
value=pushPrefs.isVibrateEnabled();
break;
}
return value;
}
Program: 188055
Project: 188055
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  menu.add(0,MENU_ITEM_INSERT,0,R.string.menu_insert).setShortcut('1','i').setIcon(android.R.drawable.ic_menu_add);
  menu.add(0,MENU_SEARCH,0,R.string.menu_search).setShortcut('2','s').setIcon(android.R.drawable.ic_menu_search);
  menu.add(0,MENU_OPEN,0,R.string.menu_open_from_sdcard).setShortcut('3','o').setIcon(R.drawable.ic_menu_folder);
  UpdateMenu.addUpdateMenu(this,menu,0,MENU_UPDATE,0,R.string.update);
  menu.add(0,MENU_SETTINGS,0,R.string.settings).setIcon(android.R.drawable.ic_menu_preferences).setShortcut('9','s');
  menu.add(0,MENU_ABOUT,0,R.string.about).setIcon(android.R.drawable.ic_menu_info_details).setShortcut('0','a');
  Intent intent=new Intent(null,getIntent().getData());
  if (debug)   Log.i(TAG,"String_Node_Str" + intent.getDataString());
  intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
  MenuIntentOptionsWithIcons menu2=new MenuIntentOptionsWithIcons(this,menu);
  menu2.addIntentOptions(CATEGORY_ALTERNATIVE_GLOBAL,0,0,new ComponentName(this,NotesList.class),null,intent,0,null);
  return true;
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  super.onCreateOptionsMenu(menu);
  menu.add(0,MENU_ITEM_INSERT,0,R.string.menu_insert).setShortcut('1','i').setIcon(android.R.drawable.ic_menu_add);
  menu.add(0,MENU_SEARCH,0,R.string.menu_search).setShortcut('2','s').setIcon(android.R.drawable.ic_menu_search);
  menu.add(0,MENU_OPEN,0,R.string.menu_open_from_sdcard).setShortcut('3','o').setIcon(R.drawable.ic_menu_folder);
  UpdateMenu.addUpdateMenu(this,menu,0,MENU_UPDATE,0,R.string.menu_update);
  menu.add(0,MENU_SETTINGS,0,R.string.settings).setIcon(android.R.drawable.ic_menu_preferences).setShortcut('9','s');
  menu.add(0,MENU_ABOUT,0,R.string.about).setIcon(android.R.drawable.ic_menu_info_details).setShortcut('0','a');
  Intent intent=new Intent(null,getIntent().getData());
  if (debug)   Log.i(TAG,"String_Node_Str" + intent.getDataString());
  intent.addCategory(Intent.CATEGORY_ALTERNATIVE);
  MenuIntentOptionsWithIcons menu2=new MenuIntentOptionsWithIcons(this,menu);
  menu2.addIntentOptions(CATEGORY_ALTERNATIVE_GLOBAL,0,0,new ComponentName(this,NotesList.class),null,intent,0,null);
  return true;
}
Program: 188057
Project: 188057
Buggy source:
@Override protected void onPostExecute(Bundle result){
  String error=result.getString(AccountManager.KEY_ERROR_MESSAGE);
  if (error != null) {
    MessageDialogFragment.showMessage(getFragmentManager(),error);
  }
 else   if (listener != null) {
    listener.onAccountAdded(result);
  }
  hideProgress();
}

Fixed version (ground truth):
@Override protected void onPostExecute(Bundle result){
  task=null;
  String error=result.getString(AccountManager.KEY_ERROR_MESSAGE);
  if (error != null) {
    MessageDialogFragment.showMessage(getFragmentManager(),error);
    hideProgress();
  }
 else   if (listener != null) {
    listener.onAccountAdded(result);
  }
}
Program: 188058
Project: 188058
Buggy source:
@Override public void onSubredditDiscovery(String subreddit){
  NavigationFragment navFrag=getNavigationFragment();
  if (navFrag != null && navFrag.isRandom()) {
    navFrag.setSubreddit(subreddit);
  }
 else {
    ControlFragment controlFrag=getControlFragment();
    if (controlFrag != null && controlFrag.isRandom()) {
      controlFrag=controlFrag.withSubreddit(subreddit);
      FragmentTransaction ft=getSupportFragmentManager().beginTransaction();
      ft.add(controlFrag,TAG_CONTROL_FRAGMENT);
      ft.commitAllowingStateLoss();
      refreshActionBar(controlFrag);
    }
  }
}

Fixed version (ground truth):
@Override public void onSubredditDiscovery(String subreddit){
  NavigationFragment navFrag=getNavigationFragment();
  if (navFrag != null && navFrag.isRandom()) {
    navFrag.onSubredditDiscovery(subreddit);
  }
  ControlFragment controlFrag=getControlFragment();
  if (controlFrag != null && controlFrag.isRandom()) {
    controlFrag=controlFrag.withSubreddit(subreddit);
    FragmentTransaction ft=getSupportFragmentManager().beginTransaction();
    ft.add(controlFrag,TAG_CONTROL_FRAGMENT);
    ft.commitAllowingStateLoss();
    refreshActionBar(controlFrag);
  }
}
Program: 188059
Project: 188059
Buggy source:
@Override public void onSubredditDiscovery(String subreddit){
  NavigationFragment navFrag=getNavigationFragment();
  if (navFrag != null && navFrag.isRandom()) {
    navFrag.onSubredditDiscovery(subreddit);
  }
  ControlFragment controlFrag=getControlFragment();
  if (controlFrag != null && controlFrag.isRandom()) {
    controlFrag=controlFrag.withSubreddit(subreddit);
    FragmentTransaction ft=getSupportFragmentManager().beginTransaction();
    ft.add(controlFrag,TAG_CONTROL_FRAGMENT);
    ft.commitAllowingStateLoss();
    refreshActionBar(controlFrag);
  }
}

Fixed version (ground truth):
@Override public void onSubredditDiscovery(String subreddit){
  NavigationFragment navFrag=getNavigationFragment();
  if (navFrag != null && navFrag.isRandom()) {
    navFrag.setSubreddit(subreddit);
  }
 else {
    ControlFragment controlFrag=getControlFragment();
    if (controlFrag != null && controlFrag.isRandom()) {
      controlFrag=controlFrag.withSubreddit(subreddit);
      FragmentTransaction ft=getSupportFragmentManager().beginTransaction();
      ft.add(controlFrag,TAG_CONTROL_FRAGMENT);
      ft.commitAllowingStateLoss();
      refreshActionBar(controlFrag);
    }
  }
}
Program: 188060
Project: 188060
Buggy source:
private <F extends Fragment & RightFragment>void setRightFragment(int containerId,ControlFragment controlFrag,F rightFrag,boolean force,boolean removeLeft){
  if (force || !Objects.fragmentEquals(rightFrag,getRightFragment())) {
    safePopBackStackImmediate();
    FragmentTransaction ft=getSupportFragmentManager().beginTransaction();
    ft.add(controlFrag,TAG_CONTROL_FRAGMENT);
    if (removeLeft) {
      removeFragment(ft,TAG_LEFT_FRAGMENT);
    }
    ft.replace(containerId,rightFrag,TAG_RIGHT_FRAGMENT);
    removeFragment(ft,TAG_THING_FRAGMENT);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN | FragmentTransaction.TRANSIT_FRAGMENT_CLOSE);
    ft.commitAllowingStateLoss();
    refreshActionBar(controlFrag);
    refreshViews(controlFrag.getThingBundle());
  }
}

Fixed version (ground truth):
private <F extends Fragment & RightFragment>void setRightFragment(int containerId,ControlFragment controlFrag,F rightFrag,boolean force){
  setRightFragmentRemoveLeft(containerId,controlFrag,rightFrag,force,false);
}
Program: 188061
Project: 188061
Buggy source:
private <F extends Fragment & RightFragment>void setCenterFragment(int containerId,ControlFragment controlFrag,F centerFrag,boolean force){
  setRightFragment(containerId,controlFrag,centerFrag,true);
}

Fixed version (ground truth):
private <F extends Fragment & RightFragment>void setCenterFragment(int containerId,ControlFragment controlFrag,F centerFrag,boolean force){
  setRightFragmentRemoveLeft(containerId,controlFrag,centerFrag,force,true);
}
Program: 188062
Project: 188062
Buggy source:
private void selectTab(Tab tab){
  if (BuildConfig.DEBUG) {
    Log.d(TAG,"String_Node_Str" + tab.getText() + "String_Node_Str"+ tabListenerDisabled);
  }
  if (!tabListenerDisabled) {
    if (tab == tabInSubreddit) {
      refreshThingList(getSubreddit(),getQuery());
    }
 else     if (tab == tabPosts) {
      refreshThingList(null,getQuery());
    }
 else     if (tab == tabSubreddits) {
      refreshSubredditList(getQuery());
    }
  }
}

Fixed version (ground truth):
private void selectTab(Tab tab){
  if (BuildConfig.DEBUG) {
    Log.d(TAG,"String_Node_Str" + tab.getText() + "String_Node_Str"+ tabListenerDisabled);
  }
  if (!tabListenerDisabled) {
    selectedTabIndex=tab.getPosition();
    if (tab == tabPostsInSubreddit) {
      refreshThingList(getSubreddit());
    }
 else     if (tab == tabPosts) {
      refreshThingList(null);
    }
 else     if (tab == tabSubreddits) {
      refreshSubredditList();
    }
  }
}
Program: 188063
Project: 188063
Buggy source:
private void refreshSubredditList(String query){
  setSearchSubredditsFragments(accountName,query,FilterAdapter.SUBREDDIT_HOT);
}

Fixed version (ground truth):
private void refreshSubredditList(){
  setSearchSubredditsFragments(accountName,getQuery(),FilterAdapter.SUBREDDIT_HOT);
}
Program: 188064
Project: 188064
Buggy source:
private void refreshThingList(String subreddit,String query){
  setSearchThingsFragments(accountName,subreddit,query,FilterAdapter.SUBREDDIT_HOT);
}

Fixed version (ground truth):
private void refreshThingList(String subreddit){
  setSearchThingsFragments(accountName,subreddit,getQuery(),FilterAdapter.SUBREDDIT_HOT);
}
Program: 188065
Project: 188065
Buggy source:
@Override protected boolean hasLeftFragment(){
  return bar.getSelectedTab() == tabSubreddits;
}

Fixed version (ground truth):
@Override protected boolean hasLeftFragment(){
  return selectedTabIndex == subredditsTabIndex;
}
Program: 188066
Project: 188066
Buggy source:
private void setupTabs(){
  if (Subreddits.hasSidebar(getSubreddit())) {
    tabInSubreddit=addTab(MenuHelper.getSubredditTitle(this,getSubreddit()));
  }
  tabPosts=addTab(getString(R.string.tab_posts));
  tabSubreddits=addTab(getString(R.string.tab_subreddits));
  tabListenerDisabled=savedSelectedTabIndex != 0;
  bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
  tabListenerDisabled=false;
  if (savedSelectedTabIndex != 0) {
    bar.setSelectedNavigationItem(savedSelectedTabIndex);
  }
}

Fixed version (ground truth):
private void setupTabs(){
  if (Subreddits.hasSidebar(getSubreddit())) {
    tabPostsInSubreddit=addTab(MenuHelper.getSubredditTitle(this,getSubreddit()));
  }
  tabPosts=addTab(getString(R.string.tab_posts));
  tabSubreddits=addTab(getString(R.string.tab_subreddits));
  tabListenerDisabled=selectedTabIndex != 0;
  bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
  tabListenerDisabled=false;
  if (selectedTabIndex != 0) {
    bar.setSelectedNavigationItem(selectedTabIndex);
  }
}
Program: 188067
Project: 188067
Buggy source:
@Override protected void setupActionBar(Bundle savedInstanceState){
  bar.setDisplayHomeAsUpEnabled(true);
  if (savedInstanceState != null) {
    savedSelectedTabIndex=savedInstanceState.getInt(STATE_SELECTED_TAB_INDEX);
  }
  getSupportLoaderManager().initLoader(0,null,this);
}

Fixed version (ground truth):
@Override protected void setupActionBar(Bundle savedInstanceState){
  bar.setDisplayHomeAsUpEnabled(true);
  if (savedInstanceState != null) {
    selectedTabIndex=savedInstanceState.getInt(STATE_SELECTED_TAB_INDEX);
  }
  subredditsTabIndex=Subreddits.hasSidebar(getSubreddit()) ? 2 : 1;
  getSupportLoaderManager().initLoader(0,null,this);
}
Program: 188068
Project: 188068
Buggy source:
private void selectTab(Tab tab){
  if (BuildConfig.DEBUG) {
    Log.d(TAG,"String_Node_Str" + tab.getText() + "String_Node_Str"+ tabListenerDisabled);
  }
  if (!tabListenerDisabled) {
    if (tab == tabDescription) {
      setSidebarFragments(accountName,getSubredditName());
    }
 else     if (tab == tabRelated) {
      setRelatedSubredditsFragments(accountName,getSubredditName());
    }
  }
}

Fixed version (ground truth):
private void selectTab(Tab tab){
  if (BuildConfig.DEBUG) {
    Log.d(TAG,"String_Node_Str" + tab.getText() + "String_Node_Str"+ tabListenerDisabled);
  }
  if (!tabListenerDisabled) {
    selectedTabIndex=tab.getPosition();
    if (tab == tabDescription) {
      refreshSidebarFragments();
    }
 else     if (tab == tabRelated) {
      refreshRelatedSubredditFragments();
    }
  }
}
Program: 188069
Project: 188069
Buggy source:
@Override protected boolean hasLeftFragment(){
  return bar.getSelectedTab() == tabRelated;
}

Fixed version (ground truth):
@Override protected boolean hasLeftFragment(){
  return selectedTabIndex == TAB_RELATED;
}
Program: 188070
Project: 188070
Buggy source:
private void setupTabs(){
  tabDescription=addTab(getString(R.string.tab_description));
  tabRelated=addTab(getString(R.string.tab_related));
  tabListenerDisabled=savedSelectedTabIndex != 0;
  bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
  tabListenerDisabled=false;
  if (savedSelectedTabIndex != 0) {
    bar.setSelectedNavigationItem(savedSelectedTabIndex);
  }
}

Fixed version (ground truth):
private void setupTabs(){
  tabDescription=addTab(getString(R.string.tab_description));
  tabRelated=addTab(getString(R.string.tab_related));
  tabListenerDisabled=selectedTabIndex != 0;
  bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
  tabListenerDisabled=false;
  if (selectedTabIndex != 0) {
    bar.setSelectedNavigationItem(selectedTabIndex);
  }
}
Program: 188071
Project: 188071
Buggy source:
@Override protected void setupActionBar(Bundle savedInstanceState){
  bar.setDisplayHomeAsUpEnabled(true);
  if (savedInstanceState != null) {
    savedSelectedTabIndex=savedInstanceState.getInt(STATE_SELECTED_TAB_INDEX);
  }
  getSupportLoaderManager().initLoader(0,null,this);
}

Fixed version (ground truth):
@Override protected void setupActionBar(Bundle savedInstanceState){
  bar.setDisplayHomeAsUpEnabled(true);
  if (savedInstanceState != null) {
    selectedTabIndex=savedInstanceState.getInt(STATE_SELECTED_TAB_INDEX);
  }
  getSupportLoaderManager().initLoader(0,null,this);
}
Program: 188072
Project: 188072
Buggy source:
private void setRightFragment(int containerId,ControlFragment controlFrag,ThingListFragment<?> rightFrag){
  if (isSinglePane) {
    setRightFragmentSinglePane(containerId,controlFrag,rightFrag,false);
  }
 else {
    setRightFragmentMultiPane(containerId,controlFrag,rightFrag,false);
  }
}

Fixed version (ground truth):
private <F extends Fragment & ComparableFragment>void setRightFragment(int containerId,ControlFragment controlFrag,F frag){
  if (isSinglePane) {
    setRightFragmentSinglePane(containerId,controlFrag,frag,false);
  }
 else {
    setRightFragmentMultiPane(containerId,controlFrag,frag,false);
  }
}
Program: 188073
Project: 188073
Buggy source:
private void setRightFragmentSinglePane(int containerId,ControlFragment controlFrag,ThingListFragment<?> rightFrag,boolean removeLeft){
  ThingListFragment<?> current=getThingListFragment();
  if (!Arguments.areEqual(current,rightFrag)) {
    FragmentTransaction ft=getSupportFragmentManager().beginTransaction();
    ft.add(controlFrag,CONTROL_FRAGMENT_TAG);
    if (removeLeft) {
      removeFragment(ft,LEFT_FRAGMENT_TAG);
    }
    ft.replace(containerId,rightFrag,RIGHT_FRAGMENT_TAG);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN | FragmentTransaction.TRANSIT_FRAGMENT_CLOSE);
    ft.commitAllowingStateLoss();
  }
  refreshActionBar(controlFrag);
}

Fixed version (ground truth):
private <F extends Fragment & ComparableFragment>void setRightFragmentSinglePane(int containerId,ControlFragment controlFrag,F frag,boolean removeLeft){
  if (!Objects.fragmentEquals(frag,getRightComparableFragment())) {
    FragmentTransaction ft=getSupportFragmentManager().beginTransaction();
    ft.add(controlFrag,CONTROL_FRAGMENT_TAG);
    if (removeLeft) {
      removeFragment(ft,LEFT_FRAGMENT_TAG);
    }
    ft.replace(containerId,frag,RIGHT_FRAGMENT_TAG);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN | FragmentTransaction.TRANSIT_FRAGMENT_CLOSE);
    ft.commitAllowingStateLoss();
  }
  refreshActionBar(controlFrag);
}