nus-yam/ex-repair huggingface dataset:
Program: 26228
Project: 26228
Buggy source:
@Override void fetchEvents(){
  setIsLoading(true);
  if (Utils.isOnline(getActivity())) {
    loadFirstPage();
  }
 else {
    modelCache.getAsync(mCacheKey,false,new ModelCache.CacheListener(){
      @Override public void onGet(      Object item){
        if (checkValidCache(item)) {
          ArrayList<Event> events=(ArrayList<Event>)item;
          mAdapter.addAll(events);
          setIsLoading(false);
          Snackbar snackbar=Snackbar.make(getView(),R.string.cached_content,Snackbar.LENGTH_SHORT);
          ColoredSnackBar.info(snackbar).show();
        }
 else {
          modelCache.removeAsync(mCacheKey);
          onNotFound();
        }
      }
      @Override public void onNotFound(      String key){
        onNotFound();
      }
      private void onNotFound(){
        setIsLoading(false);
        showError(R.string.offline_alert);
      }
    }
);
  }
}

Fixed version (ground truth):
@Override void fetchEvents(){
  setIsLoading(true);
  if (Utils.isOnline(getActivity())) {
    loadFirstPage();
  }
 else {
    modelCache.getAsync(mCacheKey,false,new ModelCache.CacheListener(){
      @Override public void onGet(      Object item){
        if (checkValidCache(item)) {
          ArrayList<Event> events=(ArrayList<Event>)item;
          mAdapter.addAll(events);
          setIsLoading(false);
          Snackbar.make(getView(),R.string.cached_content,Snackbar.LENGTH_SHORT).show();
        }
 else {
          modelCache.removeAsync(mCacheKey);
          onNotFound();
        }
      }
      @Override public void onNotFound(      String key){
        onNotFound();
      }
      private void onNotFound(){
        setIsLoading(false);
        showError(R.string.offline_alert);
      }
    }
);
  }
}
Program: 26229
Project: 26229
Buggy source:
@Override public void onGet(Object item){
  if (checkValidCache(item)) {
    ArrayList<Event> events=(ArrayList<Event>)item;
    mAdapter.addAll(events);
    setIsLoading(false);
    Snackbar snackbar=Snackbar.make(getView(),R.string.cached_content,Snackbar.LENGTH_SHORT);
    ColoredSnackBar.info(snackbar).show();
  }
 else {
    modelCache.removeAsync(mCacheKey);
    onNotFound();
  }
}

Fixed version (ground truth):
@Override public void onGet(Object item){
  if (checkValidCache(item)) {
    ArrayList<Event> events=(ArrayList<Event>)item;
    mAdapter.addAll(events);
    setIsLoading(false);
    Snackbar.make(getView(),R.string.cached_content,Snackbar.LENGTH_SHORT).show();
  }
 else {
    modelCache.removeAsync(mCacheKey);
    onNotFound();
  }
}
Program: 26230
Project: 26230
Buggy source:
public PlusImageUrlConverter(PlusApi plusApi){
  this.plusApi=plusApi;
  ;
}

Fixed version (ground truth):
public PlusImageUrlConverter(PlusApi plusApi){
  this.plusApi=plusApi;
}
Program: 26231
Project: 26231
Buggy source:
private void onEventDetailsLoaded(final EventFullDetails eventFullDetails){
  if (getActivity() == null) {
    return;
  }
  if (getActivity() instanceof Callbacks) {
    ((Callbacks)getActivity()).onEventLoaded(eventFullDetails);
  }
  mEvent=eventFullDetails;
  getActivity().supportInvalidateOptionsMenu();
  updateWithDetails(eventFullDetails);
  App.from(getContext()).getModelCache().getAsync(ModelCache.KEY_CHAPTER_LIST_HUB,new ModelCache.CacheListener(){
    @Override public void onGet(    Object item){
      mDirectory=(Directory)item;
      updateGroupDetails(mDirectory.getGroupById(eventFullDetails.getChapter()));
    }
    @Override public void onNotFound(    String key){
      if (Utils.isOnline(getActivity())) {
        App.from(getContext()).getGdgXHub().getDirectory().enqueue(new Callback<Directory>(){
          @Override public void onSuccess(          Directory directory){
            mDirectory=directory;
            updateGroupDetails(mDirectory.getGroupById(eventFullDetails.getChapter()));
          }
          @Override public void onError(){
            showError(R.string.fetch_chapters_failed);
          }
          @Override public void onNetworkFailure(          Throwable error){
            showError(R.string.offline_alert);
          }
        }
);
      }
 else {
        showError(R.string.offline_alert);
      }
    }
  }
);
}

Fixed version (ground truth):
private void onEventDetailsLoaded(final EventFullDetails eventFullDetails){
  if (getActivity() == null) {
    return;
  }
  if (getActivity() instanceof Callbacks) {
    ((Callbacks)getActivity()).onEventLoaded(eventFullDetails);
  }
  mEvent=eventFullDetails;
  getActivity().supportInvalidateOptionsMenu();
  updateWithDetails(eventFullDetails);
  ModelCache modelCache=App.from(getContext()).getModelCache();
  modelCache.getAsync(ModelCache.KEY_CHAPTER_LIST_HUB,new ModelCache.CacheListener(){
    @Override public void onGet(    Object item){
      mDirectory=(Directory)item;
      updateGroupDetails(mDirectory.getGroupById(eventFullDetails.getChapter()));
    }
    @Override public void onNotFound(    String key){
      if (Utils.isOnline(getActivity())) {
        App.from(getContext()).getGdgXHub().getDirectory().enqueue(new Callback<Directory>(){
          @Override public void onSuccess(          Directory directory){
            mDirectory=directory;
            updateGroupDetails(mDirectory.getGroupById(eventFullDetails.getChapter()));
          }
          @Override public void onError(){
            showError(R.string.fetch_chapters_failed);
          }
          @Override public void onNetworkFailure(          Throwable error){
            showError(R.string.offline_alert);
          }
        }
);
      }
 else {
        showError(R.string.offline_alert);
      }
    }
  }
);
}
Program: 26232
Project: 26232
Buggy source:
public static ChapterSelectDialog newInstance(@Nullable Chapter selectedChapter){
  ChapterSelectDialog fragment=new ChapterSelectDialog();
  Bundle args=new Bundle(2);
  args.putParcelable(EXTRA_SELECTED_CHAPTER,selectedChapter);
  fragment.setArguments(args);
  return fragment;
}

