nus-yam/ex-repair huggingface dataset:
Program: 44595
Project: 44595
Buggy source:
private static void updateContact(final String number,boolean canBlock){
  Runnable r=new Runnable(){
    public void run(){
      Contact c=Cache.get(number);
      if (c == null) {
        Log.w(TAG,"String_Node_Str");
        return;
      }
      if (handleLocalNumber(c))       return;
      ContactInfoCache cache=ContactInfoCache.getInstance();
      ContactInfoCache.CacheEntry entry=cache.getContactInfo(number);
synchronized (Cache.getInstance()) {
        if (contactChanged(c,entry)) {
          c.mName=entry.name;
          c.mNameAndNumber=formatNameAndNumber(c.mName,c.mNumber);
          c.mLabel=entry.phoneLabel;
          c.mPersonId=entry.person_id;
          c.mPresenceResId=entry.presenceResId;
          c.mPresenceText=entry.presenceText;
          c.mAvatar=entry.mAvatar;
          for (          UpdateListener l : c.mListeners) {
            if (V)             Log.d(TAG,"String_Node_Str" + l);
            l.onUpdate(c);
          }
        }
      }
    }
  }
;
  if (canBlock) {
    r.run();
  }
 else {
    sTaskStack.push(r);
  }
}

Fixed version (ground truth):
private static void updateContact(final Contact c){
  if (c == null) {
    return;
  }
  if (handleLocalNumber(c)) {
    return;
  }
  ContactInfoCache cache=ContactInfoCache.getInstance();
  ContactInfoCache.CacheEntry entry=cache.getContactInfo(c.mNumber);
synchronized (Cache.getInstance()) {
    if (contactChanged(c,entry)) {
      if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
        log("String_Node_Str" + entry.name);
      }
      c.mName=entry.name;
      c.mNameAndNumber=formatNameAndNumber(c.mName,c.mNumber);
      c.mLabel=entry.phoneLabel;
      c.mPersonId=entry.person_id;
      c.mPresenceResId=entry.presenceResId;
      c.mPresenceText=entry.presenceText;
      c.mAvatar=entry.mAvatar;
      for (      UpdateListener l : c.mListeners) {
        if (V)         Log.d(TAG,"String_Node_Str" + l);
        l.onUpdate(c);
      }
    }
  }
}
Program: 44596
Project: 44596
Buggy source:
public static void invalidateCache(){
  if (V)   Log.d(TAG,"String_Node_Str");
  ContactInfoCache.getInstance().invalidateCache();
  sTaskStack.clear();
  String[] numbersToUpdate=Cache.getNumbers();
  for (  String number : numbersToUpdate) {
    updateContact(number,false);
  }
}

Fixed version (ground truth):
public static void invalidateCache(){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    log("String_Node_Str");
  }
  ContactInfoCache.getInstance().invalidateCache();
  sTaskStack.clear();
  asyncUpdateContacts(Cache.getContacts(),false);
}
Program: 44597
Project: 44597
Buggy source:
public SmsMessageSender(Context context,String[] dests,String msgText,long threadId){
  mContext=context;
  mMessageText=msgText;
  mNumberOfDests=dests.length;
  mDests=new String[mNumberOfDests];
  System.arraycopy(dests,0,mDests,0,mNumberOfDests);
  mTimestamp=System.currentTimeMillis();
  mThreadId=threadId;
  mServiceCenter=getOutgoingServiceCenter(mThreadId);
}

Fixed version (ground truth):
public SmsMessageSender(Context context,String[] dests,String msgText,long threadId){
  if (Log.isLoggable(LogTag.APP,Log.DEBUG)) {
    log("String_Node_Str" + threadId + "String_Node_Str");
    for (    String addr : dests) {
      log("String_Node_Str" + addr);
    }
  }
  mContext=context;
  mMessageText=msgText;
  mNumberOfDests=dests.length;
  mDests=new String[mNumberOfDests];
  System.arraycopy(dests,0,mDests,0,mNumberOfDests);
  mTimestamp=System.currentTimeMillis();
  mThreadId=threadId;
  mServiceCenter=getOutgoingServiceCenter(mThreadId);
}
Program: 44598
Project: 44598
Buggy source:
/** 
 * Helper method to verify which field has the focus
 * @param focused The view that should be focused (all others should not have focus)
 */
private void checkFocused(View focused){
  assertEquals(focused == mRecipientsView,mRecipientsView.isFocused());
  assertEquals(focused == mTextEditor,mTextEditor.isFocused());
}

Fixed version (ground truth):
/** 
 * Helper method to verify which field has the focus
 * @param focused The view that should be focused (all others should not have focus)
 */
@SmallTest private void checkFocused(View focused){
  assertEquals(focused == mRecipientsView,mRecipientsView.isFocused());
  assertEquals(focused == mTextEditor,mTextEditor.isFocused());
}
Program: 44599
Project: 44599
Buggy source:
public float getDur(){
  float dur=0;
  try {
    String durString=mSmilElement.getAttribute("String_Node_Str");
    if (durString != null) {
      dur=TimeImpl.parseClockValue(durString) / 1000f;
    }
  }
 catch (  IllegalArgumentException e) {
  }
  if (dur == 0) {
    dur=MmsConfig.getMinimumSlideElementDuration();
  }
  return dur;
}

Fixed version (ground truth):
public float getDur(){
  float dur=0;
  try {
    String durString=mSmilElement.getAttribute("String_Node_Str");
    if (durString != null) {
      dur=TimeImpl.parseClockValue(durString) / 1000f;
    }
  }
 catch (  IllegalArgumentException e) {
  }
  return dur;
}
Program: 44601
Project: 44601
Buggy source:
public void deliver(Context context,boolean isNew,int count,int uniqueThreads){
  updateNotification(context,mClickIntent,mDescription,mIconResourceId,isNew,mTicker,mTimeMillis,mTitle,count,uniqueThreads);
}

Fixed version (ground truth):
public void deliver(Context context,boolean isNew,int count,int uniqueThreads){
  updateNotification(context,mClickIntent,mDescription,mIconResourceId,isNew,(isNew ? mTicker : null),mTimeMillis,mTitle,count,uniqueThreads);
}
Program: 44602
Project: 44602
Buggy source:
private void showSubjectEditor(boolean show){
  if (mSubjectTextEditor == null) {
    if (show == false) {
      return;
    }
    mSubjectTextEditor=(EditText)findViewById(R.id.subject);
    mSubjectTextEditor.setOnKeyListener(mSubjectKeyListener);
    mSubjectTextEditor.addTextChangedListener(mSubjectEditorWatcher);
  }
  mSubjectTextEditor.setText(mWorkingMessage.getSubject());
  mSubjectTextEditor.setVisibility(show ? View.VISIBLE : View.GONE);
  hideOrShowTopPanel();
}

