nus-yam/ex-repair huggingface dataset:
Program: 38348
Project: 38348
Buggy source:
private Intent computeSharingIntent(JobContext jc){
  ArrayList<Path> expandedPaths=mSelectionManager.getSelected(true);
  if (expandedPaths.size() == 0) {
    setNfcBeamPushUris(null);
    return null;
  }
  final ArrayList<Uri> uris=new ArrayList<Uri>();
  DataManager manager=mActivity.getDataManager();
  int type=0;
  final Intent intent=new Intent();
  for (  Path path : expandedPaths) {
    if (jc.isCancelled())     return null;
    int support=manager.getSupportedOperations(path);
    type|=manager.getMediaType(path);
    if ((support & MediaObject.SUPPORT_SHARE) != 0) {
      uris.add(manager.getContentUri(path));
    }
  }
  final int size=uris.size();
  if (size > 0) {
    final String mimeType=MenuExecutor.getMimeType(type);
    if (size > 1) {
      intent.setAction(Intent.ACTION_SEND_MULTIPLE).setType(mimeType);
      intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM,uris);
    }
 else {
      intent.setAction(Intent.ACTION_SEND).setType(mimeType);
      intent.putExtra(Intent.EXTRA_STREAM,uris.get(0));
    }
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    setNfcBeamPushUris(uris.toArray(new Uri[uris.size()]));
  }
 else {
    setNfcBeamPushUris(null);
  }
  return intent;
}

Fixed version (ground truth):
private Intent computeSharingIntent(JobContext jc,int maxItems){
  ArrayList<Path> expandedPaths=mSelectionManager.getSelected(true,maxItems);
  if (expandedPaths == null || expandedPaths.size() == 0) {
    setNfcBeamPushUris(null);
    return new Intent();
  }
  final ArrayList<Uri> uris=new ArrayList<Uri>();
  DataManager manager=mActivity.getDataManager();
  int type=0;
  final Intent intent=new Intent();
  for (  Path path : expandedPaths) {
    if (jc.isCancelled())     return null;
    int support=manager.getSupportedOperations(path);
    type|=manager.getMediaType(path);
    if ((support & MediaObject.SUPPORT_SHARE) != 0) {
      uris.add(manager.getContentUri(path));
    }
  }
  final int size=uris.size();
  if (size > 0) {
    final String mimeType=MenuExecutor.getMimeType(type);
    if (size > 1) {
      intent.setAction(Intent.ACTION_SEND_MULTIPLE).setType(mimeType);
      intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM,uris);
    }
 else {
      intent.setAction(Intent.ACTION_SEND).setType(mimeType);
      intent.putExtra(Intent.EXTRA_STREAM,uris.get(0));
    }
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    setNfcBeamPushUris(uris.toArray(new Uri[uris.size()]));
  }
 else {
    setNfcBeamPushUris(null);
  }
  return intent;
}
Program: 38349
Project: 38349
Buggy source:
private Intent computePanoramaSharingIntent(JobContext jc){
  ArrayList<Path> expandedPaths=mSelectionManager.getSelected(true);
  if (expandedPaths.size() == 0) {
    return null;
  }
  final ArrayList<Uri> uris=new ArrayList<Uri>();
  DataManager manager=mActivity.getDataManager();
  final Intent intent=new Intent();
  for (  Path path : expandedPaths) {
    if (jc.isCancelled())     return null;
    uris.add(manager.getContentUri(path));
  }
  final int size=uris.size();
  if (size > 0) {
    if (size > 1) {
      intent.setAction(Intent.ACTION_SEND_MULTIPLE);
      intent.setType(GalleryUtils.MIME_TYPE_PANORAMA360);
      intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM,uris);
    }
 else {
      intent.setAction(Intent.ACTION_SEND);
      intent.setType(GalleryUtils.MIME_TYPE_PANORAMA360);
      intent.putExtra(Intent.EXTRA_STREAM,uris.get(0));
    }
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
  }
  return intent;
}

Fixed version (ground truth):
private Intent computePanoramaSharingIntent(JobContext jc,int maxItems){
  ArrayList<Path> expandedPaths=mSelectionManager.getSelected(true,maxItems);
  if (expandedPaths == null || expandedPaths.size() == 0) {
    return new Intent();
  }
  final ArrayList<Uri> uris=new ArrayList<Uri>();
  DataManager manager=mActivity.getDataManager();
  final Intent intent=new Intent();
  for (  Path path : expandedPaths) {
    if (jc.isCancelled())     return null;
    uris.add(manager.getContentUri(path));
  }
  final int size=uris.size();
  if (size > 0) {
    if (size > 1) {
      intent.setAction(Intent.ACTION_SEND_MULTIPLE);
      intent.setType(GalleryUtils.MIME_TYPE_PANORAMA360);
      intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM,uris);
    }
 else {
      intent.setAction(Intent.ACTION_SEND);
      intent.setType(GalleryUtils.MIME_TYPE_PANORAMA360);
      intent.putExtra(Intent.EXTRA_STREAM,uris.get(0));
    }
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
  }
  return intent;
}
Program: 38350
Project: 38350
Buggy source:
private static void expandMediaSet(ArrayList<Path> items,MediaSet set){
  int subCount=set.getSubMediaSetCount();
  for (int i=0; i < subCount; i++) {
    expandMediaSet(items,set.getSubMediaSet(i));
  }
  int total=set.getMediaItemCount();
  int batch=50;
  int index=0;
  while (index < total) {
    int count=index + batch < total ? batch : total - index;
    ArrayList<MediaItem> list=set.getMediaItem(index,count);
    for (    MediaItem item : list) {
      items.add(item.getPath());
    }
    index+=batch;
  }
}