Fixed version (ground truth):
public static ChapterSelectDialog newInstance(@Nullable Chapter selectedChapter){
  ChapterSelectDialog fragment=new ChapterSelectDialog();
  Bundle args=new Bundle();
  args.putParcelable(EXTRA_SELECTED_CHAPTER,selectedChapter);
  fragment.setArguments(args);
  return fragment;
}
Program: 26233
Project: 26233
Buggy source:
private void setupUI(){
  listView.setOnItemClickListener(this);
  listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
  final CheckedItemAdapter adapter=new CheckedItemAdapter(getContext(),android.R.layout.simple_list_item_single_choice,android.R.id.text1,chapters);
  listView.setAdapter(adapter);
  int selectedItemPos=chapters.indexOf(selectedChapter);
  listView.setSelection(selectedItemPos);
  listView.setItemChecked(selectedItemPos,true);
  final Filter.FilterListener filterListener=new Filter.FilterListener(){
    @Override public void onFilterComplete(    int count){
      int index=findIndexByValueInFilteredListView(selectedChapter);
      listView.setItemChecked(index,true);
    }
  }
;
  cityNameSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener(){
    @Override public boolean onQueryTextSubmit(    String query){
      return false;
    }
    @Override public boolean onQueryTextChange(    String newText){
      adapter.getFilter().filter(newText,filterListener);
      return true;
    }
  }
);
  cityNameSearchView.requestFocus();
  adapter.getFilter().filter(cityNameSearchView.getQuery(),filterListener);
}

Fixed version (ground truth):
private void setupUI(){
  listView.setOnItemClickListener(this);
  listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
  final CheckedItemAdapter adapter=new CheckedItemAdapter(getContext(),android.R.layout.simple_list_item_single_choice,android.R.id.text1,chapters);
  listView.setAdapter(adapter);
  if (selectedChapter != null) {
    int selectedItemPos=chapters.indexOf(selectedChapter);
    listView.setSelection(selectedItemPos);
    listView.setItemChecked(selectedItemPos,true);
  }
  final Filter.FilterListener filterListener=new Filter.FilterListener(){
    @Override public void onFilterComplete(    int count){
      int index=findIndexByValueInFilteredListView(selectedChapter);
      listView.setItemChecked(index,true);
    }
  }
;
  cityNameSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener(){
    @Override public boolean onQueryTextSubmit(    String query){
      return false;
    }
    @Override public boolean onQueryTextChange(    String newText){
      adapter.getFilter().filter(newText,filterListener);
      return true;
    }
  }
);
  cityNameSearchView.requestFocus();
  adapter.getFilter().filter(cityNameSearchView.getQuery(),filterListener);
}
Program: 26234
Project: 26234
Buggy source:
private int findIndexByValueInFilteredListView(Chapter value){
  if (value == null || listView == null) {
    return -1;
  }
  Adapter adapter=listView.getAdapter();
  for (int i=adapter.getCount() - 1; i >= 0; i--) {
    Chapter item=(Chapter)adapter.getItem(i);
    if (item.equals(value)) {
      return i;
    }
  }
  return -1;
}

Fixed version (ground truth):
private int findIndexByValueInFilteredListView(@Nullable Chapter value){
  if (value == null || listView == null) {
    return -1;
  }
  Adapter adapter=listView.getAdapter();
  for (int i=adapter.getCount() - 1; i >= 0; i--) {
    Chapter item=(Chapter)adapter.getItem(i);
    if (item.equals(value)) {
      return i;
    }
  }
  return -1;
}
Program: 26235
Project: 26235
Buggy source:
void initUI(){
  mViewPagerAdapter=new ChapterFragmentPagerAdapter(this,getSupportFragmentManager(),selectedChapterId);
  mViewPager.setAdapter(mViewPagerAdapter);
  mViewPager.setOffscreenPageLimit(3);
  updateSelectionFor(findChapterById(selectedChapterId));
  recordStartPageView();
  mTabLayout.setupWithViewPager(mViewPager);
  if (SECTION_EVENTS.equals(getIntent().getStringExtra(Const.EXTRA_SECTION))) {
    mHandler.postDelayed(new Runnable(){
      @Override public void run(){
        mViewPager.setCurrentItem(2,true);
      }
    }
,500);
  }
}

Fixed version (ground truth):
void initUI(){
  mViewPagerAdapter=new ChapterFragmentPagerAdapter(this,getSupportFragmentManager(),selectedChapterId);
  mViewPager.setAdapter(mViewPagerAdapter);
  mViewPager.setOffscreenPageLimit(3);
  Chapter selectedChapter=findChapterById(selectedChapterId);
  if (selectedChapter != null) {
    updateSelectionFor(selectedChapter);
  }
  recordStartPageView();
  mTabLayout.setupWithViewPager(mViewPager);
  if (SECTION_EVENTS.equals(getIntent().getStringExtra(Const.EXTRA_SECTION))) {
    mHandler.postDelayed(new Runnable(){
      @Override public void run(){
        mViewPager.setCurrentItem(2,true);
      }
    }
,500);
  }
}
Program: 26237
Project: 26237
Buggy source:
@Override protected void onSaveInstanceState(Bundle outState){
  super.onSaveInstanceState(outState);
  if (chapters != null && !chapters.isEmpty()) {
    outState.putParcelableArrayList(ARG_CHAPTERS,chapters);
  }
  if (mViewPagerAdapter != null) {
    outState.putString(ARG_SELECTED_CHAPTER,mViewPagerAdapter.getSelectedChapter());
  }
}

Fixed version (ground truth):
@Override protected void onSaveInstanceState(Bundle outState){
  super.onSaveInstanceState(outState);
  if (!chapters.isEmpty()) {
    outState.putParcelableArrayList(ARG_CHAPTERS,chapters);
  }
  if (mViewPagerAdapter != null) {
    outState.putString(ARG_SELECTED_CHAPTER,mViewPagerAdapter.getSelectedChapter());
  }
}
Program: 26238
Project: 26238
Buggy source:
private void addUrlToUI(Urls url){
  TextView tv=(TextView)mInflater.inflate(R.layout.list_resource_item,(ViewGroup)getView(),false);
  tv.setText(Html.fromHtml("String_Node_Str" + url.getValue() + "String_Node_Str"+ url.getLabel()+ "String_Node_Str"));
  mResourcesBox.addView(tv);
}

