nus-yam/ex-repair huggingface dataset:
Program: 162572
Project: 162572
Buggy source:
@Override public long getHeaderId(int position){
  if (position != 0) {
    if (enter.get(position - 1) == null)     return -1;
 else     if (enter.get(position - 1).isDirectory())     return 'D';
 else     return 'F';
  }
  return -1;
}

Fixed version (ground truth):
@Override public long getHeaderId(int position){
  if (position >= 0 && position < enter.size())   if (position != 0) {
    if (enter.get(position - 1) == null)     return -1;
 else     if (enter.get(position - 1).isDirectory())     return 'D';
 else     return 'F';
  }
  return -1;
}
Program: 162575
Project: 162575
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  setRetainInstance(true);
  mainActivity=(MainActivity)getActivity();
  mainActivity.toolbar.setTitle(utils.getString(getActivity(),R.string.apps));
  mainActivity.tabsSpinner.setVisibility(View.GONE);
  mainActivity.supportInvalidateOptionsMenu();
  fabSkin=mainActivity.fabskin;
  vl=getListView();
  Sp=PreferenceManager.getDefaultSharedPreferences(getActivity());
  ListView vl=getListView();
  int theme=Integer.parseInt(Sp.getString("String_Node_Str","String_Node_Str"));
  theme1=theme == 2 ? PreferenceUtils.hourOfDay() : theme;
  vl.setDivider(null);
  if (theme1 == 1)   getActivity().getWindow().getDecorView().setBackgroundColor(getResources().getColor(R.color.holo_dark_background));
  if (savedInstanceState == null)   new LoadListTask().execute();
 else {
    c=savedInstanceState.getParcelableArrayList("String_Node_Str");
    a=savedInstanceState.getParcelableArrayList("String_Node_Str");
    adapter=new AppsAdapter(getActivity(),R.layout.rowlayout,a,app,c);
    setListAdapter(adapter);
    vl.setSelectionFromTop(savedInstanceState.getInt("String_Node_Str"),savedInstanceState.getInt("String_Node_Str"));
  }
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  setRetainInstance(true);
  mainActivity=(MainActivity)getActivity();
  mainActivity.toolbar.setTitle(utils.getString(getActivity(),R.string.apps));
  mainActivity.tabsSpinner.setVisibility(View.GONE);
  mainActivity.floatingActionButton.setVisibility(View.GONE);
  mainActivity.buttonBarFrame.setVisibility(View.GONE);
  mainActivity.supportInvalidateOptionsMenu();
  fabSkin=mainActivity.fabskin;
  vl=getListView();
  Sp=PreferenceManager.getDefaultSharedPreferences(getActivity());
  ListView vl=getListView();
  int theme=Integer.parseInt(Sp.getString("String_Node_Str","String_Node_Str"));
  theme1=theme == 2 ? PreferenceUtils.hourOfDay() : theme;
  vl.setDivider(null);
  if (theme1 == 1)   getActivity().getWindow().getDecorView().setBackgroundColor(getResources().getColor(R.color.holo_dark_background));
  if (savedInstanceState == null)   new LoadListTask().execute();
 else {
    c=savedInstanceState.getParcelableArrayList("String_Node_Str");
    a=savedInstanceState.getParcelableArrayList("String_Node_Str");
    adapter=new AppsAdapter(getActivity(),R.layout.rowlayout,a,app,c);
    setListAdapter(adapter);
    vl.setSelectionFromTop(savedInstanceState.getInt("String_Node_Str"),savedInstanceState.getInt("String_Node_Str"));
  }
}
Program: 162576
Project: 162576
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  rootView=inflater.inflate(R.layout.bookmark_frag,container,false);
  MainActivity mainActivity=(MainActivity)getActivity();
  mainActivity.toolbar.setTitle(utils.getString(getActivity(),R.string.bookmanag));
  mainActivity.tabsSpinner.setVisibility(View.GONE);
  mainActivity.floatingActionButton.setVisibility(View.GONE);
  listview=(RecyclerView)rootView.findViewById(R.id.listView);
  rootView.findViewById(R.id.buttonbarframe).setVisibility(View.GONE);
  c=getActivity();
  linearLayoutManager=new LinearLayoutManager(c);
  listview.setLayoutManager(linearLayoutManager);
  return rootView;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  rootView=inflater.inflate(R.layout.bookmark_frag,container,false);
  MainActivity mainActivity=(MainActivity)getActivity();
  mainActivity.toolbar.setTitle(utils.getString(getActivity(),R.string.bookmanag));
  mainActivity.tabsSpinner.setVisibility(View.GONE);
  mainActivity.floatingActionButton.setVisibility(View.GONE);
  mainActivity.buttonBarFrame.setVisibility(View.GONE);
  listview=(RecyclerView)rootView.findViewById(R.id.listView);
  c=getActivity();
  linearLayoutManager=new LinearLayoutManager(c);
  listview.setLayoutManager(linearLayoutManager);
  return rootView;
}
Program: 162578
Project: 162578
Buggy source:
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View root=(ViewGroup)inflater.inflate(R.layout.processparent,container,false);
  setRetainInstance(false);
  mainActivity=(MainActivity)getActivity();
  if (mainActivity.theme1 == 1)   root.setBackgroundResource(android.R.color.black);
  rootView=(LinearLayout)root.findViewById(R.id.secondbut);
  mainActivity.toolbar.setTitle(utils.getString(getActivity(),R.string.processes));
  mainActivity.tabsSpinner.setVisibility(View.GONE);
  Sp=PreferenceManager.getDefaultSharedPreferences(getActivity());
  icons=new IconUtils(Sp,getActivity());
  mainActivity.supportInvalidateOptionsMenu();
  return root;
}