Fixed version (ground truth):
private static boolean expandMediaSet(ArrayList<Path> items,MediaSet set,int maxSelection){
  int subCount=set.getSubMediaSetCount();
  for (int i=0; i < subCount; i++) {
    if (!expandMediaSet(items,set.getSubMediaSet(i),maxSelection)) {
      return false;
    }
  }
  int total=set.getMediaItemCount();
  int batch=50;
  int index=0;
  while (index < total) {
    int count=index + batch < total ? batch : total - index;
    ArrayList<MediaItem> list=set.getMediaItem(index,count);
    if (list != null && list.size() > (maxSelection - items.size())) {
      return false;
    }
    for (    MediaItem item : list) {
      items.add(item.getPath());
    }
    index+=batch;
  }
  return true;
}
Program: 38351
Project: 38351
Buggy source:
public ArrayList<Path> getSelected(boolean expandSet){
  ArrayList<Path> selected=new ArrayList<Path>();
  if (mIsAlbumSet) {
    if (mInverseSelection) {
      int total=getTotalCount();
      for (int i=0; i < total; i++) {
        MediaSet set=mSourceMediaSet.getSubMediaSet(i);
        Path id=set.getPath();
        if (!mClickedSet.contains(id)) {
          if (expandSet) {
            expandMediaSet(selected,set);
          }
 else {
            selected.add(id);
          }
        }
      }
    }
 else {
      for (      Path id : mClickedSet) {
        if (expandSet) {
          expandMediaSet(selected,mDataManager.getMediaSet(id));
        }
 else {
          selected.add(id);
        }
      }
    }
  }
 else {
    if (mInverseSelection) {
      int total=getTotalCount();
      int index=0;
      while (index < total) {
        int count=Math.min(total - index,MediaSet.MEDIAITEM_BATCH_FETCH_COUNT);
        ArrayList<MediaItem> list=mSourceMediaSet.getMediaItem(index,count);
        for (        MediaItem item : list) {
          Path id=item.getPath();
          if (!mClickedSet.contains(id))           selected.add(id);
        }
        index+=count;
      }
    }
 else {
      for (      Path id : mClickedSet) {
        selected.add(id);
      }
    }
  }
  return selected;
}

Fixed version (ground truth):
public ArrayList<Path> getSelected(boolean expandSet,int maxSelection){
  ArrayList<Path> selected=new ArrayList<Path>();
  if (mIsAlbumSet) {
    if (mInverseSelection) {
      int total=getTotalCount();
      for (int i=0; i < total; i++) {
        MediaSet set=mSourceMediaSet.getSubMediaSet(i);
        Path id=set.getPath();
        if (!mClickedSet.contains(id)) {
          if (expandSet && !expandMediaSet(selected,set,maxSelection)) {
            return null;
          }
 else {
            selected.add(id);
            if (selected.size() > maxSelection) {
              return null;
            }
          }
        }
      }
    }
 else {
      for (      Path id : mClickedSet) {
        if (expandSet && !expandMediaSet(selected,mDataManager.getMediaSet(id),maxSelection)) {
          return null;
        }
 else {
          selected.add(id);
          if (selected.size() > maxSelection) {
            return null;
          }
        }
      }
    }
  }
 else {
    if (mInverseSelection) {
      int total=getTotalCount();
      int index=0;
      while (index < total) {
        int count=Math.min(total - index,MediaSet.MEDIAITEM_BATCH_FETCH_COUNT);
        ArrayList<MediaItem> list=mSourceMediaSet.getMediaItem(index,count);
        for (        MediaItem item : list) {
          Path id=item.getPath();
          if (!mClickedSet.contains(id)) {
            selected.add(id);
            if (selected.size() > maxSelection) {
              return null;
            }
          }
        }
        index+=count;
      }
    }
 else {
      for (      Path id : mClickedSet) {
        selected.add(id);
        if (selected.size() > maxSelection) {
          return null;
        }
      }
    }
  }
  return selected;
}
Program: 38352
Project: 38352
Buggy source:
@Override public void run(){
  mMenuTask=null;
  if (jc.isCancelled())   return;
  MenuExecutor.updateMenuOperation(mMenu,operation);
  MenuExecutor.updateMenuForPanorama(mMenu,supportCallback.mAllPanorama360,supportCallback.mHasPanorama360);
  if (mSharePanoramaMenuItem != null) {
    mSharePanoramaMenuItem.setEnabled(true);
    if (supportCallback.mAllPanorama360) {
      mShareMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
      mShareMenuItem.setTitle(mActivity.getResources().getString(R.string.share_as_photo));
    }
 else {
      mSharePanoramaMenuItem.setVisible(false);
      mShareMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
      mShareMenuItem.setTitle(mActivity.getResources().getString(R.string.share));
    }
    mSharePanoramaActionProvider.setShareIntent(share_panorama_intent);
  }
  if (mShareMenuItem != null) {
    mShareMenuItem.setEnabled(true);
    mShareActionProvider.setShareIntent(share_intent);
  }
}

Fixed version (ground truth):
@Override public void run(){
  mMenuTask=null;
  if (jc.isCancelled())   return;
  MenuExecutor.updateMenuOperation(mMenu,operation);
  MenuExecutor.updateMenuForPanorama(mMenu,canSharePanoramas && supportCallback.mAllPanorama360,canSharePanoramas && supportCallback.mHasPanorama360);
  if (mSharePanoramaMenuItem != null) {
    mSharePanoramaMenuItem.setEnabled(true);
    if (canSharePanoramas && supportCallback.mAllPanorama360) {
      mShareMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
      mShareMenuItem.setTitle(mActivity.getResources().getString(R.string.share_as_photo));
    }
 else {
      mSharePanoramaMenuItem.setVisible(false);
      mShareMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
      mShareMenuItem.setTitle(mActivity.getResources().getString(R.string.share));
    }
    mSharePanoramaActionProvider.setShareIntent(share_panorama_intent);
  }
  if (mShareMenuItem != null) {
    mShareMenuItem.setEnabled(canShare);
    mShareActionProvider.setShareIntent(share_intent);
  }
}
Program: 38354
Project: 38354
Buggy source:
private Intent computeSharingIntent(JobContext jc){
  ArrayList<Path> expandedPaths=mSelectionManager.getSelected(true);
  if (expandedPaths.size() == 0) {
    setNfcBeamPushUris(null);
    return null;
  }
  final ArrayList<Uri> uris=new ArrayList<Uri>();
  DataManager manager=mActivity.getDataManager();
  int type=0;
  final Intent intent=new Intent();
  for (  Path path : expandedPaths) {
    if (jc.isCancelled())     return null;
    int support=manager.getSupportedOperations(path);
    type|=manager.getMediaType(path);
    if ((support & MediaObject.SUPPORT_SHARE) != 0) {
      uris.add(manager.getContentUri(path));
    }
  }
  final int size=uris.size();
  if (size > 0) {
    final String mimeType=MenuExecutor.getMimeType(type);
    if (size > 1) {
      intent.setAction(Intent.ACTION_SEND_MULTIPLE).setType(mimeType);
      intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM,uris);
    }
 else {
      intent.setAction(Intent.ACTION_SEND).setType(mimeType);
      intent.putExtra(Intent.EXTRA_STREAM,uris.get(0));
    }
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    setNfcBeamPushUris(uris.toArray(new Uri[uris.size()]));
  }
 else {
    setNfcBeamPushUris(null);
  }
  return intent;
}