Fixed version (ground truth):
private void addUrlToUI(Urls url){
  TextView tv=(TextView)mInflater.inflate(R.layout.list_resource_item,(ViewGroup)getView(),false);
  tv.setText(Html.fromHtml("String_Node_Str" + url.getValue() + "String_Node_Str"+ url.getLabel()+ "String_Node_Str"));
  tv.setMovementMethod(LinkMovementMethod.getInstance());
  mResourcesBox.addView(tv);
}
Program: 26239
Project: 26239
Buggy source:
private void updateChapterUIFrom(Person chapter){
  if (mTagline != null) {
    mTagline.setText(chapter.getTagline());
  }
  if (mAbout != null) {
    mAbout.setText(getAboutText(chapter));
  }
}

Fixed version (ground truth):
private void updateChapterUIFrom(Person chapter){
  if (mTagline != null) {
    mTagline.setText(chapter.getTagline());
  }
  if (mAbout != null) {
    mAbout.setText(getAboutText(chapter));
    mAbout.setMovementMethod(LinkMovementMethod.getInstance());
  }
}
Program: 26240
Project: 26240
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  listView.setOnItemClickListener(this);
  listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
  final CheckedItemAdapter adapter=new CheckedItemAdapter(getContext(),android.R.layout.simple_list_item_single_choice,android.R.id.text1,chapters);
  listView.setAdapter(adapter);
  int selectedItemPos=chapters.indexOf(selectedChapter);
  listView.setSelection(selectedItemPos);
  listView.setItemChecked(selectedItemPos,true);
  final Filter.FilterListener filterListener=new Filter.FilterListener(){
    @Override public void onFilterComplete(    int count){
      int index=findIndexByValueInFilteredListView(selectedChapter);
      listView.setItemChecked(index,true);
    }
  }
;
  cityNameSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener(){
    @Override public boolean onQueryTextSubmit(    String query){
      return false;
    }
    @Override public boolean onQueryTextChange(    String newText){
      adapter.getFilter().filter(newText,filterListener);
      return true;
    }
  }
);
  cityNameSearchView.requestFocus();
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  listView.setOnItemClickListener(this);
  listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
  final CheckedItemAdapter adapter=new CheckedItemAdapter(getContext(),android.R.layout.simple_list_item_single_choice,android.R.id.text1,chapters);
  listView.setAdapter(adapter);
  int selectedItemPos=chapters.indexOf(selectedChapter);
  listView.setSelection(selectedItemPos);
  listView.setItemChecked(selectedItemPos,true);
  final Filter.FilterListener filterListener=new Filter.FilterListener(){
    @Override public void onFilterComplete(    int count){
      int index=findIndexByValueInFilteredListView(selectedChapter);
      listView.setItemChecked(index,true);
    }
  }
;
  cityNameSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener(){
    @Override public boolean onQueryTextSubmit(    String query){
      return false;
    }
    @Override public boolean onQueryTextChange(    String newText){
      adapter.getFilter().filter(newText,filterListener);
      return true;
    }
  }
);
  cityNameSearchView.requestFocus();
  adapter.getFilter().filter(cityNameSearchView.getQuery(),filterListener);
}
Program: 26241
Project: 26241
Buggy source:
public void setAlarmForNotification(){
  AlarmManager am=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
  Intent intent=new Intent(SummitNotificationReceiver.ACTION_SUMMIT_NOTIFICATION);
  DateTime summitDateTime=new DateTime(2016,5,17,15,0,DateTimeZone.UTC);
  am.set(AlarmManager.RTC_WAKEUP,summitDateTime.getMillis(),PendingIntent.getBroadcast(context,0,intent,PendingIntent.FLAG_UPDATE_CURRENT));
}

Fixed version (ground truth):
public void setAlarmForNotification(){
  AlarmManager am=(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
  Intent intent=new Intent(SummitNotificationReceiver.ACTION_SUMMIT_NOTIFICATION);
  am.set(AlarmManager.RTC_WAKEUP,SUMMIT_DATE_TIME.getMillis(),PendingIntent.getBroadcast(context,0,intent,PendingIntent.FLAG_UPDATE_CURRENT));
}
Program: 26242
Project: 26242
Buggy source:
public boolean shouldSetAlarm(){
  return !PrefUtils.isSummitNotificationSent(context);
}

Fixed version (ground truth):
public boolean shouldSetAlarm(){
  return !PrefUtils.isSummitNotificationSent(context) && SUMMIT_DATE_TIME.isAfterNow();
}
Program: 26243
Project: 26243
Buggy source:
@Nullable public static String getCurrentPersonId(GoogleApiClient apiClient){
  Person plusPerson=null;
  if (apiClient.hasConnectedApi(Plus.API)) {
    plusPerson=Plus.PeopleApi.getCurrentPerson(apiClient);
  }
  return plusPerson != null ? plusPerson.getId() : null;
}

Fixed version (ground truth):
@Nullable public static String getCurrentPersonId(GoogleApiClient apiClient){
  Person plusPerson=null;
  if (apiClient.isConnected() && apiClient.hasConnectedApi(Plus.API)) {
    plusPerson=Plus.PeopleApi.getCurrentPerson(apiClient);
  }
  return plusPerson != null ? plusPerson.getId() : null;
}
Program: 26244
Project: 26244
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_arrow_tagged);
  adapter=new OrganizerAdapter();
  if (!PrefUtils.isSignedIn(this)) {
    finish();
  }
  taggedList.setLayoutManager(new LinearLayoutManager(this));
  taggedList.addItemDecoration(new DividerItemDecoration(this,null));
  taggedList.setAdapter(adapter);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_arrow_tagged);
  getActionBarToolbar().setNavigationIcon(R.drawable.ic_up);
  adapter=new OrganizerAdapter();
  if (!PrefUtils.isSignedIn(this)) {
    finish();
  }
  taggedList.setLayoutManager(new LinearLayoutManager(this));
  taggedList.addItemDecoration(new DividerItemDecoration(this,null));
  taggedList.setAdapter(adapter);
}
Program: 26245
Project: 26245
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_youtube);
  YouTubePlayerSupportFragment mPlayerFragment=(YouTubePlayerSupportFragment)getSupportFragmentManager().findFragmentById(R.id.youtube_fragment);
  mPlayerFragment.initialize(BuildConfig.ANDROID_SIMPLE_API_ACCESS_KEY,this);
  setRequestedOrientation(PORTRAIT_ORIENTATION);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_youtube);
  YouTubePlayerSupportFragment mPlayerFragment=(YouTubePlayerSupportFragment)getSupportFragmentManager().findFragmentById(R.id.youtube_fragment);
  mPlayerFragment.initialize(BuildConfig.ANDROID_SIMPLE_API_ACCESS_KEY,this);
  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
