Program: 22096
Project: 22096
Buggy source:
/** 
 * Save data of the part into storage. The source data may be given by a byte[] or a Uri. If it's a byte[], directly save it into storage, otherwise load source data from the dataUri and then save it. If the data is an image, we may scale down it according to user preference.
 * @param part The PDU part which contains data to be saved.
 * @param uri The URI of the part.
 * @param contentType The MIME type of the part.
 * @throws MmsException Cannot find source data or error occurredwhile saving the data.
 */
private void persistData(PduPart part,Uri uri,String contentType) throws MmsException {
  OutputStream os=null;
  InputStream is=null;
  try {
    byte[] data=part.getData();
    if ("String_Node_Str".equals(contentType) || "String_Node_Str".equals(contentType)) {
      ContentValues cv=new ContentValues();
      cv.put(Telephony.Mms.Part.TEXT,new EncodedStringValue(data).getString());
      if (mContentResolver.update(uri,cv,null,null) != 1) {
        throw new MmsException("String_Node_Str" + uri.toString());
      }
    }
 else {
      os=mContentResolver.openOutputStream(uri);
      if (data == null) {
        Uri dataUri=part.getDataUri();
        if ((dataUri == null) || (dataUri == uri)) {
          Log.w(TAG,"String_Node_Str");
          return;
        }
        is=mContentResolver.openInputStream(dataUri);
        if (LOCAL_LOGV) {
          Log.v(TAG,"String_Node_Str" + uri);
        }
        byte[] buffer=new byte[256];
        for (int len=0; (len=is.read(buffer)) != -1; ) {
          os.write(buffer,0,len);
        }
      }
 else {
        if (LOCAL_LOGV) {
          Log.v(TAG,"String_Node_Str" + uri);
        }
        os.write(data);
      }
    }
  }
 catch (  FileNotFoundException e) {
    Log.e(TAG,"String_Node_Str",e);
    throw new MmsException(e);
  }
catch (  IOException e) {
    Log.e(TAG,"String_Node_Str",e);
    throw new MmsException(e);
  }
 finally {
    if (os != null) {
      try {
        os.close();
      }
 catch (      IOException e) {
        Log.e(TAG,"String_Node_Str" + os,e);
      }
    }
    if (is != null) {
      try {
        is.close();
      }
 catch (      IOException e) {
        Log.e(TAG,"String_Node_Str" + is,e);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Save data of the part into storage. The source data may be given by a byte[] or a Uri. If it's a byte[], directly save it into storage, otherwise load source data from the dataUri and then save it. If the data is an image, we may scale down it according to user preference.
 * @param part The PDU part which contains data to be saved.
 * @param uri The URI of the part.
 * @param contentType The MIME type of the part.
 * @throws MmsException Cannot find source data or error occurredwhile saving the data.
 */
private void persistData(PduPart part,Uri uri,String contentType) throws MmsException {
  OutputStream os=null;
  InputStream is=null;
  try {
    byte[] data=part.getData();
    if (ContentType.TEXT_PLAIN.equals(contentType) || ContentType.APP_SMIL.equals(contentType) || ContentType.TEXT_HTML.equals(contentType)) {
      ContentValues cv=new ContentValues();
      cv.put(Telephony.Mms.Part.TEXT,new EncodedStringValue(data).getString());
      if (mContentResolver.update(uri,cv,null,null) != 1) {
        throw new MmsException("String_Node_Str" + uri.toString());
      }
    }
 else {
      os=mContentResolver.openOutputStream(uri);
      if (data == null) {
        Uri dataUri=part.getDataUri();
        if ((dataUri == null) || (dataUri == uri)) {
          Log.w(TAG,"String_Node_Str");
          return;
        }
        is=mContentResolver.openInputStream(dataUri);
        if (LOCAL_LOGV) {
          Log.v(TAG,"String_Node_Str" + uri);
        }
        byte[] buffer=new byte[256];
        for (int len=0; (len=is.read(buffer)) != -1; ) {
          os.write(buffer,0,len);
        }
      }
 else {
        if (LOCAL_LOGV) {
          Log.v(TAG,"String_Node_Str" + uri);
        }
        os.write(data);
      }
    }
  }
 catch (  FileNotFoundException e) {
    Log.e(TAG,"String_Node_Str",e);
    throw new MmsException(e);
  }
catch (  IOException e) {
    Log.e(TAG,"String_Node_Str",e);
    throw new MmsException(e);
  }
 finally {
    if (os != null) {
      try {
        os.close();
      }
 catch (      IOException e) {
        Log.e(TAG,"String_Node_Str" + os,e);
      }
    }
    if (is != null) {
      try {
        is.close();
      }
 catch (      IOException e) {
        Log.e(TAG,"String_Node_Str" + is,e);
      }
    }
  }
}