Program: 162422
Project: 162422
Buggy source:
protected void onActivityResult(int requestCode,int responseCode,Intent intent){
  if (requestCode == Drawer.image_selector_request_code) {
    drawer.onActivityResult(requestCode,responseCode,intent);
  }
 else   if (requestCode == 3) {
    Uri treeUri;
    if (responseCode == Activity.RESULT_OK) {
      treeUri=intent.getData();
      if (treeUri != null)       getPrefs().edit().putString(PreferencesConstants.PREFERENCE_URI,treeUri.toString()).commit();
    }
 else {
      return;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      getContentResolver().takePersistableUriPermission(treeUri,Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
    }
switch (operation) {
case DataUtils.DELETE:
      new DeleteTask(null,mainActivity).execute((oparrayList));
    break;
case DataUtils.COPY:
  if (oparrayList != null && oparrayList.size() != 0) {
    oparrayListList=new ArrayList<>();
    oparrayListList.add(oparrayList);
    oparrayList=null;
    oppatheList=new ArrayList<>();
    oppatheList.add(oppathe);
    oppathe="String_Node_Str";
  }
for (int i=0; i < oparrayListList.size(); i++) {
  ArrayList<HybridFileParcelable> sourceList=oparrayListList.get(i);
  Intent intent1=new Intent(con,CopyService.class);
  intent1.putExtra(CopyService.TAG_COPY_SOURCES,sourceList);
  intent1.putExtra(CopyService.TAG_COPY_TARGET,oppatheList.get(i));
  ServiceWatcherUtil.runService(this,intent1);
}
break;
case DataUtils.MOVE:
if (oparrayList != null && oparrayList.size() != 0) {
oparrayListList=new ArrayList<>();
oparrayListList.add(oparrayList);
oparrayList=null;
oppatheList=new ArrayList<>();
oppatheList.add(oppathe);
oppathe="String_Node_Str";
}
new MoveFiles(oparrayListList,getCurrentMainFragment(),getCurrentMainFragment().getActivity(),OpenMode.FILE).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,oppatheList);
break;
case DataUtils.NEW_FOLDER:
mainActivityHelper.mkDir(RootHelper.generateBaseFile(new File(oppathe),true),getCurrentMainFragment());
break;
case DataUtils.RENAME:
MainFragment ma=getCurrentMainFragment();
mainActivityHelper.rename(ma.openMode,(oppathe),(oppathe1),mainActivity,isRootExplorer());
ma.updateList();
break;
case DataUtils.NEW_FILE:
mainActivityHelper.mkFile(new HybridFile(OpenMode.FILE,oppathe),getCurrentMainFragment());
break;
case DataUtils.EXTRACT:
mainActivityHelper.extractFile(new File(oppathe));
break;
case DataUtils.COMPRESS:
mainActivityHelper.compressFiles(new File(oppathe),oparrayList);
}
operation=-1;
}
 else if (requestCode == REQUEST_CODE_SAF) {
if (responseCode == Activity.RESULT_OK && intent.getData() != null) {
Uri usbOtgRoot=Uri.parse(intent.getData().toString());
SingletonUsbOtg.getInstance().setUsbOtgRoot(usbOtgRoot);
drawer.closeIfNotLocked();
if (drawer.isLocked()) drawer.onDrawerClosed();
}
 else {
Toast.makeText(this,R.string.error,Toast.LENGTH_SHORT).show();
drawer.resetPendingPath();
}
}
}

Fixed version (ground truth):
protected void onActivityResult(int requestCode,int responseCode,Intent intent){
  if (requestCode == Drawer.image_selector_request_code) {
    drawer.onActivityResult(requestCode,responseCode,intent);
  }
 else   if (requestCode == 3) {
    Uri treeUri;
    if (responseCode == Activity.RESULT_OK) {
      treeUri=intent.getData();
      if (treeUri != null)       getPrefs().edit().putString(PreferencesConstants.PREFERENCE_URI,treeUri.toString()).commit();
    }
 else {
      return;
    }
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
      getContentResolver().takePersistableUriPermission(treeUri,Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
    }
switch (operation) {
case DataUtils.DELETE:
      new DeleteTask(null,mainActivity).execute((oparrayList));
    break;
case DataUtils.COPY:
  if (oparrayList != null && oparrayList.size() != 0) {
    oparrayListList=new ArrayList<>();
    oparrayListList.add(oparrayList);
    oparrayList=null;
    oppatheList=new ArrayList<>();
    oppatheList.add(oppathe);
    oppathe="String_Node_Str";
  }
for (int i=0; i < oparrayListList.size(); i++) {
  ArrayList<HybridFileParcelable> sourceList=oparrayListList.get(i);
  Intent intent1=new Intent(con,CopyService.class);
  intent1.putExtra(CopyService.TAG_COPY_SOURCES,sourceList);
  intent1.putExtra(CopyService.TAG_COPY_TARGET,oppatheList.get(i));
  ServiceWatcherUtil.runService(this,intent1);
}
break;
case DataUtils.MOVE:
if (oparrayList != null && oparrayList.size() != 0) {
oparrayListList=new ArrayList<>();
oparrayListList.add(oparrayList);
oparrayList=null;
oppatheList=new ArrayList<>();
oppatheList.add(oppathe);
oppathe="String_Node_Str";
}
new MoveFiles(oparrayListList,getCurrentMainFragment(),getCurrentMainFragment().getActivity(),OpenMode.FILE).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,oppatheList);
break;
case DataUtils.NEW_FOLDER:
mainActivityHelper.mkDir(RootHelper.generateBaseFile(new File(oppathe),true),getCurrentMainFragment());
break;
case DataUtils.RENAME:
MainFragment ma=getCurrentMainFragment();
mainActivityHelper.rename(ma.openMode,(oppathe),(oppathe1),mainActivity,isRootExplorer());
ma.updateList();
break;
case DataUtils.NEW_FILE:
mainActivityHelper.mkFile(new HybridFile(OpenMode.FILE,oppathe),getCurrentMainFragment());
break;
case DataUtils.EXTRACT:
mainActivityHelper.extractFile(new File(oppathe));
break;
case DataUtils.COMPRESS:
mainActivityHelper.compressFiles(new File(oppathe),oparrayList);
break;
case DataUtils.SAVE_FILE:
FileUtil.writeUriToStorage(this,urisToBeSaved,getContentResolver(),getCurrentMainFragment().getCurrentPath());
urisToBeSaved=null;
finish();
break;
}
operation=-1;
}
 else if (requestCode == REQUEST_CODE_SAF) {
if (responseCode == Activity.RESULT_OK && intent.getData() != null) {
Uri usbOtgRoot=Uri.parse(intent.getData().toString());
SingletonUsbOtg.getInstance().setUsbOtgRoot(usbOtgRoot);
drawer.closeIfNotLocked();
if (drawer.isLocked()) drawer.onDrawerClosed();
}
 else {
Toast.makeText(this,R.string.error,Toast.LENGTH_SHORT).show();
drawer.resetPendingPath();
}
}
}