nus-yam/ex-repair huggingface dataset:
Program: 7973
Project: 7973
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  if (item.getItemId() == R.id.fixed) {
    item.setChecked(!item.isChecked());
    if (item.isChecked()) {
      adapter.setPageCount(3);
      tabs.setTabMode(TabLayout.MODE_FIXED);
    }
 else {
      adapter.setPageCount(10);
      tabs.setTabMode(TabLayout.MODE_SCROLLABLE);
    }
    adapter.notifyDataSetChanged();
    tabs.setTabsFromPagerAdapter(adapter);
    return (true);
  }
  return (super.onOptionsItemSelected(item));
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  if (item.getItemId() == R.id.fixed) {
    item.setChecked(!item.isChecked());
    if (item.isChecked()) {
      adapter.setPageCount(3);
      tabs.setTabMode(TabLayout.MODE_FIXED);
    }
 else {
      adapter.setPageCount(10);
      tabs.setTabMode(TabLayout.MODE_SCROLLABLE);
    }
    adapter.notifyDataSetChanged();
    if (pager.getCurrentItem() >= 3) {
      pager.setCurrentItem(2);
    }
    return (true);
  }
  return (super.onOptionsItemSelected(item));
}
Program: 7974
Project: 7974
Buggy source:
void setVideos(Cursor c){
  if (c == null) {
    videos=null;
    notifyDataSetChanged();
  }
 else {
    ArrayList<Video> temp=new ArrayList<>();
    c.moveToFirst();
    while (c.moveToNext()) {
      temp.add(new Video(c));
    }
    if (videos == null) {
      videos=new ArrayList<>();
    }
    sortAndApply(temp);
  }
}

Fixed version (ground truth):
void setVideos(Cursor c){
  if (c == null) {
    videos=null;
    notifyDataSetChanged();
  }
 else {
    ArrayList<Video> temp=new ArrayList<>();
    while (c.moveToNext()) {
      temp.add(new Video(c));
    }
    if (videos == null) {
      videos=new ArrayList<>();
    }
    sortAndApply(temp);
  }
}
Program: 7975
Project: 7975
Buggy source:
@Override public boolean onKeyDown(int keyCode,KeyEvent event){
  if (event.getRepeatCount() == 0) {
    if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) {
      int position=adapter.getCheckedPosition();
      if (position >= 0) {
        Uri videoUri=adapter.getVideoUri(position);
        if (event.isAltPressed()) {
          playVideo(videoUri);
        }
 else         if (event.isCtrlPressed()) {
          showLargeThumbnail(videoUri);
        }
        return (true);
      }
    }
 else     if (keyCode == KeyEvent.KEYCODE_SLASH && event.isAltPressed() && Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
      new ShortcutDialogFragment().show(getFragmentManager(),"String_Node_Str");
      return (true);
    }
  }
  return (super.onKeyDown(keyCode,event));
}

Fixed version (ground truth):
@Override public boolean onKeyDown(int keyCode,KeyEvent event){
  if (event.getRepeatCount() == 0) {
    if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) {
      int position=adapter.getCheckedPosition();
      if (position >= 0) {
        Uri videoUri=adapter.getVideoUri(position);
        if (event.isAltPressed()) {
          playVideo(videoUri);
        }
 else         if (event.isCtrlPressed()) {
          showLargeThumbnail(videoUri);
        }
        return (true);
      }
    }
 else     if (keyCode == KeyEvent.KEYCODE_SLASH && event.isMetaPressed() && Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
      new ShortcutDialogFragment().show(getFragmentManager(),"String_Node_Str");
      return (true);
    }
  }
  return (super.onKeyDown(keyCode,event));
}
Program: 7976
Project: 7976
Buggy source:
@Override public void onProvideKeyboardShortcuts(List<KeyboardShortcutGroup> data,Menu menu,int deviceId){
  super.onProvideKeyboardShortcuts(data,menu,deviceId);
  List<KeyboardShortcutInfo> shortcuts=new ArrayList<>();
  String caption=getString(R.string.menu_video);
  shortcuts.add(new KeyboardShortcutInfo(caption,KeyEvent.KEYCODE_DPAD_RIGHT,KeyEvent.META_ALT_ON));
  caption=getString(R.string.menu_thumbnail);
  shortcuts.add(new KeyboardShortcutInfo(caption,KeyEvent.KEYCODE_DPAD_RIGHT,KeyEvent.META_CTRL_ON));
  data.add(new KeyboardShortcutGroup(getString(R.string.msg_custom),shortcuts));
}