Program: 26247
Project: 26247
Buggy source:
@Override public void onPostExecute(String[] params,Person person){
  if (person != null) {
    updateChapterUIFrom(person);
    updateOrganizersOnline(person);
  }
}

Fixed version (ground truth):
@Override public void onPostExecute(String[] params,Person person){
  if (person != null && getActivity() != null) {
    updateChapterUIFrom(person);
    updateOrganizersOnline(person);
  }
}
Program: 26248
Project: 26248
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.arrow_lb:
    startActivityForResult(Games.Leaderboards.getLeaderboardIntent(getGoogleApiClient(),Const.ARROW_LB),REQUEST_LEADERBOARD);
  return true;
case R.id.arrow_tagged:
startActivity(new Intent(this,ArrowTaggedActivity.class));
return true;
}
return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
switch (item.getItemId()) {
case R.id.arrow_lb:
    startActivityForResult(Games.Leaderboards.getLeaderboardIntent(getGoogleApiClient(),Const.ARROW_LB),REQUEST_LEADERBOARD);
  return true;
case R.id.arrow_tagged:
Intent i=new Intent(this,ArrowTaggedActivity.class);
Bundle data=new Bundle();
data.putInt(EXTRA_SELECTED_DRAWER_ITEM_ID,Const.DRAWER_ARROW);
i.putExtras(data);
startActivity(i);
return true;
}
return super.onOptionsItemSelected(item);
}
Program: 26249
Project: 26249
Buggy source:
public View createSwipeRefresh(final View listFragmentView){
  mSwipeRefreshLayout=new ListFragmentSwipeRefreshLayout(getActivity());
  mSwipeRefreshLayout.addView(listFragmentView,ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
  mSwipeRefreshLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT));
  return mSwipeRefreshLayout;
}

Fixed version (ground truth):
public View createSwipeRefresh(final View listFragmentView){
  mSwipeRefreshLayout=new ListFragmentSwipeRefreshLayout(getActivity());
  mSwipeRefreshLayout.addView(listFragmentView,ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
  mSwipeRefreshLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT));
  mSwipeRefreshLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
    @Override public void onGlobalLayout(){
      mSwipeRefreshLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
      mSwipeRefreshLayout.setRecyclerView(getListView());
    }
  }
);
  return mSwipeRefreshLayout;
}
Program: 26250
Project: 26250
Buggy source:
public View createSwipeRefresh(final View listFragmentView){
  mSwipeRefreshLayout=new ListFragmentSwipeRefreshLayout(getActivity());
  mSwipeRefreshLayout.addView(listFragmentView,ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
  mSwipeRefreshLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT));
  return mSwipeRefreshLayout;
}

Fixed version (ground truth):
public View createSwipeRefresh(final View listFragmentView){
  mSwipeRefreshLayout=new ListFragmentSwipeRefreshLayout(getActivity());
  mSwipeRefreshLayout.addView(listFragmentView,ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
  mSwipeRefreshLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT));
  mSwipeRefreshLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
    @Override public void onGlobalLayout(){
      mSwipeRefreshLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
      mSwipeRefreshLayout.setRecyclerView(getListView());
    }
  }
);
  return mSwipeRefreshLayout;
}
Program: 26251
Project: 26251
Buggy source:
@Override public void onNotFound(String key){
  setIsLoading(false);
  Snackbar snackbar=Snackbar.make(getView(),R.string.offline_alert,Snackbar.LENGTH_SHORT);
  ColoredSnackBar.alert(snackbar).show();
}

Fixed version (ground truth):
private void onNotFound(){
  setIsLoading(false);
  Snackbar snackbar=Snackbar.make(getView(),R.string.offline_alert,Snackbar.LENGTH_SHORT);
  ColoredSnackBar.alert(snackbar).show();
}
Program: 26253
Project: 26253
Buggy source:
@Override public void onGet(Object item){
  if (checkValidCache(item)) {
    ArrayList<Event> events=(ArrayList<Event>)item;
    mAdapter.addAll(events);
    setIsLoading(false);
    Snackbar snackbar=Snackbar.make(getView(),R.string.cached_content,Snackbar.LENGTH_SHORT);
    ColoredSnackBar.info(snackbar).show();
  }
 else {
    App.getInstance().getModelCache().removeAsync(cacheKey);
  }
}

Fixed version (ground truth):
@Override public void onGet(Object item){
  if (checkValidCache(item)) {
    ArrayList<Event> events=(ArrayList<Event>)item;
    mAdapter.addAll(events);
    setIsLoading(false);
    Snackbar snackbar=Snackbar.make(getView(),R.string.cached_content,Snackbar.LENGTH_SHORT);
    ColoredSnackBar.info(snackbar).show();
  }
 else {
    App.getInstance().getModelCache().removeAsync(cacheKey);
    onNotFound();
  }
}
Program: 26254
Project: 26254
Buggy source:
@Override protected Void doInBackground(Void... voids){
  put(url,obj,expiresAt);
  return null;
}

Fixed version (ground truth):
@Override protected Void doInBackground(Void... voids){
  ModelCache.this.remove(url);
  return null;
}
Program: 26256
Project: 26256
Buggy source:
@Override public void onGet(Object item){
  ArrayList<Event> events=(ArrayList<Event>)item;
  mAdapter.addAll(events);
  setIsLoading(false);
  Snackbar snackbar=Snackbar.make(getView(),R.string.cached_content,Snackbar.LENGTH_SHORT);
  ColoredSnackBar.info(snackbar).show();
}