Fixed version (ground truth):
@Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
  View root=(ViewGroup)inflater.inflate(R.layout.processparent,container,false);
  setRetainInstance(false);
  mainActivity=(MainActivity)getActivity();
  if (mainActivity.theme1 == 1)   root.setBackgroundResource(getResources().getColor(R.color.holo_dark_background));
  rootView=(LinearLayout)root.findViewById(R.id.secondbut);
  mainActivity.toolbar.setTitle(utils.getString(getActivity(),R.string.processes));
  mainActivity.tabsSpinner.setVisibility(View.GONE);
  mainActivity.floatingActionButton.setVisibility(View.GONE);
  Sp=PreferenceManager.getDefaultSharedPreferences(getActivity());
  icons=new IconUtils(Sp,getActivity());
  mainActivity.supportInvalidateOptionsMenu();
  return root;
}
Program: 162584
Project: 162584
Buggy source:
public void createviews(ArrayList<FileHeader> zipEntries,String dir){
  zipViewer.zipAdapter=new RarAdapter(zipViewer.getActivity(),zipEntries,zipViewer);
  zipViewer.listView.setAdapter(zipViewer.zipAdapter);
  if (!addheader) {
    listView.removeItemDecoration(dividerItemDecoration);
    listView.removeItemDecoration(headersDecor);
    addheader=true;
  }
  if (addheader) {
    dividerItemDecoration=new DividerItemDecoration(getActivity(),DividerItemDecoration.VERTICAL_LIST);
    listView.addItemDecoration(dividerItemDecoration);
    headersDecor=new StickyRecyclerHeadersDecoration(zipAdapter);
    listView.addItemDecoration(headersDecor);
    addheader=false;
  }
  listView.setOnScrollListener(new HidingScrollListener(getActivity(),hidemode){
    @Override public void onMoved(    int distance){
      mToolbarContainer.setTranslationY(-distance);
    }
    @Override public void onShow(){
      mToolbarContainer.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start();
    }
    @Override public void onHide(){
      mToolbarContainer.findViewById(R.id.lin).animate().translationY(-mToolbarHeight).setInterpolator(new AccelerateInterpolator(2)).start();
    }
  }
);
  zipViewer.current=dir;
  zipViewer.bbar();
  swipeRefreshLayout.setRefreshing(false);
}

Fixed version (ground truth):
public void createviews(ArrayList<FileHeader> zipEntries,String dir){
  zipViewer.zipAdapter=new RarAdapter(zipViewer.getActivity(),zipEntries,zipViewer);
  zipViewer.listView.setAdapter(zipViewer.zipAdapter);
  if (!addheader) {
    listView.removeItemDecoration(dividerItemDecoration);
    listView.removeItemDecoration(headersDecor);
    addheader=true;
  }
  if (addheader) {
    dividerItemDecoration=new DividerItemDecoration(getActivity(),DividerItemDecoration.VERTICAL_LIST);
    listView.addItemDecoration(dividerItemDecoration);
    headersDecor=new StickyRecyclerHeadersDecoration(zipAdapter);
    listView.addItemDecoration(headersDecor);
    addheader=false;
  }
  listView.setOnScrollListener(scrollListener);
  zipViewer.current=dir;
  zipViewer.bbar();
  swipeRefreshLayout.setRefreshing(false);
}
Program: 162586
Project: 162586
Buggy source:
public void createviews(ArrayList<ZipObj> zipEntries,String dir){
  zipViewer.zipAdapter=new ZipAdapter(zipViewer.getActivity(),zipEntries,zipViewer);
  zipViewer.listView.setAdapter(zipViewer.zipAdapter);
  if (!addheader) {
    listView.removeItemDecoration(dividerItemDecoration);
    listView.removeItemDecoration(headersDecor);
    addheader=true;
  }
  if (addheader) {
    dividerItemDecoration=new DividerItemDecoration(getActivity(),DividerItemDecoration.VERTICAL_LIST);
    listView.addItemDecoration(dividerItemDecoration);
    headersDecor=new StickyRecyclerHeadersDecoration(zipAdapter);
    listView.addItemDecoration(headersDecor);
    addheader=false;
  }
  listView.setOnScrollListener(new HidingScrollListener(getActivity(),hidemode){
    @Override public void onMoved(    int distance){
      mToolbarContainer.setTranslationY(-distance);
    }
    @Override public void onShow(){
      mToolbarContainer.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start();
    }
    @Override public void onHide(){
      mToolbarContainer.findViewById(R.id.lin).animate().translationY(-mToolbarHeight).setInterpolator(new AccelerateInterpolator(2)).start();
    }
  }
);
  zipViewer.current=dir;
  zipViewer.bbar();
  swipeRefreshLayout.setRefreshing(false);
}

Fixed version (ground truth):
public void createviews(ArrayList<ZipObj> zipEntries,String dir){
  zipViewer.zipAdapter=new ZipAdapter(zipViewer.getActivity(),zipEntries,zipViewer);
  zipViewer.listView.setAdapter(zipViewer.zipAdapter);
  if (!addheader) {
    listView.removeItemDecoration(dividerItemDecoration);
    listView.removeItemDecoration(headersDecor);
    addheader=true;
  }
  if (addheader) {
    dividerItemDecoration=new DividerItemDecoration(getActivity(),DividerItemDecoration.VERTICAL_LIST);
    listView.addItemDecoration(dividerItemDecoration);
    headersDecor=new StickyRecyclerHeadersDecoration(zipAdapter);
    listView.addItemDecoration(headersDecor);
    addheader=false;
  }
  listView.setOnScrollListener(scrollListener);
  zipViewer.current=dir;
  zipViewer.bbar();
  swipeRefreshLayout.setRefreshing(false);
}
Program: 162588
Project: 162588
Buggy source:
public HidingScrollListener(Context context,int mode){
switch (mode) {
case HIDE_NONE:
    mToolbarHeight=0;
  break;
case HIDE_TOOLBAR:
mToolbarHeight=getToolbarHeight(context);
break;
case HIDE_WHOLE_BAR:
mToolbarHeight=getToolbarHeight(context) + dpToPx(72,context);
break;
}
}