Fixed version (ground truth):
@TargetApi(Build.VERSION_CODES.N) @Override public void onProvideKeyboardShortcuts(List<KeyboardShortcutGroup> data,Menu menu,int deviceId){
  super.onProvideKeyboardShortcuts(data,menu,deviceId);
  List<KeyboardShortcutInfo> shortcuts=new ArrayList<>();
  String caption=getString(R.string.menu_video);
  shortcuts.add(new KeyboardShortcutInfo(caption,KeyEvent.KEYCODE_DPAD_RIGHT,KeyEvent.META_ALT_ON));
  caption=getString(R.string.menu_thumbnail);
  shortcuts.add(new KeyboardShortcutInfo(caption,KeyEvent.KEYCODE_DPAD_RIGHT,KeyEvent.META_CTRL_ON));
  data.add(new KeyboardShortcutGroup(getString(R.string.msg_custom),shortcuts));
}
Program: 7977
Project: 7977
Buggy source:
private void rotate(){
  int target=(getOrientation() == Configuration.ORIENTATION_LANDSCAPE ? ActivityInfo.SCREEN_ORIENTATION_PORTRAIT : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
  main.getActivity().setRequestedOrientation(target);
}

Fixed version (ground truth):
private void rotate(){
  int target=(getOrientation() == Configuration.ORIENTATION_LANDSCAPE ? ActivityInfo.SCREEN_ORIENTATION_PORTRAIT : ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
  main.getActivity().setRequestedOrientation(target);
}
Program: 7978
Project: 7978
Buggy source:
void populateWhitelist(MultiSelectListPreference whitelist){
  List<ApplicationInfo> apps=pm.getInstalledApplications(PackageManager.GET_PERMISSIONS);
  Collections.sort(apps,new ApplicationInfo.DisplayNameComparator(pm));
  ArrayList<CharSequence> displayNames=new ArrayList<CharSequence>();
  ArrayList<String> packageNames=new ArrayList<String>();
  for (  ApplicationInfo app : apps) {
    try {
      PackageInfo pkgInfo=pm.getPackageInfo(app.packageName,PackageManager.GET_PERMISSIONS);
      if (pkgInfo.requestedPermissions != null) {
        for (        String perm : pkgInfo.requestedPermissions) {
          if (SYSTEM_ALERT_WINDOW.equals(perm)) {
            displayNames.add(app.loadLabel(pm));
            packageNames.add(app.packageName);
            break;
          }
        }
      }
    }
 catch (    PackageManager.NameNotFoundException e) {
    }
  }
  whitelist.setEntries(displayNames.toArray(new CharSequence[displayNames.size()]));
  whitelist.setEntryValues(packageNames.toArray(new String[packageNames.size()]));
}

Fixed version (ground truth):
void populateWhitelist(MultiSelectListPreference whitelist){
  List<ApplicationInfo> apps=pm.getInstalledApplications(0);
  Collections.sort(apps,new ApplicationInfo.DisplayNameComparator(pm));
  ArrayList<CharSequence> displayNames=new ArrayList<CharSequence>();
  ArrayList<String> packageNames=new ArrayList<String>();
  for (  ApplicationInfo app : apps) {
    try {
      PackageInfo pkgInfo=pm.getPackageInfo(app.packageName,PackageManager.GET_PERMISSIONS);
      if (pkgInfo.requestedPermissions != null) {
        for (        String perm : pkgInfo.requestedPermissions) {
          if (SYSTEM_ALERT_WINDOW.equals(perm)) {
            displayNames.add(app.loadLabel(pm));
            packageNames.add(app.packageName);
            break;
          }
        }
      }
    }
 catch (    PackageManager.NameNotFoundException e) {
    }
  }
  whitelist.setEntries(displayNames.toArray(new CharSequence[displayNames.size()]));
  whitelist.setEntryValues(packageNames.toArray(new String[packageNames.size()]));
}
Program: 7979
Project: 7979
Buggy source:
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
  initAdapter();
  Drawable d=getResources().getDrawable(R.drawable.action_bar_background);
  getActionBar().setBackgroundDrawable(d);
  getActionBar().setSplitBackgroundDrawable(d);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
  initAdapter();
  Drawable d=getResources().getDrawable(R.drawable.action_bar_background);
  getActionBar().setBackgroundDrawable(d);
}
Program: 7980
Project: 7980
Buggy source:
void onChecked(int position,boolean isChecked){
  if (choiceMode.isSingleChoice()) {
    int checked=choiceMode.getCheckedPosition();
    if (checked >= 0) {
      RowController row=(RowController)rv.findViewHolderForPosition(checked);
      if (row != null) {
        row.setChecked(false);
      }
    }
  }
  choiceMode.setChecked(position,isChecked);
}

Fixed version (ground truth):
void onChecked(int position,boolean isChecked){
  if (choiceMode.isSingleChoice()) {
    int checked=choiceMode.getCheckedPosition();
    if (checked >= 0) {
      RowController row=(RowController)rv.findViewHolderForAdapterPosition(checked);
      if (row != null) {
        row.setChecked(false);
      }
    }
  }
  choiceMode.setChecked(position,isChecked);
}
Program: 7981
Project: 7981
Buggy source:
static void scheduleExactAlarm(Context ctxt,AlarmManager alarms,long period,boolean isDownload){
  Intent i=buildBaseIntent(ctxt).putExtra(EXTRA_PERIOD,period).putExtra(EXTRA_IS_DOWNLOAD,isDownload);
  PendingIntent pi=PendingIntent.getBroadcast(ctxt,0,i,0);
  if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1) {
    Log.e("String_Node_Str","String_Node_Str");
    alarms.setAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP,SystemClock.elapsedRealtime() + period,pi);
  }
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    alarms.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP,SystemClock.elapsedRealtime() + period,pi);
  }
 else {
    alarms.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,SystemClock.elapsedRealtime() + period,pi);
  }
}

Fixed version (ground truth):
static void scheduleExactAlarm(Context ctxt,AlarmManager alarms,long period,boolean isDownload){
  Intent i=buildBaseIntent(ctxt).putExtra(EXTRA_PERIOD,period).putExtra(EXTRA_IS_DOWNLOAD,isDownload);
  PendingIntent pi=PendingIntent.getBroadcast(ctxt,0,i,0);
  if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP_MR1) {
    Log.e("String_Node_Str","String_Node_Str");
    alarms.setAndAllowWhileIdle(AlarmManager.ELAPSED_REALTIME_WAKEUP,SystemClock.elapsedRealtime() + period,pi);
  }
 else   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    alarms.setExact(AlarmManager.ELAPSED_REALTIME_WAKEUP,SystemClock.elapsedRealtime() + period,pi);
  }
 else {
    alarms.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,SystemClock.elapsedRealtime() + period,pi);
  }
}
Program: 7982
Project: 7982
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  task=new LoadCursorTask();
  task.execute();
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  task=new LoadCursorTask().execute();
}
Program: 7983
Project: 7983
Buggy source:
public void onClick(DialogInterface di,int whichButton){
  ContentValues values=new ContentValues(2);
  AlertDialog dlg=(AlertDialog)di;
  EditText title=(EditText)dlg.findViewById(R.id.title);
  EditText value=(EditText)dlg.findViewById(R.id.value);
  values.put(DatabaseHelper.TITLE,title.getText().toString());
  values.put(DatabaseHelper.VALUE,value.getText().toString());
  task=new InsertTask();
  task.execute(values);
}

Fixed version (ground truth):
public void onClick(DialogInterface di,int whichButton){
  ContentValues values=new ContentValues(2);
  AlertDialog dlg=(AlertDialog)di;
  EditText title=(EditText)dlg.findViewById(R.id.title);
  EditText value=(EditText)dlg.findViewById(R.id.value);
  values.put(DatabaseHelper.TITLE,title.getText().toString());
  values.put(DatabaseHelper.VALUE,value.getText().toString());
  task=new InsertTask().execute(values);
}
Program: 7984
Project: 7984
Buggy source:
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  SimpleCursorAdapter adapter=new SimpleCursorAdapter(getActivity(),R.layout.row,current,new String[]{DatabaseHelper.TITLE,DatabaseHelper.VALUE},new int[]{R.id.title,R.id.value},0);
  setListAdapter(adapter);
  if (current == null) {
    db=new DatabaseHelper(getActivity());
    task=new LoadCursorTask();
    task.execute();
  }
}