Fixed version (ground truth):
@Override public void onGet(Object item){
  if (checkValidCache(item)) {
    ArrayList<Event> events=(ArrayList<Event>)item;
    mAdapter.addAll(events);
    setIsLoading(false);
    Snackbar snackbar=Snackbar.make(getView(),R.string.cached_content,Snackbar.LENGTH_SHORT);
    ColoredSnackBar.info(snackbar).show();
  }
 else {
    App.getInstance().getModelCache().removeAsync(cacheKey);
  }
}
Program: 26258
Project: 26258
Buggy source:
@Override public Person doInBackground(String... params){
  if (isAdded()) {
    return GdgNavDrawerActivity.getPersonSync(((GdgNavDrawerActivity)getActivity()).getGoogleApiClient(),params[0]);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public Person doInBackground(String... params){
  if (isAdded()) {
    return GdgNavDrawerActivity.getPersonSync(((GdgNavDrawerActivity)getActivity()).getGoogleApiClient(),chapterPlusId);
  }
 else {
    return null;
  }
}
Program: 26259
Project: 26259
Buggy source:
public static Person getPersonSync(final GoogleApiClient apiClient,final String gplusId){
  final String cacheUrl=Const.CACHE_KEY_PERSON + gplusId;
  Object cachedPerson=App.getInstance().getModelCache().get(cacheUrl);
  if (cachedPerson instanceof Person) {
    return (Person)cachedPerson;
  }
  if (cachedPerson != null) {
    App.getInstance().getModelCache().remove(cacheUrl);
  }
  People.LoadPeopleResult result=Plus.PeopleApi.load(apiClient,gplusId).await();
  if (result.getStatus().getStatusCode() == CommonStatusCodes.SUCCESS) {
    PersonBuffer personBuffer=result.getPersonBuffer();
    try {
      if (personBuffer.getCount() > 0) {
        Person person=personBuffer.get(0);
        App.getInstance().getModelCache().put(cacheUrl,person,DateTime.now().plusDays(2));
        return person;
      }
    }
  finally {
      personBuffer.close();
    }
  }
  return null;
}

Fixed version (ground truth):
public static Person getPersonSync(final GoogleApiClient apiClient,final String gplusId){
  final String cacheUrl=Const.CACHE_KEY_PERSON + gplusId;
  Object cachedPerson=App.getInstance().getModelCache().get(cacheUrl);
  Person person=null;
  if (cachedPerson instanceof Person) {
    person=(Person)cachedPerson;
    if (person.getId() != null) {
      return person;
    }
  }
  if (cachedPerson != null) {
    App.getInstance().getModelCache().remove(cacheUrl);
  }
  People.LoadPeopleResult result=Plus.PeopleApi.load(apiClient,gplusId).await();
  if (result.getStatus().getStatusCode() == CommonStatusCodes.SUCCESS) {
    PersonBuffer personBuffer=result.getPersonBuffer();
    try {
      if (personBuffer.getCount() > 0) {
        person=personBuffer.get(0);
        App.getInstance().getModelCache().put(cacheUrl,person,DateTime.now().plusDays(2));
      }
    }
  finally {
      personBuffer.close();
    }
  }
  return person;
}
Program: 26260
Project: 26260
Buggy source:
@Override public CharSequence getPageTitle(int position){
  if (0 < position && position < mPages.length) {
    return mContext.getString(mPages[position]);
  }
 else {
    return "String_Node_Str";
  }
}

Fixed version (ground truth):
@Override public CharSequence getPageTitle(int position){
  if (0 <= position && position < mPages.length) {
    return mContext.getString(mPages[position]);
  }
 else {
    return "String_Node_Str";
  }
}
Program: 26261
Project: 26261
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  Timber.i("String_Node_Str");
  setContentView(R.layout.activity_first_start);
  App.getInstance().updateLastLocation();
  ButterKnife.inject(this);
  mViewPagerAdapter=new FirstStartPageAdapter(getSupportFragmentManager());
  mViewPager.setAdapter(mViewPagerAdapter);
  mGcm=GoogleCloudMessaging.getInstance(this);
  mViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener(){
    @Override public void onPageScrolled(    int i,    float v,    int i2){
    }
    @Override public void onPageSelected(    int i){
      Tracker t=App.getInstance().getTracker();
      t.setScreenName("String_Node_Str" + (1 + i));
      t.send(new HitBuilders.AppViewBuilder().build());
    }
    @Override public void onPageScrollStateChanged(    int i){
    }
  }
);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_first_start);
  App.getInstance().updateLastLocation();
  ButterKnife.inject(this);
  mViewPagerAdapter=new FirstStartPageAdapter(getSupportFragmentManager());
  mViewPager.setAdapter(mViewPagerAdapter);
  mGcm=GoogleCloudMessaging.getInstance(this);
  mViewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener(){
    @Override public void onPageScrolled(    int i,    float v,    int i2){
    }
    @Override public void onPageSelected(    int i){
      Tracker t=App.getInstance().getTracker();
      t.setScreenName("String_Node_Str" + (1 + i));
      t.send(new HitBuilders.AppViewBuilder().build());
    }
    @Override public void onPageScrollStateChanged(    int i){
    }
  }
);
}
Program: 26262
Project: 26262
Buggy source:
@Override public int getItemViewType(int position){
  Item item=getItemInternal(position);
  Activity activity=item.getActivity();
  if (activity.getObject().getAttachments() == null || activity.getObject().getAttachments().isEmpty())   return 0;
 else {
    Activity.PlusObject.Attachments attachment=activity.getObject().getAttachments().get(0);
    String objectType=attachment.getObjectType();
    if (objectType.equals("String_Node_Str"))     return 1;
 else     if (objectType.equals("String_Node_Str"))     return 2;
 else     if (objectType.equals("String_Node_Str"))     return 3;
 else     if (objectType.equals("String_Node_Str"))     return 4;
 else     if (objectType.equals("String_Node_Str"))     return 5;
  }
  return 0;
}

Fixed version (ground truth):
@Override public int getItemViewType(int position){
  if (position >= 0) {
    if (position >= getItemCount()) {
      position=position % getItemCount();
    }
    Item item=getItemInternal(position);
    Activity activity=item.getActivity();
    if (activity.getObject().getAttachments() == null || activity.getObject().getAttachments().isEmpty()) {
      return 0;
    }
 else {
      Activity.PlusObject.Attachments attachment=activity.getObject().getAttachments().get(0);
      String objectType=attachment.getObjectType();
switch (objectType) {
case "String_Node_Str":
        return VIEWTYPE_ARTICLE;
case "String_Node_Str":
      return VIEWTYPE_VIDEO;
case "String_Node_Str":
    return VIEWTYPE_PHOTO;
case "String_Node_Str":
  return VIEWTYPE_ALBUM;
case "String_Node_Str":
return VIEWTYPE_EVENT;
}
}
}
return 0;
}
Program: 26263
Project: 26263
Buggy source:
private void populateArticle(ViewHolder mViewHolder,ViewGroup container,final Activity.PlusObject.Attachments attachment){
  if (attachment == null)   return;
  View attachmentView=createAttachmentView(mViewHolder,container,R.layout.news_item_article,1);
  mViewHolder.title.setText(attachment.getDisplayName());
  try {
    mViewHolder.attachmentContent.setText(new URL(attachment.getUrl()).getHost());
  }
 catch (  MalformedURLException e) {
    e.printStackTrace();
  }
  if (attachment.getImage() == null && attachment.getFullImage() == null)   mViewHolder.articleImage.setVisibility(View.GONE);
 else {
    String imageUrl=attachment.getImage().getUrl();
    if (attachment.getFullImage() != null)     imageUrl=attachment.getFullImage().getUrl();
    mViewHolder.articleImage.setImageDrawable(null);
    mViewHolder.articleImage.setVisibility(View.VISIBLE);
    App.getInstance().getPicasso().load(imageUrl).into(mViewHolder.articleImage);
  }
  attachmentView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      Intent i=new Intent(Intent.ACTION_VIEW);
      i.setData(Uri.parse(attachment.getUrl()));
      mContext.startActivity(i);
    }
  }
);
}