Fixed version (ground truth):
private Intent computeSharingIntent(JobContext jc,int maxItems){
  ArrayList<Path> expandedPaths=mSelectionManager.getSelected(true,maxItems);
  if (expandedPaths == null || expandedPaths.size() == 0) {
    setNfcBeamPushUris(null);
    return new Intent();
  }
  final ArrayList<Uri> uris=new ArrayList<Uri>();
  DataManager manager=mActivity.getDataManager();
  int type=0;
  final Intent intent=new Intent();
  for (  Path path : expandedPaths) {
    if (jc.isCancelled())     return null;
    int support=manager.getSupportedOperations(path);
    type|=manager.getMediaType(path);
    if ((support & MediaObject.SUPPORT_SHARE) != 0) {
      uris.add(manager.getContentUri(path));
    }
  }
  final int size=uris.size();
  if (size > 0) {
    final String mimeType=MenuExecutor.getMimeType(type);
    if (size > 1) {
      intent.setAction(Intent.ACTION_SEND_MULTIPLE).setType(mimeType);
      intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM,uris);
    }
 else {
      intent.setAction(Intent.ACTION_SEND).setType(mimeType);
      intent.putExtra(Intent.EXTRA_STREAM,uris.get(0));
    }
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    setNfcBeamPushUris(uris.toArray(new Uri[uris.size()]));
  }
 else {
    setNfcBeamPushUris(null);
  }
  return intent;
}
Program: 38355
Project: 38355
Buggy source:
private Intent computePanoramaSharingIntent(JobContext jc){
  ArrayList<Path> expandedPaths=mSelectionManager.getSelected(true);
  if (expandedPaths.size() == 0) {
    return null;
  }
  final ArrayList<Uri> uris=new ArrayList<Uri>();
  DataManager manager=mActivity.getDataManager();
  final Intent intent=new Intent();
  for (  Path path : expandedPaths) {
    if (jc.isCancelled())     return null;
    uris.add(manager.getContentUri(path));
  }
  final int size=uris.size();
  if (size > 0) {
    if (size > 1) {
      intent.setAction(Intent.ACTION_SEND_MULTIPLE);
      intent.setType(GalleryUtils.MIME_TYPE_PANORAMA360);
      intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM,uris);
    }
 else {
      intent.setAction(Intent.ACTION_SEND);
      intent.setType(GalleryUtils.MIME_TYPE_PANORAMA360);
      intent.putExtra(Intent.EXTRA_STREAM,uris.get(0));
    }
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
  }
  return intent;
}

Fixed version (ground truth):
private Intent computePanoramaSharingIntent(JobContext jc,int maxItems){
  ArrayList<Path> expandedPaths=mSelectionManager.getSelected(true,maxItems);
  if (expandedPaths == null || expandedPaths.size() == 0) {
    return new Intent();
  }
  final ArrayList<Uri> uris=new ArrayList<Uri>();
  DataManager manager=mActivity.getDataManager();
  final Intent intent=new Intent();
  for (  Path path : expandedPaths) {
    if (jc.isCancelled())     return null;
    uris.add(manager.getContentUri(path));
  }
  final int size=uris.size();
  if (size > 0) {
    if (size > 1) {
      intent.setAction(Intent.ACTION_SEND_MULTIPLE);
      intent.setType(GalleryUtils.MIME_TYPE_PANORAMA360);
      intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM,uris);
    }
 else {
      intent.setAction(Intent.ACTION_SEND);
      intent.setType(GalleryUtils.MIME_TYPE_PANORAMA360);
      intent.putExtra(Intent.EXTRA_STREAM,uris.get(0));
    }
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
  }
  return intent;
}
Program: 38356
Project: 38356
Buggy source:
private static void expandMediaSet(ArrayList<Path> items,MediaSet set){
  int subCount=set.getSubMediaSetCount();
  for (int i=0; i < subCount; i++) {
    expandMediaSet(items,set.getSubMediaSet(i));
  }
  int total=set.getMediaItemCount();
  int batch=50;
  int index=0;
  while (index < total) {
    int count=index + batch < total ? batch : total - index;
    ArrayList<MediaItem> list=set.getMediaItem(index,count);
    for (    MediaItem item : list) {
      items.add(item.getPath());
    }
    index+=batch;
  }
}

Fixed version (ground truth):
private static boolean expandMediaSet(ArrayList<Path> items,MediaSet set,int maxSelection){
  int subCount=set.getSubMediaSetCount();
  for (int i=0; i < subCount; i++) {
    if (!expandMediaSet(items,set.getSubMediaSet(i),maxSelection)) {
      return false;
    }
  }
  int total=set.getMediaItemCount();
  int batch=50;
  int index=0;
  while (index < total) {
    int count=index + batch < total ? batch : total - index;
    ArrayList<MediaItem> list=set.getMediaItem(index,count);
    if (list != null && list.size() > (maxSelection - items.size())) {
      return false;
    }
    for (    MediaItem item : list) {
      items.add(item.getPath());
    }
    index+=batch;
  }
  return true;
}
Program: 38357
Project: 38357
Buggy source:
public ArrayList<Path> getSelected(boolean expandSet){
  ArrayList<Path> selected=new ArrayList<Path>();
  if (mIsAlbumSet) {
    if (mInverseSelection) {
      int total=getTotalCount();
      for (int i=0; i < total; i++) {
        MediaSet set=mSourceMediaSet.getSubMediaSet(i);
        Path id=set.getPath();
        if (!mClickedSet.contains(id)) {
          if (expandSet) {
            expandMediaSet(selected,set);
          }
 else {
            selected.add(id);
          }
        }
      }
    }
 else {
      for (      Path id : mClickedSet) {
        if (expandSet) {
          expandMediaSet(selected,mDataManager.getMediaSet(id));
        }
 else {
          selected.add(id);
        }
      }
    }
  }
 else {
    if (mInverseSelection) {
      int total=getTotalCount();
      int index=0;
      while (index < total) {
        int count=Math.min(total - index,MediaSet.MEDIAITEM_BATCH_FETCH_COUNT);
        ArrayList<MediaItem> list=mSourceMediaSet.getMediaItem(index,count);
        for (        MediaItem item : list) {
          Path id=item.getPath();
          if (!mClickedSet.contains(id))           selected.add(id);
        }
        index+=count;
      }
    }
 else {
      for (      Path id : mClickedSet) {
        selected.add(id);
      }
    }
  }
  return selected;
}