Fixed version (ground truth):
public HidingScrollListener(int mToolbarHeight){
  this.mToolbarHeight=mToolbarHeight;
}
Program: 162589
Project: 162589
Buggy source:
public ArrayList<Layoutelements> addToSmb(SmbFile[] mFile) throws SmbException {
  ArrayList<Layoutelements> a=new ArrayList<Layoutelements>();
  smbFiles=new ArrayList<SmbFile>();
  for (int i=0; i < mFile.length; i++) {
    smbFiles.add(mFile[i]);
    if (mFile[i].isDirectory()) {
      a.add(new Layoutelements(folder,mFile[i].getName(),mFile[i].getPath(),"String_Node_Str","String_Node_Str","String_Node_Str",false,"String_Node_Str",true));
    }
 else {
      try {
        a.add(new Layoutelements(Icons.loadMimeIcon(getActivity(),mFile[i].getPath(),!islist),mFile[i].getName(),mFile[i].getPath(),"String_Node_Str","String_Node_Str",utils.readableFileSize(mFile[i].length()),false,"String_Node_Str",false));
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
  }
  return a;
}

Fixed version (ground truth):
public ArrayList<Layoutelements> addToSmb(SmbFile[] mFile) throws SmbException {
  Log.e("String_Node_Str",mFile.length + "String_Node_Str");
  ArrayList<Layoutelements> a=new ArrayList<Layoutelements>();
  smbFiles=new ArrayList<SmbFile>();
  for (int i=0; i < mFile.length; i++) {
    smbFiles.add(mFile[i]);
    if (mFile[i].isDirectory()) {
      a.add(new Layoutelements(folder,mFile[i].getName(),mFile[i].getPath(),"String_Node_Str","String_Node_Str","String_Node_Str",false,"String_Node_Str",true));
    }
 else {
      try {
        a.add(new Layoutelements(Icons.loadMimeIcon(getActivity(),mFile[i].getPath(),!islist),mFile[i].getName(),mFile[i].getPath(),"String_Node_Str","String_Node_Str",utils.readableFileSize(mFile[i].length()),false,"String_Node_Str",false));
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
  }
  Log.e("String_Node_Str",a.size() + "String_Node_Str");
  return a;
}
Program: 162590
Project: 162590
Buggy source:
public void onListItemClicked(int position,View v){
  if (results) {
    String path=list.get(position).getDesc();
    if (selection)     adapter.toggleChecked(position);
 else {
      final File f=new File(path);
      if (list.get(position).isDirectory()) {
        loadlist(f,false);
        results=false;
      }
 else {
        if (mainActivity.mReturnIntent) {
          returnIntentResults(f);
        }
 else         utils.openFile(f,(MainActivity)getActivity());
      }
    }
  }
 else   if (selection == true) {
    if (!list.get(position).getSize().equals(goback)) {
      adapter.toggleChecked(position);
    }
 else {
      selection=false;
      if (mActionMode != null)       mActionMode.finish();
      mActionMode=null;
    }
  }
 else {
    if (!list.get(position).getSize().equals(goback)) {
      String path;
      Layoutelements l=list.get(position);
      if (!l.hasSymlink()) {
        path=l.getDesc();
      }
 else {
        path=l.getSymlink();
      }
      final File f=new File(path);
      if (l.isDirectory()) {
        computeScroll();
        loadlist(f,false);
      }
 else {
        if (mainActivity.mReturnIntent) {
          returnIntentResults(f);
        }
 else {
          utils.openFile(f,(MainActivity)getActivity());
        }
      }
    }
 else {
      goBackItemClick();
    }
  }
}

Fixed version (ground truth):
public void onListItemClicked(int position,View v){
  if (results) {
    String path=list.get(position).getDesc();
    if (selection)     adapter.toggleChecked(position);
 else {
      final File f=new File(path);
      if (list.get(position).isDirectory()) {
        loadlist(f,false);
        results=false;
      }
 else {
        if (mainActivity.mReturnIntent) {
          returnIntentResults(f);
        }
 else         utils.openFile(f,(MainActivity)getActivity());
      }
    }
  }
 else   if (smbMode) {
    if (selection)     adapter.toggleChecked(position);
 else {
      Toast.makeText(getActivity(),"String_Node_Str",Toast.LENGTH_LONG).show();
      loadSmblist(smbFiles.get(position),false);
    }
  }
 else   if (selection == true) {
    if (!list.get(position).getSize().equals(goback)) {
      adapter.toggleChecked(position);
    }
 else {
      selection=false;
      if (mActionMode != null)       mActionMode.finish();
      mActionMode=null;
    }
  }
 else {
    if (!list.get(position).getSize().equals(goback)) {
      String path;
      Layoutelements l=list.get(position);
      if (!l.hasSymlink()) {
        path=l.getDesc();
      }
 else {
        path=l.getSymlink();
      }
      final File f=new File(path);
      if (l.isDirectory()) {
        computeScroll();
        loadlist(f,false);
      }
 else {
        if (mainActivity.mReturnIntent) {
          returnIntentResults(f);
        }
 else {
          utils.openFile(f,(MainActivity)getActivity());
        }
      }
    }
 else {
      goBackItemClick();
    }
  }
}
Program: 162592
Project: 162592
Buggy source:
@Override public void onSaveInstanceState(Bundle outState){
  super.onSaveInstanceState(outState);
  int index;
  View vi;
  if (listView != null) {
    if (islist) {
      index=(mLayoutManager).findFirstVisibleItemPosition();
      vi=listView.getChildAt(0);
    }
 else {
      index=(mLayoutManagerGrid).findFirstVisibleItemPosition();
      vi=listView.getChildAt(0);
    }
    int top=(vi == null) ? 0 : vi.getTop();
    outState.putInt("String_Node_Str",index);
    outState.putInt("String_Node_Str",top);
    outState.putParcelableArrayList("String_Node_Str",list);
    outState.putString("String_Node_Str",current);
    outState.putBoolean("String_Node_Str",selection);
    if (selection) {
      outState.putIntegerArrayList("String_Node_Str",adapter.getCheckedItemPositions());
    }
    if (results) {
      outState.putBoolean("String_Node_Str",results);
    }
  }
}

Fixed version (ground truth):
@Override public void onSaveInstanceState(Bundle outState){
  super.onSaveInstanceState(outState);
  int index;
  View vi;
  if (listView != null) {
    if (islist) {
      index=(mLayoutManager).findFirstVisibleItemPosition();
      vi=listView.getChildAt(0);
    }
 else {
      index=(mLayoutManagerGrid).findFirstVisibleItemPosition();
      vi=listView.getChildAt(0);
    }
    int top=(vi == null) ? 0 : vi.getTop();
    outState.putInt("String_Node_Str",index);
    outState.putInt("String_Node_Str",top);
    outState.putParcelableArrayList("String_Node_Str",list);
    outState.putString("String_Node_Str",current);
    outState.putBoolean("String_Node_Str",selection);
    if (selection) {
      outState.putIntegerArrayList("String_Node_Str",adapter.getCheckedItemPositions());
    }
    if (results) {
      outState.putBoolean("String_Node_Str",results);
    }
    if (smbMode)     addSmbToSavedInstance(outState,smbUser,smbPass,smbFiles,SmbAnonym);
  }
}
Program: 162593
Project: 162593
Buggy source:
public SmbFile connectingWithSmbServer(String[] auth,boolean anonym){
  try {
    String yourPeerIP=auth[0];
    String path="String_Node_Str" + yourPeerIP;
    SmbFile smbFile;
    if (anonym) {
      smbFile=new SmbFile(path,NtlmPasswordAuthentication.ANONYMOUS);
    }
 else {
      NtlmPasswordAuthentication auth1=new NtlmPasswordAuthentication(null,auth[1],auth[2]);
      smbFile=new SmbFile(path,auth1);
    }
    return smbFile;
  }
 catch (  Exception e) {
    e.printStackTrace();
    Log.e("String_Node_Str",e.getMessage());
    return null;
  }
}

Fixed version (ground truth):
public SmbFile connectingWithSmbServer(String[] auth,boolean anonym){
  try {
    String yourPeerIP=auth[0];
    String path="String_Node_Str" + yourPeerIP;
    smbPath=path;
    SmbFile smbFile;
    if (anonym) {
      SmbAnonym=true;
      smbFile=new SmbFile(path,NtlmPasswordAuthentication.ANONYMOUS);
    }
 else {
      SmbAnonym=false;
      smbUser=auth[1];
      smbPass=auth[2];
      NtlmPasswordAuthentication auth1=new NtlmPasswordAuthentication(null,auth[1],auth[2]);
      smbFile=new SmbFile(path,auth1);
    }
    return smbFile;
  }
 catch (  Exception e) {
    e.printStackTrace();
    Log.e("String_Node_Str",e.getMessage());
    return null;
  }
}
Program: 162594
Project: 162594
Buggy source:
@Override protected void onPreExecute(){
  ma.history.addPath(ma.current);
}

Fixed version (ground truth):
@Override protected void onPreExecute(){
  Log.e("String_Node_Str","String_Node_Str");
  ma.history.addPath(ma.current);
}
Program: 162595
Project: 162595
Buggy source:
@Override protected ArrayList<Layoutelements> doInBackground(SmbFile... params){
  f=params[0];
  ma.list=new ArrayList<Layoutelements>();
  try {
    ma.list=ma.addToSmb(f.listFiles());
    return ma.list;
  }
 catch (  Exception e) {
    publishProgress(e.getMessage());
    return null;
  }
}

Fixed version (ground truth):
@Override protected ArrayList<Layoutelements> doInBackground(SmbFile... params){
  Log.e("String_Node_Str","String_Node_Str");
  f=params[0];
  Log.e("String_Node_Str",f.getPath());
  ma.list=new ArrayList<Layoutelements>();
  try {
    SmbFile[] smbFile=f.listFiles();
    Log.e("String_Node_Str","String_Node_Str" + smbFile.length);
    ma.list=ma.addToSmb(smbFile);
    return ma.list;
  }
 catch (  Exception e) {
    publishProgress(e.getMessage());
    e.printStackTrace();
    return null;
  }
}
Program: 162596
Project: 162596
Buggy source:
@Override protected void onPostExecute(ArrayList<Layoutelements> bitmap){
  if (isCancelled()) {
    bitmap=null;
  }
  ma.createViews(bitmap,back,new File(f.getPath()));
  ma.listView.setVisibility(View.VISIBLE);
}

Fixed version (ground truth):
@Override protected void onPostExecute(ArrayList<Layoutelements> bitmap){
  if (isCancelled()) {
    bitmap=null;
  }
  Log.e("String_Node_Str","String_Node_Str");
  ma.createViews(bitmap,back,new File(f.getPath()));
  ma.smbPath=f.getPath();
  ma.smbMode=true;
  ma.listView.setVisibility(View.VISIBLE);
}
Program: 162598
Project: 162598
Buggy source:
@Override public void onGlobalLayout(){
  if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
    mToolbarContainer.getViewTreeObserver().removeOnGlobalLayoutListener(this);
  }
 else {
    mToolbarContainer.getViewTreeObserver().removeGlobalOnLayoutListener(this);
  }
  paddingTop=mToolbarContainer.getHeight();
  if (hidemode != 2)   mToolbarHeight=mainActivity.toolbar.getHeight();
  if (scrollListener != null)   scrollListener.updatedimens(mToolbarHeight);
}

Fixed version (ground truth):
@Override public void onGlobalLayout(){
  if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
    mToolbarContainer.getViewTreeObserver().removeOnGlobalLayoutListener(this);
  }
 else {
    mToolbarContainer.getViewTreeObserver().removeGlobalOnLayoutListener(this);
  }
  paddingTop=mToolbarContainer.getHeight();
  if (hidemode != 2)   mToolbarHeight=mainActivity.toolbar.getHeight();
}
Program: 162600
Project: 162600
Buggy source:
@Override public void onGlobalLayout(){
  if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
    mToolbarContainer.getViewTreeObserver().removeOnGlobalLayoutListener(this);
  }
 else {
    mToolbarContainer.getViewTreeObserver().removeGlobalOnLayoutListener(this);
  }
  paddingTop=mToolbarContainer.getHeight();
  if (hidemode != 2)   mToolbarHeight=mainActivity.toolbar.getHeight();
  if (scrollListener != null)   scrollListener.updatedimens(mToolbarHeight);
}

Fixed version (ground truth):
@Override public void onGlobalLayout(){
  if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
    mToolbarContainer.getViewTreeObserver().removeOnGlobalLayoutListener(this);
  }
 else {
    mToolbarContainer.getViewTreeObserver().removeGlobalOnLayoutListener(this);
  }
  paddingTop=mToolbarContainer.getHeight();
  if (hidemode != 2)   mToolbarHeight=mainActivity.toolbar.getHeight();
}
Program: 162601
Project: 162601
Buggy source:
public void createviews(ArrayList<FileHeader> zipEntries,String dir){
  zipViewer.zipAdapter=new RarAdapter(zipViewer.getActivity(),zipEntries,zipViewer);
  zipViewer.listView.setAdapter(zipViewer.zipAdapter);
  if (!addheader) {
    listView.removeItemDecoration(dividerItemDecoration);
    listView.removeItemDecoration(headersDecor);
    addheader=true;
  }
  if (addheader) {
    dividerItemDecoration=new DividerItemDecoration(getActivity(),DividerItemDecoration.VERTICAL_LIST);
    listView.addItemDecoration(dividerItemDecoration);
    headersDecor=new StickyRecyclerHeadersDecoration(zipAdapter);
    listView.addItemDecoration(headersDecor);
    addheader=false;
  }
  listView.setOnScrollListener(scrollListener);
  zipViewer.current=dir;
  zipViewer.bbar();
  swipeRefreshLayout.setRefreshing(false);
}