Fixed version (ground truth):
private void showSubjectEditor(boolean show){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    log("String_Node_Str" + show);
  }
  if (mSubjectTextEditor == null) {
    if (show == false) {
      return;
    }
    mSubjectTextEditor=(EditText)findViewById(R.id.subject);
  }
  mSubjectTextEditor.setOnKeyListener(show ? mSubjectKeyListener : null);
  if (show) {
    mSubjectTextEditor.addTextChangedListener(mSubjectEditorWatcher);
  }
 else {
    mSubjectTextEditor.removeTextChangedListener(mSubjectEditorWatcher);
  }
  mSubjectTextEditor.setText(mWorkingMessage.getSubject());
  mSubjectTextEditor.setVisibility(show ? View.VISIBLE : View.GONE);
  hideOrShowTopPanel();
}
Program: 44603
Project: 44603
Buggy source:
private void showSubjectEditor(boolean show){
  if (mSubjectTextEditor == null) {
    if (show == false) {
      return;
    }
    mSubjectTextEditor=(EditText)findViewById(R.id.subject);
    mSubjectTextEditor.setOnKeyListener(mSubjectKeyListener);
    mSubjectTextEditor.addTextChangedListener(mSubjectEditorWatcher);
  }
  mSubjectTextEditor.setText(mWorkingMessage.getSubject());
  mSubjectTextEditor.setVisibility(show ? View.VISIBLE : View.GONE);
  hideOrShowTopPanel();
}