Fixed version (ground truth):
public ArrayList<Path> getSelected(boolean expandSet,int maxSelection){
  ArrayList<Path> selected=new ArrayList<Path>();
  if (mIsAlbumSet) {
    if (mInverseSelection) {
      int total=getTotalCount();
      for (int i=0; i < total; i++) {
        MediaSet set=mSourceMediaSet.getSubMediaSet(i);
        Path id=set.getPath();
        if (!mClickedSet.contains(id)) {
          if (expandSet && !expandMediaSet(selected,set,maxSelection)) {
            return null;
          }
 else {
            selected.add(id);
            if (selected.size() > maxSelection) {
              return null;
            }
          }
        }
      }
    }
 else {
      for (      Path id : mClickedSet) {
        if (expandSet && !expandMediaSet(selected,mDataManager.getMediaSet(id),maxSelection)) {
          return null;
        }
 else {
          selected.add(id);
          if (selected.size() > maxSelection) {
            return null;
          }
        }
      }
    }
  }
 else {
    if (mInverseSelection) {
      int total=getTotalCount();
      int index=0;
      while (index < total) {
        int count=Math.min(total - index,MediaSet.MEDIAITEM_BATCH_FETCH_COUNT);
        ArrayList<MediaItem> list=mSourceMediaSet.getMediaItem(index,count);
        for (        MediaItem item : list) {
          Path id=item.getPath();
          if (!mClickedSet.contains(id)) {
            selected.add(id);
            if (selected.size() > maxSelection) {
              return null;
            }
          }
        }
        index+=count;
      }
    }
 else {
      for (      Path id : mClickedSet) {
        selected.add(id);
        if (selected.size() > maxSelection) {
          return null;
        }
      }
    }
  }
  return selected;
}
Program: 38358
Project: 38358
Buggy source:
@Override public void run(){
  mMenuTask=null;
  if (jc.isCancelled())   return;
  MenuExecutor.updateMenuOperation(mMenu,operation);
  MenuExecutor.updateMenuForPanorama(mMenu,supportCallback.mAllPanorama360,supportCallback.mHasPanorama360);
  if (mSharePanoramaMenuItem != null) {
    mSharePanoramaMenuItem.setEnabled(true);
    if (supportCallback.mAllPanorama360) {
      mShareMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
      mShareMenuItem.setTitle(mActivity.getResources().getString(R.string.share_as_photo));
    }
 else {
      mSharePanoramaMenuItem.setVisible(false);
      mShareMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
      mShareMenuItem.setTitle(mActivity.getResources().getString(R.string.share));
    }
    mSharePanoramaActionProvider.setShareIntent(share_panorama_intent);
  }
  if (mShareMenuItem != null) {
    mShareMenuItem.setEnabled(true);
    mShareActionProvider.setShareIntent(share_intent);
  }
}

Fixed version (ground truth):
@Override public void run(){
  mMenuTask=null;
  if (jc.isCancelled())   return;
  MenuExecutor.updateMenuOperation(mMenu,operation);
  MenuExecutor.updateMenuForPanorama(mMenu,canSharePanoramas && supportCallback.mAllPanorama360,canSharePanoramas && supportCallback.mHasPanorama360);
  if (mSharePanoramaMenuItem != null) {
    mSharePanoramaMenuItem.setEnabled(true);
    if (canSharePanoramas && supportCallback.mAllPanorama360) {
      mShareMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
      mShareMenuItem.setTitle(mActivity.getResources().getString(R.string.share_as_photo));
    }
 else {
      mSharePanoramaMenuItem.setVisible(false);
      mShareMenuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
      mShareMenuItem.setTitle(mActivity.getResources().getString(R.string.share));
    }
    mSharePanoramaActionProvider.setShareIntent(share_panorama_intent);
  }
  if (mShareMenuItem != null) {
    mShareMenuItem.setEnabled(canShare);
    mShareActionProvider.setShareIntent(share_intent);
  }
}
Program: 38360
Project: 38360
Buggy source:
private Intent computeSharingIntent(JobContext jc){
  ArrayList<Path> expandedPaths=mSelectionManager.getSelected(true);
  if (expandedPaths.size() == 0) {
    setNfcBeamPushUris(null);
    return null;
  }
  final ArrayList<Uri> uris=new ArrayList<Uri>();
  DataManager manager=mActivity.getDataManager();
  int type=0;
  final Intent intent=new Intent();
  for (  Path path : expandedPaths) {
    if (jc.isCancelled())     return null;
    int support=manager.getSupportedOperations(path);
    type|=manager.getMediaType(path);
    if ((support & MediaObject.SUPPORT_SHARE) != 0) {
      uris.add(manager.getContentUri(path));
    }
  }
  final int size=uris.size();
  if (size > 0) {
    final String mimeType=MenuExecutor.getMimeType(type);
    if (size > 1) {
      intent.setAction(Intent.ACTION_SEND_MULTIPLE).setType(mimeType);
      intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM,uris);
    }
 else {
      intent.setAction(Intent.ACTION_SEND).setType(mimeType);
      intent.putExtra(Intent.EXTRA_STREAM,uris.get(0));
    }
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    setNfcBeamPushUris(uris.toArray(new Uri[uris.size()]));
  }
 else {
    setNfcBeamPushUris(null);
  }
  return intent;
}

Fixed version (ground truth):
private Intent computeSharingIntent(JobContext jc,int maxItems){
  ArrayList<Path> expandedPaths=mSelectionManager.getSelected(true,maxItems);
  if (expandedPaths == null || expandedPaths.size() == 0) {
    setNfcBeamPushUris(null);
    return new Intent();
  }
  final ArrayList<Uri> uris=new ArrayList<Uri>();
  DataManager manager=mActivity.getDataManager();
  int type=0;
  final Intent intent=new Intent();
  for (  Path path : expandedPaths) {
    if (jc.isCancelled())     return null;
    int support=manager.getSupportedOperations(path);
    type|=manager.getMediaType(path);
    if ((support & MediaObject.SUPPORT_SHARE) != 0) {
      uris.add(manager.getContentUri(path));
    }
  }
  final int size=uris.size();
  if (size > 0) {
    final String mimeType=MenuExecutor.getMimeType(type);
    if (size > 1) {
      intent.setAction(Intent.ACTION_SEND_MULTIPLE).setType(mimeType);
      intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM,uris);
    }
 else {
      intent.setAction(Intent.ACTION_SEND).setType(mimeType);
      intent.putExtra(Intent.EXTRA_STREAM,uris.get(0));
    }
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    setNfcBeamPushUris(uris.toArray(new Uri[uris.size()]));
  }
 else {
    setNfcBeamPushUris(null);
  }
  return intent;
}
Program: 38361
Project: 38361
Buggy source:
private Intent computePanoramaSharingIntent(JobContext jc){
  ArrayList<Path> expandedPaths=mSelectionManager.getSelected(true);
  if (expandedPaths.size() == 0) {
    return null;
  }
  final ArrayList<Uri> uris=new ArrayList<Uri>();
  DataManager manager=mActivity.getDataManager();
  final Intent intent=new Intent();
  for (  Path path : expandedPaths) {
    if (jc.isCancelled())     return null;
    uris.add(manager.getContentUri(path));
  }
  final int size=uris.size();
  if (size > 0) {
    if (size > 1) {
      intent.setAction(Intent.ACTION_SEND_MULTIPLE);
      intent.setType(GalleryUtils.MIME_TYPE_PANORAMA360);
      intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM,uris);
    }
 else {
      intent.setAction(Intent.ACTION_SEND);
      intent.setType(GalleryUtils.MIME_TYPE_PANORAMA360);
      intent.putExtra(Intent.EXTRA_STREAM,uris.get(0));
    }
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
  }
  return intent;
}