Fixed version (ground truth):
private void populateArticle(ViewHolder mViewHolder,ViewGroup container,final Activity.PlusObject.Attachments attachment){
  if (attachment == null)   return;
  View attachmentView=createAttachmentView(mViewHolder,container,R.layout.news_item_article,1);
  mViewHolder.title.setText(attachment.getDisplayName());
  try {
    mViewHolder.attachmentContent.setText(new URL(attachment.getUrl()).getHost());
  }
 catch (  MalformedURLException e) {
    e.printStackTrace();
  }
  if (attachment.getImage() == null && attachment.getFullImage() == null) {
    mViewHolder.articleImage.setVisibility(View.GONE);
  }
 else {
    String imageUrl=null;
    if (attachment.getFullImage() != null) {
      imageUrl=attachment.getFullImage().getUrl();
    }
    if (attachment.getImage() != null) {
      imageUrl=attachment.getImage().getUrl();
    }
    mViewHolder.articleImage.setImageDrawable(null);
    if (imageUrl != null) {
      mViewHolder.articleImage.setVisibility(View.VISIBLE);
      App.getInstance().getPicasso().load(imageUrl).into(mViewHolder.articleImage);
    }
 else {
      mViewHolder.articleImage.setVisibility(View.GONE);
    }
  }
  attachmentView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      Intent i=new Intent(Intent.ACTION_VIEW);
      i.setData(Uri.parse(attachment.getUrl()));
      mContext.startActivity(i);
    }
  }
);
}
Program: 26264
Project: 26264
Buggy source:
public NewsAdapter(Context ctx,GoogleApiClient client){
  mContext=ctx;
  mPlusClient=client;
  mInflater=LayoutInflater.from(mContext);
  mActivities=new ArrayList<Item>();
}

Fixed version (ground truth):
public NewsAdapter(Context ctx,GoogleApiClient client){
  mContext=ctx;
  mPlusClient=client;
  mInflater=LayoutInflater.from(mContext);
  mActivities=new ArrayList<>();
  setHasStableIds(true);
}
Program: 26265
Project: 26265
Buggy source:
private void populateVideo(ViewHolder mViewHolder,ViewGroup container,final Activity.PlusObject.Attachments attachment){
  if (attachment == null)   return;
  View attachmentView=createAttachmentView(mViewHolder,container,R.layout.news_item_video,2);
  mViewHolder.poster.setDimensions(attachment.getImage().getWidth(),attachment.getImage().getHeight(),attachment.getImage().getUrl());
  mViewHolder.poster.setImageDrawable(null);
  App.getInstance().getPicasso().load(attachment.getImage().getUrl()).into(mViewHolder.poster);
  attachmentView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      try {
        Intent playVideoIntent=new Intent(mContext,YoutubeActivity.class);
        playVideoIntent.putExtra("String_Node_Str",Utils.splitQuery(new URL(attachment.getUrl())).get("String_Node_Str"));
        mContext.startActivity(playVideoIntent);
      }
 catch (      UnsupportedEncodingException e) {
        e.printStackTrace();
      }
catch (      MalformedURLException e) {
        e.printStackTrace();
      }
    }
  }
);
}

Fixed version (ground truth):
private void populateVideo(ViewHolder mViewHolder,ViewGroup container,final Activity.PlusObject.Attachments attachment){
  if (attachment == null)   return;
  View attachmentView=createAttachmentView(mViewHolder,container,R.layout.news_item_video,2);
  mViewHolder.poster.setDimensions(attachment.getImage().getWidth(),attachment.getImage().getHeight(),attachment.getImage().getUrl());
  mViewHolder.poster.setImageDrawable(null);
  App.getInstance().getPicasso().load(attachment.getImage().getUrl()).into(mViewHolder.poster);
  attachmentView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      try {
        Intent playVideoIntent=new Intent(mContext,YoutubeActivity.class);
        playVideoIntent.putExtra("String_Node_Str",Utils.splitQuery(new URL(attachment.getUrl())).get("String_Node_Str"));
        mContext.startActivity(playVideoIntent);
      }
 catch (      UnsupportedEncodingException|MalformedURLException e) {
        e.printStackTrace();
      }
    }
  }
);
}
Program: 26266
Project: 26266
Buggy source:
private Spanned fromHtml(String html){
  Spanned spanned=Html.fromHtml(html);
  if (spanned instanceof SpannableStringBuilder) {
    SpannableStringBuilder ssb=(SpannableStringBuilder)spanned;
    URLSpan[] urlspans=ssb.getSpans(0,ssb.length() - 1,URLSpan.class);
    for (int i=0; i < urlspans.length; i++) {
      URLSpan span=urlspans[i];
      int start=ssb.getSpanStart(span);
      int end=ssb.getSpanEnd(span);
      final String url=span.getURL();
      ssb.removeSpan(span);
      ssb.setSpan(new ClickableSpan(){
        @Override public void onClick(        View view){
          Intent i=new Intent(Intent.ACTION_VIEW);
          i.setData(Uri.parse(url));
          mContext.startActivity(i);
        }
      }
,start,end,33);
    }
  }
  return spanned;
}