Fixed version (ground truth):
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  SimpleCursorAdapter adapter=new SimpleCursorAdapter(getActivity(),R.layout.row,current,new String[]{DatabaseHelper.TITLE,DatabaseHelper.VALUE},new int[]{R.id.title,R.id.value},0);
  setListAdapter(adapter);
  if (current == null) {
    db=new DatabaseHelper(getActivity());
    task=new LoadCursorTask().execute();
  }
}
Program: 7985
Project: 7985
Buggy source:
public void onClick(DialogInterface di,int whichButton){
  ContentValues values=new ContentValues(2);
  AlertDialog dlg=(AlertDialog)di;
  EditText title=(EditText)dlg.findViewById(R.id.title);
  EditText value=(EditText)dlg.findViewById(R.id.value);
  values.put(DatabaseHelper.TITLE,title.getText().toString());
  values.put(DatabaseHelper.VALUE,value.getText().toString());
  task=new InsertTask();
  task.execute(values);
}

Fixed version (ground truth):
public void onClick(DialogInterface di,int whichButton){
  ContentValues values=new ContentValues(2);
  AlertDialog dlg=(AlertDialog)di;
  EditText title=(EditText)dlg.findViewById(R.id.title);
  EditText value=(EditText)dlg.findViewById(R.id.value);
  values.put(DatabaseHelper.TITLE,title.getText().toString());
  values.put(DatabaseHelper.VALUE,value.getText().toString());
  task=new InsertTask().execute(values);
}
Program: 7986
Project: 7986
Buggy source:
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  SimpleCursorAdapter adapter=new SimpleCursorAdapter(getActivity(),R.layout.row,current,new String[]{DatabaseHelper.TITLE,DatabaseHelper.VALUE},new int[]{R.id.title,R.id.value},0);
  setListAdapter(adapter);
  if (current == null) {
    db=new DatabaseHelper(getActivity());
    task=new LoadCursorTask();
    task.execute();
  }
}

Fixed version (ground truth):
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  SimpleCursorAdapter adapter=new SimpleCursorAdapter(getActivity(),R.layout.row,current,new String[]{DatabaseHelper.TITLE,DatabaseHelper.VALUE},new int[]{R.id.title,R.id.value},0);
  setListAdapter(adapter);
  if (current == null) {
    db=new DatabaseHelper(getActivity());
    task=new LoadCursorTask().execute();
  }
}
Program: 7987
Project: 7987
Buggy source:
public void onClick(DialogInterface di,int whichButton){
  ContentValues values=new ContentValues(2);
  AlertDialog dlg=(AlertDialog)di;
  EditText title=(EditText)dlg.findViewById(R.id.title);
  EditText value=(EditText)dlg.findViewById(R.id.value);
  values.put(DatabaseHelper.TITLE,title.getText().toString());
  values.put(DatabaseHelper.VALUE,value.getText().toString());
  task=new InsertTask();
  task.execute(values);
}

Fixed version (ground truth):
public void onClick(DialogInterface di,int whichButton){
  ContentValues values=new ContentValues(2);
  AlertDialog dlg=(AlertDialog)di;
  EditText title=(EditText)dlg.findViewById(R.id.title);
  EditText value=(EditText)dlg.findViewById(R.id.value);
  values.put(DatabaseHelper.TITLE,title.getText().toString());
  values.put(DatabaseHelper.VALUE,value.getText().toString());
  task=new InsertTask().execute(values);
}
Program: 7988
Project: 7988
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  setHasOptionsMenu(true);
  setRetainInstance(true);
  db=new DatabaseHelper(getActivity());
  task=new LoadCursorTask(getActivity().getApplicationContext());
  task.execute();
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  setHasOptionsMenu(true);
  setRetainInstance(true);
  db=new DatabaseHelper(getActivity());
  task=new LoadCursorTask(getActivity().getApplicationContext()).execute();
}
Program: 7989
Project: 7989
Buggy source:
void setVideos(Cursor videos){
  this.videos=videos;
}

Fixed version (ground truth):
void setVideos(Cursor videos){
  this.videos=videos;
  notifyDataSetChanged();
}
Program: 7990
Project: 7990
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  details=(DetailsFragment)getFragmentManager().findFragmentById(R.id.details);
  if (details == null) {
    details=new DetailsFragment();
    getFragmentManager().beginTransaction().add(android.R.id.content,details).commit();
  }
  url=getIntent().getStringExtra(EXTRA_URL);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  details=(DetailsFragment)getFragmentManager().findFragmentById(android.R.id.content);
  if (details == null) {
    details=new DetailsFragment();
    getFragmentManager().beginTransaction().add(android.R.id.content,details).commit();
  }
  url=getIntent().getStringExtra(EXTRA_URL);
}
Program: 7991
Project: 7991
Buggy source:
@Override void onChecked(int position,boolean isChecked){
  super.onChecked(position,isChecked);
  if (getCheckedCount() > 0) {
    if (activeMode == null) {
      activeMode=startActionMode(this);
    }
 else {
      updateSubtitle(activeMode);
    }
  }
 else   if (getCheckedCount() == 0 && activeMode != null) {
    activeMode.finish();
  }
}

Fixed version (ground truth):
@Override void onChecked(int position,boolean isChecked){
  super.onChecked(position,isChecked);
  if (isChecked) {
    if (activeMode == null) {
      activeMode=startActionMode(this);
    }
 else {
      updateSubtitle(activeMode);
    }
  }
 else   if (getCheckedCount() == 0 && activeMode != null) {
    activeMode.finish();
  }
}
Program: 7992
Project: 7992
Buggy source:
@Override void onChecked(int position,boolean isChecked){
  super.onChecked(position,isChecked);
  if (getCheckedCount() > 0) {
    if (activeMode == null) {
      activeMode=startActionMode(this);
    }
 else {
      updateSubtitle(activeMode);
    }
  }
 else   if (getCheckedCount() == 0 && activeMode != null) {
    activeMode.finish();
  }
}