Fixed version (ground truth):
private Intent computePanoramaSharingIntent(JobContext jc,int maxItems){
  ArrayList<Path> expandedPaths=mSelectionManager.getSelected(true,maxItems);
  if (expandedPaths == null || expandedPaths.size() == 0) {
    return new Intent();
  }
  final ArrayList<Uri> uris=new ArrayList<Uri>();
  DataManager manager=mActivity.getDataManager();
  final Intent intent=new Intent();
  for (  Path path : expandedPaths) {
    if (jc.isCancelled())     return null;
    uris.add(manager.getContentUri(path));
  }
  final int size=uris.size();
  if (size > 0) {
    if (size > 1) {
      intent.setAction(Intent.ACTION_SEND_MULTIPLE);
      intent.setType(GalleryUtils.MIME_TYPE_PANORAMA360);
      intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM,uris);
    }
 else {
      intent.setAction(Intent.ACTION_SEND);
      intent.setType(GalleryUtils.MIME_TYPE_PANORAMA360);
      intent.putExtra(Intent.EXTRA_STREAM,uris.get(0));
    }
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
  }
  return intent;
}
Program: 38362
Project: 38362
Buggy source:
private static void expandMediaSet(ArrayList<Path> items,MediaSet set){
  int subCount=set.getSubMediaSetCount();
  for (int i=0; i < subCount; i++) {
    expandMediaSet(items,set.getSubMediaSet(i));
  }
  int total=set.getMediaItemCount();
  int batch=50;
  int index=0;
  while (index < total) {
    int count=index + batch < total ? batch : total - index;
    ArrayList<MediaItem> list=set.getMediaItem(index,count);
    for (    MediaItem item : list) {
      items.add(item.getPath());
    }
    index+=batch;
  }
}

Fixed version (ground truth):
private static boolean expandMediaSet(ArrayList<Path> items,MediaSet set,int maxSelection){
  int subCount=set.getSubMediaSetCount();
  for (int i=0; i < subCount; i++) {
    if (!expandMediaSet(items,set.getSubMediaSet(i),maxSelection)) {
      return false;
    }
  }
  int total=set.getMediaItemCount();
  int batch=50;
  int index=0;
  while (index < total) {
    int count=index + batch < total ? batch : total - index;
    ArrayList<MediaItem> list=set.getMediaItem(index,count);
    if (list != null && list.size() > (maxSelection - items.size())) {
      return false;
    }
    for (    MediaItem item : list) {
      items.add(item.getPath());
    }
    index+=batch;
  }
  return true;
}
Program: 38363
Project: 38363
Buggy source:
public ArrayList<Path> getSelected(boolean expandSet){
  ArrayList<Path> selected=new ArrayList<Path>();
  if (mIsAlbumSet) {
    if (mInverseSelection) {
      int total=getTotalCount();
      for (int i=0; i < total; i++) {
        MediaSet set=mSourceMediaSet.getSubMediaSet(i);
        Path id=set.getPath();
        if (!mClickedSet.contains(id)) {
          if (expandSet) {
            expandMediaSet(selected,set);
          }
 else {
            selected.add(id);
          }
        }
      }
    }
 else {
      for (      Path id : mClickedSet) {
        if (expandSet) {
          expandMediaSet(selected,mDataManager.getMediaSet(id));
        }
 else {
          selected.add(id);
        }
      }
    }
  }
 else {
    if (mInverseSelection) {
      int total=getTotalCount();
      int index=0;
      while (index < total) {
        int count=Math.min(total - index,MediaSet.MEDIAITEM_BATCH_FETCH_COUNT);
        ArrayList<MediaItem> list=mSourceMediaSet.getMediaItem(index,count);
        for (        MediaItem item : list) {
          Path id=item.getPath();
          if (!mClickedSet.contains(id))           selected.add(id);
        }
        index+=count;
      }
    }
 else {
      for (      Path id : mClickedSet) {
        selected.add(id);
      }
    }
  }
  return selected;
}

Fixed version (ground truth):
public ArrayList<Path> getSelected(boolean expandSet,int maxSelection){
  ArrayList<Path> selected=new ArrayList<Path>();
  if (mIsAlbumSet) {
    if (mInverseSelection) {
      int total=getTotalCount();
      for (int i=0; i < total; i++) {
        MediaSet set=mSourceMediaSet.getSubMediaSet(i);
        Path id=set.getPath();
        if (!mClickedSet.contains(id)) {
          if (expandSet && !expandMediaSet(selected,set,maxSelection)) {
            return null;
          }
 else {
            selected.add(id);
            if (selected.size() > maxSelection) {
              return null;
            }
          }
        }
      }
    }
 else {
      for (      Path id : mClickedSet) {
        if (expandSet && !expandMediaSet(selected,mDataManager.getMediaSet(id),maxSelection)) {
          return null;
        }
 else {
          selected.add(id);
          if (selected.size() > maxSelection) {
            return null;
          }
        }
      }
    }
  }
 else {
    if (mInverseSelection) {
      int total=getTotalCount();
      int index=0;
      while (index < total) {
        int count=Math.min(total - index,MediaSet.MEDIAITEM_BATCH_FETCH_COUNT);
        ArrayList<MediaItem> list=mSourceMediaSet.getMediaItem(index,count);
        for (        MediaItem item : list) {
          Path id=item.getPath();
          if (!mClickedSet.contains(id)) {
            selected.add(id);
            if (selected.size() > maxSelection) {
              return null;
            }
          }
        }
        index+=count;
      }
    }
 else {
      for (      Path id : mClickedSet) {
        selected.add(id);
        if (selected.size() > maxSelection) {
          return null;
        }
      }
    }
  }
  return selected;
}
Program: 38364
Project: 38364
Buggy source:
public synchronized Bitmap renderGeometryIcon(Bitmap bitmap,ImagePreset preset){
synchronized (CachingPipeline.class) {
    if (getRenderScriptContext() == null) {
      return bitmap;
    }
    setupEnvironment(preset,false);
    mEnvironment.setQuality(ImagePreset.QUALITY_PREVIEW);
    bitmap=preset.applyGeometry(bitmap,mEnvironment);
    return bitmap;
  }
}

