Program: 3032
Project: 3032
Buggy source:
@Override protected SaveImageInBackgroundData doInBackground(SaveImageInBackgroundData... params){
  if (params.length != 1)   return null;
  Process.setThreadPriority(Process.THREAD_PRIORITY_FOREGROUND);
  Context context=params[0].context;
  Bitmap image=params[0].image;
  Resources r=context.getResources();
  try {
    ContentValues values=new ContentValues();
    ContentResolver resolver=context.getContentResolver();
    values.put(MediaStore.Images.ImageColumns.DATA,mImageFilePath);
    values.put(MediaStore.Images.ImageColumns.TITLE,mImageFileName);
    values.put(MediaStore.Images.ImageColumns.DISPLAY_NAME,mImageFileName);
    values.put(MediaStore.Images.ImageColumns.DATE_TAKEN,mImageTime);
    values.put(MediaStore.Images.ImageColumns.DATE_ADDED,mImageTime);
    values.put(MediaStore.Images.ImageColumns.DATE_MODIFIED,mImageTime);
    values.put(MediaStore.Images.ImageColumns.MIME_TYPE,"String_Node_Str");
    Uri uri=resolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,values);
    Intent sharingIntent=new Intent(Intent.ACTION_SEND);
    sharingIntent.setType("String_Node_Str");
    sharingIntent.putExtra(Intent.EXTRA_STREAM,uri);
    Intent chooserIntent=Intent.createChooser(sharingIntent,null);
    chooserIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
    mNotificationBuilder.addAction(R.drawable.ic_menu_share,r.getString(com.android.internal.R.string.share),PendingIntent.getActivity(context,0,chooserIntent,PendingIntent.FLAG_CANCEL_CURRENT));
    OutputStream out=resolver.openOutputStream(uri);
    image.compress(Bitmap.CompressFormat.PNG,100,out);
    out.flush();
    out.close();
    values.clear();
    values.put(MediaStore.Images.ImageColumns.SIZE,new File(mImageFilePath).length());
    resolver.update(uri,values,null,null);
    params[0].imageUri=uri;
    params[0].result=0;
  }
 catch (  Exception e) {
    params[0].result=1;
  }
  return params[0];
}

Fixed version (ground truth):
@Override protected SaveImageInBackgroundData doInBackground(SaveImageInBackgroundData... params){
  if (params.length != 1)   return null;
  Process.setThreadPriority(Process.THREAD_PRIORITY_FOREGROUND);
  Context context=params[0].context;
  Bitmap image=params[0].image;
  Resources r=context.getResources();
  try {
    ContentValues values=new ContentValues();
    ContentResolver resolver=context.getContentResolver();
    values.put(MediaStore.Images.ImageColumns.DATA,mImageFilePath);
    values.put(MediaStore.Images.ImageColumns.TITLE,mImageFileName);
    values.put(MediaStore.Images.ImageColumns.DISPLAY_NAME,mImageFileName);
    values.put(MediaStore.Images.ImageColumns.DATE_TAKEN,mImageTime);
    values.put(MediaStore.Images.ImageColumns.DATE_ADDED,mImageTime);
    values.put(MediaStore.Images.ImageColumns.DATE_MODIFIED,mImageTime);
    values.put(MediaStore.Images.ImageColumns.MIME_TYPE,"String_Node_Str");
    Uri uri=resolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,values);
    String subjectDate=new SimpleDateFormat("String_Node_Str").format(new Date(mImageTime));
    String subject=String.format(SCREENSHOT_SHARE_SUBJECT_TEMPLATE,subjectDate);
    Intent sharingIntent=new Intent(Intent.ACTION_SEND);
    sharingIntent.setType("String_Node_Str");
    sharingIntent.putExtra(Intent.EXTRA_STREAM,uri);
    sharingIntent.putExtra(Intent.EXTRA_SUBJECT,subject);
    Intent chooserIntent=Intent.createChooser(sharingIntent,null);
    chooserIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
    mNotificationBuilder.addAction(R.drawable.ic_menu_share,r.getString(com.android.internal.R.string.share),PendingIntent.getActivity(context,0,chooserIntent,PendingIntent.FLAG_CANCEL_CURRENT));
    OutputStream out=resolver.openOutputStream(uri);
    image.compress(Bitmap.CompressFormat.PNG,100,out);
    out.flush();
    out.close();
    values.clear();
    values.put(MediaStore.Images.ImageColumns.SIZE,new File(mImageFilePath).length());
    resolver.update(uri,values,null,null);
    params[0].imageUri=uri;
    params[0].result=0;
  }
 catch (  Exception e) {
    params[0].result=1;
  }
  return params[0];
}