nus-yam/ex-repair huggingface dataset:
Program: 162514
Project: 162514
Buggy source:
@Override public boolean onPreferenceClick(Preference preference){
  if (preferences != null)   ((PreferencesActivity)getActivity()).setChanged();
  currentValue[prefPos.get(preference.getKey())]=((SwitchPreference)preference).isChecked();
  TinyDB.putBooleanArray(preferences,KEY,currentValue);
  return true;
}

Fixed version (ground truth):
@Override public boolean onPreferenceClick(Preference preference){
  currentValue[prefPos.get(preference.getKey())]=((SwitchPreference)preference).isChecked();
  TinyDB.putBooleanArray(preferences,KEY,currentValue);
  return true;
}
Program: 162515
Project: 162515
Buggy source:
@Override protected Void doInBackground(Void... params){
  if (baseFile.isDirectory())   totalSize=baseFile.folderSize(context);
 else   totalSize=baseFile.length(context);
  progressHandler=new ProgressHandler(1,totalSize);
  progressHandler.setProgressListener(DecryptService.this::publishResults);
  serviceWatcherUtil=new ServiceWatcherUtil(progressHandler,totalSize);
  addFirstDatapoint(baseFile.getName(),1,totalSize,false);
  if (FileUtil.checkFolder(baseFile.getPath(),context) == 1) {
    serviceWatcherUtil.watch();
    try {
      new CryptUtil(context,baseFile,decryptPath,progressHandler,failedOps);
    }
 catch (    Exception e) {
      e.printStackTrace();
      failedOps.add(baseFile);
    }
  }
  return null;
}

Fixed version (ground truth):
@Override protected Void doInBackground(Void... params){
  String baseFileFolder=baseFile.isDirectory() ? baseFile.getPath() : baseFile.getPath().substring(0,baseFile.getPath().lastIndexOf('/'));
  if (baseFile.isDirectory())   totalSize=baseFile.folderSize(context);
 else   totalSize=baseFile.length(context);
  progressHandler=new ProgressHandler(1,totalSize);
  progressHandler.setProgressListener(DecryptService.this::publishResults);
  serviceWatcherUtil=new ServiceWatcherUtil(progressHandler,totalSize);
  addFirstDatapoint(baseFile.getName(),1,totalSize,false);
  if (FileUtil.checkFolder(baseFileFolder,context) == 1) {
    serviceWatcherUtil.watch();
    try {
      new CryptUtil(context,baseFile,decryptPath,progressHandler,failedOps);
    }
 catch (    Exception e) {
      e.printStackTrace();
      failedOps.add(baseFile);
    }
  }
  return null;
}
Program: 162516
Project: 162516
Buggy source:
public void generateMode(Context context){
  if (path.startsWith("String_Node_Str")) {
    mode=OpenMode.SMB;
  }
 else   if (path.startsWith(OTGUtil.PREFIX_OTG)) {
    mode=OpenMode.OTG;
  }
 else   if (isCustomPath()) {
    mode=OpenMode.CUSTOM;
  }
 else   if (path.startsWith(CloudHandler.CLOUD_PREFIX_BOX)) {
    mode=OpenMode.BOX;
  }
 else   if (path.startsWith(CloudHandler.CLOUD_PREFIX_ONE_DRIVE)) {
    mode=OpenMode.ONEDRIVE;
  }
 else   if (path.startsWith(CloudHandler.CLOUD_PREFIX_GOOGLE_DRIVE)) {
    mode=OpenMode.GDRIVE;
  }
 else   if (path.startsWith(CloudHandler.CLOUD_PREFIX_DROPBOX)) {
    mode=OpenMode.DROPBOX;
  }
 else   if (context == null) {
    mode=OpenMode.FILE;
  }
 else {
    boolean rootmode=PreferenceManager.getDefaultSharedPreferences(context).getBoolean("String_Node_Str",false);
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
      mode=OpenMode.FILE;
      if (rootmode && !getFile().canRead()) {
        mode=OpenMode.ROOT;
      }
    }
 else {
      if (FileUtil.isOnExtSdCard(getFile(),context)) {
        mode=OpenMode.FILE;
      }
 else       if (rootmode && !getFile().canRead()) {
        mode=OpenMode.ROOT;
      }
      if (mode == OpenMode.UNKNOWN) {
        mode=OpenMode.FILE;
      }
    }
  }
}

Fixed version (ground truth):
public void generateMode(Context context){
  if (path.startsWith("String_Node_Str")) {
    mode=OpenMode.SMB;
  }
 else   if (path.startsWith(OTGUtil.PREFIX_OTG)) {
    mode=OpenMode.OTG;
  }
 else   if (isCustomPath()) {
    mode=OpenMode.CUSTOM;
  }
 else   if (path.startsWith(CloudHandler.CLOUD_PREFIX_BOX)) {
    mode=OpenMode.BOX;
  }
 else   if (path.startsWith(CloudHandler.CLOUD_PREFIX_ONE_DRIVE)) {
    mode=OpenMode.ONEDRIVE;
  }
 else   if (path.startsWith(CloudHandler.CLOUD_PREFIX_GOOGLE_DRIVE)) {
    mode=OpenMode.GDRIVE;
  }
 else   if (path.startsWith(CloudHandler.CLOUD_PREFIX_DROPBOX)) {
    mode=OpenMode.DROPBOX;
  }
 else   if (context == null) {
    mode=OpenMode.FILE;
  }
 else {
    boolean rootmode=PreferenceManager.getDefaultSharedPreferences(context).getBoolean(PrefFrag.PREFERENCE_ROOTMODE,false);
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
      mode=OpenMode.FILE;
      if (rootmode && !getFile().canRead()) {
        mode=OpenMode.ROOT;
      }
    }
 else {
      if (FileUtil.isOnExtSdCard(getFile(),context)) {
        mode=OpenMode.FILE;
      }
 else       if (rootmode && !getFile().canRead()) {
        mode=OpenMode.ROOT;
      }
      if (mode == OpenMode.UNKNOWN) {
        mode=OpenMode.FILE;
      }
    }
  }
}
Program: 162517
Project: 162517
Buggy source:
private void createViews(ArrayList<CompressedObjectParcelable> items,String dir){
  if (compressedExplorerAdapter == null) {
    compressedExplorerAdapter=new CompressedExplorerAdapter(getActivity(),utilsProvider,items,this);
    listView.setAdapter(compressedExplorerAdapter);
  }
 else {
    compressedExplorerAdapter.generateZip(items);
  }
  folder=0;
  file=0;
  for (  CompressedObjectParcelable item : items) {
    if (item.isDirectory())     folder++;
 else     file++;
  }
  stopAnims=true;
  if (!addheader) {
    listView.removeItemDecoration(dividerItemDecoration);
    addheader=true;
  }
 else {
    dividerItemDecoration=new DividerItemDecoration(getActivity(),true,showDividers);
    listView.addItemDecoration(dividerItemDecoration);
    addheader=false;
  }
  final FastScroller fastScroller=(FastScroller)rootView.findViewById(R.id.fastscroll);
  fastScroller.setRecyclerView(listView,1);
  fastScroller.setPressedHandleColor(mainActivity.getColorPreference().getColor(ColorUsage.ACCENT));
  ((AppBarLayout)mToolbarContainer).addOnOffsetChangedListener((appBarLayout,verticalOffset) -> {
    fastScroller.updateHandlePosition(verticalOffset,112);
  }
);
  listView.stopScroll();
  relativeDirectory=dir;
  updateBottomBar();
  swipeRefreshLayout.setRefreshing(false);
}