Fixed version (ground truth):
@Override void onChecked(int position,boolean isChecked){
  super.onChecked(position,isChecked);
  if (isChecked) {
    if (activeMode == null) {
      activeMode=startActionMode(this);
    }
 else {
      updateSubtitle(activeMode);
    }
  }
 else   if (getCheckedCount() == 0 && activeMode != null) {
    activeMode.finish();
  }
}
Program: 7993
Project: 7993
Buggy source:
void setVideos(Cursor videos){
  this.videos=videos;
}

Fixed version (ground truth):
void setVideos(Cursor videos){
  this.videos=videos;
  notifyDataSetChanged();
}
Program: 7994
Project: 7994
Buggy source:
void setVideos(Cursor videos){
  this.videos=videos;
}

Fixed version (ground truth):
void setVideos(Cursor videos){
  this.videos=videos;
  notifyDataSetChanged();
}
Program: 7995
Project: 7995
Buggy source:
@Before public void init(){
  list=(ListView)main.get().findViewById(android.R.id.list);
}

Fixed version (ground truth):
@Before public void init(){
  list=(ListView)main.get().findViewById(android.R.id.list);
  main.instrumentation().setInTouchMode(true);
}
Program: 7996
Project: 7996
Buggy source:
@Before public void init(){
  LayoutInflater inflater=LayoutInflater.from(InstrumentationRegistry.getTargetContext());
  root=inflater.inflate(R.layout.add,null);
  root.measure(800,480);
  root.layout(0,0,800,480);
  field=root.findViewById(R.id.title);
}

Fixed version (ground truth):
@Before public void init(){
  InstrumentationRegistry.getInstrumentation().runOnMainSync(new Runnable(){
    @Override public void run(){
      LayoutInflater inflater=LayoutInflater.from(InstrumentationRegistry.getTargetContext());
      root=inflater.inflate(R.layout.add,null);
    }
  }
);
  root.measure(800,480);
  root.layout(0,0,800,480);
  field=root.findViewById(R.id.title);
}
Program: 7997
Project: 7997
Buggy source:
@Test public void exists(){
  Assert.assertNotNull(field);
}

Fixed version (ground truth):
@Test public void exists(){
  init();
  Assert.assertNotNull(field);
}
Program: 7998
Project: 7998
Buggy source:
@Test public void position(){
  Assert.assertEquals(0,field.getTop());
  Assert.assertEquals(0,field.getLeft());
}

Fixed version (ground truth):
@Test public void position(){
  init();
  Assert.assertEquals(0,field.getTop());
  Assert.assertEquals(0,field.getLeft());
}
Program: 7999
Project: 7999
Buggy source:
private void showHelp(){
  if (sidebar != null) {
    openSidebar();
    if (help == null) {
      help=SimpleContentFragment.newInstance(FILE_HELP);
    }
    getFragmentManager().beginTransaction().addToBackStack(null).replace(R.id.sidebar,help).commit();
  }
 else {
    Intent i=new Intent(this,SimpleContentActivity.class);
    i.putExtra(SimpleContentActivity.EXTRA_FILE,FILE_HELP);
    startActivity(i);
  }
}

Fixed version (ground truth):
private void showHelp(){
  if (sidebar != null) {
    openSidebar();
    if (help == null) {
      help=SimpleContentFragment.newInstance(FILE_HELP);
    }
    getFragmentManager().beginTransaction().addToBackStack(null).replace(R.id.sidebar,help,HELP).commit();
  }
 else {
    Intent i=new Intent(this,SimpleContentActivity.class);
    i.putExtra(SimpleContentActivity.EXTRA_FILE,FILE_HELP);
    startActivity(i);
  }
}
Program: 8000
Project: 8000
Buggy source:
private void showAbout(){
  if (sidebar != null) {
    openSidebar();
    if (about == null) {
      about=SimpleContentFragment.newInstance(FILE_ABOUT);
    }
    getFragmentManager().beginTransaction().addToBackStack(null).replace(R.id.sidebar,about).commit();
  }
 else {
    Intent i=new Intent(this,SimpleContentActivity.class);
    i.putExtra(SimpleContentActivity.EXTRA_FILE,FILE_ABOUT);
    startActivity(i);
  }
}

