Program: 162519
Project: 162519
Buggy source:
@Override protected ArrayList<LayoutElementParcelable> doInBackground(String... params){
  ArrayList<LayoutElementParcelable> list=null;
  path=params[0];
  grid=ma.checkPathIsGrid(path);
  ma.folder_count=0;
  ma.file_count=0;
  if (openmode == OpenMode.UNKNOWN) {
    HybridFile hFile=new HybridFile(OpenMode.UNKNOWN,path);
    hFile.generateMode(ma.getActivity());
    if (hFile.isLocal()) {
      openmode=OpenMode.FILE;
    }
 else     if (hFile.isSmb()) {
      openmode=OpenMode.SMB;
      ma.smbPath=path;
    }
 else     if (hFile.isOtgFile()) {
      openmode=OpenMode.OTG;
    }
 else     if (hFile.isBoxFile()) {
      openmode=OpenMode.BOX;
    }
 else     if (hFile.isDropBoxFile()) {
      openmode=OpenMode.DROPBOX;
    }
 else     if (hFile.isGoogleDriveFile()) {
      openmode=OpenMode.GDRIVE;
    }
 else     if (hFile.isOneDriveFile()) {
      openmode=OpenMode.ONEDRIVE;
    }
 else     if (hFile.isCustomPath())     openmode=OpenMode.CUSTOM;
 else     if (android.util.Patterns.EMAIL_ADDRESS.matcher(path).matches()) {
      openmode=OpenMode.ROOT;
    }
  }
switch (openmode) {
case SMB:
    HybridFile hFile=new HybridFile(OpenMode.SMB,path);
  try {
    SmbFile[] smbFile=hFile.getSmbFile(5000).listFiles();
    list=ma.addToSmb(smbFile,path);
    openmode=OpenMode.SMB;
  }
 catch (  SmbAuthException e) {
    if (!e.getMessage().toLowerCase().contains("String_Node_Str"))     ma.reauthenticateSmb();
    publishProgress(e.getLocalizedMessage());
  }
catch (  SmbException|NullPointerException e) {
    publishProgress(e.getLocalizedMessage());
    e.printStackTrace();
  }
break;
case CUSTOM:
ArrayList<HybridFileParcelable> arrayList=null;
switch (Integer.parseInt(path)) {
case 0:
arrayList=listImages();
break;
case 1:
arrayList=listVideos();
break;
case 2:
arrayList=listaudio();
break;
case 3:
arrayList=listDocs();
break;
case 4:
arrayList=listApks();
break;
case 5:
arrayList=listRecent();
break;
case 6:
arrayList=listRecentFiles();
break;
}
path=String.valueOf(Integer.parseInt(path));
if (arrayList != null) list=addTo(arrayList);
 else return new ArrayList<>();
break;
case OTG:
list=addTo(listOtg(path));
openmode=OpenMode.OTG;
break;
case DROPBOX:
CloudStorage cloudStorageDropbox=dataUtils.getAccount(OpenMode.DROPBOX);
try {
list=addTo(listCloud(path,cloudStorageDropbox,OpenMode.DROPBOX));
}
 catch (CloudPluginException e) {
e.printStackTrace();
return new ArrayList<>();
}
break;
case BOX:
CloudStorage cloudStorageBox=dataUtils.getAccount(OpenMode.BOX);
try {
list=addTo(listCloud(path,cloudStorageBox,OpenMode.BOX));
}
 catch (CloudPluginException e) {
e.printStackTrace();
return new ArrayList<>();
}
break;
case GDRIVE:
CloudStorage cloudStorageGDrive=dataUtils.getAccount(OpenMode.GDRIVE);
try {
list=addTo(listCloud(path,cloudStorageGDrive,OpenMode.GDRIVE));
}
 catch (CloudPluginException e) {
e.printStackTrace();
return new ArrayList<>();
}
break;
case ONEDRIVE:
CloudStorage cloudStorageOneDrive=dataUtils.getAccount(OpenMode.ONEDRIVE);
try {
list=addTo(listCloud(path,cloudStorageOneDrive,OpenMode.ONEDRIVE));
}
 catch (CloudPluginException e) {
e.printStackTrace();
return new ArrayList<>();
}
break;
default :
try {
ArrayList<HybridFileParcelable> arrayList1;
arrayList1=RootHelper.getFilesList(path,ThemedActivity.rootMode,ma.SHOW_HIDDEN,new RootHelper.GetModeCallBack(){
@Override public void getMode(OpenMode mode){
openmode=mode;
}
}
);
list=addTo(arrayList1);
}
 catch (RootNotPermittedException e) {
return null;
}
break;
}
if (list != null && !(openmode == OpenMode.CUSTOM && ((path).equals("String_Node_Str") || (path).equals("String_Node_Str")))) {
Collections.sort(list,new FileListSorter(ma.dsort,ma.sortby,ma.asc));
}
return list;
}

