Program: 178327
Project: 178327
Buggy source:
@Override public void run(){
  try {
    if (V_LOG) {
      Log.v(TAG,"String_Node_Str" + dataFile);
    }
    ContentResolver mContentResolver=context.getContentResolver();
    InputStream mInputStream=mContentResolver.openInputStream(dataFile);
    try {
      ContentValues mNewValues=null;
      Cursor mCursor=null;
      LocationMessage.Message mMessage;
      long mLatestTimeStamp=-1;
      while ((mMessage=LocationMessage.Message.parseDelimitedFrom(mInputStream)) != null) {
        if (mLatestTimeStamp == -1) {
          String[] mProjection={LocationsContract.Table.TIMESTAMP};
          String mSelection=LocationsContract.Table.PHONE_NUMBER + "String_Node_Str";
          String[] mSelectionArgs=new String[1];
          mSelectionArgs[0]=mMessage.getPhoneNumber();
          String mOrderBy=LocationsContract.Table.TIMESTAMP + "String_Node_Str";
          mCursor=mContentResolver.query(LocationsContract.CONTENT_URI,mProjection,mSelection,mSelectionArgs,mOrderBy);
          if (mCursor.getCount() != 0) {
            mCursor.moveToFirst();
            mLatestTimeStamp=mCursor.getLong(mCursor.getColumnIndex(LocationsContract.Table.TIMESTAMP));
          }
 else {
            mLatestTimeStamp=0;
          }
          mCursor.close();
          mCursor=null;
        }
        if (mMessage.getTimestamp() > mLatestTimeStamp) {
          mNewValues=new ContentValues();
          mNewValues.put(LocationsContract.Table.PHONE_NUMBER,mMessage.getPhoneNumber());
          mNewValues.put(LocationsContract.Table.SUBSCRIBER_ID,mMessage.getSubsciberId());
          mNewValues.put(LocationsContract.Table.LATITUDE,mMessage.getLatitude());
          mNewValues.put(LocationsContract.Table.LONGITUDE,mMessage.getLongitude());
          mNewValues.put(LocationsContract.Table.TIMESTAMP,mMessage.getTimestamp());
          mNewValues.put(LocationsContract.Table.TIMEZONE,mMessage.getTimeZone());
          try {
            mContentResolver.insert(LocationsContract.CONTENT_URI,mNewValues);
          }
 catch (          SQLiteException e) {
            Log.e(TAG,"String_Node_Str",e);
            break;
          }
          if (V_LOG) {
            Log.v(TAG,"String_Node_Str");
          }
        }
 else {
          if (V_LOG) {
            Log.v(TAG,"String_Node_Str");
          }
          try {
            Thread.sleep(sleepTime);
          }
 catch (          InterruptedException e) {
            Log.w(TAG,"String_Node_Str");
          }
        }
        mNewValues=null;
        try {
          Thread.sleep(sleepTime);
        }
 catch (        InterruptedException e) {
          Log.w(TAG,"String_Node_Str");
        }
      }
    }
  finally {
      mInputStream.close();
    }
  }
 catch (  Exception e) {
    Log.e(TAG,e.getMessage(),e);
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    if (V_LOG) {
      Log.v(TAG,"String_Node_Str" + dataFile);
    }
    ContentResolver mContentResolver=context.getContentResolver();
    InputStream mInputStream=null;
    try {
      mInputStream=mContentResolver.openInputStream(dataFile);
    }
 catch (    java.io.FileNotFoundException e) {
      Log.e(TAG,"String_Node_Str" + dataFile);
      return;
    }
    try {
      ContentValues mNewValues=null;
      Cursor mCursor=null;
      LocationMessage.Message mMessage;
      long mLatestTimeStamp=-1;
      while ((mMessage=LocationMessage.Message.parseDelimitedFrom(mInputStream)) != null) {
        if (mLatestTimeStamp == -1) {
          String[] mProjection={LocationsContract.Table.TIMESTAMP};
          String mSelection=LocationsContract.Table.PHONE_NUMBER + "String_Node_Str";
          String[] mSelectionArgs=new String[1];
          mSelectionArgs[0]=mMessage.getPhoneNumber();
          String mOrderBy=LocationsContract.Table.TIMESTAMP + "String_Node_Str";
          mCursor=mContentResolver.query(LocationsContract.CONTENT_URI,mProjection,mSelection,mSelectionArgs,mOrderBy);
          if (mCursor.getCount() != 0) {
            mCursor.moveToFirst();
            mLatestTimeStamp=mCursor.getLong(mCursor.getColumnIndex(LocationsContract.Table.TIMESTAMP));
          }
 else {
            mLatestTimeStamp=0;
          }
          mCursor.close();
          mCursor=null;
        }
        if (mMessage.getTimestamp() > mLatestTimeStamp) {
          mNewValues=new ContentValues();
          mNewValues.put(LocationsContract.Table.PHONE_NUMBER,mMessage.getPhoneNumber());
          mNewValues.put(LocationsContract.Table.SUBSCRIBER_ID,mMessage.getSubsciberId());
          mNewValues.put(LocationsContract.Table.LATITUDE,mMessage.getLatitude());
          mNewValues.put(LocationsContract.Table.LONGITUDE,mMessage.getLongitude());
          mNewValues.put(LocationsContract.Table.TIMESTAMP,mMessage.getTimestamp());
          mNewValues.put(LocationsContract.Table.TIMEZONE,mMessage.getTimeZone());
          try {
            mContentResolver.insert(LocationsContract.CONTENT_URI,mNewValues);
          }
 catch (          SQLiteException e) {
            Log.e(TAG,"String_Node_Str",e);
            break;
          }
          if (V_LOG) {
            Log.v(TAG,"String_Node_Str");
          }
        }
 else {
          try {
            Thread.sleep(sleepTime);
          }
 catch (          InterruptedException e) {
            Log.w(TAG,"String_Node_Str");
          }
        }
        mNewValues=null;
        try {
          Thread.sleep(sleepTime);
        }
 catch (        InterruptedException e) {
          Log.w(TAG,"String_Node_Str");
        }
      }
    }
  finally {
      mInputStream.close();
    }
  }
 catch (  Exception e) {
    Log.e(TAG,e.getMessage(),e);
  }
}