Fixed version (ground truth):
public void createviews(ArrayList<FileHeader> zipEntries,String dir){
  zipViewer.zipAdapter=new RarAdapter(zipViewer.getActivity(),zipEntries,zipViewer);
  zipViewer.listView.setAdapter(zipViewer.zipAdapter);
  if (!addheader) {
    listView.removeItemDecoration(dividerItemDecoration);
    listView.removeItemDecoration(headersDecor);
    addheader=true;
  }
  if (addheader) {
    dividerItemDecoration=new DividerItemDecoration(getActivity(),DividerItemDecoration.VERTICAL_LIST);
    listView.addItemDecoration(dividerItemDecoration);
    headersDecor=new StickyRecyclerHeadersDecoration(zipAdapter);
    listView.addItemDecoration(headersDecor);
    addheader=false;
  }
  listView.setOnScrollListener(new HidingScrollListener(mToolbarHeight,hidemode){
    @Override public void onMoved(    int distance){
      mToolbarContainer.setTranslationY(-distance);
    }
    @Override public void onShow(){
      mToolbarContainer.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start();
    }
    @Override public void onHide(){
      mToolbarContainer.findViewById(R.id.lin).animate().translationY(-mToolbarHeight).setInterpolator(new AccelerateInterpolator(2)).start();
    }
  }
);
  zipViewer.current=dir;
  zipViewer.bbar();
  swipeRefreshLayout.setRefreshing(false);
}
Program: 162603
Project: 162603
Buggy source:
@Override public void onGlobalLayout(){
  if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
    mToolbarContainer.getViewTreeObserver().removeOnGlobalLayoutListener(this);
  }
 else {
    mToolbarContainer.getViewTreeObserver().removeGlobalOnLayoutListener(this);
  }
  paddingTop=mToolbarContainer.getHeight();
  if (hidemode != 2)   mToolbarHeight=mainActivity.toolbar.getHeight();
  if (scrollListener != null)   scrollListener.updatedimens(mToolbarHeight);
}

