Program: 162505
Project: 162505
Buggy source:
public boolean onActionItemClicked(ActionMode mode,MenuItem item){
  computeScroll();
  ArrayList<LayoutElementParcelable> checkedItems=adapter.getCheckedItems();
switch (item.getItemId()) {
case R.id.openmulti:
    try {
      Intent intent_result=new Intent(Intent.ACTION_SEND_MULTIPLE);
      ArrayList<Uri> resulturis=new ArrayList<>();
      for (      LayoutElementParcelable element : checkedItems) {
        HybridFileParcelable baseFile=element.generateBaseFile();
        Uri resultUri=Utils.getUriForBaseFile(getActivity(),baseFile);
        if (resultUri != null) {
          resulturis.add(resultUri);
        }
      }
      intent_result.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
      getActivity().setResult(FragmentActivity.RESULT_OK,intent_result);
      intent_result.putParcelableArrayListExtra(Intent.EXTRA_STREAM,resulturis);
      getActivity().finish();
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  return true;
case R.id.about:
LayoutElementParcelable x=checkedItems.get(0);
GeneralDialogCreation.showPropertiesDialogWithPermissions((x).generateBaseFile(),x.permissions,(ThemedActivity)getActivity(),ThemedActivity.rootMode,utilsProvider.getAppTheme());
mode.finish();
return true;
case R.id.delete:
GeneralDialogCreation.deleteFilesDialog(getContext(),LIST_ELEMENTS,getMainActivity(),checkedItems,utilsProvider.getAppTheme());
return true;
case R.id.share:
ArrayList<File> arrayList=new ArrayList<>();
for (LayoutElementParcelable e : checkedItems) {
arrayList.add(new File(e.desc));
}
if (arrayList.size() > 100) Toast.makeText(getActivity(),getResources().getString(R.string.share_limit),Toast.LENGTH_SHORT).show();
 else {
switch (LIST_ELEMENTS.get(0).getMode()) {
case DROPBOX:
case BOX:
case GDRIVE:
case ONEDRIVE:
FileUtils.shareCloudFile(LIST_ELEMENTS.get(0).desc,LIST_ELEMENTS.get(0).getMode(),getContext());
break;
default :
FileUtils.shareFiles(arrayList,getActivity(),utilsProvider.getAppTheme(),accentColor);
break;
}
}
return true;
case R.id.openparent:
loadlist(new File(checkedItems.get(0).desc).getParent(),false,OpenMode.FILE);
return true;
case R.id.all:
if (adapter.areAllChecked(CURRENT_PATH)) {
adapter.toggleChecked(false,CURRENT_PATH);
}
 else {
adapter.toggleChecked(true,CURRENT_PATH);
}
mode.invalidate();
return true;
case R.id.rename:
final ActionMode m=mode;
final HybridFileParcelable f;
f=checkedItems.get(0).generateBaseFile();
rename(f);
mode.finish();
return true;
case R.id.hide:
for (int i1=0; i1 < checkedItems.size(); i1++) {
hide(checkedItems.get(i1).desc);
}
updateList();
mode.finish();
return true;
case R.id.ex:
getMainActivity().mainActivityHelper.extractFile(new File(checkedItems.get(0).desc));
mode.finish();
return true;
case R.id.cpy:
case R.id.cut:
{
HybridFileParcelable[] copies=new HybridFileParcelable[checkedItems.size()];
for (int i=0; i < checkedItems.size(); i++) {
copies[i]=checkedItems.get(i).generateBaseFile();
}
int op=item.getItemId() == R.id.cpy ? PasteHelper.OPERATION_COPY : PasteHelper.OPERATION_CUT;
PasteHelper pasteHelper=new PasteHelper(op,copies);
getMainActivity().setPaste(pasteHelper);
mode.finish();
return true;
}
case R.id.compress:
ArrayList<HybridFileParcelable> copies1=new ArrayList<>();
for (int i4=0; i4 < checkedItems.size(); i4++) {
copies1.add(checkedItems.get(i4).generateBaseFile());
}
GeneralDialogCreation.showCompressDialog((MainActivity)getActivity(),copies1,CURRENT_PATH);
mode.finish();
return true;
case R.id.openwith:
boolean useNewStack=sharedPref.getBoolean(PreferencesConstants.PREFERENCE_TEXTEDITOR_NEWSTACK,false);
FileUtils.openunknown(new File(checkedItems.get(0).desc),getActivity(),true,useNewStack);
return true;
case R.id.addshortcut:
addShortcut(checkedItems.get(0));
mode.finish();
return true;
default :
return false;
}
}

Fixed version (ground truth):
public boolean onActionItemClicked(ActionMode mode,MenuItem item){
  computeScroll();
  ArrayList<LayoutElementParcelable> checkedItems=adapter.getCheckedItems();
switch (item.getItemId()) {
case R.id.openmulti:
    try {
      Intent intent_result=new Intent(Intent.ACTION_SEND_MULTIPLE);
      ArrayList<Uri> resulturis=new ArrayList<>();
      for (      LayoutElementParcelable element : checkedItems) {
        HybridFileParcelable baseFile=element.generateBaseFile();
        Uri resultUri=Utils.getUriForBaseFile(getActivity(),baseFile);
        if (resultUri != null) {
          resulturis.add(resultUri);
        }
      }
      intent_result.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
      getActivity().setResult(FragmentActivity.RESULT_OK,intent_result);
      intent_result.putParcelableArrayListExtra(Intent.EXTRA_STREAM,resulturis);
      getActivity().finish();
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  return true;
case R.id.about:
LayoutElementParcelable x=checkedItems.get(0);
GeneralDialogCreation.showPropertiesDialogWithPermissions((x).generateBaseFile(),x.permissions,(ThemedActivity)getActivity(),ThemedActivity.rootMode,utilsProvider.getAppTheme());
mode.finish();
return true;
case R.id.delete:
GeneralDialogCreation.deleteFilesDialog(getContext(),LIST_ELEMENTS,getMainActivity(),checkedItems,utilsProvider.getAppTheme());
return true;
case R.id.share:
ArrayList<File> arrayList=new ArrayList<>();
for (LayoutElementParcelable e : checkedItems) {
arrayList.add(new File(e.desc));
}
if (arrayList.size() > 100) Toast.makeText(getActivity(),getResources().getString(R.string.share_limit),Toast.LENGTH_SHORT).show();
 else {
switch (LIST_ELEMENTS.get(0).getMode()) {
case DROPBOX:
case BOX:
case GDRIVE:
case ONEDRIVE:
FileUtils.shareCloudFile(LIST_ELEMENTS.get(0).desc,LIST_ELEMENTS.get(0).getMode(),getContext());
break;
default :
FileUtils.shareFiles(arrayList,getActivity(),utilsProvider.getAppTheme(),accentColor);
break;
}
}
return true;
case R.id.openparent:
loadlist(new File(checkedItems.get(0).desc).getParent(),false,OpenMode.FILE);
return true;
case R.id.all:
if (adapter.areAllChecked(CURRENT_PATH)) {
adapter.toggleChecked(false,CURRENT_PATH);
item.setTitle(R.string.selectall);
}
 else {
adapter.toggleChecked(true,CURRENT_PATH);
item.setTitle(R.string.deselect_all);
}
mode.invalidate();
return true;
case R.id.rename:
final ActionMode m=mode;
final HybridFileParcelable f;
f=checkedItems.get(0).generateBaseFile();
rename(f);
mode.finish();
return true;
case R.id.hide:
for (int i1=0; i1 < checkedItems.size(); i1++) {
hide(checkedItems.get(i1).desc);
}
updateList();
mode.finish();
return true;
case R.id.ex:
getMainActivity().mainActivityHelper.extractFile(new File(checkedItems.get(0).desc));
mode.finish();
return true;
case R.id.cpy:
case R.id.cut:
{
HybridFileParcelable[] copies=new HybridFileParcelable[checkedItems.size()];
for (int i=0; i < checkedItems.size(); i++) {
copies[i]=checkedItems.get(i).generateBaseFile();
}
int op=item.getItemId() == R.id.cpy ? PasteHelper.OPERATION_COPY : PasteHelper.OPERATION_CUT;
PasteHelper pasteHelper=new PasteHelper(op,copies);
getMainActivity().setPaste(pasteHelper);
mode.finish();
return true;
}
case R.id.compress:
ArrayList<HybridFileParcelable> copies1=new ArrayList<>();
for (int i4=0; i4 < checkedItems.size(); i4++) {
copies1.add(checkedItems.get(i4).generateBaseFile());
}
GeneralDialogCreation.showCompressDialog((MainActivity)getActivity(),copies1,CURRENT_PATH);
mode.finish();
return true;
case R.id.openwith:
boolean useNewStack=sharedPref.getBoolean(PreferencesConstants.PREFERENCE_TEXTEDITOR_NEWSTACK,false);
FileUtils.openunknown(new File(checkedItems.get(0).desc),getActivity(),true,useNewStack);
return true;
case R.id.addshortcut:
addShortcut(checkedItems.get(0));
mode.finish();
return true;
default :
return false;
}
}