Fixed version (ground truth):
public Bitmap renderGeometryIcon(Bitmap bitmap,ImagePreset preset){
  if (mGeometry == null) {
    mGeometry=new ImageFilterGeometry();
  }
  mGeometry.useRepresentation(preset.getGeometry());
  return mGeometry.apply(bitmap,mPreviewScaleFactor,ImagePreset.QUALITY_PREVIEW);
}
Program: 38365
Project: 38365
Buggy source:
@Override public FilterRepresentation clone() throws CloneNotSupportedException {
  FilterRepresentation representation=(FilterRepresentation)super.clone();
  representation.setName(getName());
  representation.setPriority(getPriority());
  representation.setFilterClass(getFilterClass());
  representation.setSupportsPartialRendering(supportsPartialRendering());
  representation.setTextId(getTextId());
  representation.setEditorId(getEditorId());
  representation.setButtonId(getButtonId());
  representation.setOverlayId(getOverlayId());
  representation.setOverlayOnly(getOverlayOnly());
  representation.setShowEditingControls(showEditingControls());
  representation.setShowParameterValue(showParameterValue());
  representation.setShowUtilityPanel(showUtilityPanel());
  representation.mTempRepresentation=null;
  if (DEBUG) {
    Log.v(LOGTAG,"String_Node_Str" + this + "String_Node_Str"+ representation+ "String_Node_Str");
  }
  return representation;
}

Fixed version (ground truth):
@Override public FilterRepresentation clone() throws CloneNotSupportedException {
  FilterRepresentation representation=(FilterRepresentation)super.clone();
  representation.setName(getName());
  representation.setPriority(getPriority());
  representation.setFilterClass(getFilterClass());
  representation.setSupportsPartialRendering(supportsPartialRendering());
  representation.setTextId(getTextId());
  representation.setEditorId(getEditorId());
  representation.setButtonId(getButtonId());
  representation.setOverlayId(getOverlayId());
  representation.setOverlayOnly(getOverlayOnly());
  representation.setShowEditingControls(showEditingControls());
  representation.setShowParameterValue(showParameterValue());
  representation.setShowUtilityPanel(showUtilityPanel());
  representation.mTempRepresentation=mTempRepresentation != null ? mTempRepresentation.clone() : null;
  if (DEBUG) {
    Log.v(LOGTAG,"String_Node_Str" + this + "String_Node_Str"+ representation+ "String_Node_Str");
  }
  return representation;
}
Program: 38366
Project: 38366
Buggy source:
@Override public boolean handleMessage(Message msg){
  if (!mPipelineIsOn) {
    return false;
  }
switch (msg.what) {
case COMPUTE_PRESET:
{
      ImagePreset preset=(ImagePreset)msg.obj;
      TripleBufferBitmap buffer=MasterImage.getImage().getDoubleBuffer();
      mPreviewPipeline.compute(buffer,preset,COMPUTE_PRESET);
      buffer.swapProducer();
      Message uimsg=mUIHandler.obtainMessage(NEW_PRESET);
      mUIHandler.sendMessage(uimsg);
      break;
    }
case COMPUTE_RENDERING_REQUEST:
case COMPUTE_PARTIAL_RENDERING_REQUEST:
case COMPUTE_HIGHRES_RENDERING_REQUEST:
{
    if (msg.what == COMPUTE_PARTIAL_RENDERING_REQUEST || msg.what == COMPUTE_HIGHRES_RENDERING_REQUEST) {
      if (mProcessingHandler.hasMessages(msg.what)) {
        return false;
      }
    }
    if (DEBUG) {
      Log.v(LOGTAG,"String_Node_Str" + getType(msg.what));
    }
    RenderingRequest request=(RenderingRequest)msg.obj;
    mAccessoryPipeline.render(request);
    Message uimsg=mUIHandler.obtainMessage(NEW_RENDERING_REQUEST);
    uimsg.obj=request;
    mUIHandler.sendMessage(uimsg);
    break;
  }
}
return false;
}

Fixed version (ground truth):
@Override public boolean handleMessage(Message msg){
  if (!mPipelineIsOn) {
    return false;
  }
switch (msg.what) {
case COMPUTE_PRESET:
{
      ImagePreset preset=(ImagePreset)msg.obj;
      TripleBufferBitmap buffer=MasterImage.getImage().getDoubleBuffer();
      mPreviewPipeline.compute(buffer,preset,COMPUTE_PRESET);
      buffer.swapProducer();
      Message uimsg=mUIHandler.obtainMessage(NEW_PRESET);
      mUIHandler.sendMessage(uimsg);
      break;
    }
case COMPUTE_RENDERING_REQUEST:
case COMPUTE_PARTIAL_RENDERING_REQUEST:
case COMPUTE_HIGHRES_RENDERING_REQUEST:
{
    if (DEBUG) {
      Log.v(LOGTAG,"String_Node_Str" + getType(msg.what));
    }
    RenderingRequest request=(RenderingRequest)msg.obj;
    mAccessoryPipeline.render(request);
    Message uimsg=mUIHandler.obtainMessage(NEW_RENDERING_REQUEST);
    uimsg.obj=request;
    mUIHandler.sendMessage(uimsg);
    break;
  }
}
return false;
}
Program: 38367
Project: 38367
Buggy source:
public void postRenderingRequest(RenderingRequest request){
  if (!mPipelineIsOn) {
    return;
  }
  int type=COMPUTE_RENDERING_REQUEST;
  if (request.getType() == RenderingRequest.PARTIAL_RENDERING) {
    type=COMPUTE_PARTIAL_RENDERING_REQUEST;
  }
  if (request.getType() == RenderingRequest.HIGHRES_RENDERING) {
    type=COMPUTE_HIGHRES_RENDERING_REQUEST;
  }
  Message msg=mProcessingHandler.obtainMessage(type);
  msg.obj=request;
  if (type == COMPUTE_PARTIAL_RENDERING_REQUEST || type == COMPUTE_HIGHRES_RENDERING_REQUEST) {
    mProcessingHandler.sendMessageDelayed(msg,HIRES_DELAY);
  }
 else {
    mProcessingHandler.sendMessage(msg);
  }
}