Fixed version (ground truth):
@Override public void onGlobalLayout(){
  if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
    mToolbarContainer.getViewTreeObserver().removeOnGlobalLayoutListener(this);
  }
 else {
    mToolbarContainer.getViewTreeObserver().removeGlobalOnLayoutListener(this);
  }
  paddingTop=mToolbarContainer.getHeight();
  if (hidemode != 2)   mToolbarHeight=mainActivity.toolbar.getHeight();
}
Program: 162604
Project: 162604
Buggy source:
public void createviews(ArrayList<ZipObj> zipEntries,String dir){
  zipViewer.zipAdapter=new ZipAdapter(zipViewer.getActivity(),zipEntries,zipViewer);
  zipViewer.listView.setAdapter(zipViewer.zipAdapter);
  if (!addheader) {
    listView.removeItemDecoration(dividerItemDecoration);
    listView.removeItemDecoration(headersDecor);
    addheader=true;
  }
  if (addheader) {
    dividerItemDecoration=new DividerItemDecoration(getActivity(),DividerItemDecoration.VERTICAL_LIST);
    listView.addItemDecoration(dividerItemDecoration);
    headersDecor=new StickyRecyclerHeadersDecoration(zipAdapter);
    listView.addItemDecoration(headersDecor);
    addheader=false;
  }
  listView.setOnScrollListener(scrollListener);
  zipViewer.current=dir;
  zipViewer.bbar();
  swipeRefreshLayout.setRefreshing(false);
}

Fixed version (ground truth):
public void createviews(ArrayList<ZipObj> zipEntries,String dir){
  zipViewer.zipAdapter=new ZipAdapter(zipViewer.getActivity(),zipEntries,zipViewer);
  zipViewer.listView.setAdapter(zipViewer.zipAdapter);
  if (!addheader) {
    listView.removeItemDecoration(dividerItemDecoration);
    listView.removeItemDecoration(headersDecor);
    addheader=true;
  }
  if (addheader) {
    dividerItemDecoration=new DividerItemDecoration(getActivity(),DividerItemDecoration.VERTICAL_LIST);
    listView.addItemDecoration(dividerItemDecoration);
    headersDecor=new StickyRecyclerHeadersDecoration(zipAdapter);
    listView.addItemDecoration(headersDecor);
    addheader=false;
  }
  listView.setOnScrollListener(new HidingScrollListener(mToolbarHeight,hidemode){
    @Override public void onMoved(    int distance){
      mToolbarContainer.setTranslationY(-distance);
    }
    @Override public void onShow(){
      mToolbarContainer.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start();
    }
    @Override public void onHide(){
      mToolbarContainer.findViewById(R.id.lin).animate().translationY(-mToolbarHeight).setInterpolator(new AccelerateInterpolator(2)).start();
    }
  }
);
  zipViewer.current=dir;
  zipViewer.bbar();
  swipeRefreshLayout.setRefreshing(false);
}
Program: 162606
Project: 162606
Buggy source:
public HidingScrollListener(int mToolbarHeight){
  this.mToolbarHeight=mToolbarHeight;
}

Fixed version (ground truth):
public HidingScrollListener(int mToolbarHeight,int mode){
  this.mToolbarHeight=mToolbarHeight;
  if (mode == 0)   this.mToolbarHeight=0;
}
Program: 162608
Project: 162608
Buggy source:
private boolean isPositionHeader(int position){
  return position == 0;
}

Fixed version (ground truth):
private boolean isPositionHeader(int position){
  if (main.islist)   return position == 0;
 else   return position == 0 || position == 1 || position == 2;
}
Program: 162609
Project: 162609
Buggy source:
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent,int viewType){
  View v;
  if (main.islist)   v=mInflater.inflate(R.layout.rowlayout,parent,false);
 else   v=mInflater.inflate(R.layout.griditem,parent,false);
  ViewHolder vh=new ViewHolder(v);
  if (main.theme1 == 1)   vh.txtTitle.setTextColor(main.getActivity().getResources().getColor(android.R.color.white));
  return vh;
}

Fixed version (ground truth):
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent,int viewType){
  if (viewType == 0) {
    View v=mInflater.inflate(R.layout.rowlayout,parent,false);
    return new ViewHolder(v);
  }
  View v;
  if (main.islist)   v=mInflater.inflate(R.layout.rowlayout,parent,false);
 else   v=mInflater.inflate(R.layout.griditem,parent,false);
  ViewHolder vh=new ViewHolder(v);
  if (main.theme1 == 1)   vh.txtTitle.setTextColor(main.getActivity().getResources().getColor(android.R.color.white));
  return vh;
}
Program: 162611
Project: 162611
Buggy source:
@Override public long getHeaderId(int i){
  if (i != 0) {
    if (items.get(i - 1).getSize().equals(main.goback))     return -1;
    if (items.get(i - 1).isDirectory(main.rootMode))     return 'D';
 else     return 'F';
  }
  return -1;
}

