Program: 134394
Project: 134394
Buggy source:
/** 
 * Given the path to an image, rotate it by using EXIF info
 * @param context the passed context
 * @param path the path to the original image
 * @return the path to the rotated image or null
 */
public static String rotateImageIfNecessary(Context context,String path){
  if (context == null || TextUtils.isEmpty(path)) {
    return null;
  }
  File file=new File(path);
  if (!file.exists()) {
    return null;
  }
  int orientation=getImageOrientation(context,path);
  if (orientation == 0) {
    return null;
  }
  String mimeType=MediaUtils.getMediaFileMimeType(file);
  if (mimeType.equals("String_Node_Str")) {
    return null;
  }
  Uri srcImageUri=Uri.parse(path);
  if (srcImageUri == null) {
    return null;
  }
  String fileName=MediaUtils.getMediaFileName(file,mimeType);
  String fileExtension=MimeTypeMap.getFileExtensionFromUrl(fileName).toLowerCase();
  int selectedWidth=getImageSize(srcImageUri,context)[0];
  if (selectedWidth == 0) {
    return null;
  }
  File rotatedImageFile;
  FileOutputStream out;
  try {
    String prefix;
    int dotPos=fileName.indexOf('.');
    if (dotPos > 0) {
      prefix=fileName.substring(0,dotPos) + "String_Node_Str";
    }
 else {
      prefix=fileName + "String_Node_Str";
    }
    if (prefix.length() < 3) {
      prefix="String_Node_Str";
    }
    rotatedImageFile=File.createTempFile(prefix,"String_Node_Str" + fileExtension);
    out=new FileOutputStream(rotatedImageFile);
  }
 catch (  IOException e) {
    AppLog.e(AppLog.T.MEDIA,"String_Node_Str");
    return null;
  }
catch (  SecurityException e) {
    AppLog.e(AppLog.T.MEDIA,"String_Node_Str");
    return null;
  }
  try {
    boolean res=resizeImageAndWriteToStream(context,srcImageUri,fileExtension,selectedWidth,orientation,85,out);
    if (!res) {
      AppLog.w(AppLog.T.MEDIA,"String_Node_Str");
      return null;
    }
  }
 catch (  IOException e) {
    AppLog.e(AppLog.T.MEDIA,"String_Node_Str");
    return null;
  }
catch (  OutOfMemoryError e) {
    AppLog.e(AppLog.T.MEDIA,"String_Node_Str");
    return null;
  }
 finally {
    try {
      out.flush();
      out.close();
    }
 catch (    IOException e) {
    }
  }
  String tempFilePath=rotatedImageFile.getPath();
  if (!TextUtils.isEmpty(tempFilePath)) {
    return tempFilePath;
  }
 else {
    AppLog.e(AppLog.T.MEDIA,"String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Given the path to an image, rotate it by using EXIF info
 * @param context the passed context
 * @param path the path to the original image
 * @return the path to the rotated image or null
 */
public static String rotateImageIfNecessary(Context context,String path){
  if (context == null || TextUtils.isEmpty(path)) {
    return null;
  }
  File file=new File(path);
  if (!file.exists()) {
    return null;
  }
  int orientation=getImageOrientation(context,path);
  if (orientation == 0) {
    return null;
  }
  String mimeType=MediaUtils.getMediaFileMimeType(file);
  if (mimeType.equals("String_Node_Str")) {
    return null;
  }
  Uri srcImageUri=Uri.parse(path);
  if (srcImageUri == null) {
    return null;
  }
  String fileName=MediaUtils.getMediaFileName(file,mimeType);
  String fileExtension=MimeTypeMap.getFileExtensionFromUrl(fileName).toLowerCase();
  int selectedWidth=getImageSize(srcImageUri,context)[0];
  if (selectedWidth == 0) {
    return null;
  }
  File rotatedImageFile;
  FileOutputStream out;
  try {
    String prefix;
    int dotPos=fileName.indexOf('.');
    if (dotPos > 0) {
      prefix=fileName.substring(0,dotPos);
    }
 else {
      prefix=fileName;
    }
    if (prefix.length() < 3) {
      prefix="String_Node_Str";
    }
    rotatedImageFile=File.createTempFile(prefix,"String_Node_Str" + fileExtension);
    out=new FileOutputStream(rotatedImageFile);
  }
 catch (  IOException e) {
    AppLog.e(AppLog.T.MEDIA,"String_Node_Str");
    return null;
  }
catch (  SecurityException e) {
    AppLog.e(AppLog.T.MEDIA,"String_Node_Str");
    return null;
  }
  try {
    boolean res=resizeImageAndWriteToStream(context,srcImageUri,fileExtension,selectedWidth,orientation,85,out);
    if (!res) {
      AppLog.w(AppLog.T.MEDIA,"String_Node_Str");
      return null;
    }
  }
 catch (  IOException e) {
    AppLog.e(AppLog.T.MEDIA,"String_Node_Str");
    return null;
  }
catch (  OutOfMemoryError e) {
    AppLog.e(AppLog.T.MEDIA,"String_Node_Str");
    return null;
  }
 finally {
    try {
      out.flush();
      out.close();
    }
 catch (    IOException e) {
    }
  }
  String tempFilePath=rotatedImageFile.getPath();
  if (!TextUtils.isEmpty(tempFilePath)) {
    return tempFilePath;
  }
 else {
    AppLog.e(AppLog.T.MEDIA,"String_Node_Str");
  }
  return null;
}