Fixed version (ground truth):
public void postRenderingRequest(RenderingRequest request){
  if (!mPipelineIsOn) {
    return;
  }
  int type=COMPUTE_RENDERING_REQUEST;
  if (request.getType() == RenderingRequest.PARTIAL_RENDERING) {
    type=COMPUTE_PARTIAL_RENDERING_REQUEST;
  }
  if (request.getType() == RenderingRequest.HIGHRES_RENDERING) {
    type=COMPUTE_HIGHRES_RENDERING_REQUEST;
  }
  Message msg=mProcessingHandler.obtainMessage(type);
  msg.obj=request;
  if (type == COMPUTE_PARTIAL_RENDERING_REQUEST || type == COMPUTE_HIGHRES_RENDERING_REQUEST) {
    if (mProcessingHandler.hasMessages(msg.what)) {
      mProcessingHandler.removeMessages(msg.what);
    }
    mProcessingHandler.sendMessageDelayed(msg,HIRES_DELAY);
  }
 else {
    mProcessingHandler.sendMessage(msg);
  }
}
Program: 38368
Project: 38368
Buggy source:
@Override public FilterRepresentation clone() throws CloneNotSupportedException {
  FilterRepresentation representation=(FilterRepresentation)super.clone();
  representation.setName(getName());
  representation.setPriority(getPriority());
  representation.setFilterClass(getFilterClass());
  representation.setSupportsPartialRendering(supportsPartialRendering());
  representation.setTextId(getTextId());
  representation.setEditorId(getEditorId());
  representation.setButtonId(getButtonId());
  representation.setOverlayId(getOverlayId());
  representation.setOverlayOnly(getOverlayOnly());
  representation.setShowEditingControls(showEditingControls());
  representation.setShowParameterValue(showParameterValue());
  representation.setShowUtilityPanel(showUtilityPanel());
  representation.mTempRepresentation=null;
  if (DEBUG) {
    Log.v(LOGTAG,"String_Node_Str" + this + "String_Node_Str"+ representation+ "String_Node_Str");
  }
  return representation;
}

Fixed version (ground truth):
@Override public FilterRepresentation clone() throws CloneNotSupportedException {
  FilterRepresentation representation=(FilterRepresentation)super.clone();
  representation.setName(getName());
  representation.setPriority(getPriority());
  representation.setFilterClass(getFilterClass());
  representation.setSupportsPartialRendering(supportsPartialRendering());
  representation.setTextId(getTextId());
  representation.setEditorId(getEditorId());
  representation.setButtonId(getButtonId());
  representation.setOverlayId(getOverlayId());
  representation.setOverlayOnly(getOverlayOnly());
  representation.setShowEditingControls(showEditingControls());
  representation.setShowParameterValue(showParameterValue());
  representation.setShowUtilityPanel(showUtilityPanel());
  representation.mTempRepresentation=mTempRepresentation != null ? mTempRepresentation.clone() : null;
  if (DEBUG) {
    Log.v(LOGTAG,"String_Node_Str" + this + "String_Node_Str"+ representation+ "String_Node_Str");
  }
  return representation;
}
Program: 38369
Project: 38369
Buggy source:
@Override protected void onPostExecute(Boolean result){
  if (isCancelled()) {
    return;
  }
  if (!result) {
    cannotLoadImage();
  }
  final View loading=findViewById(R.id.loading);
  loading.setVisibility(View.GONE);
  final View filters=findViewById(R.id.filtersPanel);
  filters.setVisibility(View.VISIBLE);
  if (PanelController.useAnimationsLayer()) {
    float y=filters.getY();
    filters.setY(y + filters.getHeight());
    filters.animate().setDuration(600).y(y).withLayer().start();
  }
  final View imageShow=findViewById(R.id.imageShow);
  imageShow.setVisibility(View.VISIBLE);
  Bitmap largeBitmap=mImageLoader.getOriginalBitmapLarge();
  FilteringPipeline pipeline=FilteringPipeline.getPipeline();
  pipeline.setOriginal(largeBitmap);
  float previewScale=(float)largeBitmap.getWidth() / (float)mImageLoader.getOriginalBounds().width();
  pipeline.setPreviewScaleFactor(previewScale);
  MasterImage.getImage().setOriginalGeometry(largeBitmap);
  mLoadBitmapTask=null;
  if (mAction == CROP_ACTION) {
    mPanelController.showComponent(findViewById(EditorCrop.ID));
  }
 else   if (mAction == TINY_PLANET_ACTION) {
    mPanelController.showComponent(findViewById(EditorTinyPlanet.ID));
  }
  pipeline.turnOnPipeline(true);
  super.onPostExecute(result);
}

Fixed version (ground truth):
@Override protected void onPostExecute(Boolean result){
  if (isCancelled()) {
    return;
  }
  if (!result) {
    cannotLoadImage();
  }
  final View loading=findViewById(R.id.loading);
  loading.setVisibility(View.GONE);
  final View filters=findViewById(R.id.filtersPanel);
  filters.setVisibility(View.VISIBLE);
  if (PanelController.useAnimationsLayer()) {
    float y=filters.getY();
    filters.setY(y + filters.getHeight());
    filters.animate().setDuration(600).y(y).withLayer().start();
  }
  final View imageShow=findViewById(R.id.imageShow);
  imageShow.setVisibility(View.VISIBLE);
  Bitmap largeBitmap=mImageLoader.getOriginalBitmapLarge();
  FilteringPipeline pipeline=FilteringPipeline.getPipeline();
  pipeline.setOriginal(largeBitmap);
  float previewScale=(float)largeBitmap.getWidth() / (float)mImageLoader.getOriginalBounds().width();
  pipeline.setPreviewScaleFactor(previewScale);
  pipeline.turnOnPipeline(true);
  MasterImage.getImage().setOriginalGeometry(largeBitmap);
  mLoadBitmapTask=null;
  if (mAction == CROP_ACTION) {
    mPanelController.showComponent(findViewById(EditorCrop.ID));
  }
 else   if (mAction == TINY_PLANET_ACTION) {
    mPanelController.showComponent(findViewById(EditorTinyPlanet.ID));
  }
  super.onPostExecute(result);
}
Program: 38370
Project: 38370
Buggy source:
public void postRenderingRequest(RenderingRequest request){
  if (mOriginalAllocation == null) {
    return;
  }
  int type=COMPUTE_RENDERING_REQUEST;
  if (request.getType() == RenderingRequest.PARTIAL_RENDERING) {
    type=COMPUTE_PARTIAL_RENDERING_REQUEST;
  }
  Message msg=mProcessingHandler.obtainMessage(type);
  msg.obj=request;
  if (type == COMPUTE_PARTIAL_RENDERING_REQUEST) {
    mProcessingHandler.sendMessageDelayed(msg,HIRES_DELAY);
  }
 else {
    mProcessingHandler.sendMessage(msg);
  }
}