Fixed version (ground truth):
@Override public long getHeaderId(int i){
  if (main.islist) {
    if (i != 0) {
      if (items.get(i - 1).getSize().equals(main.goback))       return -1;
      if (items.get(i - 1).isDirectory(main.rootMode))       return 'D';
 else       return 'F';
    }
  }
 else {
    if (i != 0 && i != 1 && i != 2) {
      if (items.get(i - 3).getSize().equals(main.goback))       return -1;
      if (items.get(i - 3).isDirectory(main.rootMode))       return 'D';
 else       return 'F';
    }
  }
  return -1;
}
Program: 162613
Project: 162613
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  setRetainInstance(true);
  MainActivity mainActivity=(MainActivity)getActivity();
  mainActivity.toolbar.setTitle(utils.getString(getActivity(),R.string.apps));
  mainActivity.tabsSpinner.setVisibility(View.GONE);
  mainActivity.supportInvalidateOptionsMenu();
  vl=getListView();
  Sp=PreferenceManager.getDefaultSharedPreferences(getActivity());
  uimode=Integer.parseInt(Sp.getString("String_Node_Str","String_Node_Str"));
  ListView vl=getListView();
  Calendar calendar=Calendar.getInstance();
  int hour=calendar.get(Calendar.HOUR_OF_DAY);
  int theme=Integer.parseInt(Sp.getString("String_Node_Str","String_Node_Str"));
  theme1=theme;
  vl.setDivider(null);
  if (theme == 2) {
    if (hour <= 6 || hour >= 18) {
      theme1=1;
    }
 else     theme1=0;
  }
  if (theme1 == 1)   getActivity().getWindow().getDecorView().setBackgroundColor(Color.BLACK);
  if (savedInstanceState == null)   new LoadListTask().execute();
 else {
    c=savedInstanceState.getParcelableArrayList("String_Node_Str");
    a=savedInstanceState.getParcelableArrayList("String_Node_Str");
    adapter=new AppsAdapter(getActivity(),R.layout.rowlayout,a,app,c);
    setListAdapter(adapter);
    vl.setSelectionFromTop(savedInstanceState.getInt("String_Node_Str"),savedInstanceState.getInt("String_Node_Str"));
  }
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  setRetainInstance(true);
  MainActivity mainActivity=(MainActivity)getActivity();
  mainActivity.toolbar.setTitle(utils.getString(getActivity(),R.string.apps));
  mainActivity.tabsSpinner.setVisibility(View.GONE);
  mainActivity.supportInvalidateOptionsMenu();
  vl=getListView();
  Sp=PreferenceManager.getDefaultSharedPreferences(getActivity());
  ListView vl=getListView();
  Calendar calendar=Calendar.getInstance();
  int hour=calendar.get(Calendar.HOUR_OF_DAY);
  int theme=Integer.parseInt(Sp.getString("String_Node_Str","String_Node_Str"));
  theme1=theme;
  vl.setDivider(null);
  if (theme == 2) {
    if (hour <= 6 || hour >= 18) {
      theme1=1;
    }
 else     theme1=0;
  }
  if (theme1 == 1)   getActivity().getWindow().getDecorView().setBackgroundColor(Color.BLACK);
  if (savedInstanceState == null)   new LoadListTask().execute();
 else {
    c=savedInstanceState.getParcelableArrayList("String_Node_Str");
    a=savedInstanceState.getParcelableArrayList("String_Node_Str");
    adapter=new AppsAdapter(getActivity(),R.layout.rowlayout,a,app,c);
    setListAdapter(adapter);
    vl.setSelectionFromTop(savedInstanceState.getInt("String_Node_Str"),savedInstanceState.getInt("String_Node_Str"));
  }
}
Program: 162618
Project: 162618
Buggy source:
public void createviews(ArrayList<FileHeader> zipEntries,String dir){
  zipViewer.zipAdapter=new RarAdapter(zipViewer.getActivity(),zipEntries,zipViewer);
  zipViewer.listView.setAdapter(zipViewer.zipAdapter);
  if (!addheader) {
    if (uimode == 0)     listView.removeItemDecoration(dividerItemDecoration);
    listView.removeItemDecoration(headersDecor);
    addheader=true;
  }
  if (addheader) {
    if (uimode == 0) {
      dividerItemDecoration=new DividerItemDecoration(getActivity(),DividerItemDecoration.VERTICAL_LIST);
      listView.addItemDecoration(dividerItemDecoration);
    }
    headersDecor=new StickyRecyclerHeadersDecoration(zipAdapter);
    listView.addItemDecoration(headersDecor);
    addheader=false;
  }
  listView.setOnScrollListener(new HidingScrollListener(getActivity(),hidemode){
    @Override public void onMoved(    int distance){
      mToolbarContainer.setTranslationY(-distance);
    }
    @Override public void onShow(){
      mToolbarContainer.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start();
    }
    @Override public void onHide(){
      mToolbarContainer.findViewById(R.id.lin).animate().translationY(-mToolbarHeight).setInterpolator(new AccelerateInterpolator(2)).start();
    }
  }
);
  zipViewer.current=dir;
  zipViewer.bbar();
  swipeRefreshLayout.setRefreshing(false);
}