Fixed version (ground truth):
private Spanned fromHtml(String html){
  Spanned spanned=Html.fromHtml(html);
  if (spanned instanceof SpannableStringBuilder) {
    SpannableStringBuilder ssb=(SpannableStringBuilder)spanned;
    URLSpan[] urlspans=ssb.getSpans(0,ssb.length() - 1,URLSpan.class);
    for (    URLSpan span : urlspans) {
      int start=ssb.getSpanStart(span);
      int end=ssb.getSpanEnd(span);
      final String url=span.getURL();
      ssb.removeSpan(span);
      ssb.setSpan(new ClickableSpan(){
        @Override public void onClick(        View view){
          Intent i=new Intent(Intent.ACTION_VIEW);
          i.setData(Uri.parse(url));
          mContext.startActivity(i);
        }
      }
,start,end,33);
    }
  }
  return spanned;
}
Program: 26267
Project: 26267
Buggy source:
@Override public void onItemClick(AdapterView<?> adapterView,View view,int i,long l){
  DrawerAdapter.DrawerItem item=(DrawerAdapter.DrawerItem)mDrawerAdapter.getItem(i);
switch (item.getId()) {
case Const.DRAWER_ACHIEVEMENTS:
    if (mPreferences.getBoolean(Const.SETTINGS_SIGNED_IN,false) && getGoogleApiClient().isConnected()) {
      startActivityForResult(Games.Achievements.getAchievementsIntent(getGoogleApiClient()),0);
    }
 else {
      Crouton.makeText(GdgNavDrawerActivity.this,getString(R.string.achievements_need_signin),Style.INFO).show();
    }
  break;
case Const.DRAWER_HOME:
navigateTo(MainActivity.class,null);
break;
case Const.DRAWER_GDE:
navigateTo(GdeActivity.class,null);
break;
case Const.DRAWER_SPECIAL:
Bundle special=new Bundle();
special.putInt(Const.SPECIAL_EVENT_LOGO_EXTRA,R.drawable.ic_logo_devfest);
special.putString(Const.SPECIAL_EVENT_VIEWTAG_EXTRA,"String_Node_Str");
special.putString(Const.SPECIAL_EVENT_CACHEKEY_EXTRA,"String_Node_Str");
special.putLong(Const.SPECIAL_EVENT_START_EXTRA,DateTime.now().getMillis());
special.putLong(Const.SPECIAL_EVENT_END_EXTRA,1419984000000L);
special.putInt(Const.SPECIAL_EVENT_DESCRIPTION_EXTRA,R.string.devfest_description);
navigateTo(SpecialEventActivity.class,special);
break;
case Const.DRAWER_PULSE:
navigateTo(PulseActivity.class,null);
break;
case Const.DRAWER_ARROW:
navigateTo(ArrowActivity.class,null);
break;
}
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView<?> adapterView,View view,int i,long l){
  DrawerAdapter.DrawerItem item=(DrawerAdapter.DrawerItem)mDrawerAdapter.getItem(i);
switch (item.getId()) {
case Const.DRAWER_ACHIEVEMENTS:
    if (mPreferences.getBoolean(Const.SETTINGS_SIGNED_IN,false) && getGoogleApiClient().isConnected()) {
      startActivityForResult(Games.Achievements.getAchievementsIntent(getGoogleApiClient()),0);
    }
 else {
      Crouton.makeText(GdgNavDrawerActivity.this,getString(R.string.achievements_need_signin),Style.INFO).show();
    }
  break;
case Const.DRAWER_HOME:
navigateTo(MainActivity.class,null);
break;
case Const.DRAWER_GDE:
navigateTo(GdeActivity.class,null);
break;
case Const.DRAWER_SPECIAL:
Bundle special=new Bundle();
special.putInt(Const.SPECIAL_EVENT_LOGO_EXTRA,R.drawable.ic_logo_devfest);
special.putString(Const.SPECIAL_EVENT_VIEWTAG_EXTRA,"String_Node_Str");
special.putString(Const.SPECIAL_EVENT_CACHEKEY_EXTRA,"String_Node_Str");
special.putLong(Const.SPECIAL_EVENT_START_EXTRA,DateTime.now().getMillis());
special.putLong(Const.SPECIAL_EVENT_END_EXTRA,1419984000000L);
special.putInt(Const.SPECIAL_EVENT_DESCRIPTION_EXTRA,R.string.devfest_description);
navigateTo(SpecialEventActivity.class,special);
break;
case Const.DRAWER_PULSE:
navigateTo(PulseActivity.class,null);
break;
case Const.DRAWER_ARROW:
if (mPreferences.getBoolean(Const.SETTINGS_SIGNED_IN,false) && getGoogleApiClient().isConnected()) {
navigateTo(ArrowActivity.class,null);
}
 else {
Crouton.makeText(GdgNavDrawerActivity.this,getString(R.string.arrow_need_games),Style.INFO).show();
}
break;
}
}
Program: 26269
Project: 26269
Buggy source:
public ApiRequest getEvent(String eventId,Response.Listener<EventFullDetails> successListener,Response.ErrorListener errorListener){
  GsonRequest<Void,EventFullDetails> eventReq=new GsonRequest<Void,EventFullDetails>(Request.Method.GET,EVENT_DETAIL_URL + eventId,EventFullDetails.class,successListener,errorListener,GsonRequest.getGson(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES,new ZuluDateTimeDeserializer()));
  eventReq.setRetryPolicy(new DefaultRetryPolicy(60000,DefaultRetryPolicy.DEFAULT_MAX_RETRIES,DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
  return new ApiRequest(eventReq);
}

Fixed version (ground truth):
public ApiRequest getEvent(String eventId,Response.Listener<EventFullDetails> successListener,Response.ErrorListener errorListener){
  GsonRequest<Void,EventFullDetails> eventReq=new GsonRequest<Void,EventFullDetails>(Request.Method.GET,EVENT_DETAIL_URL + eventId,EventFullDetails.class,successListener,errorListener,GsonRequest.getGson(FieldNamingPolicy.IDENTITY,new ZuluDateTimeDeserializer()));
  eventReq.setRetryPolicy(new DefaultRetryPolicy(60000,DefaultRetryPolicy.DEFAULT_MAX_RETRIES,DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
  return new ApiRequest(eventReq);
}
Program: 26270
Project: 26270
Buggy source:
@Override public void onCreateOptionsMenu(Menu menu,MenuInflater inflater){
  if (mEvent != null) {
    inflater.inflate(R.menu.event_menu,menu);
    MenuItem item=menu.findItem(R.id.share);
    mShareActionProvider=(ShareActionProvider)MenuItemCompat.getActionProvider(item);
    Intent shareIntent=new Intent(Intent.ACTION_SEND);
    shareIntent.putExtra(Intent.EXTRA_TEXT,mEvent.getEventUrl());
    if (mShareActionProvider != null) {
      mShareActionProvider.setShareIntent(shareIntent);
    }
  }
}

Fixed version (ground truth):
@Override public void onCreateOptionsMenu(Menu menu,MenuInflater inflater){
  if (mEvent != null && mEvent.getEventUrl() != null) {
    inflater.inflate(R.menu.event_menu,menu);
    MenuItem item=menu.findItem(R.id.share);
    mShareActionProvider=(ShareActionProvider)MenuItemCompat.getActionProvider(item);
    Intent shareIntent=new Intent(Intent.ACTION_SEND);
    shareIntent.setType("String_Node_Str");
    shareIntent.putExtra(Intent.EXTRA_TEXT,mEvent.getEventUrl());
    if (mShareActionProvider != null) {
      mShareActionProvider.setShareIntent(shareIntent);
    }
  }
}
Program: 26271
Project: 26271
Buggy source:
public AchievementActionHandler(Handler handler,GoogleApiClient googleApiClient,SharedPreferences preferences){
  mHandler=handler;
  mGoogleApi=googleApiClient;
  mPreferences=preferences;
}

Fixed version (ground truth):
public AchievementActionHandler(Handler handler,GoogleApiClient googleApiClient,SharedPreferences preferences){
  mPending=new ArrayList<>();
  mHandler=handler;
  mGoogleApi=googleApiClient;
  mPreferences=preferences;
}
Program: 26272
Project: 26272
Buggy source:
private void postAchievementUnlockedEvent(final String achievementName){
  mHandler.postDelayed(new Runnable(){
    @Override public void run(){
      Games.Achievements.unlock(mGoogleApi,achievementName);
    }
  }
,ONE_SEC_IN_MILLISECONDS);
}

Fixed version (ground truth):
private void postAchievementUnlockedEvent(final String achievementName){
  if (!mGoogleApi.isConnected()) {
    mPending.add(achievementName);
  }
 else {
    mHandler.postDelayed(new Runnable(){
      @Override public void run(){
        Games.Achievements.unlock(mGoogleApi,achievementName);
      }
    }
,ONE_SEC_IN_MILLISECONDS);
  }
}
Program: 26273
Project: 26273
Buggy source:
@Override public void onConnected(Bundle bundle){
}

Fixed version (ground truth):
@Override public void onConnected(Bundle bundle){
  mAchievementActionHandler.onConnected();
}
Program: 26275
Project: 26275
Buggy source:
private void writeValueToDisk(OutputStream os,Object o) throws IOException {
  BufferedWriter out=new BufferedWriter(new OutputStreamWriter(os));
  String className=o.getClass().getCanonicalName();
  if (o instanceof ArrayList) {
    ArrayList d=(ArrayList)o;
    if (d.size() > 0)     className=className + "String_Node_Str" + d.get(0).getClass().getCanonicalName()+ "String_Node_Str";
  }
  out.write(className + "String_Node_Str");
  if (className.contains("String_Node_Str")) {
    mJsonFactory.createJsonGenerator(out).serialize(o);
  }
 else {
    String json=mGson.toJson(o);
    out.write(json);
  }
  out.close();
}

Fixed version (ground truth):
private void writeValueToDisk(OutputStream os,Object o) throws IOException {
  BufferedWriter out=new BufferedWriter(new OutputStreamWriter(os));
  String className=o.getClass().getCanonicalName();
  if (o instanceof ArrayList) {
    className=parseArrayList(o);
  }
 else   if (o instanceof HashMap) {
    HashMap d=(HashMap)o;
    if (d.size() > 0) {
      Map.Entry entry=(Map.Entry)d.entrySet().iterator().next();
      if (entry.getValue() instanceof ArrayList) {
        className=className + "String_Node_Str" + entry.getKey().getClass().getCanonicalName()+ "String_Node_Str"+ parseArrayList(entry.getValue())+ "String_Node_Str";
      }
 else {
        className=className + "String_Node_Str" + entry.getKey().getClass().getCanonicalName()+ "String_Node_Str"+ entry.getValue().getClass().getCanonicalName()+ "String_Node_Str";
      }
    }
  }
  out.write(className + "String_Node_Str");
  if (className.contains("String_Node_Str")) {
    mJsonFactory.createJsonGenerator(out).serialize(o);
  }
 else {
    String json=mGson.toJson(o);
    out.write(json);
  }
  out.close();
}
Program: 26276
Project: 26276
Buggy source:
public static TaggedEventFragment newInstance(String cacheKey,String eventTag,long start,long end,int fragmentLayout){
  TaggedEventFragment frag=new TaggedEventFragment();
  Bundle args=new Bundle();
  args.putString(Const.SPECIAL_EVENT_CACHEKEY_EXTRA,cacheKey);
  args.putString(Const.SPECIAL_EVENT_VIEWTAG_EXTRA,eventTag);
  args.putLong(Const.SPECIAL_EVENT_START_EXTRA,start);
  args.putLong(Const.SPECIAL_EVENT_END_EXTRA,end);
  args.putLong(Const.SPECIAL_EVENT_FRAGMENT_LAYOUT_EXTRA,fragmentLayout);
  frag.setArguments(args);
  return frag;
}

Fixed version (ground truth):
public static TaggedEventFragment newInstance(String cacheKey,String eventTag,long start,long end,int fragmentLayout){
  TaggedEventFragment frag=new TaggedEventFragment();
  Bundle args=new Bundle();
  args.putString(Const.SPECIAL_EVENT_CACHEKEY_EXTRA,cacheKey);
  args.putString(Const.SPECIAL_EVENT_VIEWTAG_EXTRA,eventTag);
  args.putLong(Const.SPECIAL_EVENT_START_EXTRA,start);
  args.putLong(Const.SPECIAL_EVENT_END_EXTRA,end);
  args.putInt(Const.SPECIAL_EVENT_FRAGMENT_LAYOUT_EXTRA,fragmentLayout);
  frag.setArguments(args);
  return frag;
}
Program: 26277
Project: 26277
Buggy source:
public DrawerItem(int icon,int title){
  mIcon=icon;
  mTitle=title;
}

Fixed version (ground truth):
public DrawerItem(int id,int icon,int title){
  mId=id;
  mIcon=icon;
  mTitle=title;
}
Program: 26278
Project: 26278
Buggy source:
public DrawerItem(int icon,int title){
  mIcon=icon;
  mTitle=title;
}

Fixed version (ground truth):
public DrawerItem(int id,int icon,int title){
  mId=id;
  mIcon=icon;
  mTitle=title;
}