Fixed version (ground truth):
private void showAbout(){
  if (sidebar != null) {
    openSidebar();
    if (about == null) {
      about=SimpleContentFragment.newInstance(FILE_ABOUT);
    }
    getFragmentManager().beginTransaction().addToBackStack(null).replace(R.id.sidebar,about,ABOUT).commit();
  }
 else {
    Intent i=new Intent(this,SimpleContentActivity.class);
    i.putExtra(SimpleContentActivity.EXTRA_FILE,FILE_ABOUT);
    startActivity(i);
  }
}
Program: 8001
Project: 8001
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setupStrictMode();
  setContentView(R.layout.main);
  pager=(ViewPager)findViewById(R.id.pager);
  ModelFragment mfrag=(ModelFragment)getFragmentManager().findFragmentByTag(MODEL);
  if (mfrag == null) {
    getFragmentManager().beginTransaction().add(new ModelFragment(),MODEL).commit();
  }
 else   if (mfrag.getBook() != null) {
    setupPager(mfrag.getBook());
  }
  getActionBar().setHomeButtonEnabled(true);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setupStrictMode();
  setContentView(R.layout.main);
  pager=(ViewPager)findViewById(R.id.pager);
  getActionBar().setHomeButtonEnabled(true);
}
Program: 8002
Project: 8002
Buggy source:
@Override public void onResume(){
  super.onResume();
  EventBus.getDefault().register(this);
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  EventBus.getDefault().register(this);
  if (adapter == null) {
    ModelFragment mfrag=(ModelFragment)getFragmentManager().findFragmentByTag(MODEL);
    if (mfrag == null) {
      getFragmentManager().beginTransaction().add(new ModelFragment(),MODEL).commit();
    }
 else     if (mfrag.getBook() != null) {
      setupPager(mfrag.getBook());
    }
  }
}
Program: 8003
Project: 8003
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setupStrictMode();
  setContentView(R.layout.main);
  pager=(ViewPager)findViewById(R.id.pager);
  mfrag=(ModelFragment)getFragmentManager().findFragmentByTag(MODEL);
  if (mfrag == null) {
    mfrag=new ModelFragment();
    getFragmentManager().beginTransaction().add(mfrag,MODEL).commit();
  }
 else   if (mfrag.getBook() != null) {
    setupPager(mfrag.getBook());
  }
  getActionBar().setHomeButtonEnabled(true);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setupStrictMode();
  setContentView(R.layout.main);
  pager=(ViewPager)findViewById(R.id.pager);
  getActionBar().setHomeButtonEnabled(true);
}
Program: 8004
Project: 8004
Buggy source:
@Override public void onResume(){
  super.onResume();
  EventBus.getDefault().register(this);
  if (mfrag.getPrefs() != null) {
    pager.setKeepScreenOn(mfrag.getPrefs().getBoolean(PREF_KEEP_SCREEN_ON,false));
  }
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  EventBus.getDefault().register(this);
  if (adapter == null) {
    mfrag=(ModelFragment)getFragmentManager().findFragmentByTag(MODEL);
    if (mfrag == null) {
      mfrag=new ModelFragment();
      getFragmentManager().beginTransaction().add(mfrag,MODEL).commit();
    }
 else     if (mfrag.getBook() != null) {
      setupPager(mfrag.getBook());
    }
  }
  if (mfrag.getPrefs() != null) {
    pager.setKeepScreenOn(mfrag.getPrefs().getBoolean(PREF_KEEP_SCREEN_ON,false));
  }
}
Program: 8005
Project: 8005
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setupStrictMode();
  setContentView(R.layout.main);
  pager=(ViewPager)findViewById(R.id.pager);
  mfrag=(ModelFragment)getFragmentManager().findFragmentByTag(MODEL);
  if (mfrag == null) {
    mfrag=new ModelFragment();
    getFragmentManager().beginTransaction().add(mfrag,MODEL).commit();
  }
 else   if (mfrag.getBook() != null) {
    setupPager(mfrag.getBook());
  }
  getActionBar().setHomeButtonEnabled(true);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setupStrictMode();
  setContentView(R.layout.main);
  pager=(ViewPager)findViewById(R.id.pager);
  getActionBar().setHomeButtonEnabled(true);
}
Program: 8006
Project: 8006
Buggy source:
@Override public void onResume(){
  super.onResume();
  EventBus.getDefault().register(this);
  if (mfrag.getPrefs() != null) {
    pager.setKeepScreenOn(mfrag.getPrefs().getBoolean(PREF_KEEP_SCREEN_ON,false));
  }
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  EventBus.getDefault().register(this);
  if (adapter == null) {
    mfrag=(ModelFragment)getFragmentManager().findFragmentByTag(MODEL);
    if (mfrag == null) {
      mfrag=new ModelFragment();
      getFragmentManager().beginTransaction().add(mfrag,MODEL).commit();
    }
 else     if (mfrag.getBook() != null) {
      setupPager(mfrag.getBook());
    }
  }
  if (mfrag.getPrefs() != null) {
    pager.setKeepScreenOn(mfrag.getPrefs().getBoolean(PREF_KEEP_SCREEN_ON,false));
  }
}
Program: 8007
Project: 8007
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setupStrictMode();
  setContentView(R.layout.main);
  pager=(ViewPager)findViewById(R.id.pager);
  mfrag=(ModelFragment)getFragmentManager().findFragmentByTag(MODEL);
  if (mfrag == null) {
    mfrag=new ModelFragment();
    getFragmentManager().beginTransaction().add(mfrag,MODEL).commit();
  }
 else   if (mfrag.getBook() != null) {
    setupPager(mfrag.getBook());
  }
  getActionBar().setHomeButtonEnabled(true);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setupStrictMode();
  setContentView(R.layout.main);
  pager=(ViewPager)findViewById(R.id.pager);
  getActionBar().setHomeButtonEnabled(true);
}
Program: 8008
Project: 8008
Buggy source:
@Override public void onResume(){
  super.onResume();
  EventBus.getDefault().register(this);
  if (mfrag.getPrefs() != null) {
    pager.setKeepScreenOn(mfrag.getPrefs().getBoolean(PREF_KEEP_SCREEN_ON,false));
  }
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  EventBus.getDefault().register(this);
  if (adapter == null) {
    mfrag=(ModelFragment)getFragmentManager().findFragmentByTag(MODEL);
    if (mfrag == null) {
      mfrag=new ModelFragment();
      getFragmentManager().beginTransaction().add(mfrag,MODEL).commit();
    }
 else     if (mfrag.getBook() != null) {
      setupPager(mfrag.getBook());
    }
  }
  if (mfrag.getPrefs() != null) {
    pager.setKeepScreenOn(mfrag.getPrefs().getBoolean(PREF_KEEP_SCREEN_ON,false));
  }
}
Program: 8009
Project: 8009
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setupStrictMode();
  setContentView(R.layout.main);
  pager=(ViewPager)findViewById(R.id.pager);
  mfrag=(ModelFragment)getFragmentManager().findFragmentByTag(MODEL);
  if (mfrag == null) {
    mfrag=new ModelFragment();
    getFragmentManager().beginTransaction().add(mfrag,MODEL).commit();
  }
 else   if (mfrag.getBook() != null) {
    setupPager(mfrag.getBook());
  }
  getActionBar().setHomeButtonEnabled(true);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setupStrictMode();
  setContentView(R.layout.main);
  pager=(ViewPager)findViewById(R.id.pager);
  getActionBar().setHomeButtonEnabled(true);
}
Program: 8010
Project: 8010
Buggy source:
@Override public void onResume(){
  super.onResume();
  EventBus.getDefault().register(this);
  if (mfrag.getPrefs() != null) {
    pager.setKeepScreenOn(mfrag.getPrefs().getBoolean(PREF_KEEP_SCREEN_ON,false));
  }
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  EventBus.getDefault().register(this);
  if (adapter == null) {
    mfrag=(ModelFragment)getFragmentManager().findFragmentByTag(MODEL);
    if (mfrag == null) {
      mfrag=new ModelFragment();
      getFragmentManager().beginTransaction().add(mfrag,MODEL).commit();
    }
 else     if (mfrag.getBook() != null) {
      setupPager(mfrag.getBook());
    }
  }
  if (mfrag.getPrefs() != null) {
    pager.setKeepScreenOn(mfrag.getPrefs().getBoolean(PREF_KEEP_SCREEN_ON,false));
  }
}
Program: 8011
Project: 8011
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setupStrictMode();
  setContentView(R.layout.main);
  pager=(ViewPager)findViewById(R.id.pager);
  mfrag=(ModelFragment)getFragmentManager().findFragmentByTag(MODEL);
  if (mfrag == null) {
    mfrag=new ModelFragment();
    getFragmentManager().beginTransaction().add(mfrag,MODEL).commit();
  }
 else   if (mfrag.getBook() != null) {
    setupPager(mfrag.getBook());
  }
  getActionBar().setHomeButtonEnabled(true);
  UpdateReceiver.scheduleAlarm(this);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setupStrictMode();
  setContentView(R.layout.main);
  pager=(ViewPager)findViewById(R.id.pager);
  getActionBar().setHomeButtonEnabled(true);
  UpdateReceiver.scheduleAlarm(this);
}
Program: 8012
Project: 8012
Buggy source:
@Override public void onResume(){
  super.onResume();
  EventBus.getDefault().register(this);
  if (mfrag.getPrefs() != null) {
    pager.setKeepScreenOn(mfrag.getPrefs().getBoolean(PREF_KEEP_SCREEN_ON,false));
  }
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  EventBus.getDefault().register(this);
  if (adapter == null) {
    mfrag=(ModelFragment)getFragmentManager().findFragmentByTag(MODEL);
    if (mfrag == null) {
      mfrag=new ModelFragment();
      getFragmentManager().beginTransaction().add(mfrag,MODEL).commit();
    }
 else     if (mfrag.getBook() != null) {
      setupPager(mfrag.getBook());
    }
  }
  if (mfrag.getPrefs() != null) {
    pager.setKeepScreenOn(mfrag.getPrefs().getBoolean(PREF_KEEP_SCREEN_ON,false));
  }
}
Program: 8013
Project: 8013
Buggy source:
public void onEvent(BookUpdatedEvent event){
  NotificationCompat.Builder builder=new NotificationCompat.Builder(this);
  Intent toLaunch=new Intent(this,EmPubLiteActivity.class);
  PendingIntent pi=PendingIntent.getActivity(this,0,toLaunch,0);
  builder.setAutoCancel(true).setContentIntent(pi).setContentTitle(getString(R.string.update_complete)).setContentText(getString(R.string.update_desc)).setSmallIcon(android.R.drawable.stat_sys_download_done).setTicker(getString(R.string.update_complete));
  NotificationManager mgr=((NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE));
  mgr.notify(NOTIFY_ID,builder.build());
}