Fixed version (ground truth):
public void createviews(ArrayList<FileHeader> zipEntries,String dir){
  zipViewer.zipAdapter=new RarAdapter(zipViewer.getActivity(),zipEntries,zipViewer);
  zipViewer.listView.setAdapter(zipViewer.zipAdapter);
  if (!addheader) {
    listView.removeItemDecoration(dividerItemDecoration);
    listView.removeItemDecoration(headersDecor);
    addheader=true;
  }
  if (addheader) {
    dividerItemDecoration=new DividerItemDecoration(getActivity(),DividerItemDecoration.VERTICAL_LIST);
    listView.addItemDecoration(dividerItemDecoration);
    headersDecor=new StickyRecyclerHeadersDecoration(zipAdapter);
    listView.addItemDecoration(headersDecor);
    addheader=false;
  }
  listView.setOnScrollListener(new HidingScrollListener(getActivity(),hidemode){
    @Override public void onMoved(    int distance){
      mToolbarContainer.setTranslationY(-distance);
    }
    @Override public void onShow(){
      mToolbarContainer.animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)).start();
    }
    @Override public void onHide(){
      mToolbarContainer.findViewById(R.id.lin).animate().translationY(-mToolbarHeight).setInterpolator(new AccelerateInterpolator(2)).start();
    }
  }
);
  zipViewer.current=dir;
  zipViewer.bbar();
  swipeRefreshLayout.setRefreshing(false);
}
Program: 162620
Project: 162620
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mainActivity=(MainActivity)getActivity();
  no=getArguments().getInt("String_Node_Str",1);
  home=getArguments().getString("String_Node_Str");
  current=getArguments().getString("String_Node_Str");
  tabHandler=new TabHandler(getActivity(),null,null,1);
  Sp=PreferenceManager.getDefaultSharedPreferences(getActivity());
  savepaths=Sp.getBoolean("String_Node_Str",true);
  skin=Sp.getString("String_Node_Str","String_Node_Str");
  mainActivity.initiatebbar(ma.current,ma);
  sh=new Shortcuts(getActivity());
  islist=Sp.getBoolean("String_Node_Str",true);
  Calendar calendar=Calendar.getInstance();
  int hour=calendar.get(Calendar.HOUR_OF_DAY);
  year=("String_Node_Str" + calendar.get(Calendar.YEAR)).substring(2,4);
  theme=Integer.parseInt(Sp.getString("String_Node_Str","String_Node_Str"));
  theme1=theme;
  if (theme == 2) {
    if (hour <= 6 || hour >= 18) {
      theme1=1;
    }
 else     theme1=0;
  }
  showPermissions=Sp.getBoolean("String_Node_Str",false);
  showSize=Sp.getBoolean("String_Node_Str",false);
  gobackitem=Sp.getBoolean("String_Node_Str",false);
  circularImages=Sp.getBoolean("String_Node_Str",true);
  showLastModified=Sp.getBoolean("String_Node_Str",true);
  icons=new IconUtils(Sp,getActivity());
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mainActivity=(MainActivity)getActivity();
  no=getArguments().getInt("String_Node_Str",1);
  home=getArguments().getString("String_Node_Str");
  current=getArguments().getString("String_Node_Str");
  tabHandler=new TabHandler(getActivity(),null,null,1);
  Sp=PreferenceManager.getDefaultSharedPreferences(getActivity());
  savepaths=Sp.getBoolean("String_Node_Str",true);
  skin=Sp.getString("String_Node_Str","String_Node_Str");
  sh=new Shortcuts(getActivity());
  islist=Sp.getBoolean("String_Node_Str",true);
  Calendar calendar=Calendar.getInstance();
  int hour=calendar.get(Calendar.HOUR_OF_DAY);
  year=("String_Node_Str" + calendar.get(Calendar.YEAR)).substring(2,4);
  theme=Integer.parseInt(Sp.getString("String_Node_Str","String_Node_Str"));
  theme1=theme;
  if (theme == 2) {
    if (hour <= 6 || hour >= 18) {
      theme1=1;
    }
 else     theme1=0;
  }
  showPermissions=Sp.getBoolean("String_Node_Str",false);
  showSize=Sp.getBoolean("String_Node_Str",false);
  gobackitem=Sp.getBoolean("String_Node_Str",false);
  circularImages=Sp.getBoolean("String_Node_Str",true);
  showLastModified=Sp.getBoolean("String_Node_Str",true);
  icons=new IconUtils(Sp,getActivity());
}
Program: 162622
Project: 162622
Buggy source:
@Override public void onClick(View view){
  popup.show();
}

Fixed version (ground truth):
@Override public void onClick(View view){
  Fragment fragment=getFragment().getTab();
  if (fragment.getClass().getName().contains("String_Node_Str")) {
    Main main=(Main)fragment;
    main.bbar(main.current);
    main.crossfade();
    main.timer.cancel();
    main.timer.start();
  }
}
Program: 162624
Project: 162624
Buggy source:
public void onClick(View p1){
  loadlist(new File(rpaths.get(index)),true);
  timer.cancel();
  timer.start();
}

Fixed version (ground truth):
public void onClick(View p1){
  mainActivity.getFragment().getTab().loadlist(new File("String_Node_Str"),false);
  timer.cancel();
  timer.start();
}
Program: 162627
Project: 162627
Buggy source:
private void crossfade(){
  buttons.setAlpha(0f);
  buttons.setVisibility(View.VISIBLE);
  buttons.animate().alpha(1f).setDuration(100).setListener(null);
  pathbar.animate().alpha(0f).setDuration(100).setListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      pathbar.setVisibility(View.GONE);
    }
  }
);
}