Fixed version (ground truth):
private void createViews(ArrayList<CompressedObjectParcelable> items,String dir){
  if (compressedExplorerAdapter == null) {
    compressedExplorerAdapter=new CompressedExplorerAdapter(getActivity(),utilsProvider,items,this);
    listView.setAdapter(compressedExplorerAdapter);
  }
 else {
    compressedExplorerAdapter.generateZip(items);
  }
  folder=0;
  file=0;
  for (  CompressedObjectParcelable item : items) {
    if (item.getType() == CompressedObjectParcelable.TYPE_GOBACK)     continue;
    if (item.isDirectory())     folder++;
 else     file++;
  }
  stopAnims=true;
  if (!addheader) {
    listView.removeItemDecoration(dividerItemDecoration);
    addheader=true;
  }
 else {
    dividerItemDecoration=new DividerItemDecoration(getActivity(),true,showDividers);
    listView.addItemDecoration(dividerItemDecoration);
    addheader=false;
  }
  final FastScroller fastScroller=(FastScroller)rootView.findViewById(R.id.fastscroll);
  fastScroller.setRecyclerView(listView,1);
  fastScroller.setPressedHandleColor(mainActivity.getColorPreference().getColor(ColorUsage.ACCENT));
  ((AppBarLayout)mToolbarContainer).addOnOffsetChangedListener((appBarLayout,verticalOffset) -> {
    fastScroller.updateHandlePosition(verticalOffset,112);
  }
);
  listView.stopScroll();
  relativeDirectory=dir;
  updateBottomBar();
  swipeRefreshLayout.setRefreshing(false);
}
Program: 162518
Project: 162518
Buggy source:
public LoadFilesListTask(Context c,UtilitiesProviderInterface utilsProvider,boolean back,MainFragment ma,OpenMode openmode){
  this.utilsProvider=utilsProvider;
  this.back=back;
  this.ma=ma;
  this.openmode=openmode;
  this.c=c;
}

Fixed version (ground truth):
public LoadFilesListTask(Context c,String path,MainFragment ma,OpenMode openmode,OnAsyncTaskFinished<Pair<OpenMode,ArrayList<LayoutElementParcelable>>> l){
  this.path=path;
  this.ma=ma;
  this.openmode=openmode;
  this.c=c;
  this.listener=l;
}
Program: 162520
Project: 162520
Buggy source:
@Override protected void onPostExecute(ArrayList<LayoutElementParcelable> list){
  if (isCancelled()) {
    list=null;
  }
  ma.createViews(list,back,path,openmode,false,grid);
  ma.mSwipeRefreshLayout.setRefreshing(false);
}

Fixed version (ground truth):
@Override protected void onPostExecute(Pair<OpenMode,ArrayList<LayoutElementParcelable>> list){
  super.onPostExecute(list);
  listener.onAsyncTaskFinished(list);
}
Program: 162521
Project: 162521
Buggy source:
public void loadlist(String path,boolean back,OpenMode openMode){
  if (mActionMode != null) {
    mActionMode.finish();
  }
  if (loadFilesListTask != null && loadFilesListTask.getStatus() == AsyncTask.Status.RUNNING)   loadFilesListTask.cancel(true);
  loadFilesListTask=new LoadFilesListTask(ma.getActivity(),utilsProvider,back,ma,openMode);
  loadFilesListTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR,(path));
}

Fixed version (ground truth):
/** 
 * This loads a path into the MainFragment.
 * @param path the path to be loaded
 * @param back if we're coming back from any directory and want the scroll to be restored
 * @param openMode the mode in which the directory should be opened
 */
