Program: 44608
Project: 44608
Buggy source:
private boolean copyPart(PduPart part){
  Uri uri=part.getDataUri();
  InputStream input=null;
  FileOutputStream fout=null;
  try {
    input=mContentResolver.openInputStream(uri);
    if (input instanceof FileInputStream) {
      FileInputStream fin=(FileInputStream)input;
      byte[] location=part.getName();
      if (location == null) {
        location=part.getFilename();
      }
      if (location == null) {
        location=part.getContentLocation();
      }
      String fileName=new String(location);
      String dir="String_Node_Str";
      String extension;
      int index;
      if ((index=fileName.indexOf("String_Node_Str")) == -1) {
        String type=new String(part.getContentType());
        extension=MimeTypeMap.getSingleton().getExtensionFromMimeType(type);
      }
 else {
        extension=fileName.substring(index + 1,fileName.length());
        fileName=fileName.substring(0,index);
      }
      File file=getUniqueDestination(dir + fileName,extension);
      File parentFile=file.getParentFile();
      if (!parentFile.exists() && !parentFile.mkdirs()) {
        Log.e(TAG,"String_Node_Str" + parentFile.getPath() + "String_Node_Str");
        return false;
      }
      fout=new FileOutputStream(file);
      byte[] buffer=new byte[8000];
      while (fin.read(buffer) != -1) {
        fout.write(buffer);
      }
      sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,Uri.fromFile(file)));
    }
  }
 catch (  IOException e) {
    Log.e(TAG,"String_Node_Str",e);
    return false;
  }
 finally {
    if (null != input) {
      try {
        input.close();
      }
 catch (      IOException e) {
        Log.e(TAG,"String_Node_Str",e);
        return false;
      }
    }
    if (null != fout) {
      try {
        fout.close();
      }
 catch (      IOException e) {
        Log.e(TAG,"String_Node_Str",e);
        return false;
      }
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean copyPart(PduPart part){
  Uri uri=part.getDataUri();
  InputStream input=null;
  FileOutputStream fout=null;
  try {
    input=mContentResolver.openInputStream(uri);
    if (input instanceof FileInputStream) {
      FileInputStream fin=(FileInputStream)input;
      byte[] location=part.getName();
      if (location == null) {
        location=part.getFilename();
      }
      if (location == null) {
        location=part.getContentLocation();
      }
      String fileName=new String(location);
      String dir="String_Node_Str";
      String extension;
      int index;
      if ((index=fileName.indexOf("String_Node_Str")) == -1) {
        String type=new String(part.getContentType());
        extension=MimeTypeMap.getSingleton().getExtensionFromMimeType(type);
      }
 else {
        extension=fileName.substring(index + 1,fileName.length());
        fileName=fileName.substring(0,index);
      }
      File file=getUniqueDestination(dir + fileName,extension);
      File parentFile=file.getParentFile();
      if (!parentFile.exists() && !parentFile.mkdirs()) {
        Log.e(TAG,"String_Node_Str" + parentFile.getPath() + "String_Node_Str");
        return false;
      }
      fout=new FileOutputStream(file);
      byte[] buffer=new byte[8000];
      int size=0;
      while ((size=fin.read(buffer)) != -1) {
        fout.write(buffer,0,size);
      }
      sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,Uri.fromFile(file)));
    }
  }
 catch (  IOException e) {
    Log.e(TAG,"String_Node_Str",e);
    return false;
  }
 finally {
    if (null != input) {
      try {
        input.close();
      }
 catch (      IOException e) {
        Log.e(TAG,"String_Node_Str",e);
        return false;
      }
    }
    if (null != fout) {
      try {
        fout.close();
      }
 catch (      IOException e) {
        Log.e(TAG,"String_Node_Str",e);
        return false;
      }
    }
  }
  return true;
}