Fixed version (ground truth):
public void onEvent(NoSubscriberEvent event){
  NotificationCompat.Builder builder=new NotificationCompat.Builder(this);
  Intent toLaunch=new Intent(this,EmPubLiteActivity.class);
  PendingIntent pi=PendingIntent.getActivity(this,0,toLaunch,0);
  builder.setAutoCancel(true).setContentIntent(pi).setContentTitle(getString(R.string.update_complete)).setContentText(getString(R.string.update_desc)).setSmallIcon(android.R.drawable.stat_sys_download_done).setTicker(getString(R.string.update_complete));
  NotificationManager mgr=((NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE));
  mgr.notify(NOTIFY_ID,builder.build());
}
Program: 8014
Project: 8014
Buggy source:
@Override protected void doWakefulWork(Intent intent){
  try {
    String url=getUpdateUrl();
    if (url != null) {
      File book=download(url);
      File updateDir=new File(getFilesDir(),UPDATE_BASEDIR);
      updateDir.mkdirs();
      unzip(book,updateDir);
      book.delete();
      EventBus.getDefault().register(this,0);
      EventBus.getDefault().post(new BookUpdatedEvent());
      EventBus.getDefault().unregister(this);
    }
  }
 catch (  Exception e) {
    Log.e(getClass().getSimpleName(),"String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override protected void doWakefulWork(Intent intent){
  try {
    String url=getUpdateUrl();
    if (url != null) {
      File book=download(url);
      File updateDir=new File(getFilesDir(),UPDATE_BASEDIR);
      updateDir.mkdirs();
      unzip(book,updateDir);
      book.delete();
      EventBus.getDefault().register(this);
      EventBus.getDefault().post(new BookUpdatedEvent());
      EventBus.getDefault().unregister(this);
    }
  }
 catch (  Exception e) {
    Log.e(getClass().getSimpleName(),"String_Node_Str",e);
  }
}
Program: 8015
Project: 8015
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setupStrictMode();
  setContentView(R.layout.main);
  pager=(ViewPager)findViewById(R.id.pager);
  mfrag=(ModelFragment)getFragmentManager().findFragmentByTag(MODEL);
  if (mfrag == null) {
    mfrag=new ModelFragment();
    getFragmentManager().beginTransaction().add(mfrag,MODEL).commit();
  }
 else   if (mfrag.getBook() != null) {
    setupPager(mfrag.getBook());
  }
  getActionBar().setHomeButtonEnabled(true);
  UpdateReceiver.scheduleAlarm(this);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setupStrictMode();
  setContentView(R.layout.main);
  pager=(ViewPager)findViewById(R.id.pager);
  getActionBar().setHomeButtonEnabled(true);
  UpdateReceiver.scheduleAlarm(this);
}
Program: 8016
Project: 8016
Buggy source:
@Override public void onResume(){
  super.onResume();
  EventBus.getDefault().register(this);
  if (mfrag.getPrefs() != null) {
    pager.setKeepScreenOn(mfrag.getPrefs().getBoolean(PREF_KEEP_SCREEN_ON,false));
  }
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  EventBus.getDefault().register(this);
  if (adapter == null) {
    mfrag=(ModelFragment)getFragmentManager().findFragmentByTag(MODEL);
    if (mfrag == null) {
      mfrag=new ModelFragment();
      getFragmentManager().beginTransaction().add(mfrag,MODEL).commit();
    }
 else     if (mfrag.getBook() != null) {
      setupPager(mfrag.getBook());
    }
  }
  if (mfrag.getPrefs() != null) {
    pager.setKeepScreenOn(mfrag.getPrefs().getBoolean(PREF_KEEP_SCREEN_ON,false));
  }
}
Program: 8017
Project: 8017
Buggy source:
@Override public void onAttach(Activity host){
  super.onAttach(host);
  EventBus.getDefault().register(this,1);
  if (contents == null) {
    new LoadThread(host).start();
  }
}

Fixed version (ground truth):
@Override public void onAttach(Activity host){
  super.onAttach(host);
  EventBus.getDefault().register(this);
  if (contents == null) {
    new LoadThread(host).start();
  }
}
Program: 8018
Project: 8018
Buggy source:
public void onEvent(BookUpdatedEvent event){
  if (getActivity() != null) {
    new LoadThread(getActivity()).start();
    EventBus.getDefault().cancelEventDelivery(event);
  }
}

Fixed version (ground truth):
public void onEvent(BookUpdatedEvent event){
  if (getActivity() != null) {
    new LoadThread(getActivity()).start();
  }
}
Program: 8019
Project: 8019
Buggy source:
public void onEvent(BookUpdatedEvent event){
  NotificationCompat.Builder builder=new NotificationCompat.Builder(this);
  Intent toLaunch=new Intent(this,EmPubLiteActivity.class);
  PendingIntent pi=PendingIntent.getActivity(this,0,toLaunch,0);
  builder.setAutoCancel(true).setContentIntent(pi).setContentTitle(getString(R.string.update_complete)).setContentText(getString(R.string.update_desc)).setSmallIcon(android.R.drawable.stat_sys_download_done).setTicker(getString(R.string.update_complete));
  NotificationManager mgr=((NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE));
  mgr.notify(NOTIFY_ID,builder.build());
}

Fixed version (ground truth):
public void onEvent(NoSubscriberEvent event){
  NotificationCompat.Builder builder=new NotificationCompat.Builder(this);
  Intent toLaunch=new Intent(this,EmPubLiteActivity.class);
  PendingIntent pi=PendingIntent.getActivity(this,0,toLaunch,0);
  builder.setAutoCancel(true).setContentIntent(pi).setContentTitle(getString(R.string.update_complete)).setContentText(getString(R.string.update_desc)).setSmallIcon(android.R.drawable.stat_sys_download_done).setTicker(getString(R.string.update_complete));
  NotificationManager mgr=((NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE));
  mgr.notify(NOTIFY_ID,builder.build());
}
Program: 8020
Project: 8020
Buggy source:
@Override protected void doWakefulWork(Intent intent){
  try {
    String url=getUpdateUrl();
    if (url != null) {
      File book=download(url);
      File updateDir=new File(getFilesDir(),UPDATE_BASEDIR);
      updateDir.mkdirs();
      unzip(book,updateDir);
      book.delete();
      EventBus.getDefault().register(this,0);
      EventBus.getDefault().post(new BookUpdatedEvent());
      EventBus.getDefault().unregister(this);
    }
  }
 catch (  Exception e) {
    Log.e(getClass().getSimpleName(),"String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override protected void doWakefulWork(Intent intent){
  try {
    String url=getUpdateUrl();
    if (url != null) {
      File book=download(url);
      File updateDir=new File(getFilesDir(),UPDATE_BASEDIR);
      updateDir.mkdirs();
      unzip(book,updateDir);
      book.delete();
      EventBus.getDefault().register(this);
      EventBus.getDefault().post(new BookUpdatedEvent());
      EventBus.getDefault().unregister(this);
    }
  }
 catch (  Exception e) {
    Log.e(getClass().getSimpleName(),"String_Node_Str",e);
  }
}
Program: 8021
Project: 8021
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setupStrictMode();
  setContentView(R.layout.main);
  pager=(ViewPager)findViewById(R.id.pager);
  sidebar=findViewById(R.id.sidebar);
  divider=findViewById(R.id.divider);
  getFragmentManager().addOnBackStackChangedListener(this);
  mfrag=(ModelFragment)getFragmentManager().findFragmentByTag(MODEL);
  if (mfrag == null) {
    mfrag=new ModelFragment();
    getFragmentManager().beginTransaction().add(mfrag,MODEL).commit();
  }
 else   if (mfrag.getBook() != null) {
    setupPager(mfrag.getBook());
  }
  help=(SimpleContentFragment)getFragmentManager().findFragmentByTag(HELP);
  about=(SimpleContentFragment)getFragmentManager().findFragmentByTag(ABOUT);
  getActionBar().setHomeButtonEnabled(true);
  UpdateReceiver.scheduleAlarm(this);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setupStrictMode();
  setContentView(R.layout.main);
  pager=(ViewPager)findViewById(R.id.pager);
  sidebar=findViewById(R.id.sidebar);
  divider=findViewById(R.id.divider);
  getFragmentManager().addOnBackStackChangedListener(this);
  help=(SimpleContentFragment)getFragmentManager().findFragmentByTag(HELP);
  about=(SimpleContentFragment)getFragmentManager().findFragmentByTag(ABOUT);
  getActionBar().setHomeButtonEnabled(true);
  UpdateReceiver.scheduleAlarm(this);
}
Program: 8022
Project: 8022
Buggy source:
@Override public void onResume(){
  super.onResume();
  EventBus.getDefault().register(this);
  if (mfrag.getPrefs() != null) {
    pager.setKeepScreenOn(mfrag.getPrefs().getBoolean(PREF_KEEP_SCREEN_ON,false));
  }
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  EventBus.getDefault().register(this);
  if (adapter == null) {
    mfrag=(ModelFragment)getFragmentManager().findFragmentByTag(MODEL);
    if (mfrag == null) {
      mfrag=new ModelFragment();
      getFragmentManager().beginTransaction().add(mfrag,MODEL).commit();
    }
 else     if (mfrag.getBook() != null) {
      setupPager(mfrag.getBook());
    }
  }
  if (mfrag.getPrefs() != null) {
    pager.setKeepScreenOn(mfrag.getPrefs().getBoolean(PREF_KEEP_SCREEN_ON,false));
  }
}
Program: 8023
Project: 8023
Buggy source:
@Override public void onAttach(Activity host){
  super.onAttach(host);
  EventBus.getDefault().register(this,1);
  if (contents == null) {
    new LoadThread(host).start();
  }
}

Fixed version (ground truth):
@Override public void onAttach(Activity host){
  super.onAttach(host);
  EventBus.getDefault().register(this);
  if (contents == null) {
    new LoadThread(host).start();
  }
}
Program: 8024
Project: 8024
Buggy source:
public void onEvent(BookUpdatedEvent event){
  if (getActivity() != null) {
    new LoadThread(getActivity()).start();
    EventBus.getDefault().cancelEventDelivery(event);
  }
}

Fixed version (ground truth):
public void onEvent(BookUpdatedEvent event){
  if (getActivity() != null) {
    new LoadThread(getActivity()).start();
  }
}
Program: 8025
Project: 8025
Buggy source:
@Override protected Void doInBackground(ContentValues... values){
  db.getWritableDatabase().insert(DatabaseHelper.TABLE,DatabaseHelper.TITLE,values[0]);
  constantsCursor=doQuery();
  constantsCursor.getCount();
  return (null);
}

Fixed version (ground truth):
@Override protected Cursor doInBackground(ContentValues... values){
  db.getWritableDatabase().insert(DatabaseHelper.TABLE,DatabaseHelper.TITLE,values[0]);
  return (doQuery());
}
Program: 8026
Project: 8026
Buggy source:
private Cursor doQuery(){
  String query=String.format("String_Node_Str",DatabaseHelper.TITLE,DatabaseHelper.VALUE,DatabaseHelper.TABLE,DatabaseHelper.TITLE);
  return (db.getReadableDatabase().rawQuery(query,null));
}

Fixed version (ground truth):
protected Cursor doQuery(){
  Cursor result=db.getReadableDatabase().query(DatabaseHelper.TABLE,new String[]{"String_Node_Str",DatabaseHelper.TITLE,DatabaseHelper.VALUE},null,null,null,null,DatabaseHelper.TITLE);
  result.getCount();
  return (result);
}
Program: 8027
Project: 8027
Buggy source:
@Override public void onPostExecute(Void arg0){
  ((CursorAdapter)getListAdapter()).changeCursor(constantsCursor);
}

Fixed version (ground truth):
@Override public void onPostExecute(Cursor result){
  ((CursorAdapter)getListAdapter()).changeCursor(result);
}
Program: 8028
Project: 8028
Buggy source:
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  db=new DatabaseHelper(getActivity());
  new LoadCursorTask().execute();
}

Fixed version (ground truth):
@Override public void onViewCreated(View view,Bundle savedInstanceState){
  super.onViewCreated(view,savedInstanceState);
  SimpleCursorAdapter adapter=new SimpleCursorAdapter(getActivity(),R.layout.row,current,new String[]{DatabaseHelper.TITLE,DatabaseHelper.VALUE},new int[]{R.id.title,R.id.value},0);
  setListAdapter(adapter);
  if (current == null) {
    db=new DatabaseHelper(getActivity());
    new LoadCursorTask().execute();
  }
}
Program: 8029
Project: 8029
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.add:
    add();
  return (true);
}
return (super.onOptionsItemSelected(item));
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  if (item.getItemId() == R.id.add) {
    add();
    return (true);
  }
  return (super.onOptionsItemSelected(item));
}
Program: 8030
Project: 8030
Buggy source:
@Override protected void onHandleIntent(Intent intent){
  String url=getUpdateUrl();
  if (url != null) {
    try {
      File book=download(url);
      File updateDir=new File(getFilesDir(),UPDATE_BASEDIR);
      updateDir.mkdirs();
      unzip(book,updateDir);
      book.delete();
      EventBus.getDefault().post(new BookUpdatedEvent());
    }
 catch (    Exception e) {
      Log.e(getClass().getSimpleName(),"String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@Override protected void onHandleIntent(Intent intent){
  try {
    String url=getUpdateUrl();
    if (url != null) {
      File book=download(url);
      File updateDir=new File(getFilesDir(),UPDATE_BASEDIR);
      updateDir.mkdirs();
      unzip(book,updateDir);
      book.delete();
      EventBus.getDefault().post(new BookUpdatedEvent());
    }
  }
 catch (  Exception e) {
    Log.e(getClass().getSimpleName(),"String_Node_Str",e);
  }
}
Program: 8031
Project: 8031
Buggy source:
@Override protected void doWakefulWork(Intent intent){
  String url=getUpdateUrl();
  if (url != null) {
    try {
      File book=download(url);
      File updateDir=new File(getFilesDir(),UPDATE_BASEDIR);
      updateDir.mkdirs();
      unzip(book,updateDir);
      book.delete();
      EventBus.getDefault().post(new BookUpdatedEvent());
    }
 catch (    Exception e) {
      Log.e(getClass().getSimpleName(),"String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@Override protected void doWakefulWork(Intent intent){
  try {
    String url=getUpdateUrl();
    if (url != null) {
      File book=download(url);
      File updateDir=new File(getFilesDir(),UPDATE_BASEDIR);
      updateDir.mkdirs();
      unzip(book,updateDir);
      book.delete();
      EventBus.getDefault().post(new BookUpdatedEvent());
    }
  }
 catch (  Exception e) {
    Log.e(getClass().getSimpleName(),"String_Node_Str",e);
  }
}
Program: 8032
Project: 8032
Buggy source:
@Override protected void doWakefulWork(Intent intent){
  String url=getUpdateUrl();
  if (url != null) {
    try {
      File book=download(url);
      File updateDir=new File(getFilesDir(),UPDATE_BASEDIR);
      updateDir.mkdirs();
      unzip(book,updateDir);
      book.delete();
      EventBus.getDefault().register(this,0);
      EventBus.getDefault().post(new BookUpdatedEvent());
      EventBus.getDefault().unregister(this);
    }
 catch (    Exception e) {
      Log.e(getClass().getSimpleName(),"String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@Override protected void doWakefulWork(Intent intent){
  try {
    String url=getUpdateUrl();
    if (url != null) {
      File book=download(url);
      File updateDir=new File(getFilesDir(),UPDATE_BASEDIR);
      updateDir.mkdirs();
      unzip(book,updateDir);
      book.delete();
      EventBus.getDefault().register(this,0);
      EventBus.getDefault().post(new BookUpdatedEvent());
      EventBus.getDefault().unregister(this);
    }
  }
 catch (  Exception e) {
    Log.e(getClass().getSimpleName(),"String_Node_Str",e);
  }
}