public void loadlist(final String path,final boolean back,final OpenMode openMode){
  if (mActionMode != null)   mActionMode.finish();
  mSwipeRefreshLayout.setRefreshing(true);
  if (loadFilesListTask != null && loadFilesListTask.getStatus() == AsyncTask.Status.RUNNING) {
    loadFilesListTask.cancel(true);
  }
  loadFilesListTask=new LoadFilesListTask(ma.getActivity(),path,ma,openMode,new OnAsyncTaskFinished<Pair<OpenMode,ArrayList<LayoutElementParcelable>>>(){
    @Override public void onAsyncTaskFinished(    Pair<OpenMode,ArrayList<LayoutElementParcelable>> data){
      if (data.second != null) {
        createViews(data.second,back,path,data.first,false,checkPathIsGrid(path));
        mSwipeRefreshLayout.setRefreshing(false);
      }
    }
  }
);
  loadFilesListTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Program: 162523
Project: 162523
Buggy source:
@Override public void onClick(){
  super.onClick();
  mTile=getQsTile();
  if (!FTPService.isRunning()) {
    if (FTPService.isConnectedToWifi(getApplicationContext())) {
      startServer();
      mTile.setState(Tile.STATE_ACTIVE);
      mTile.updateTile();
    }
 else {
      mTile.setState(Tile.STATE_INACTIVE);
      mTile.updateTile();
      Toast.makeText(getApplicationContext(),getString(R.string.ftp_no_wifi),Toast.LENGTH_LONG).show();
    }
  }
 else {
    stopServer();
    mTile.setState(Tile.STATE_INACTIVE);
    mTile.updateTile();
  }
}

Fixed version (ground truth):
@Override public void onClick(){
  super.onClick();
  mTile=getQsTile();
  if (!FTPService.isRunning()) {
    if (FTPService.isConnectedToWifi(getApplicationContext()) || FTPService.isConnectedToLocalNetwork(getApplicationContext()) || FTPService.isEnabledWifiHotspot(getApplicationContext())) {
      startServer();
      mTile.setState(Tile.STATE_ACTIVE);
      mTile.updateTile();
    }
 else {
      mTile.setState(Tile.STATE_INACTIVE);
      mTile.updateTile();
      Toast.makeText(getApplicationContext(),getString(R.string.ftp_no_wifi),Toast.LENGTH_LONG).show();
    }
  }
 else {
    stopServer();
    mTile.setState(Tile.STATE_INACTIVE);
    mTile.updateTile();
  }
}
Program: 162524
Project: 162524
Buggy source:
/** 
 * AsyncTask to load RAR file items.
 * @param zipExplorerFragment the zipExplorerFragment fragment instance
 * @param dir
 */
public RarHelperTask(ZipExplorerFragment zipExplorerFragment,String dir){
  this.zipExplorerFragment=zipExplorerFragment;
  this.dir=dir;
}

Fixed version (ground truth):
/** 
 * AsyncTask to load RAR file items.
 * @param realFileDirectory the location of the zip file
 * @param dir relativeDirectory to access inside the zip file
 */
public RarHelperTask(Context c,String realFileDirectory,String dir,OnAsyncTaskFinished<Pair<Archive,ArrayList<FileHeader>>> l){
  context=new WeakReference<>(c);
  fileLocation=realFileDirectory;
  relativeDirectory=dir;
  onFinish=l;
}
Program: 162525
Project: 162525
Buggy source:
@Override protected ArrayList<FileHeader> doInBackground(File... params){
  ArrayList<FileHeader> elements=new ArrayList<>();
  try {
    Archive zipfile=new Archive(params[0]);
    zipExplorerFragment.archive=zipfile;
    if (zipExplorerFragment.wholelistRar.size() == 0) {
      FileHeader fh=zipfile.nextFileHeader();
      while (fh != null) {
        zipExplorerFragment.wholelistRar.add(fh);
        fh=zipfile.nextFileHeader();
      }
    }
    if (dir == null || dir.trim().length() == 0 || dir.equals("String_Node_Str")) {
      for (      FileHeader header : zipExplorerFragment.wholelistRar) {
        String name=header.getFileNameString();
        if (!name.contains("String_Node_Str")) {
          elements.add(header);
        }
      }
    }
 else {
      for (      FileHeader header : zipExplorerFragment.wholelistRar) {
        String name=header.getFileNameString();
        if (name.substring(0,name.lastIndexOf("String_Node_Str")).equals(dir)) {
          elements.add(header);
        }
      }
    }
  }
 catch (  Exception e) {
  }
  Collections.sort(elements,new FileListSorter());
  return elements;
}

Fixed version (ground truth):
@Override protected Pair<Archive,ArrayList<FileHeader>> doInBackground(Void... params){
  try {
    ArrayList<FileHeader> elements=new ArrayList<>();
    Archive zipfile=new Archive(new File(fileLocation));
    String relativeDirDiffSeparator=relativeDirectory.replace("String_Node_Str","String_Node_Str");
    for (    FileHeader header : zipfile.getFileHeaders()) {
      String name=header.getFileNameString();
      boolean isInBaseDir=(relativeDirDiffSeparator == null || relativeDirDiffSeparator.equals("String_Node_Str")) && !name.contains("String_Node_Str");
      boolean isInRelativeDir=relativeDirDiffSeparator != null && name.contains("String_Node_Str") && name.substring(0,name.lastIndexOf("String_Node_Str")).equals(relativeDirDiffSeparator);
      if (isInBaseDir || isInRelativeDir) {
        elements.add(header);
      }
    }
    Collections.sort(elements,new FileListSorter());
    return new Pair<>(zipfile,elements);
  }
 catch (  RarException|IOException e) {
    e.printStackTrace();
    return null;
  }
}
Program: 162526
Project: 162526
Buggy source:
@Override protected void onPostExecute(ArrayList<FileHeader> zipEntries){
  super.onPostExecute(zipEntries);
  zipExplorerFragment.swipeRefreshLayout.setRefreshing(false);
  zipExplorerFragment.createRarViews(zipEntries,dir);
}

Fixed version (ground truth):
@Override protected void onPostExecute(Pair<Archive,ArrayList<FileHeader>> ArchivePairZipEntries){
  super.onPostExecute(ArchivePairZipEntries);
  onFinish.onAsyncTaskFinished(ArchivePairZipEntries);
}
Program: 162527
Project: 162527
Buggy source:
/** 
 * AsyncTask to load ZIP file items.
 * @param zipExplorerFragment the zipExplorerFragment fragment instance
 * @param dir
 */
public ZipHelperTask(ZipExplorerFragment zipExplorerFragment,String dir){
  this.zipExplorerFragment=zipExplorerFragment;
  this.dir=dir;
  zipExplorerFragment.swipeRefreshLayout.setRefreshing(true);
}

Fixed version (ground truth):
/** 
 * AsyncTask to load ZIP file items.
 * @param realFileDirectory the location of the zip file
 * @param dir relativeDirectory to access inside the zip file
 */
public ZipHelperTask(Context c,String realFileDirectory,String dir,OnAsyncTaskFinished<ArrayList<ZipObjectParcelable>> l){
  context=new WeakReference<>(c);
  fileLocation=Uri.parse(realFileDirectory);
  relativeDirectory=dir;
  onFinish=l;
}
Program: 162529
Project: 162529
Buggy source:
@Override protected void onPostExecute(ArrayList<ZipObjectParcelable> zipEntries){
  super.onPostExecute(zipEntries);
  zipExplorerFragment.swipeRefreshLayout.setRefreshing(false);
  zipExplorerFragment.createZipViews(zipEntries,dir);
}

Fixed version (ground truth):
@Override protected void onPostExecute(ArrayList<ZipObjectParcelable> zipEntries){
  super.onPostExecute(zipEntries);
  onFinish.onAsyncTaskFinished(zipEntries);
}
Program: 162532
Project: 162532
Buggy source:
public void onClick(View p1){
  buttonPathInterface.changePath(rpaths.get(k));
  timer.cancel();
  timer.start();
}

Fixed version (ground truth):
public void onClick(View p1){
  buttonPathInterface.changePath(paths[k]);
  timer.cancel();
  timer.start();
}
Program: 162533
Project: 162533
Buggy source:
private boolean extractTar(File archive,String destinationPath){
  try {
    ArrayList<TarArchiveEntry> archiveEntries=new ArrayList<>();
    TarArchiveInputStream inputStream;
    if (archive.getName().endsWith("String_Node_Str"))     inputStream=new TarArchiveInputStream(new BufferedInputStream(new FileInputStream(archive)));
 else     inputStream=new TarArchiveInputStream(new GZIPInputStream(new FileInputStream(archive)));
    TarArchiveEntry tarArchiveEntry=inputStream.getNextTarEntry();
    while (tarArchiveEntry != null) {
      archiveEntries.add(tarArchiveEntry);
      tarArchiveEntry=inputStream.getNextTarEntry();
    }
    for (    TarArchiveEntry entry : archiveEntries) {
      totalBytes+=entry.getSize();
    }
    progressHandler.setTotalSize(totalBytes);
    setInitDataPackage(totalBytes,archiveEntries.get(0).getName(),1);
    watcherUtil=new ServiceWatcherUtil(progressHandler,totalBytes);
    watcherUtil.watch();
    for (    TarArchiveEntry entry : archiveEntries) {
      if (!progressHandler.getCancelled()) {
        progressHandler.setFileName(entry.getName());
        unzipTAREntry(inputStream,entry,destinationPath);
      }
    }
    progressHandler.setSourceFilesProcessed(1);
    inputStream.close();
    return true;
  }
 catch (  Exception e) {
    Log.e("String_Node_Str","String_Node_Str" + archive,e);
    AppConfig.toast(getApplicationContext(),getString(R.string.error));
    return false;
  }
}

Fixed version (ground truth):
private boolean extractTar(File archive,String destinationPath){
  try {
    ArrayList<TarArchiveEntry> archiveEntries=new ArrayList<>();
    TarArchiveInputStream inputStream=createTarInputStream(archive);
    TarArchiveEntry tarArchiveEntry=inputStream.getNextTarEntry();
    while (tarArchiveEntry != null) {
      archiveEntries.add(tarArchiveEntry);
      tarArchiveEntry=inputStream.getNextTarEntry();
    }
    for (    TarArchiveEntry entry : archiveEntries) {
      totalBytes+=entry.getSize();
    }
    progressHandler.setTotalSize(totalBytes);
    setInitDataPackage(totalBytes,archiveEntries.get(0).getName(),1);
    watcherUtil=new ServiceWatcherUtil(progressHandler,totalBytes);
    watcherUtil.watch();
    inputStream=createTarInputStream(archive);
    for (    TarArchiveEntry entry : archiveEntries) {
      if (!progressHandler.getCancelled()) {
        inputStream.getNextTarEntry();
        progressHandler.setFileName(entry.getName());
        unzipTAREntry(inputStream,entry,destinationPath);
      }
    }
    progressHandler.setSourceFilesProcessed(1);
    inputStream.close();
    return true;
  }
 catch (  Exception e) {
    Log.e("String_Node_Str","String_Node_Str" + archive,e);
    AppConfig.toast(getApplicationContext(),getString(R.string.error));
    return false;
  }
}
Program: 162535
Project: 162535
Buggy source:
public static int getPort(){
  return port;
}

Fixed version (ground truth):
public static int getPort(Context context){
  SharedPreferences preferences=PreferenceManager.getDefaultSharedPreferences(context);
  return preferences.getInt(PORT_PREFERENCE_KEY,DEFAULT_PORT);
}
Program: 162536
Project: 162536
Buggy source:
public static InetAddress getLocalInetAddress(Context context){
  if (!isConnectedToLocalNetwork(context)) {
    Log.e(TAG,"String_Node_Str");
    return null;
  }
  if (isConnectedToWifi(context)) {
    WifiManager wm=(WifiManager)context.getSystemService(Context.WIFI_SERVICE);
    int ipAddress=wm.getConnectionInfo().getIpAddress();
    if (ipAddress == 0)     return null;
    return intToInet(ipAddress);
  }
  try {
    Enumeration<NetworkInterface> netinterfaces=NetworkInterface.getNetworkInterfaces();
    while (netinterfaces.hasMoreElements()) {
      NetworkInterface netinterface=netinterfaces.nextElement();
      Enumeration<InetAddress> addresses=netinterface.getInetAddresses();
      while (addresses.hasMoreElements()) {
        InetAddress address=addresses.nextElement();
        if (isEnabledWifiHotspot(context) && WIFI_AP_ADDRESS.equals(address.getHostAddress()))         return address;
        if (!address.isLoopbackAddress() && !address.isLinkLocalAddress())         return address;
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
public static InetAddress getLocalInetAddress(Context context){
  if (!isConnectedToLocalNetwork(context) && !isEnabledWifiHotspot(context)) {
    Log.e(TAG,"String_Node_Str");
    return null;
  }
  if (isConnectedToWifi(context)) {
    WifiManager wm=(WifiManager)context.getSystemService(Context.WIFI_SERVICE);
    int ipAddress=wm.getConnectionInfo().getIpAddress();
    if (ipAddress == 0)     return null;
    return intToInet(ipAddress);
  }
  try {
    Enumeration<NetworkInterface> netinterfaces=NetworkInterface.getNetworkInterfaces();
    while (netinterfaces.hasMoreElements()) {
      NetworkInterface netinterface=netinterfaces.nextElement();
      Enumeration<InetAddress> addresses=netinterface.getInetAddresses();
      while (addresses.hasMoreElements()) {
        InetAddress address=addresses.nextElement();
        if (isEnabledWifiHotspot(context) && WIFI_AP_ADDRESS.equals(address.getHostAddress()))         return address;
        if (!address.isLoopbackAddress() && !address.isLinkLocalAddress())         return address;
      }
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return null;
}
Program: 162539
Project: 162539
Buggy source:
@Override protected void onPostExecute(final String[] hashes){
  super.onPostExecute(hashes);
  if (!f.isDirectory()) {
    md5HashText.setText(hashes[0]);
    sha256Text.setText(hashes[1]);
    mMD5LinearLayout.setOnLongClickListener(new View.OnLongClickListener(){
      @Override public boolean onLongClick(      View v){
        Futils.copyToClipboard(c,hashes[0]);
        Toast.makeText(c,c.getResources().getString(R.string.md5).toUpperCase() + "String_Node_Str" + c.getResources().getString(R.string.properties_copied_clipboard),Toast.LENGTH_SHORT).show();
        return false;
      }
    }
);
    mSHA256LinearLayout.setOnLongClickListener(new View.OnLongClickListener(){
      @Override public boolean onLongClick(      View v){
        Futils.copyToClipboard(c,hashes[1]);
        Toast.makeText(c,c.getResources().getString(R.string.hash_sha256) + "String_Node_Str" + c.getResources().getString(R.string.properties_copied_clipboard),Toast.LENGTH_SHORT).show();
        return false;
      }
    }
);
  }
 else {
    mMD5LinearLayout.setVisibility(View.GONE);
    mSHA256LinearLayout.setVisibility(View.GONE);
  }
}

Fixed version (ground truth):
@Override protected void onPostExecute(final String[] hashes){
  super.onPostExecute(hashes);
  if (!f.isDirectory() && f.getSize() != 0) {
    md5HashText.setText(hashes[0]);
    sha256Text.setText(hashes[1]);
    mMD5LinearLayout.setOnLongClickListener(new View.OnLongClickListener(){
      @Override public boolean onLongClick(      View v){
        Futils.copyToClipboard(c,hashes[0]);
        Toast.makeText(c,c.getResources().getString(R.string.md5).toUpperCase() + "String_Node_Str" + c.getResources().getString(R.string.properties_copied_clipboard),Toast.LENGTH_SHORT).show();
        return false;
      }
    }
);
    mSHA256LinearLayout.setOnLongClickListener(new View.OnLongClickListener(){
      @Override public boolean onLongClick(      View v){
        Futils.copyToClipboard(c,hashes[1]);
        Toast.makeText(c,c.getResources().getString(R.string.hash_sha256) + "String_Node_Str" + c.getResources().getString(R.string.properties_copied_clipboard),Toast.LENGTH_SHORT).show();
        return false;
      }
    }
);
  }
 else {
    mMD5LinearLayout.setVisibility(View.GONE);
    mSHA256LinearLayout.setVisibility(View.GONE);
  }
}
Program: 162540
Project: 162540
Buggy source:
@Override protected void onPostExecute(Pair<String,List<PieEntry>> data){
  if (data == null) {
    chart.setVisibility(View.GONE);
    return;
  }
  PieDataSet set=new PieDataSet(data.second,null);
  set.setColors(COLORS);
  set.setXValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE);
  set.setYValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE);
  set.setSliceSpace(5f);
  PieData pieData=new PieData(set);
  pieData.setValueFormatter(new SizeFormatter(context));
  chart.setCenterText(new SpannableString(context.getString(R.string.total) + data.first));
  chart.setData(pieData);
  chart.notifyDataSetChanged();
  chart.invalidate();
}

Fixed version (ground truth):
@Override protected void onPostExecute(Pair<String,List<PieEntry>> data){
  if (data == null) {
    chart.setVisibility(View.GONE);
    return;
  }
  PieDataSet set=new PieDataSet(data.second,null);
  set.setColors(COLORS);
  set.setXValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE);
  set.setYValuePosition(PieDataSet.ValuePosition.OUTSIDE_SLICE);
  set.setSliceSpace(5f);
  set.setValueLinePart2Length(1.05f);
  set.setSelectionShift(0f);
  PieData pieData=new PieData(set);
  pieData.setValueFormatter(new SizeFormatter(context));
  chart.setCenterText(new SpannableString(context.getString(R.string.total) + "String_Node_Str" + data.first));
  chart.setData(pieData);
  chart.notifyDataSetChanged();
  chart.invalidate();
}
Program: 162542
Project: 162542
Buggy source:
public void refreshDrawer(){
  List<String> val=DataUtils.getStorages();
  if (val == null)   val=getStorageDirectories();
  createDrawerItems(DataUtils.getAccounts(),DataUtils.getServers(),val);
}

Fixed version (ground truth):
public void refreshDrawer(){
  List<String> val=DataUtils.getStorages();
  if (val == null)   val=getStorageDirectories();
  createDrawerItems(val);
}
Program: 162546
Project: 162546
Buggy source:
@Override public void onPostExecute(Boolean movedCorrectly){
  if (movedCorrectly) {
    if (main != null && main.CURRENT_PATH.equals(paths.get(0)))     main.updateList();
    for (int i=0; i < paths.size(); i++) {
      for (      BaseFile f : files.get(i)) {
        Futils.scanFile(f.getPath(),context);
        Futils.scanFile(paths.get(i) + "String_Node_Str" + f.getName(),context);
      }
    }
  }
 else {
    for (int i=0; i < paths.size(); i++) {
      Intent intent=new Intent(context,CopyService.class);
      intent.putExtra(CopyService.TAG_COPY_SOURCES,files.get(i));
      intent.putExtra(CopyService.TAG_COPY_TARGET,paths.get(i));
      intent.putExtra(CopyService.TAG_COPY_MOVE,true);
      intent.putExtra(CopyService.TAG_COPY_OPEN_MODE,mode.ordinal());
      ServiceWatcherUtil.runService(context,intent);
    }
  }
  for (  ArrayList<BaseFile> folder : files) {
    BaseFile folderPath=new BaseFile(folder.get(0).getParent());
    try {
      if (folderPath.listOnlyFiles(rootMode).size() == 0)       folderPath.delete(context,rootMode);
    }
 catch (    RootNotPermittedException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
@Override public void onPostExecute(Boolean movedCorrectly){
  if (movedCorrectly) {
    if (main != null && main.CURRENT_PATH.equals(paths.get(0)))     main.updateList();
    for (int i=0; i < paths.size(); i++) {
      for (      BaseFile f : files.get(i)) {
        Futils.scanFile(f.getPath(),context);
        Futils.scanFile(paths.get(i) + "String_Node_Str" + f.getName(),context);
      }
    }
  }
 else {
    for (int i=0; i < paths.size(); i++) {
      Intent intent=new Intent(context,CopyService.class);
      intent.putExtra(CopyService.TAG_COPY_SOURCES,files.get(i));
      intent.putExtra(CopyService.TAG_COPY_TARGET,paths.get(i));
      intent.putExtra(CopyService.TAG_COPY_MOVE,true);
      intent.putExtra(CopyService.TAG_COPY_OPEN_MODE,mode.ordinal());
      ServiceWatcherUtil.runService(context,intent);
    }
  }
  Collections.reverse(files);
  for (  ArrayList<BaseFile> folder : files) {
    BaseFile folderPath=new BaseFile(folder.get(0).getParent());
    try {
      if (folderPath.listFiles(rootMode).size() == 0)       folderPath.delete(context,rootMode);
    }
 catch (    RootNotPermittedException e) {
      e.printStackTrace();
    }
  }
}
Program: 162547
Project: 162547
Buggy source:
@Override public void run(){
  mModified=!mInput.getText().toString().equals(mOriginal);
  invalidateOptionsMenu();
}

Fixed version (ground truth):
@Override public void run(){
  modified=!mInput.getText().toString().equals(mOriginal);
  if (mModified != modified) {
    mModified=modified;
    invalidateOptionsMenu();
  }
}
Program: 162549
Project: 162549
Buggy source:
@Override public void onTextChanged(CharSequence charSequence,int i,int i2,int i3){
  if (charSequence.hashCode() == mInput.getText().hashCode()) {
    if (mTimer != null) {
      mTimer.cancel();
      mTimer.purge();
      mTimer=null;
    }
    mTimer=new Timer();
    mTimer.schedule(new TimerTask(){
      @Override public void run(){
        mModified=!mInput.getText().toString().equals(mOriginal);
        invalidateOptionsMenu();
      }
    }
,250);
  }
}

Fixed version (ground truth):
@Override public void onTextChanged(CharSequence charSequence,int i,int i2,int i3){
  if (charSequence.hashCode() == mInput.getText().hashCode()) {
    if (mTimer != null) {
      mTimer.cancel();
      mTimer.purge();
      mTimer=null;
    }
    mTimer=new Timer();
    mTimer.schedule(new TimerTask(){
      boolean modified;
      @Override public void run(){
        modified=!mInput.getText().toString().equals(mOriginal);
        if (mModified != modified) {
          mModified=modified;
          invalidateOptionsMenu();
        }
      }
    }
,250);
  }
}
Program: 162550
Project: 162550
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  getMenuInflater().inflate(R.menu.text,menu);
  menu.findItem(R.id.save).setVisible(mModified);
  menu.findItem(R.id.find).setVisible(true);
  return super.onCreateOptionsMenu(menu);
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  getMenuInflater().inflate(R.menu.text,menu);
  menu.findItem(R.id.find).setVisible(true);
  return super.onCreateOptionsMenu(menu);
}
Program: 162551
Project: 162551
Buggy source:
/** 
 * Check is a file is writable. Detects write issues on external SD card.
 * @param file The file
 * @return true if the file is writable.
 */
public static final boolean isWritable(final File file){
  if (file == null)   return false;
  boolean isExisting=file.exists();
  try {
    FileOutputStream output=new FileOutputStream(file,true);
    try {
      output.close();
    }
 catch (    IOException e) {
    }
  }
 catch (  FileNotFoundException e) {
    return false;
  }
  boolean result=file.canWrite();
  if (!isExisting) {
    file.delete();
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Check if a file is writable. Detects write issues on external SD card.
 * @param file The file
 * @return true if the file is writable.
 */
public static final boolean isWritable(final File file){
  if (file == null)   return false;
  boolean isExisting=file.exists();
  try {
    FileOutputStream output=new FileOutputStream(file,true);
    try {
      output.close();
    }
 catch (    IOException e) {
    }
  }
 catch (  FileNotFoundException e) {
    return false;
  }
  boolean result=file.canWrite();
  if (!isExisting) {
    file.delete();
  }
  return result;
}
Program: 162553
Project: 162553
Buggy source:
public void guideDialogForLEXA(String path){
  final MaterialDialog.Builder x=new MaterialDialog.Builder(mainActivity);
  x.theme(mainActivity.getAppTheme().getMaterialDialogTheme());
  x.title(R.string.needsaccess);
  LayoutInflater layoutInflater=(LayoutInflater)mainActivity.getSystemService(mainActivity.LAYOUT_INFLATER_SERVICE);
  View view=layoutInflater.inflate(R.layout.lexadrawer,null);
  x.customView(view,true);
  TextView textView=(TextView)view.findViewById(R.id.description);
  textView.setText(mainActivity.getResources().getString(R.string.needsaccesssummary) + path + mainActivity.getResources().getString(R.string.needsaccesssummary1));
  ((ImageView)view.findViewById(R.id.icon)).setImageResource(R.drawable.sd_operate_step);
  x.positiveText(R.string.open);
  x.negativeText(R.string.cancel);
  x.positiveColor(Color.parseColor(BaseActivity.accentSkin));
  x.negativeColor(Color.parseColor(BaseActivity.accentSkin));
  x.callback(new MaterialDialog.ButtonCallback(){
    @Override public void onPositive(    MaterialDialog materialDialog){
      triggerStorageAccessFramework();
    }
    @Override public void onNegative(    MaterialDialog materialDialog){
      Toast.makeText(mainActivity,R.string.error,Toast.LENGTH_SHORT).show();
    }
  }
);
  final MaterialDialog y=x.build();
  y.show();
}

Fixed version (ground truth):
public void guideDialogForLEXA(String path){
  final MaterialDialog.Builder x=new MaterialDialog.Builder(mainActivity);
  x.theme(mainActivity.getAppTheme().getMaterialDialogTheme());
  x.title(R.string.needsaccess);
  LayoutInflater layoutInflater=(LayoutInflater)mainActivity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View view=layoutInflater.inflate(R.layout.lexadrawer,null);
  x.customView(view,true);
  TextView textView=(TextView)view.findViewById(R.id.description);
  textView.setText(mainActivity.getResources().getString(R.string.needsaccesssummary) + path + mainActivity.getResources().getString(R.string.needsaccesssummary1));
  ((ImageView)view.findViewById(R.id.icon)).setImageResource(R.drawable.sd_operate_step);
  x.positiveText(R.string.open);
  x.negativeText(R.string.cancel);
  x.positiveColor(Color.parseColor(BaseActivity.accentSkin));
  x.negativeColor(Color.parseColor(BaseActivity.accentSkin));
  x.callback(new MaterialDialog.ButtonCallback(){
    @Override public void onPositive(    MaterialDialog materialDialog){
      triggerStorageAccessFramework();
    }
    @Override public void onNegative(    MaterialDialog materialDialog){
      Toast.makeText(mainActivity,R.string.error,Toast.LENGTH_SHORT).show();
    }
  }
);
  final MaterialDialog y=x.build();
  y.show();
}
Program: 162555
Project: 162555
Buggy source:
@Override protected void onPostExecute(Void aVoid){
  super.onPostExecute(aVoid);
  String cmd="String_Node_Str" + output.getPath();
  Log.d("String_Node_Str",cmd);
  RootHelper.runAndWait(cmd,false);
  utilsProvider.getFutils().openFile(output,(MainActivity)zipViewer);
}

Fixed version (ground truth):
@Override protected void onPostExecute(Void aVoid){
  super.onPostExecute(aVoid);
  String cmd="String_Node_Str" + output.getPath();
  Log.d("String_Node_Str",cmd);
  RootHelper.runAndWait(cmd,false);
  new Futils().openFile(output,(MainActivity)zipViewer);
}
Program: 162557
Project: 162557
Buggy source:
private void load(final File file){
  new Thread(new Runnable(){
    @Override public void run(){
      if (!file.canRead() && rootMode) {
        File file1=getExternalCacheDir();
        if (file1 != null)         file1=getCacheDir();
        RootTools.remount(file.getParent(),"String_Node_Str");
        RootTools.copyFile(pathFile.getPath(),new File(file1.getPath(),file.getName()).getPath(),true,false);
        pathFile=new File(file1.getPath(),file.getName());
        RootHelper.runAndWait("String_Node_Str" + pathFile.getPath(),true);
        delete=true;
      }
      try {
        sqLiteDatabase=SQLiteDatabase.openDatabase(pathFile.getPath(),null,SQLiteDatabase.OPEN_READONLY);
        c=sqLiteDatabase.rawQuery("String_Node_Str",null);
        arrayList=getDbTableNames(c);
        arrayAdapter=new ArrayAdapter(DbViewer.this,android.R.layout.simple_list_item_1,arrayList);
      }
 catch (      Exception e) {
        e.printStackTrace();
        finish();
      }
      runOnUiThread(new Runnable(){
        @Override public void run(){
          listView.setAdapter(arrayAdapter);
        }
      }
);
    }
  }
).start();
}

Fixed version (ground truth):
private void load(final File file){
  new Thread(new Runnable(){
    @Override public void run(){
      if (!file.canRead() && rootmode) {
        File file1=getExternalCacheDir();
        if (file1 != null)         file1=getCacheDir();
        RootTools.remount(file.getParent(),"String_Node_Str");
        RootTools.copyFile(pathFile.getPath(),new File(file1.getPath(),file.getName()).getPath(),true,false);
        pathFile=new File(file1.getPath(),file.getName());
        RootHelper.runAndWait("String_Node_Str" + pathFile.getPath(),true);
        delete=true;
      }
      try {
        sqLiteDatabase=SQLiteDatabase.openDatabase(pathFile.getPath(),null,SQLiteDatabase.OPEN_READONLY);
        c=sqLiteDatabase.rawQuery("String_Node_Str",null);
        arrayList=getDbTableNames(c);
        arrayAdapter=new ArrayAdapter(DbViewer.this,android.R.layout.simple_list_item_1,arrayList);
      }
 catch (      Exception e) {
        e.printStackTrace();
        finish();
      }
      runOnUiThread(new Runnable(){
        @Override public void run(){
          listView.setAdapter(arrayAdapter);
        }
      }
);
    }
  }
).start();
}
Program: 162559
Project: 162559
Buggy source:
@Override public void onClick(View v){
switch (v.getId()) {
case R.id.prev:
    Log.d(getClass().getName(),"String_Node_Str");
  if (it.hasPrevious()) {
    MapEntry keyValue=(MapEntry)it.previous();
    Log.d(getClass().getName(),"String_Node_Str" + keyValue.getKey() + "String_Node_Str"+ keyValue.getValue());
  }
break;
case R.id.next:
Log.d(getClass().getName(),"String_Node_Str");
if (it.hasNext()) {
MapEntry keyValue=(MapEntry)it.next();
Log.d(getClass().getName(),"String_Node_Str" + keyValue.getKey() + "String_Node_Str"+ keyValue.getValue());
}
break;
case R.id.close:
searchEditText.setText("String_Node_Str");
break;
default :
return;
}
}

Fixed version (ground truth):
@Override public void onClick(View v){
switch (v.getId()) {
case R.id.prev:
    if (mCurrent > 0) {
      Map.Entry keyValue=nodes.get(--mCurrent);
      mInput.requestFocus();
      mInput.setSelection((Integer)keyValue.getKey(),(Integer)keyValue.getValue());
    }
  break;
case R.id.next:
if (mCurrent < nodes.size() - 1) {
  Map.Entry keyValue=nodes.get(++mCurrent);
  mInput.requestFocus();
  mInput.setSelection((Integer)keyValue.getKey(),(Integer)keyValue.getValue());
}
break;
case R.id.close:
searchEditText.setText("String_Node_Str");
break;
default :
return;
}
}
Program: 162560
Project: 162560
Buggy source:
@Override public void afterTextChanged(Editable editable){
  if (searchEditText != null && editable.hashCode() == searchEditText.getText().hashCode()) {
    while (it.hasNext()) {
      it.next();
      it.remove();
      System.out.println("String_Node_Str");
    }
    for (int i=0; i < (mOriginal.length() - editable.length()); i++) {
      if (searchEditText.length() == 0)       break;
      if (mOriginal.substring(i,i + editable.length()).equalsIgnoreCase(editable.toString())) {
        MapEntry mapEntry=new MapEntry(i,i + editable.length());
        it.add(mapEntry);
      }
    }
    System.out.println(nodes.size());
    if (!it.hasNext()) {
      upButton.setEnabled(true);
      downButton.setEnabled(true);
    }
 else {
      upButton.setEnabled(false);
      downButton.setEnabled(false);
    }
  }
}

Fixed version (ground truth):
@Override public void afterTextChanged(Editable editable){
  if (searchEditText != null && editable.hashCode() == searchEditText.getText().hashCode()) {
    for (int i=0; i < (mOriginal.length() - editable.length()); i++) {
      if (searchEditText.length() == 0)       break;
      if (mOriginal.substring(i,i + editable.length()).equalsIgnoreCase(editable.toString())) {
        nodes.add(new MapEntry(i,i + editable.length()));
      }
    }
    if (nodes.size() != 0) {
      upButton.setEnabled(true);
      downButton.setEnabled(true);
    }
 else {
      upButton.setEnabled(false);
      downButton.setEnabled(false);
    }
  }
}
Program: 162561
Project: 162561
Buggy source:
@Override public void beforeTextChanged(CharSequence charSequence,int i,int i2,int i3){
}

Fixed version (ground truth):
@Override public void beforeTextChanged(CharSequence charSequence,int i,int i2,int i3){
  if (searchEditText != null && charSequence.hashCode() == searchEditText.getText().hashCode()) {
    nodes.clear();
    mCurrent=-1;
  }
}
Program: 162562
Project: 162562
Buggy source:
@Override public boolean onCreateOptionsMenu(Menu menu){
  getMenuInflater().inflate(R.menu.text,menu);
  menu.findItem(R.id.save).setVisible(mModified);
  menu.findItem(R.id.find).setVisible(false);
  menu.findItem(R.id.edit).setVisible(false);
  return super.onCreateOptionsMenu(menu);
}

Fixed version (ground truth):
@Override public boolean onCreateOptionsMenu(Menu menu){
  getMenuInflater().inflate(R.menu.text,menu);
  menu.findItem(R.id.save).setVisible(mModified);
  menu.findItem(R.id.find).setVisible(true);
  menu.findItem(R.id.edit).setVisible(false);
  return super.onCreateOptionsMenu(menu);
}
Program: 162563
Project: 162563
Buggy source:
public void onDestroyActionMode(ActionMode mode){
  mActionMode=null;
  selection=false;
  if (!results)   adapter.toggleChecked(false,current);
 else   adapter.toggleChecked(false);
  mainActivity.setPagingEnabled(true);
  ObjectAnimator anim=ObjectAnimator.ofInt(getActivity().findViewById(R.id.buttonbarframe),"String_Node_Str",res.getColor(R.color.holo_dark_action_mode),skin_color);
  anim.setDuration(0);
  anim.setEvaluator(new ArgbEvaluator());
  anim.start();
  if (Build.VERSION.SDK_INT >= 21) {
    Window window=getActivity().getWindow();
    if (mainActivity.colourednavigation)     window.setNavigationBarColor(mainActivity.skinStatusBar);
  }
}

Fixed version (ground truth):
public void onDestroyActionMode(ActionMode mode){
  mActionMode=null;
  selection=false;
  if (mainActivity.isDrawerLocked)   mainActivity.translateDrawerList(false);
  if (!results)   adapter.toggleChecked(false,current);
 else   adapter.toggleChecked(false);
  mainActivity.setPagingEnabled(true);
  ObjectAnimator anim=ObjectAnimator.ofInt(getActivity().findViewById(R.id.buttonbarframe),"String_Node_Str",res.getColor(R.color.holo_dark_action_mode),skin_color);
  anim.setDuration(0);
  anim.setEvaluator(new ArgbEvaluator());
  anim.start();
  if (Build.VERSION.SDK_INT >= 21) {
    Window window=getActivity().getWindow();
    if (mainActivity.colourednavigation)     window.setNavigationBarColor(mainActivity.skinStatusBar);
  }
}
Program: 162564
Project: 162564
Buggy source:
public boolean onCreateActionMode(ActionMode mode,Menu menu){
  MenuInflater inflater=mode.getMenuInflater();
  v=getActivity().getLayoutInflater().inflate(R.layout.actionmode,null);
  try {
    v.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View v){
      }
    }
);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  mode.setCustomView(v);
  mainActivity.setPagingEnabled(false);
  inflater.inflate(R.menu.contextual,menu);
  initMenu(menu);
  hideOption(R.id.addshortcut,menu);
  hideOption(R.id.sethome,menu);
  hideOption(R.id.rename,menu);
  hideOption(R.id.share,menu);
  hideOption(R.id.about,menu);
  hideOption(R.id.openwith,menu);
  hideOption(R.id.ex,menu);
  if (mainActivity.mReturnIntent)   showOption(R.id.openmulti,menu);
  mode.setTitle(utils.getString(getActivity(),R.string.select));
  ObjectAnimator anim=ObjectAnimator.ofInt(getActivity().findViewById(R.id.buttonbarframe),"String_Node_Str",skin_color,res.getColor(R.color.holo_dark_action_mode));
  anim.setDuration(0);
  anim.setEvaluator(new ArgbEvaluator());
  anim.start();
  if (Build.VERSION.SDK_INT >= 21) {
    Window window=getActivity().getWindow();
    if (mainActivity.colourednavigation)     window.setNavigationBarColor(res.getColor(android.R.color.black));
  }
  return true;
}

Fixed version (ground truth):
public boolean onCreateActionMode(ActionMode mode,Menu menu){
  MenuInflater inflater=mode.getMenuInflater();
  v=getActivity().getLayoutInflater().inflate(R.layout.actionmode,null);
  try {
    v.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View v){
      }
    }
);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  mode.setCustomView(v);
  mainActivity.setPagingEnabled(false);
  if (mainActivity.isDrawerLocked)   mainActivity.translateDrawerList(true);
  inflater.inflate(R.menu.contextual,menu);
  initMenu(menu);
  hideOption(R.id.addshortcut,menu);
  hideOption(R.id.sethome,menu);
  hideOption(R.id.rename,menu);
  hideOption(R.id.share,menu);
  hideOption(R.id.about,menu);
  hideOption(R.id.openwith,menu);
  hideOption(R.id.ex,menu);
  if (mainActivity.mReturnIntent)   showOption(R.id.openmulti,menu);
  mode.setTitle(utils.getString(getActivity(),R.string.select));
  ObjectAnimator anim=ObjectAnimator.ofInt(getActivity().findViewById(R.id.buttonbarframe),"String_Node_Str",skin_color,res.getColor(R.color.holo_dark_action_mode));
  anim.setDuration(0);
  anim.setEvaluator(new ArgbEvaluator());
  anim.start();
  if (Build.VERSION.SDK_INT >= 21) {
    Window window=getActivity().getWindow();
    if (mainActivity.colourednavigation)     window.setNavigationBarColor(res.getColor(android.R.color.black));
  }
  return true;
}
Program: 162567
Project: 162567
Buggy source:
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent,int viewType){
  View v=mInflater.inflate(R.layout.rowlayout,parent,false);
  ViewHolder vh=new ViewHolder(v);
  if (zipViewer.mainActivity.theme1 == 1)   vh.txtTitle.setTextColor(zipViewer.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);
    v.findViewById(R.id.icon).setVisibility(View.INVISIBLE);
    return new ViewHolder(v);
  }
  View v=mInflater.inflate(R.layout.rowlayout,parent,false);
  ViewHolder vh=new ViewHolder(v);
  if (zipViewer.mainActivity.theme1 == 1)   vh.txtTitle.setTextColor(zipViewer.getActivity().getResources().getColor(android.R.color.white));
  return vh;
}
Program: 162569
Project: 162569
Buggy source:
@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;
}

Fixed version (ground truth):
@Override public long getHeaderId(int i){
  if (i >= 0 && i < items.size())   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: 162570
Project: 162570
Buggy source:
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup,int i){
  View v=mInflater.inflate(R.layout.rowlayout,viewGroup,false);
  ViewHolder vh=new ViewHolder(v);
  if (zipViewer.mainActivity.theme1 == 1)   vh.txtTitle.setTextColor(zipViewer.getActivity().getResources().getColor(android.R.color.white));
  return vh;
}

Fixed version (ground truth):
@Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup,int i){
  if (i == 0) {
    View v=mInflater.inflate(R.layout.rowlayout,viewGroup,false);
    v.findViewById(R.id.icon).setVisibility(View.INVISIBLE);
    return new ViewHolder(v);
  }
  View v=mInflater.inflate(R.layout.rowlayout,viewGroup,false);
  ViewHolder vh=new ViewHolder(v);
  if (zipViewer.mainActivity.theme1 == 1)   vh.txtTitle.setTextColor(zipViewer.getActivity().getResources().getColor(android.R.color.white));
  return vh;
}