Fixed version (ground truth):
public void crossfade(){
  buttons.setAlpha(0f);
  buttons.setVisibility(View.VISIBLE);
  buttons.animate().alpha(1f).setDuration(100).setListener(null);
  pathbar.animate().alpha(0f).setDuration(100).setListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationEnd(    Animator animation){
      pathbar.setVisibility(View.GONE);
    }
  }
);
}
Program: 162629
Project: 162629
Buggy source:
public void onPageSelected(int p1){
  currenttab=p1;
  String name=fragments.get(p1).getClass().getName();
  if (name.contains("String_Node_Str")) {
    Main ma=((Main)fragments.get(p1));
    if (ma.current != null) {
      ((MainActivity)getActivity()).updateDrawer(ma.current);
      ma.bbar(ma.current);
      try {
        ((TextView)STRIP.getChildAt(p1)).setText(ma.current);
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
  }
 else   if (name.contains("String_Node_Str")) {
    ZipViewer ma=((ZipViewer)fragments.get(p1));
    ma.bbar();
  }
}

Fixed version (ground truth):
public void onPageSelected(int p1){
  currenttab=p1;
  mainActivity.updateActionButtons();
  String name=fragments.get(p1).getClass().getName();
  if (name.contains("String_Node_Str")) {
    Main ma=((Main)fragments.get(p1));
    if (ma.current != null) {
      mainActivity.updateDrawer(ma.current);
      ma.updatePath(ma.current);
      if (ma.buttons.getVisibility() == View.VISIBLE)       ma.bbar(ma.current);
      try {
        ((TextView)STRIP.getChildAt(p1)).setText(ma.current);
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
  }
 else   if (name.contains("String_Node_Str")) {
    ZipViewer ma=((ZipViewer)fragments.get(p1));
    ma.bbar();
  }
}
Program: 162630
Project: 162630
Buggy source:
@Override public CharSequence getPageTitle(int position){
  String name=fragments.get(position).getClass().getName();
  if (name.contains("String_Node_Str")) {
    Main ma=((Main)fragments.get(position));
    if (ma.results) {
      return utils.getString(getActivity(),R.string.searchresults);
    }
 else {
      if (ma.current.equals("String_Node_Str")) {
        return "String_Node_Str";
      }
 else {
        return new File(ma.current).getName();
      }
    }
  }
 else   if (name.contains("String_Node_Str")) {
    ZipViewer ma=((ZipViewer)fragments.get(position));
    if (ma.current == null || ma.current.equals("String_Node_Str")) {
      return "String_Node_Str";
    }
 else {
      return new File(ma.current).getName();
    }
  }
  return fragments.get(position).getClass().getName();
}

Fixed version (ground truth):
@Override public CharSequence getPageTitle(int position){
  String name=fragments.get(position).getClass().getName();
  if (name.contains("String_Node_Str")) {
    Main ma=((Main)fragments.get(position));
    if (ma.results) {
      return utils.getString(getActivity(),R.string.searchresults);
    }
 else {
      if (ma.current.equals("String_Node_Str")) {
        return "String_Node_Str";
      }
 else {
        return new File(ma.current).getName();
      }
    }
  }
 else   if (name.contains("String_Node_Str")) {
    ZipViewer ma=((ZipViewer)fragments.get(position));
    try {
      return ma.f.getName();
    }
 catch (    Exception e) {
      return "String_Node_Str";
    }
  }
  return fragments.get(position).getClass().getName();
}
Program: 162635
Project: 162635
Buggy source:
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  getActivity().findViewById(R.id.fabbutton).setVisibility(View.GONE);
  final int maxMemory=(int)(Runtime.getRuntime().maxMemory() / 1024);
  getActivity().findViewById(R.id.buttonbarframe).setVisibility(View.GONE);
  final int cacheSize=maxMemory / 4;
  mMemoryCache=new LruCache<String,Bitmap>(cacheSize){
  }
;
  vl=getListView();
  Sp=PreferenceManager.getDefaultSharedPreferences(getActivity());
  uimode=Integer.parseInt(Sp.getString("String_Node_Str","String_Node_Str"));
  ListView vl=getListView();
  if (uimode == 1) {
    float scale=getResources().getDisplayMetrics().density;
    int dpAsPixels=(int)(5 * scale + 0.5f);
    vl.setPadding(dpAsPixels,0,dpAsPixels,0);
    vl.setDivider(null);
  }
  vl.setFastScrollEnabled(true);
  if (savedInstanceState == null)   new LoadListTask().execute();
 else {
    c=savedInstanceState.getParcelableArrayList("String_Node_Str");
    a=savedInstanceState.getParcelableArrayList("String_Node_Str");
    adapter=new AppsAdapter(getActivity(),R.layout.rowlayout,a,app);
    setListAdapter(adapter);
    vl.setSelectionFromTop(savedInstanceState.getInt("String_Node_Str"),savedInstanceState.getInt("String_Node_Str"));
  }
}

Fixed version (ground truth):
@Override public void onActivityCreated(Bundle savedInstanceState){
  super.onActivityCreated(savedInstanceState);
  getActivity().findViewById(R.id.fabbutton).setVisibility(View.GONE);
  final int maxMemory=(int)(Runtime.getRuntime().maxMemory() / 1024);
  getActivity().findViewById(R.id.buttonbarframe).setVisibility(View.GONE);
  final int cacheSize=maxMemory / 4;
  mMemoryCache=new LruCache<String,Bitmap>(cacheSize){
  }
;
  vl=getListView();
  Sp=PreferenceManager.getDefaultSharedPreferences(getActivity());
  uimode=Integer.parseInt(Sp.getString("String_Node_Str","String_Node_Str"));
  ListView vl=getListView();
  if (uimode == 1) {
    float scale=getResources().getDisplayMetrics().density;
    int dpAsPixels=(int)(5 * scale + 0.5f);
    vl.setPadding(dpAsPixels,0,dpAsPixels,0);
    vl.setDividerHeight(dpAsPixels);
  }
  vl.setDivider(null);
  vl.setFastScrollEnabled(true);
  if (savedInstanceState == null)   new LoadListTask().execute();
 else {
    c=savedInstanceState.getParcelableArrayList("String_Node_Str");
    a=savedInstanceState.getParcelableArrayList("String_Node_Str");
    adapter=new AppsAdapter(getActivity(),R.layout.rowlayout,a,app);
    setListAdapter(adapter);
    vl.setSelectionFromTop(savedInstanceState.getInt("String_Node_Str"),savedInstanceState.getInt("String_Node_Str"));
  }
}
Program: 162636
Project: 162636
Buggy source:
@Override protected Bitmap doInBackground(ApplicationInfo... params){
  path=params[0];
  Bitmap b=((BitmapDrawable)path.loadIcon(getActivity().getPackageManager())).getBitmap();
  addBitmapToMemoryCache(path.publicSourceDir,b);
  return b;
}

Fixed version (ground truth):
protected ArrayList<Layoutelements> doInBackground(Void[] p1){
  try {
    List<ApplicationInfo> all_apps=getActivity().getPackageManager().getInstalledApplications(PackageManager.GET_META_DATA);
    for (    ApplicationInfo object : all_apps) {
      c.add(object);
    }
    Collections.sort(c,new AppsSorter(getActivity().getPackageManager()));
    for (int i=0; i < c.size(); i++) {
      a.add(new Layoutelements(getActivity().getResources().getDrawable(R.drawable.ic_doc_apk_grid),c.get(i).loadLabel(getActivity().getPackageManager()).toString(),c.get(i).publicSourceDir,"String_Node_Str","String_Node_Str","String_Node_Str",false));
      File file=new File(c.get(i).publicSourceDir);
      mFile.add(file);
    }
  }
 catch (  Exception e) {
  }
  return a;
}
Program: 162637
Project: 162637
Buggy source:
@Override protected void onPostExecute(Bitmap bitmap){
  if (isCancelled()) {
    bitmap=null;
  }
  if (imageViewReference != null && bitmap != null) {
    final ImageView imageView=imageViewReference.get();
    final BitmapWorkerTask bitmapWorkerTask=getBitmapWorkerTask(imageView);
    if (this == bitmapWorkerTask && imageView != null) {
      imageView.setImageBitmap(bitmap);
    }
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(ArrayList<Layoutelements> bitmap){
  if (isCancelled()) {
    bitmap=null;
  }
  try {
    if (bitmap != null) {
      adapter=new AppsAdapter(getActivity(),R.layout.rowlayout,bitmap,app);
      setListAdapter(adapter);
    }
  }
 catch (  Exception e) {
  }
}
Program: 162638
Project: 162638
Buggy source:
private void verifyServiceDeclaration(){
  final PackageManager packageManager=mContext.getPackageManager();
  final Intent intent=new Intent(mContext,BeaconService.class);
  List resolveInfo=packageManager.queryIntentServices(intent,PackageManager.MATCH_DEFAULT_ONLY);
  if (resolveInfo.size() == 0) {
    throw new ServiceNotDeclaredException();
  }
}

Fixed version (ground truth):
private void verifyServiceDeclaration(){
  final PackageManager packageManager=mContext.getPackageManager();
  final Intent intent=new Intent(mContext,BeaconService.class);
  List<ResolveInfo> resolveInfo=packageManager.queryIntentServices(intent,PackageManager.MATCH_DEFAULT_ONLY);
  if (resolveInfo != null && resolveInfo.size() == 0) {
    throw new ServiceNotDeclaredException();
  }
}