Fixed version (ground truth):
protected Pair<OpenMode,ArrayList<LayoutElementParcelable>> doInBackground(Void... p){
  ma.folder_count=0;
  ma.file_count=0;
  if (openmode == OpenMode.UNKNOWN) {
    HybridFile hFile=new HybridFile(OpenMode.UNKNOWN,path);
    hFile.generateMode(ma.getActivity());
    if (hFile.isLocal()) {
      openmode=OpenMode.FILE;
    }
 else     if (hFile.isSmb()) {
      openmode=OpenMode.SMB;
      ma.smbPath=path;
    }
 else     if (hFile.isOtgFile()) {
      openmode=OpenMode.OTG;
    }
 else     if (hFile.isBoxFile()) {
      openmode=OpenMode.BOX;
    }
 else     if (hFile.isDropBoxFile()) {
      openmode=OpenMode.DROPBOX;
    }
 else     if (hFile.isGoogleDriveFile()) {
      openmode=OpenMode.GDRIVE;
    }
 else     if (hFile.isOneDriveFile()) {
      openmode=OpenMode.ONEDRIVE;
    }
 else     if (hFile.isCustomPath())     openmode=OpenMode.CUSTOM;
 else     if (android.util.Patterns.EMAIL_ADDRESS.matcher(path).matches()) {
      openmode=OpenMode.ROOT;
    }
  }
  if (isCancelled())   return null;
  ArrayList<LayoutElementParcelable> list=null;
switch (openmode) {
case SMB:
    HybridFile hFile=new HybridFile(OpenMode.SMB,path);
  try {
    SmbFile[] smbFile=hFile.getSmbFile(5000).listFiles();
    list=ma.addToSmb(smbFile,path);
    openmode=OpenMode.SMB;
  }
 catch (  SmbAuthException e) {
    if (!e.getMessage().toLowerCase().contains("String_Node_Str"))     ma.reauthenticateSmb();
    publishProgress(e.getLocalizedMessage());
  }
catch (  SmbException|NullPointerException e) {
    publishProgress(e.getLocalizedMessage());
    e.printStackTrace();
  }
break;
case CUSTOM:
ArrayList<HybridFileParcelable> arrayList=null;
switch (Integer.parseInt(path)) {
case 0:
arrayList=listImages();
break;
case 1:
arrayList=listVideos();
break;
case 2:
arrayList=listaudio();
break;
case 3:
arrayList=listDocs();
break;
case 4:
arrayList=listApks();
break;
case 5:
arrayList=listRecent();
break;
case 6:
arrayList=listRecentFiles();
break;
}
path=String.valueOf(Integer.parseInt(path));
if (arrayList != null) list=addTo(arrayList);
 else return new Pair<>(openmode,new ArrayList<LayoutElementParcelable>());
break;
case OTG:
list=addTo(listOtg(path));
openmode=OpenMode.OTG;
break;
case DROPBOX:
CloudStorage cloudStorageDropbox=dataUtils.getAccount(OpenMode.DROPBOX);
try {
list=addTo(listCloud(path,cloudStorageDropbox,OpenMode.DROPBOX));
}
 catch (CloudPluginException e) {
e.printStackTrace();
return null;
}
break;
case BOX:
CloudStorage cloudStorageBox=dataUtils.getAccount(OpenMode.BOX);
try {
list=addTo(listCloud(path,cloudStorageBox,OpenMode.BOX));
}
 catch (CloudPluginException e) {
e.printStackTrace();
return null;
}
break;
case GDRIVE:
CloudStorage cloudStorageGDrive=dataUtils.getAccount(OpenMode.GDRIVE);
try {
list=addTo(listCloud(path,cloudStorageGDrive,OpenMode.GDRIVE));
}
 catch (CloudPluginException e) {
e.printStackTrace();
return null;
}
break;
case ONEDRIVE:
CloudStorage cloudStorageOneDrive=dataUtils.getAccount(OpenMode.ONEDRIVE);
try {
list=addTo(listCloud(path,cloudStorageOneDrive,OpenMode.ONEDRIVE));
}
 catch (CloudPluginException e) {
e.printStackTrace();
return null;
}
break;
default :
try {
ArrayList<HybridFileParcelable> arrayList1;
arrayList1=RootHelper.getFilesList(path,ThemedActivity.rootMode,ma.SHOW_HIDDEN,new RootHelper.GetModeCallBack(){
@Override public void getMode(OpenMode mode){
openmode=mode;
}
}
);
list=addTo(arrayList1);
}
 catch (RootNotPermittedException e) {
return null;
}
break;
}
if (list != null && !(openmode == OpenMode.CUSTOM && ((path).equals("String_Node_Str") || (path).equals("String_Node_Str")))) {
Collections.sort(list,new FileListSorter(ma.dsort,ma.sortby,ma.asc));
}
return new Pair<>(openmode,list);
}