Program: 178344
Project: 178344
Buggy source:
/** 
 * write a POI message to the file
 * @param context a context object used to get a content resolver object
 * @param recordId the unique record identifier for the location record
 * @throws IllegalArgumentException if the context parameter is null
 * @throws IllegalArgumentException if a record cannot be found
 */
public static void writePointOfInterest(Context context,String recordId){
  if (context == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  String mOutputPath=Environment.getExternalStorageDirectory().getPath();
  mOutputPath+=context.getString(R.string.system_path_binary_data);
  if (testPath(mOutputPath) == false) {
    Log.e(TAG,"String_Node_Str");
    return;
  }
  ContentResolver mContentResolver=context.getContentResolver();
  Uri mContentUri=Uri.parse(MapItemsContract.PointsOfInterest.CONTENT_URI.toString() + "String_Node_Str" + recordId);
  Cursor mCursor=mContentResolver.query(mContentUri,null,null,null,null);
  if (mCursor.getCount() == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mCursor.moveToFirst();
  org.servalproject.maps.protobuf.PointOfInterestMessage.Message.Builder mMessageBuilder=PointOfInterestMessage.Message.newBuilder();
  mMessageBuilder.setPhoneNumber(mCursor.getString(mCursor.getColumnIndex(MapItemsContract.PointsOfInterest.Table.PHONE_NUMBER)));
  mMessageBuilder.setSubsciberId(mCursor.getString(mCursor.getColumnIndex(MapItemsContract.PointsOfInterest.Table.SUBSCRIBER_ID)));
  mMessageBuilder.setLatitude(mCursor.getDouble(mCursor.getColumnIndex(MapItemsContract.PointsOfInterest.Table.LATITUDE)));
  mMessageBuilder.setLatitude(mCursor.getDouble(mCursor.getColumnIndex(MapItemsContract.PointsOfInterest.Table.LONGITUDE)));
  mMessageBuilder.setTimestamp(mCursor.getLong(mCursor.getColumnIndex(MapItemsContract.PointsOfInterest.Table.TIMESTAMP)));
  mMessageBuilder.setTimeZone(mCursor.getString(mCursor.getColumnIndex(MapItemsContract.PointsOfInterest.Table.TIMEZONE)));
  mMessageBuilder.setTitle(mCursor.getString(mCursor.getColumnIndex(MapItemsContract.PointsOfInterest.Table.TITLE)));
  mMessageBuilder.setDescription(mCursor.getString(mCursor.getColumnIndex(MapItemsContract.PointsOfInterest.Table.DESCRIPTION)));
  mMessageBuilder.setTimestamp(mCursor.getLong(mCursor.getColumnIndex(MapItemsContract.PointsOfInterest.Table.CATEGORY)));
  String mFileName=mCursor.getString(mCursor.getColumnIndex(MapItemsContract.Locations.Table.PHONE_NUMBER));
  mFileName=mFileName.replace("String_Node_Str","String_Node_Str");
  mFileName=mFileName.replace("String_Node_Str","String_Node_Str");
  mFileName=mFileName + TimeUtils.getTodayAsString() + "String_Node_Str";
  mCursor.close();
  try {
    FileOutputStream mOutput=new FileOutputStream(mOutputPath + mFileName,true);
    mMessageBuilder.build().writeDelimitedTo(mOutput);
    mOutput.close();
  }
 catch (  FileNotFoundException e) {
    Log.e(TAG,"String_Node_Str",e);
    return;
  }
catch (  IOException e) {
    Log.e(TAG,"String_Node_Str",e);
    return;
  }
}

Fixed version (ground truth):
/** 
 * write a POI message to the file
 * @param context a context object used to get a content resolver object
 * @param recordId the unique record identifier for the location record
 * @throws IllegalArgumentException if the context parameter is null
 * @throws IllegalArgumentException if a record cannot be found
 */
public static void writePointOfInterest(Context context,String recordId){
  if (context == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  String mOutputPath=Environment.getExternalStorageDirectory().getPath();
  mOutputPath+=context.getString(R.string.system_path_binary_data);
  if (testPath(mOutputPath) == false) {
    Log.e(TAG,"String_Node_Str");
    return;
  }
  ContentResolver mContentResolver=context.getContentResolver();
  Uri mContentUri=Uri.parse(MapItemsContract.PointsOfInterest.CONTENT_URI.toString() + "String_Node_Str" + recordId);
  Cursor mCursor=mContentResolver.query(mContentUri,null,null,null,null);
  if (mCursor.getCount() == 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  mCursor.moveToFirst();
  org.servalproject.maps.protobuf.PointOfInterestMessage.Message.Builder mMessageBuilder=PointOfInterestMessage.Message.newBuilder();
  mMessageBuilder.setPhoneNumber(mCursor.getString(mCursor.getColumnIndex(MapItemsContract.PointsOfInterest.Table.PHONE_NUMBER)));
  mMessageBuilder.setSubsciberId(mCursor.getString(mCursor.getColumnIndex(MapItemsContract.PointsOfInterest.Table.SUBSCRIBER_ID)));
  mMessageBuilder.setLatitude(mCursor.getDouble(mCursor.getColumnIndex(MapItemsContract.PointsOfInterest.Table.LATITUDE)));
  mMessageBuilder.setLatitude(mCursor.getDouble(mCursor.getColumnIndex(MapItemsContract.PointsOfInterest.Table.LONGITUDE)));
  mMessageBuilder.setTimestamp(mCursor.getLong(mCursor.getColumnIndex(MapItemsContract.PointsOfInterest.Table.TIMESTAMP)));
  mMessageBuilder.setTimeZone(mCursor.getString(mCursor.getColumnIndex(MapItemsContract.PointsOfInterest.Table.TIMEZONE)));
  mMessageBuilder.setTitle(mCursor.getString(mCursor.getColumnIndex(MapItemsContract.PointsOfInterest.Table.TITLE)));
  mMessageBuilder.setDescription(mCursor.getString(mCursor.getColumnIndex(MapItemsContract.PointsOfInterest.Table.DESCRIPTION)));
  mMessageBuilder.setTimestamp(mCursor.getLong(mCursor.getColumnIndex(MapItemsContract.PointsOfInterest.Table.CATEGORY)));
  String mFileName=mCursor.getString(mCursor.getColumnIndex(MapItemsContract.Locations.Table.PHONE_NUMBER));
  mFileName=mFileName.replace("String_Node_Str","String_Node_Str");
  mFileName=mFileName.replace("String_Node_Str","String_Node_Str");
  mFileName=mFileName + "String_Node_Str" + TimeUtils.getTodayAsString()+ "String_Node_Str";
  mCursor.close();
  try {
    FileOutputStream mOutput=new FileOutputStream(mOutputPath + mFileName,true);
    mMessageBuilder.build().writeDelimitedTo(mOutput);
    mOutput.close();
  }
 catch (  FileNotFoundException e) {
    Log.e(TAG,"String_Node_Str",e);
    return;
  }
catch (  IOException e) {
    Log.e(TAG,"String_Node_Str",e);
    return;
  }
}