Fixed version (ground truth):
public void postRenderingRequest(RenderingRequest request){
  if (mOriginalAllocation == null) {
    return;
  }
  if (!mPipelineIsOn) {
    return;
  }
  int type=COMPUTE_RENDERING_REQUEST;
  if (request.getType() == RenderingRequest.PARTIAL_RENDERING) {
    type=COMPUTE_PARTIAL_RENDERING_REQUEST;
  }
  Message msg=mProcessingHandler.obtainMessage(type);
  msg.obj=request;
  if (type == COMPUTE_PARTIAL_RENDERING_REQUEST) {
    mProcessingHandler.sendMessageDelayed(msg,HIRES_DELAY);
  }
 else {
    mProcessingHandler.sendMessage(msg);
  }
}
Program: 38371
Project: 38371
Buggy source:
@Override public boolean equals(FilterRepresentation o){
  if (this == o)   return true;
  if (o == null || getClass() != o.getClass())   return false;
  GeometryMetadata d=(GeometryMetadata)o;
  return (mScaleFactor == d.mScaleFactor && mRotation == d.mRotation && mStraightenRotation == d.mStraightenRotation && mFlip == d.mFlip && mCropBounds.equals(d.mCropBounds) && mPhotoBounds.equals(d.mPhotoBounds));
}

Fixed version (ground truth):
@Override public boolean equals(FilterRepresentation o){
  if (this == o)   return true;
  if (o == null || !(o instanceof GeometryMetadata))   return false;
  GeometryMetadata d=(GeometryMetadata)o;
  return (mScaleFactor == d.mScaleFactor && mRotation == d.mRotation && mStraightenRotation == d.mStraightenRotation && mFlip == d.mFlip && compareRectF(mCropBounds,d.mCropBounds) && compareRectF(mPhotoBounds,d.mPhotoBounds));
}
Program: 38372
Project: 38372
Buggy source:
public Allocation getInPixelsAllocation(){
  return mInPixelsAllocation;
}

Fixed version (ground truth):
public synchronized Allocation getInPixelsAllocation(){
  return mInPixelsAllocation;
}
Program: 38373
Project: 38373
Buggy source:
private synchronized void destroyPixelAllocations(){
  if (mInPixelsAllocation != null) {
    mInPixelsAllocation.destroy();
    mInPixelsAllocation=null;
  }
  if (mOutPixelsAllocation != null) {
    mOutPixelsAllocation.destroy();
    mOutPixelsAllocation=null;
  }
  mWidth=0;
  mHeight=0;
}

Fixed version (ground truth):
private synchronized void destroyPixelAllocations(){
  if (DEBUG) {
    Log.v(LOGTAG,"String_Node_Str" + getName());
  }
  if (mInPixelsAllocation != null) {
    mInPixelsAllocation.destroy();
    mInPixelsAllocation=null;
  }
  if (mOutPixelsAllocation != null) {
    mOutPixelsAllocation.destroy();
    mOutPixelsAllocation=null;
  }
  mWidth=0;
  mHeight=0;
}
Program: 38374
Project: 38374
Buggy source:
public Allocation getOutPixelsAllocation(){
  return mOutPixelsAllocation;
}

Fixed version (ground truth):
public synchronized Allocation getOutPixelsAllocation(){
  return mOutPixelsAllocation;
}
Program: 38375
Project: 38375
Buggy source:
public CachingPipeline(FiltersManager filtersManager){
  mFiltersManager=filtersManager;
}

Fixed version (ground truth):
public CachingPipeline(FiltersManager filtersManager,String name){
  mFiltersManager=filtersManager;
  mName=name;
}
Program: 38376
Project: 38376
Buggy source:
public boolean prepareRenderscriptAllocations(Bitmap bitmap){
  RenderScript RS=ImageFilterRS.getRenderScriptContext();
  boolean needsUpdate=false;
  if (mOutPixelsAllocation == null || mInPixelsAllocation == null || bitmap.getWidth() != mWidth || bitmap.getHeight() != mHeight) {
    destroyPixelAllocations();
    Bitmap bitmapBuffer=bitmap;
    if (bitmap.getConfig() == null || bitmap.getConfig() != BITMAP_CONFIG) {
      bitmapBuffer=bitmap.copy(BITMAP_CONFIG,true);
    }
    mOutPixelsAllocation=Allocation.createFromBitmap(RS,bitmapBuffer,Allocation.MipmapControl.MIPMAP_NONE,Allocation.USAGE_SCRIPT);
    mInPixelsAllocation=Allocation.createTyped(RS,mOutPixelsAllocation.getType());
    needsUpdate=true;
  }
  mInPixelsAllocation.copyFrom(bitmap);
  if (bitmap.getWidth() != mWidth || bitmap.getHeight() != mHeight) {
    mWidth=bitmap.getWidth();
    mHeight=bitmap.getHeight();
    needsUpdate=true;
  }
  return needsUpdate;
}

Fixed version (ground truth):
public boolean prepareRenderscriptAllocations(Bitmap bitmap){
  RenderScript RS=ImageFilterRS.getRenderScriptContext();
  boolean needsUpdate=false;
  if (mOutPixelsAllocation == null || mInPixelsAllocation == null || bitmap.getWidth() != mWidth || bitmap.getHeight() != mHeight) {
    destroyPixelAllocations();
    Bitmap bitmapBuffer=bitmap;
    if (bitmap.getConfig() == null || bitmap.getConfig() != BITMAP_CONFIG) {
      bitmapBuffer=bitmap.copy(BITMAP_CONFIG,true);
    }
    mOutPixelsAllocation=Allocation.createFromBitmap(RS,bitmapBuffer,Allocation.MipmapControl.MIPMAP_NONE,Allocation.USAGE_SCRIPT);
    mInPixelsAllocation=Allocation.createTyped(RS,mOutPixelsAllocation.getType());
    needsUpdate=true;
  }
  mInPixelsAllocation.copyFrom(bitmap);
  if (bitmap.getWidth() != mWidth || bitmap.getHeight() != mHeight) {
    mWidth=bitmap.getWidth();
    mHeight=bitmap.getHeight();
    needsUpdate=true;
  }
  if (DEBUG) {
    Log.v(LOGTAG,"String_Node_Str" + needsUpdate + "String_Node_Str"+ getName());
  }
  return needsUpdate;
}
Program: 38377
Project: 38377
Buggy source:
private FilteringPipeline(){
  mHandlerThread=new HandlerThread("String_Node_Str",Process.THREAD_PRIORITY_FOREGROUND);
  mHandlerThread.start();
  mProcessingHandler=new Handler(mHandlerThread.getLooper(),this);
  mAccessoryPipeline=new CachingPipeline(FiltersManager.getManager());
  mPreviewPipeline=new CachingPipeline(FiltersManager.getPreviewManager());
}

Fixed version (ground truth):
private FilteringPipeline(){
  mHandlerThread=new HandlerThread("String_Node_Str",Process.THREAD_PRIORITY_FOREGROUND);
  mHandlerThread.start();
  mProcessingHandler=new Handler(mHandlerThread.getLooper(),this);
  mAccessoryPipeline=new CachingPipeline(FiltersManager.getManager(),"String_Node_Str");
  mPreviewPipeline=new CachingPipeline(FiltersManager.getPreviewManager(),"String_Node_Str");
}