Fixed version (ground truth):
private void showSubjectEditor(boolean show){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    log("String_Node_Str" + show);
  }
  if (mSubjectTextEditor == null) {
    if (show == false) {
      return;
    }
    mSubjectTextEditor=(EditText)findViewById(R.id.subject);
  }
  mSubjectTextEditor.setOnKeyListener(show ? mSubjectKeyListener : null);
  if (show) {
    mSubjectTextEditor.addTextChangedListener(mSubjectEditorWatcher);
  }
 else {
    mSubjectTextEditor.removeTextChangedListener(mSubjectEditorWatcher);
  }
  mSubjectTextEditor.setText(mWorkingMessage.getSubject());
  mSubjectTextEditor.setVisibility(show ? View.VISIBLE : View.GONE);
  hideOrShowTopPanel();
}
Program: 44605
Project: 44605
Buggy source:
protected void initMediaDuration() throws MmsException {
  if (mUri == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  MediaMetadataRetriever retriever=new MediaMetadataRetriever();
  retriever.setMode(MediaMetadataRetriever.MODE_GET_METADATA_ONLY);
  int duration=0;
  try {
    retriever.setDataSource(mContext,mUri);
    String dur=retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
    if (dur != null) {
      duration=Integer.parseInt(dur);
    }
    mDuration=duration;
  }
 catch (  Exception ex) {
    Log.e(TAG,"String_Node_Str",ex);
    throw new MmsException(ex);
  }
 finally {
    retriever.release();
  }
}

Fixed version (ground truth):
protected void initMediaDuration() throws MmsException {
  if (mUri == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  MediaMetadataRetriever retriever=new MediaMetadataRetriever();
  retriever.setMode(MediaMetadataRetriever.MODE_GET_METADATA_ONLY);
  int duration=0;
  try {
    retriever.setDataSource(mContext,mUri);
    String dur=retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
    if (dur != null) {
      duration=Integer.parseInt(dur);
    }
    mDuration=duration;
  }
 catch (  Exception ex) {
    Log.e(TAG,"String_Node_Str" + mUri.getPath(),ex);
    throw new MmsException(ex);
  }
 finally {
    retriever.release();
  }
}
Program: 44606
Project: 44606
Buggy source:
private static AndroidHttpClient createHttpClient(){
  AndroidHttpClient client=AndroidHttpClient.newInstance(MmsConfig.getUserAgent());
  HttpParams params=client.getParams();
  HttpProtocolParams.setContentCharset(params,"String_Node_Str");
  return client;
}

Fixed version (ground truth):
private static AndroidHttpClient createHttpClient(){
  AndroidHttpClient client=AndroidHttpClient.newInstance(MmsConfig.getUserAgent());
  HttpParams params=client.getParams();
  HttpProtocolParams.setContentCharset(params,"String_Node_Str");
  int soTimeout=MmsConfig.getHttpSocketTimeout();
  if (Log.isLoggable(TAG,Log.DEBUG)) {
    Log.d(TAG,"String_Node_Str" + soTimeout + "String_Node_Str");
  }
  HttpConnectionParams.setSoTimeout(params,soTimeout);
  return client;
}
Program: 44607
Project: 44607
Buggy source:
/** 
 * Looks to see if there are any valid parts of the attachment that can be copied to a SD card.
 * @param msgId
 */
private boolean haveSomethingToCopyToSDCard(long msgId){
  PduBody body=PduBodyCache.getPduBody(this,ContentUris.withAppendedId(Mms.CONTENT_URI,msgId));
  if (body == null) {
    return false;
  }
  boolean result=false;
  int partNum=body.getPartsNum();
  for (int i=0; i < partNum; i++) {
    PduPart part=body.getPart(i);
    String type=new String(part.getContentType());
    if (ContentType.isImageType(type) || ContentType.isVideoType(type) || ContentType.isAudioType(type)) {
      result=true;
      break;
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Looks to see if there are any valid parts of the attachment that can be copied to a SD card.
 * @param msgId
 */
private boolean haveSomethingToCopyToSDCard(long msgId){
  PduBody body=PduBodyCache.getPduBody(this,ContentUris.withAppendedId(Mms.CONTENT_URI,msgId));
  if (body == null) {
    return false;
  }
  boolean result=false;
  int partNum=body.getPartsNum();
  for (int i=0; i < partNum; i++) {
    PduPart part=body.getPart(i);
    String type=new String(part.getContentType());
    if (Log.isLoggable(MmsApp.LOG_TAG,Log.DEBUG)) {
      log("String_Node_Str" + i + "String_Node_Str"+ type);
    }
    if (ContentType.isImageType(type) || ContentType.isVideoType(type) || ContentType.isAudioType(type)) {
      result=true;
      break;
    }
  }
  return result;
}
Program: 44610
Project: 44610
Buggy source:
protected void initMediaDuration() throws MmsException {
  if (mUri == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  MediaMetadataRetriever retriever=new MediaMetadataRetriever();
  retriever.setMode(MediaMetadataRetriever.MODE_GET_METADATA_ONLY);
  int duration=0;
  try {
    retriever.setDataSource(mContext,mUri);
    String dur=retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
    if (dur != null) {
      duration=Integer.parseInt(dur);
    }
    mDuration=duration;
  }
 catch (  Exception ex) {
    Log.e(TAG,"String_Node_Str",ex);
    throw new MmsException(ex);
  }
 finally {
    retriever.release();
  }
}

Fixed version (ground truth):
protected void initMediaDuration() throws MmsException {
  if (mUri == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  MediaMetadataRetriever retriever=new MediaMetadataRetriever();
  retriever.setMode(MediaMetadataRetriever.MODE_GET_METADATA_ONLY);
  int duration=0;
  try {
    retriever.setDataSource(mContext,mUri);
    String dur=retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION);
    if (dur != null) {
      duration=Integer.parseInt(dur);
    }
    mDuration=duration;
  }
 catch (  Exception ex) {
    Log.e(TAG,"String_Node_Str" + mUri.getPath(),ex);
    throw new MmsException(ex);
  }
 finally {
    retriever.release();
  }
}
Program: 44611
Project: 44611
Buggy source:
private static AndroidHttpClient createHttpClient(){
  AndroidHttpClient client=AndroidHttpClient.newInstance(MmsConfig.getUserAgent());
  HttpParams params=client.getParams();
  HttpProtocolParams.setContentCharset(params,"String_Node_Str");
  return client;
}

Fixed version (ground truth):
private static AndroidHttpClient createHttpClient(){
  AndroidHttpClient client=AndroidHttpClient.newInstance(MmsConfig.getUserAgent());
  HttpParams params=client.getParams();
  HttpProtocolParams.setContentCharset(params,"String_Node_Str");
  int soTimeout=MmsConfig.getHttpSocketTimeout();
  if (Log.isLoggable(TAG,Log.DEBUG)) {
    Log.d(TAG,"String_Node_Str" + soTimeout + "String_Node_Str");
  }
  HttpConnectionParams.setSoTimeout(params,soTimeout);
  return client;
}
Program: 44612
Project: 44612
Buggy source:
/** 
 * Looks to see if there are any valid parts of the attachment that can be copied to a SD card.
 * @param msgId
 */
private boolean haveSomethingToCopyToSDCard(long msgId){
  PduBody body=PduBodyCache.getPduBody(this,ContentUris.withAppendedId(Mms.CONTENT_URI,msgId));
  if (body == null) {
    return false;
  }
  boolean result=false;
  int partNum=body.getPartsNum();
  for (int i=0; i < partNum; i++) {
    PduPart part=body.getPart(i);
    String type=new String(part.getContentType());
    if (ContentType.isImageType(type) || ContentType.isVideoType(type) || ContentType.isAudioType(type)) {
      result=true;
      break;
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Looks to see if there are any valid parts of the attachment that can be copied to a SD card.
 * @param msgId
 */
private boolean haveSomethingToCopyToSDCard(long msgId){
  PduBody body=PduBodyCache.getPduBody(this,ContentUris.withAppendedId(Mms.CONTENT_URI,msgId));
  if (body == null) {
    return false;
  }
  boolean result=false;
  int partNum=body.getPartsNum();
  for (int i=0; i < partNum; i++) {
    PduPart part=body.getPart(i);
    String type=new String(part.getContentType());
    if (Log.isLoggable(MmsApp.LOG_TAG,Log.DEBUG)) {
      log("String_Node_Str" + i + "String_Node_Str"+ type);
    }
    if (ContentType.isImageType(type) || ContentType.isVideoType(type) || ContentType.isAudioType(type)) {
      result=true;
      break;
    }
  }
  return result;
}
Program: 44614
Project: 44614
Buggy source:
/** 
 * Put the specified conversation in the cache.  The caller should not place an already-existing conversation in the cache, but rather update it in place.
 */
static void put(Conversation c){
synchronized (sInstance) {
    if (sInstance.mCache.contains(c)) {
      throw new IllegalStateException("String_Node_Str" + c + "String_Node_Str"+ c.mThreadId);
    }
    sInstance.mCache.add(c);
  }
}

Fixed version (ground truth):
/** 
 * Put the specified conversation in the cache.  The caller should not place an already-existing conversation in the cache, but rather update it in place.
 */
static void put(Conversation c){
synchronized (sInstance) {
    if (DEBUG) {
      Log.v(TAG,"String_Node_Str" + c + "String_Node_Str"+ c.getThreadId()+ "String_Node_Str"+ c.hashCode());
      dumpCache();
    }
    if (sInstance.mCache.contains(c)) {
      throw new IllegalStateException("String_Node_Str" + c + "String_Node_Str"+ c.mThreadId);
    }
    sInstance.mCache.add(c);
  }
}
Program: 44615
Project: 44615
Buggy source:
/** 
 * Return the conversation with the specified recipient list, or null if it's not in cache.
 */
static Conversation get(ContactList list){
synchronized (sInstance) {
    for (    Conversation c : sInstance.mCache) {
      if (c.getRecipients().equals(list)) {
        return c;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Return the conversation with the specified recipient list, or null if it's not in cache.
 */
static Conversation get(ContactList list){
synchronized (sInstance) {
    if (DEBUG) {
      Log.v(TAG,"String_Node_Str" + list);
      dumpCache();
    }
    for (    Conversation c : sInstance.mCache) {
      if (c.getRecipients().equals(list)) {
        return c;
      }
    }
  }
  return null;
}
Program: 44616
Project: 44616
Buggy source:
private static void cacheAllThreads(Context context){
synchronized (Cache.getInstance()) {
    HashSet<Long> threadsOnDisk=new HashSet<Long>();
    Cursor c=context.getContentResolver().query(sAllThreadsUri,ALL_THREADS_PROJECTION,null,null,null);
    try {
      while (c.moveToNext()) {
        long threadId=c.getLong(ID);
        threadsOnDisk.add(threadId);
        Conversation conv=Cache.get(threadId);
        if (conv == null) {
          conv=new Conversation(context,c,true);
          Cache.put(conv);
        }
 else {
          fillFromCursor(context,conv,c,true);
        }
      }
    }
  finally {
      c.close();
    }
    Cache.keepOnly(threadsOnDisk);
  }
}

Fixed version (ground truth):
private static void cacheAllThreads(Context context){
synchronized (Cache.getInstance()) {
    if (DEBUG) {
      Log.v(TAG,"String_Node_Str");
    }
    HashSet<Long> threadsOnDisk=new HashSet<Long>();
    Cursor c=context.getContentResolver().query(sAllThreadsUri,ALL_THREADS_PROJECTION,null,null,null);
    try {
      while (c.moveToNext()) {
        long threadId=c.getLong(ID);
        threadsOnDisk.add(threadId);
        Conversation conv=Cache.get(threadId);
        if (conv == null) {
          conv=new Conversation(context,c,true);
          Cache.put(conv);
        }
 else {
          fillFromCursor(context,conv,c,true);
        }
      }
    }
  finally {
      c.close();
    }
    Cache.keepOnly(threadsOnDisk);
  }
}
Program: 44617
Project: 44617
Buggy source:
/** 
 * Guarantees that the conversation has been created in the database. This will make a blocking database call if it hasn't.
 * @return The thread ID of this conversation in the database
 */
public synchronized long ensureThreadId(){
  if (mThreadId <= 0) {
    mThreadId=getOrCreateThreadId(mContext,mRecipients);
  }
  return mThreadId;
}

Fixed version (ground truth):
/** 
 * Guarantees that the conversation has been created in the database. This will make a blocking database call if it hasn't.
 * @return The thread ID of this conversation in the database
 */
public synchronized long ensureThreadId(){
  if (DEBUG) {
    Log.v("String_Node_Str","String_Node_Str" + mThreadId);
  }
  if (mThreadId <= 0) {
    mThreadId=getOrCreateThreadId(mContext,mRecipients);
  }
  if (DEBUG) {
    Log.v("String_Node_Str","String_Node_Str" + mThreadId);
  }
  return mThreadId;
}
Program: 44618
Project: 44618
Buggy source:
public synchronized void clearThreadId(){
  mThreadId=0;
}

Fixed version (ground truth):
public synchronized void clearThreadId(){
  Cache.remove(mThreadId);
  mThreadId=0;
}
Program: 44619
Project: 44619
Buggy source:
/** 
 * Reads a draft message for the given thread ID from the database, if there is one, deletes it from the database, and returns it.
 * @return The draft message or an empty string.
 */
private static String readDraftSmsMessage(Context context,long thread_id){
  if (DEBUG)   debug("String_Node_Str",thread_id);
  ContentResolver cr=context.getContentResolver();
  if (thread_id <= 0) {
    return "String_Node_Str";
  }
  Uri thread_uri=ContentUris.withAppendedId(Sms.Conversations.CONTENT_URI,thread_id);
  String body="String_Node_Str";
  Cursor c=SqliteWrapper.query(context,cr,thread_uri,SMS_BODY_PROJECTION,SMS_DRAFT_WHERE,null,null);
  try {
    if (c.moveToFirst()) {
      body=c.getString(SMS_BODY_INDEX);
    }
  }
  finally {
    c.close();
  }
  SqliteWrapper.delete(context,cr,thread_uri,SMS_DRAFT_WHERE,null);
  return body;
}

Fixed version (ground truth):
/** 
 * Reads a draft message for the given thread ID from the database, if there is one, deletes it from the database, and returns it.
 * @return The draft message or an empty string.
 */
private static String readDraftSmsMessage(Context context,long thread_id,Conversation conv){
  if (DEBUG)   debug("String_Node_Str",thread_id);
  ContentResolver cr=context.getContentResolver();
  if (thread_id <= 0) {
    return "String_Node_Str";
  }
  Uri thread_uri=ContentUris.withAppendedId(Sms.Conversations.CONTENT_URI,thread_id);
  String body="String_Node_Str";
  Cursor c=SqliteWrapper.query(context,cr,thread_uri,SMS_BODY_PROJECTION,SMS_DRAFT_WHERE,null,null);
  try {
    if (c.moveToFirst()) {
      body=c.getString(SMS_BODY_INDEX);
    }
  }
  finally {
    c.close();
  }
  SqliteWrapper.delete(context,cr,thread_uri,SMS_DRAFT_WHERE,null);
  if (conv.getMessageCount() == 0) {
    if (DEBUG)     debug("String_Node_Str");
    conv.clearThreadId();
  }
  return body;
}
Program: 44620
Project: 44620
Buggy source:
private boolean loadFromConversation(Conversation conv){
  if (DEBUG)   debug("String_Node_Str",conv);
  long threadId=conv.getThreadId();
  if (threadId <= 0) {
    return false;
  }
  mText=readDraftSmsMessage(mContext,threadId);
  if (!TextUtils.isEmpty(mText)) {
    if (conv.getMessageCount() == 0) {
      conv.clearThreadId();
    }
    return true;
  }
  StringBuilder sb=new StringBuilder();
  Uri uri=readDraftMmsMessage(mContext,threadId,sb);
  if (uri != null) {
    if (loadFromUri(uri)) {
      if (sb.length() > 0) {
        setSubject(sb.toString());
      }
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean loadFromConversation(Conversation conv){
  if (DEBUG)   debug("String_Node_Str",conv);
  long threadId=conv.getThreadId();
  if (threadId <= 0) {
    return false;
  }
  mText=readDraftSmsMessage(mContext,threadId,conv);
  if (!TextUtils.isEmpty(mText)) {
    return true;
  }
  StringBuilder sb=new StringBuilder();
  Uri uri=readDraftMmsMessage(mContext,threadId,sb);
  if (uri != null) {
    if (loadFromUri(uri)) {
      if (sb.length() > 0) {
        setSubject(sb.toString());
      }
      return true;
    }
  }
  return false;
}
Program: 44621
Project: 44621
Buggy source:
@Override protected void onDeleteComplete(int token,Object cookie,int result){
switch (token) {
case DELETE_CONVERSATION_TOKEN:
    MessagingNotification.updateNewMessageIndicator(ConversationList.this);
  MessagingNotification.updateSendFailedNotification(ConversationList.this);
startAsyncQuery();
onContentChanged();
break;
}
}

Fixed version (ground truth):
@Override protected void onDeleteComplete(int token,Object cookie,int result){
switch (token) {
case DELETE_CONVERSATION_TOKEN:
    Conversation.init(ConversationList.this);
  MessagingNotification.updateNewMessageIndicator(ConversationList.this);
MessagingNotification.updateSendFailedNotification(ConversationList.this);
startAsyncQuery();
onContentChanged();
break;
}
}
Program: 44622
Project: 44622
Buggy source:
/** 
 * Marks all messages in this conversation as read and updates relevant notifications.  This method returns immediately; work is dispatched to a background thread.
 */
public synchronized void markAsRead(){
  if (!hasUnreadMessages()) {
    return;
  }
  final Uri threadUri=getUri();
  if (threadUri == null)   return;
  final ContentValues values=new ContentValues(1);
  values.put("String_Node_Str",1);
  new Thread(new Runnable(){
    public void run(){
      mContext.getContentResolver().update(threadUri,values,"String_Node_Str",null);
      MessagingNotification.updateAllNotifications(mContext);
    }
  }
).start();
}

Fixed version (ground truth):
/** 
 * Marks all messages in this conversation as read and updates relevant notifications.  This method returns immediately; work is dispatched to a background thread.
 */
public synchronized void markAsRead(){
  final Uri threadUri=getUri();
  new Thread(new Runnable(){
    public void run(){
      if (threadUri != null) {
        buildReadContentValues();
        mContext.getContentResolver().update(threadUri,mReadContentValues,"String_Node_Str",null);
        mHasUnreadMessages=false;
      }
      MessagingNotification.updateAllNotifications(mContext);
    }
  }
).start();
}
Program: 44623
Project: 44623
Buggy source:
@Override protected void onPause(){
  super.onPause();
  cancelPresencePollingRequests();
}

Fixed version (ground truth):
@Override protected void onPause(){
  super.onPause();
  Contact.stopPresenceObserver();
  removeRecipientsListeners();
}
Program: 44624
Project: 44624
Buggy source:
private void sendMessage(){
  mWorkingMessage.send();
  resetMessage();
  if (mExitOnSent) {
    finish();
  }
}

Fixed version (ground truth):
private void sendMessage(){
  removeRecipientsListeners();
  mWorkingMessage.send();
  addRecipientsListeners();
  resetMessage();
  if (mExitOnSent) {
    finish();
  }
}
Program: 44625
Project: 44625
Buggy source:
private void startQueryForContactInfo(){
  ContactList recipients=getRecipients();
  cancelPresencePollingRequests();
  if (recipients.size() != 1) {
    setPresenceIcon(0);
    startPresencePollingRequest();
    return;
  }
  String number=recipients.get(0).getNumber();
  mContactInfoSelectionArgs[0]=number;
  if (Mms.isEmailAddress(number)) {
    mBackgroundQueryHandler.cancelOperation(EMAIL_CONTACT_QUERY_TOKEN);
    mBackgroundQueryHandler.startQuery(EMAIL_CONTACT_QUERY_TOKEN,null,METHOD_WITH_PRESENCE_URI,EMAIL_QUERY_PROJECTION,METHOD_LOOKUP,mContactInfoSelectionArgs,null);
  }
 else {
    mBackgroundQueryHandler.cancelOperation(CALLER_ID_QUERY_TOKEN);
    mBackgroundQueryHandler.startQuery(CALLER_ID_QUERY_TOKEN,null,PHONES_WITH_PRESENCE_URI,CALLER_ID_PROJECTION,NUMBER_LOOKUP,mContactInfoSelectionArgs,null);
  }
}

Fixed version (ground truth):
private void startQueryForContactInfo(){
  ContactList recipients=getRecipients();
  if (recipients.size() != 1) {
    setPresenceIcon(0);
    return;
  }
  String number=recipients.get(0).getNumber();
  mContactInfoSelectionArgs[0]=number;
  if (Mms.isEmailAddress(number)) {
    mBackgroundQueryHandler.cancelOperation(EMAIL_CONTACT_QUERY_TOKEN);
    mBackgroundQueryHandler.startQuery(EMAIL_CONTACT_QUERY_TOKEN,null,METHOD_WITH_PRESENCE_URI,EMAIL_QUERY_PROJECTION,METHOD_LOOKUP,mContactInfoSelectionArgs,null);
  }
 else {
    mBackgroundQueryHandler.cancelOperation(CALLER_ID_QUERY_TOKEN);
    mBackgroundQueryHandler.startQuery(CALLER_ID_QUERY_TOKEN,null,PHONES_WITH_PRESENCE_URI,CALLER_ID_PROJECTION,NUMBER_LOOKUP,mContactInfoSelectionArgs,null);
  }
}
Program: 44626
Project: 44626
Buggy source:
public void run(){
  goToConversationList();
}

Fixed version (ground truth):
public void run(){
  setPresenceIcon(updated.getPresenceResId());
}
Program: 44627
Project: 44627
Buggy source:
@Override protected void onResume(){
  super.onResume();
  startPresencePollingRequest();
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  Contact.startPresenceObserver();
  addRecipientsListeners();
}
Program: 44628
Project: 44628
Buggy source:
@Override public void handleMessage(Message msg){
  if (msg.what == REFRESH_PRESENCE) {
    startQueryForContactInfo();
  }
}

Fixed version (ground truth):
@Override public void handleMessage(Message msg){
  String type;
switch (msg.what) {
case MessageListItem.MSG_LIST_EDIT_MMS:
    type="String_Node_Str";
  break;
case MessageListItem.MSG_LIST_EDIT_SMS:
type="String_Node_Str";
break;
default :
Log.w(TAG,"String_Node_Str" + msg.what);
return;
}
MessageItem msgItem=getMessageItem(type,(Long)msg.obj);
if (msgItem != null) {
editMessageItem(msgItem);
drawBottomPanel();
}
}
Program: 44629
Project: 44629
Buggy source:
@Override protected void onQueryComplete(int token,Object cookie,Cursor cursor){
switch (token) {
case MESSAGE_LIST_QUERY_TOKEN:
    mMsgListAdapter.changeCursor(cursor);
  if (cursor.getCount() == 0 && !isRecipientsEditorVisible()) {
    initRecipientsEditor();
  }
mTextEditor.requestFocus();
return;
case CALLER_ID_QUERY_TOKEN:
case EMAIL_CONTACT_QUERY_TOKEN:
cleanupContactInfoCursor();
mContactInfoCursor=cursor;
updateContactInfo();
startPresencePollingRequest();
return;
}
}

Fixed version (ground truth):
@Override protected void onQueryComplete(int token,Object cookie,Cursor cursor){
switch (token) {
case MESSAGE_LIST_QUERY_TOKEN:
    mMsgListAdapter.changeCursor(cursor);
  if (cursor.getCount() == 0 && !isRecipientsEditorVisible()) {
    initRecipientsEditor();
  }
mTextEditor.requestFocus();
return;
case CALLER_ID_QUERY_TOKEN:
case EMAIL_CONTACT_QUERY_TOKEN:
cleanupContactInfoCursor();
mContactInfoCursor=cursor;
updateContactInfo();
return;
}
}
Program: 44630
Project: 44630
Buggy source:
private void initRecipientsEditor(){
  if (isRecipientsEditorVisible()) {
    return;
  }
  ViewStub stub=(ViewStub)findViewById(R.id.recipients_editor_stub);
  if (stub != null) {
    mRecipientsEditor=(RecipientsEditor)stub.inflate();
  }
 else {
    mRecipientsEditor=(RecipientsEditor)findViewById(R.id.recipients_editor);
    mRecipientsEditor.setVisibility(View.VISIBLE);
  }
  mRecipientsEditor.setAdapter(new RecipientsAdapter(this));
  mRecipientsEditor.populate(getRecipients());
  mRecipientsEditor.setOnCreateContextMenuListener(mRecipientsMenuCreateListener);
  mRecipientsEditor.addTextChangedListener(mRecipientsWatcher);
  mRecipientsEditor.setFilters(new InputFilter[]{new InputFilter.LengthFilter(RECIPIENTS_MAX_LENGTH)});
  mRecipientsEditor.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      if (mRecipientsEditor.getRecipientCount() == 1) {
        final InputMethodManager inputManager=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
        if (inputManager == null || !inputManager.isFullscreenMode()) {
          mTextEditor.requestFocus();
        }
      }
    }
  }
);
  mTopPanel.setVisibility(View.VISIBLE);
}

Fixed version (ground truth):
private void initRecipientsEditor(){
  if (isRecipientsEditorVisible()) {
    return;
  }
  ContactList recipients=getRecipients();
  ViewStub stub=(ViewStub)findViewById(R.id.recipients_editor_stub);
  if (stub != null) {
    mRecipientsEditor=(RecipientsEditor)stub.inflate();
  }
 else {
    mRecipientsEditor=(RecipientsEditor)findViewById(R.id.recipients_editor);
    mRecipientsEditor.setVisibility(View.VISIBLE);
  }
  mRecipientsEditor.setAdapter(new RecipientsAdapter(this));
  mRecipientsEditor.populate(recipients);
  mRecipientsEditor.setOnCreateContextMenuListener(mRecipientsMenuCreateListener);
  mRecipientsEditor.addTextChangedListener(mRecipientsWatcher);
  mRecipientsEditor.setFilters(new InputFilter[]{new InputFilter.LengthFilter(RECIPIENTS_MAX_LENGTH)});
  mRecipientsEditor.setOnItemClickListener(new AdapterView.OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
      if (mRecipientsEditor.getRecipientCount() == 1) {
        final InputMethodManager inputManager=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
        if (inputManager == null || !inputManager.isFullscreenMode()) {
          mTextEditor.requestFocus();
        }
      }
    }
  }
);
  mTopPanel.setVisibility(View.VISIBLE);
}
Program: 44631
Project: 44631
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_PROGRESS);
  requestWindowFeature(Window.FEATURE_LEFT_ICON);
  setContentView(R.layout.compose_message_activity);
  setProgressBarVisibility(false);
  setTitle("String_Node_Str");
  initResourceRefs();
  mContentResolver=getContentResolver();
  mBackgroundQueryHandler=new BackgroundQueryHandler(mContentResolver);
  mWorkingMessage=WorkingMessage.createEmpty(this);
  initActivityState(savedInstanceState,getIntent());
  if (LOCAL_LOGV) {
    Log.v(TAG,"String_Node_Str" + savedInstanceState);
    Log.v(TAG,"String_Node_Str" + getIntent());
  }
  if (cancelFailedToDeliverNotification(getIntent(),this)) {
    undeliveredMessageDialog(getMessageDate(null));
  }
  cancelFailedDownloadNotification(getIntent(),this);
  initMessageList();
  mConversation.markAsRead();
  if (!handleSendIntent(getIntent()) && !handleForwardedMessage()) {
    loadDraft();
  }
  mWorkingMessage.setConversation(mConversation);
  if (mConversation.getThreadId() <= 0) {
    initRecipientsEditor();
  }
  updateSendButtonState();
  drawTopPanel();
  drawBottomPanel();
  mAttachmentEditor.update(mWorkingMessage);
  Configuration config=getResources().getConfiguration();
  mIsKeyboardOpen=config.keyboardHidden == KEYBOARDHIDDEN_NO;
  mIsLandscape=config.orientation == Configuration.ORIENTATION_LANDSCAPE;
  onKeyboardStateChanged(mIsKeyboardOpen);
  if (TRACE) {
    android.os.Debug.startMethodTracing("String_Node_Str");
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_PROGRESS);
  requestWindowFeature(Window.FEATURE_LEFT_ICON);
  setContentView(R.layout.compose_message_activity);
  setProgressBarVisibility(false);
  setTitle("String_Node_Str");
  initResourceRefs();
  mContentResolver=getContentResolver();
  mBackgroundQueryHandler=new BackgroundQueryHandler(mContentResolver);
  mWorkingMessage=WorkingMessage.createEmpty(this);
  initActivityState(savedInstanceState,getIntent());
  if (LOCAL_LOGV) {
    Log.v(TAG,"String_Node_Str" + savedInstanceState + "String_Node_Str"+ getIntent()+ "String_Node_Str"+ getRecipients());
  }
  if (cancelFailedToDeliverNotification(getIntent(),this)) {
    undeliveredMessageDialog(getMessageDate(null));
  }
  cancelFailedDownloadNotification(getIntent(),this);
  initMessageList();
  mConversation.markAsRead();
  if (!handleSendIntent(getIntent()) && !handleForwardedMessage()) {
    loadDraft();
  }
  mWorkingMessage.setConversation(mConversation);
  if (mConversation.getThreadId() <= 0) {
    initRecipientsEditor();
  }
  updateSendButtonState();
  drawTopPanel();
  drawBottomPanel();
  mAttachmentEditor.update(mWorkingMessage);
  Configuration config=getResources().getConfiguration();
  mIsKeyboardOpen=config.keyboardHidden == KEYBOARDHIDDEN_NO;
  mIsLandscape=config.orientation == Configuration.ORIENTATION_LANDSCAPE;
  onKeyboardStateChanged(mIsKeyboardOpen);
  if (TRACE) {
    android.os.Debug.startMethodTracing("String_Node_Str");
  }
}
Program: 44632
Project: 44632
Buggy source:
private void buildAddAddressToContactMenuItem(Menu menu){
  for (  Contact c : getRecipients()) {
    if (!c.existsInDatabase()) {
      Intent intent=ConversationList.createAddContactIntent(c.getNumber());
      menu.add(0,MENU_ADD_ADDRESS_TO_CONTACTS,0,R.string.menu_add_to_contacts).setIcon(android.R.drawable.ic_menu_add).setIntent(intent);
      break;
    }
  }
}

Fixed version (ground truth):
private void buildAddAddressToContactMenuItem(Menu menu){
  for (  Contact c : getRecipients()) {
    if (!c.existsInDatabase() && canAddToContacts(c)) {
      Intent intent=ConversationList.createAddContactIntent(c.getNumber());
      menu.add(0,MENU_ADD_ADDRESS_TO_CONTACTS,0,R.string.menu_add_to_contacts).setIcon(android.R.drawable.ic_menu_add).setIntent(intent);
      break;
    }
  }
}
Program: 44633
Project: 44633
Buggy source:
private void handleAddAttachmentError(int error,int mediaTypeStringId){
  if (error == WorkingMessage.OK) {
    return;
  }
  Resources res=getResources();
  String mediaType=res.getString(mediaTypeStringId);
  String title, message;
switch (error) {
case WorkingMessage.UNKNOWN_ERROR:
    message=res.getString(R.string.failed_to_add_media,mediaType);
  Toast.makeText(this,message,Toast.LENGTH_SHORT);
return;
case WorkingMessage.UNSUPPORTED_TYPE:
title=res.getString(R.string.unsupported_media_format,mediaType);
message=res.getString(R.string.select_different_media,mediaType);
break;
case WorkingMessage.MESSAGE_SIZE_EXCEEDED:
title=res.getString(R.string.exceed_message_size_limitation,mediaType);
message=res.getString(R.string.failed_to_add_media,mediaType);
break;
case WorkingMessage.IMAGE_TOO_LARGE:
title=res.getString(R.string.failed_to_resize_image);
message=res.getString(R.string.resize_image_error_information);
break;
default :
throw new IllegalArgumentException("String_Node_Str" + error);
}
MessageUtils.showErrorDialog(this,title,message);
}

Fixed version (ground truth):
private void handleAddAttachmentError(int error,int mediaTypeStringId){
  if (error == WorkingMessage.OK) {
    return;
  }
  Resources res=getResources();
  String mediaType=res.getString(mediaTypeStringId);
  String title, message;
switch (error) {
case WorkingMessage.UNKNOWN_ERROR:
    message=res.getString(R.string.failed_to_add_media,mediaType);
  Toast.makeText(this,message,Toast.LENGTH_SHORT).show();
return;
case WorkingMessage.UNSUPPORTED_TYPE:
title=res.getString(R.string.unsupported_media_format,mediaType);
message=res.getString(R.string.select_different_media,mediaType);
break;
case WorkingMessage.MESSAGE_SIZE_EXCEEDED:
title=res.getString(R.string.exceed_message_size_limitation,mediaType);
message=res.getString(R.string.failed_to_add_media,mediaType);
break;
case WorkingMessage.IMAGE_TOO_LARGE:
title=res.getString(R.string.failed_to_resize_image);
message=res.getString(R.string.resize_image_error_information);
break;
default :
throw new IllegalArgumentException("String_Node_Str" + error);
}
MessageUtils.showErrorDialog(this,title,message);
}
Program: 44634
Project: 44634
Buggy source:
public static List<String> getNumbers(String spaceSepIds){
synchronized (sInstance) {
    List<String> numbers=new ArrayList<String>();
    String[] ids=spaceSepIds.split("String_Node_Str");
    for (    String id : ids) {
      String number=sInstance.mCache.get(id);
      if (number == null) {
        Log.w(TAG,"String_Node_Str" + id + "String_Node_Str");
        dump();
        fill();
        number=sInstance.mCache.get(id);
      }
      numbers.add(number);
    }
    return numbers;
  }
}

Fixed version (ground truth):
public static List<String> getNumbers(String spaceSepIds){
synchronized (sInstance) {
    List<String> numbers=new ArrayList<String>();
    String[] ids=spaceSepIds.split("String_Node_Str");
    for (    String id : ids) {
      String number=sInstance.mCache.get(id);
      if (number == null) {
        Log.w(TAG,"String_Node_Str" + id + "String_Node_Str");
        dump();
        fill();
        number=sInstance.mCache.get(id);
      }
      if (TextUtils.isEmpty(number)) {
        Log.w(TAG,"String_Node_Str" + id + "String_Node_Str");
      }
 else {
        numbers.add(number);
      }
    }
    return numbers;
  }
}
Program: 44636
Project: 44636
Buggy source:
private boolean loadFromConversation(Conversation conv){
  if (DEBUG)   debug("String_Node_Str",conv);
  long threadId=conv.getThreadId();
  if (threadId <= 0) {
    return false;
  }
  mText=readDraftSmsMessage(mContext,threadId);
  if (!TextUtils.isEmpty(mText)) {
    conv.clearThreadId();
    return true;
  }
  StringBuilder sb=new StringBuilder();
  Uri uri=readDraftMmsMessage(mContext,threadId,sb);
  if (uri != null) {
    if (loadFromUri(uri)) {
      if (sb.length() > 0) {
        setSubject(sb.toString());
      }
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean loadFromConversation(Conversation conv){
  if (DEBUG)   debug("String_Node_Str",conv);
  long threadId=conv.getThreadId();
  if (threadId <= 0) {
    return false;
  }
  mText=readDraftSmsMessage(mContext,threadId);
  if (!TextUtils.isEmpty(mText)) {
    if (conv.getMessageCount() == 0) {
      conv.clearThreadId();
    }
    return true;
  }
  StringBuilder sb=new StringBuilder();
  Uri uri=readDraftMmsMessage(mContext,threadId,sb);
  if (uri != null) {
    if (loadFromUri(uri)) {
      if (sb.length() > 0) {
        setSubject(sb.toString());
      }
      return true;
    }
  }
  return false;
}
Program: 44637
Project: 44637
Buggy source:
private boolean loadFromConversation(Conversation conv){
  if (DEBUG)   debug("String_Node_Str",conv);
  long threadId=conv.getThreadId();
  if (threadId <= 0) {
    return false;
  }
  mText=readDraftSmsMessage(mContext,threadId);
  if (!TextUtils.isEmpty(mText)) {
    return true;
  }
  StringBuilder sb=new StringBuilder();
  Uri uri=readDraftMmsMessage(mContext,threadId,sb);
  if (uri != null) {
    if (loadFromUri(uri)) {
      if (sb.length() > 0) {
        setSubject(sb.toString());
      }
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean loadFromConversation(Conversation conv){
  if (DEBUG)   debug("String_Node_Str",conv);
  long threadId=conv.getThreadId();
  if (threadId <= 0) {
    return false;
  }
  mText=readDraftSmsMessage(mContext,threadId);
  if (!TextUtils.isEmpty(mText)) {
    conv.clearThreadId();
    return true;
  }
  StringBuilder sb=new StringBuilder();
  Uri uri=readDraftMmsMessage(mContext,threadId,sb);
  if (uri != null) {
    if (loadFromUri(uri)) {
      if (sb.length() > 0) {
        setSubject(sb.toString());
      }
      return true;
    }
  }
  return false;
}
Program: 44639
Project: 44639
Buggy source:
private void sendMmsWorker(Conversation conv,Uri mmsUri,PduPersister persister,SlideshowModel slideshow,SendReq sendReq){
  long threadId=conv.ensureThreadId();
  if (DEBUG)   debug("String_Node_Str" + mmsUri);
  if (mmsUri == null) {
    mmsUri=createDraftMmsMessage(persister,sendReq,slideshow);
  }
 else {
    updateDraftMmsMessage(mmsUri,persister,slideshow,sendReq);
  }
  deleteDraftSmsMessage(threadId);
  MessageSender sender=new MmsMessageSender(mContext,mmsUri);
  try {
    if (!sender.sendMessage(threadId)) {
      SqliteWrapper.delete(mContext,mContentResolver,mmsUri,null,null);
    }
  }
 catch (  Exception e) {
    Log.e(TAG,"String_Node_Str" + mmsUri + "String_Node_Str"+ threadId,e);
  }
  mStatusListener.onMessageSent();
}

Fixed version (ground truth):
private void sendMmsWorker(Conversation conv,Uri mmsUri,PduPersister persister,SlideshowModel slideshow,SendReq sendReq){
  long threadId=conv.ensureThreadId();
  if (DEBUG)   debug("String_Node_Str" + mmsUri);
  if (mmsUri == null) {
    mmsUri=createDraftMmsMessage(persister,sendReq,slideshow);
  }
 else {
    updateDraftMmsMessage(mmsUri,persister,slideshow,sendReq);
  }
  deleteDraftSmsMessage(threadId);
  MessageSender sender=new MmsMessageSender(mContext,mmsUri);
  try {
    if (!sender.sendMessage(threadId)) {
      SqliteWrapper.delete(mContext,mContentResolver,mmsUri,null,null);
    }
    Recycler.getMmsRecycler().deleteOldMessagesByThreadId(mContext,threadId);
  }
 catch (  Exception e) {
    Log.e(TAG,"String_Node_Str" + mmsUri + "String_Node_Str"+ threadId,e);
  }
  mStatusListener.onMessageSent();
}
Program: 44641
Project: 44641
Buggy source:
public void run(){
  try {
    DownloadManager.getInstance().markState(mUri,DownloadManager.STATE_DOWNLOADING);
    byte[] resp=getPdu(mContentLocation);
    RetrieveConf retrieveConf=(RetrieveConf)new PduParser(resp).parse();
    if (null == retrieveConf) {
      throw new MmsException("String_Node_Str");
    }
    if (isDuplicateMessage(mContext,retrieveConf)) {
      mTransactionState.setState(TransactionState.FAILED);
      mTransactionState.setContentUri(mUri);
    }
 else {
      PduPersister persister=PduPersister.getPduPersister(mContext);
      Uri uri=persister.persist(retrieveConf,Inbox.CONTENT_URI);
      mTransactionState.setState(TransactionState.SUCCESS);
      mTransactionState.setContentUri(uri);
      updateContentLocation(mContext,uri,mContentLocation);
    }
    SqliteWrapper.delete(mContext,mContext.getContentResolver(),mUri,null,null);
    sendAcknowledgeInd(retrieveConf);
    Recycler.getMmsRecycler().deleteOldMessages(mContext);
  }
 catch (  Throwable t) {
    Log.e(TAG,Log.getStackTraceString(t));
  }
 finally {
    if (mTransactionState.getState() != TransactionState.SUCCESS) {
      mTransactionState.setState(TransactionState.FAILED);
      mTransactionState.setContentUri(mUri);
      Log.e(TAG,"String_Node_Str");
    }
    notifyObservers();
  }
}

Fixed version (ground truth):
public void run(){
  try {
    DownloadManager.getInstance().markState(mUri,DownloadManager.STATE_DOWNLOADING);
    byte[] resp=getPdu(mContentLocation);
    RetrieveConf retrieveConf=(RetrieveConf)new PduParser(resp).parse();
    if (null == retrieveConf) {
      throw new MmsException("String_Node_Str");
    }
    if (isDuplicateMessage(mContext,retrieveConf)) {
      mTransactionState.setState(TransactionState.FAILED);
      mTransactionState.setContentUri(mUri);
    }
 else {
      PduPersister persister=PduPersister.getPduPersister(mContext);
      Uri uri=persister.persist(retrieveConf,Inbox.CONTENT_URI);
      mTransactionState.setState(TransactionState.SUCCESS);
      mTransactionState.setContentUri(uri);
      updateContentLocation(mContext,uri,mContentLocation);
    }
    SqliteWrapper.delete(mContext,mContext.getContentResolver(),mUri,null,null);
    sendAcknowledgeInd(retrieveConf);
  }
 catch (  Throwable t) {
    Log.e(TAG,Log.getStackTraceString(t));
  }
 finally {
    if (mTransactionState.getState() != TransactionState.SUCCESS) {
      mTransactionState.setState(TransactionState.FAILED);
      mTransactionState.setContentUri(mUri);
      Log.e(TAG,"String_Node_Str");
    }
    notifyObservers();
  }
}
Program: 44642
Project: 44642
Buggy source:
private void handleSmsReceived(Intent intent){
  SmsMessage[] msgs=Intents.getMessagesFromIntent(intent);
  Uri messageUri=insertMessage(this,msgs);
  if (messageUri != null) {
    MessagingNotification.updateNewMessageIndicator(this,true);
  }
  Recycler.getSmsRecycler().deleteOldMessages(getApplicationContext());
}

Fixed version (ground truth):
private void handleSmsReceived(Intent intent){
  SmsMessage[] msgs=Intents.getMessagesFromIntent(intent);
  Uri messageUri=insertMessage(this,msgs);
  if (messageUri != null) {
    MessagingNotification.updateNewMessageIndicator(this,true);
  }
}
Program: 44643
Project: 44643
Buggy source:
private Uri storeMessage(Context context,SmsMessage[] msgs){
  SmsMessage sms=msgs[0];
  ContentValues values=extractContentValues(sms);
  int pduCount=msgs.length;
  if (pduCount == 1) {
    values.put(Inbox.BODY,sms.getDisplayMessageBody());
  }
 else {
    StringBuilder body=new StringBuilder();
    for (int i=0; i < pduCount; i++) {
      sms=msgs[i];
      body.append(sms.getDisplayMessageBody());
    }
    values.put(Inbox.BODY,body.toString());
  }
  ContentResolver resolver=context.getContentResolver();
  return SqliteWrapper.insert(context,resolver,Inbox.CONTENT_URI,values);
}

Fixed version (ground truth):
private Uri storeMessage(Context context,SmsMessage[] msgs){
  SmsMessage sms=msgs[0];
  ContentValues values=extractContentValues(sms);
  int pduCount=msgs.length;
  if (pduCount == 1) {
    values.put(Inbox.BODY,sms.getDisplayMessageBody());
  }
 else {
    StringBuilder body=new StringBuilder();
    for (int i=0; i < pduCount; i++) {
      sms=msgs[i];
      body.append(sms.getDisplayMessageBody());
    }
    values.put(Inbox.BODY,body.toString());
  }
  Long threadId=values.getAsLong(Sms.THREAD_ID);
  String address=values.getAsString(Sms.ADDRESS);
  if (((threadId == null) || (threadId == 0)) && (address != null)) {
    values.put(Sms.THREAD_ID,Threads.getOrCreateThreadId(context,address));
  }
  ContentResolver resolver=context.getContentResolver();
  Uri insertedUri=SqliteWrapper.insert(context,resolver,Inbox.CONTENT_URI,values);
  threadId=values.getAsLong(Sms.THREAD_ID);
  Recycler.getSmsRecycler().deleteOldMessagesByThreadId(getApplicationContext(),threadId);
  return insertedUri;
}