nus-yam/ex-repair huggingface dataset:
Program: 44444
Project: 44444
Buggy source:
private static SendReq makeSendReq(Conversation conv,CharSequence subject){
  String[] dests=conv.getRecipients().getNumbers(true);
  if (dests.length == 0) {
    return null;
  }
  SendReq req=new SendReq();
  EncodedStringValue[] encodedNumbers=EncodedStringValue.encodeStrings(dests);
  if (encodedNumbers != null) {
    req.setTo(encodedNumbers);
  }
  if (!TextUtils.isEmpty(subject)) {
    req.setSubject(new EncodedStringValue(subject.toString()));
  }
  req.setDate(System.currentTimeMillis() / 1000L);
  return req;
}

Fixed version (ground truth):
/** 
 * makeSendReq should always return a non-null SendReq, whether the dest addresses are valid or not. 
 */
private static SendReq makeSendReq(Conversation conv,CharSequence subject){
  String[] dests=conv.getRecipients().getNumbers(true);
  SendReq req=new SendReq();
  EncodedStringValue[] encodedNumbers=EncodedStringValue.encodeStrings(dests);
  if (encodedNumbers != null) {
    req.setTo(encodedNumbers);
  }
  if (!TextUtils.isEmpty(subject)) {
    req.setSubject(new EncodedStringValue(subject.toString()));
  }
  req.setDate(System.currentTimeMillis() / 1000L);
  return req;
}
Program: 44445
Project: 44445
Buggy source:
/** 
 * Send this message over the network.  Will call back with onMessageSent() once it has been dispatched to the telephony stack.  This WorkingMessage object is no longer useful after this method has been called.
 */
public void send(){
  if (Log.isLoggable(LogTag.TRANSACTION,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str");
  }
  prepareForSave(true);
  final Conversation conv=mConversation;
  String msgTxt=mText.toString();
  if (requiresMms() || addressContainsEmailToMms(conv,msgTxt)) {
    final Uri mmsUri=mMessageUri;
    final PduPersister persister=PduPersister.getPduPersister(mContext);
    final SlideshowModel slideshow=mSlideshow;
    final SendReq sendReq=makeSendReq(conv,mSubject);
    if (sendReq != null) {
      slideshow.prepareForSend();
      new Thread(new Runnable(){
        public void run(){
          sendMmsWorker(conv,mmsUri,persister,slideshow,sendReq);
        }
      }
).start();
    }
 else {
      Log.e(LogTag.TAG,"String_Node_Str");
    }
  }
 else {
    final String msgText=mText.toString();
    new Thread(new Runnable(){
      public void run(){
        sendSmsWorker(conv,msgText);
      }
    }
).start();
  }
  mDiscarded=true;
}

Fixed version (ground truth):
/** 
 * Send this message over the network.  Will call back with onMessageSent() once it has been dispatched to the telephony stack.  This WorkingMessage object is no longer useful after this method has been called.
 */
public void send(){
  if (Log.isLoggable(LogTag.TRANSACTION,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str");
  }
  prepareForSave(true);
  final Conversation conv=mConversation;
  String msgTxt=mText.toString();
  if (requiresMms() || addressContainsEmailToMms(conv,msgTxt)) {
    final Uri mmsUri=mMessageUri;
    final PduPersister persister=PduPersister.getPduPersister(mContext);
    final SlideshowModel slideshow=mSlideshow;
    final SendReq sendReq=makeSendReq(conv,mSubject);
    slideshow.prepareForSend();
    new Thread(new Runnable(){
      public void run(){
        sendMmsWorker(conv,mmsUri,persister,slideshow,sendReq);
      }
    }
).start();
  }
 else {
    final String msgText=mText.toString();
    new Thread(new Runnable(){
      public void run(){
        sendSmsWorker(conv,msgText);
      }
    }
).start();
  }
  mDiscarded=true;
}
Program: 44446
Project: 44446
Buggy source:
private static SendReq makeSendReq(Conversation conv,CharSequence subject){
  String[] dests=conv.getRecipients().getNumbers(true);
  if (dests.length == 0) {
    return null;
  }
  SendReq req=new SendReq();
  EncodedStringValue[] encodedNumbers=EncodedStringValue.encodeStrings(dests);
  if (encodedNumbers != null) {
    req.setTo(encodedNumbers);
  }
  if (!TextUtils.isEmpty(subject)) {
    req.setSubject(new EncodedStringValue(subject.toString()));
  }
  req.setDate(System.currentTimeMillis() / 1000L);
  return req;
}

Fixed version (ground truth):
/** 
 * makeSendReq should always return a non-null SendReq, whether the dest addresses are valid or not. 
 */
private static SendReq makeSendReq(Conversation conv,CharSequence subject){
  String[] dests=conv.getRecipients().getNumbers(true);
  SendReq req=new SendReq();
  EncodedStringValue[] encodedNumbers=EncodedStringValue.encodeStrings(dests);
  if (encodedNumbers != null) {
    req.setTo(encodedNumbers);
  }
  if (!TextUtils.isEmpty(subject)) {
    req.setSubject(new EncodedStringValue(subject.toString()));
  }
  req.setDate(System.currentTimeMillis() / 1000L);
  return req;
}
Program: 44447
Project: 44447
Buggy source:
/** 
 * Send this message over the network.  Will call back with onMessageSent() once it has been dispatched to the telephony stack.  This WorkingMessage object is no longer useful after this method has been called.
 */
public void send(){
  if (Log.isLoggable(LogTag.TRANSACTION,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str");
  }
  prepareForSave(true);
  final Conversation conv=mConversation;
  String msgTxt=mText.toString();
  if (requiresMms() || addressContainsEmailToMms(conv,msgTxt)) {
    final Uri mmsUri=mMessageUri;
    final PduPersister persister=PduPersister.getPduPersister(mContext);
    final SlideshowModel slideshow=mSlideshow;
    final SendReq sendReq=makeSendReq(conv,mSubject);
    if (sendReq != null) {
      slideshow.prepareForSend();
      new Thread(new Runnable(){
        public void run(){
          sendMmsWorker(conv,mmsUri,persister,slideshow,sendReq);
        }
      }
).start();
    }
 else {
      Log.e(LogTag.TAG,"String_Node_Str");
    }
  }
 else {
    final String msgText=mText.toString();
    new Thread(new Runnable(){
      public void run(){
        sendSmsWorker(conv,msgText);
      }
    }
).start();
  }
  mDiscarded=true;
}

Fixed version (ground truth):
/** 
 * Send this message over the network.  Will call back with onMessageSent() once it has been dispatched to the telephony stack.  This WorkingMessage object is no longer useful after this method has been called.
 */
public void send(){
  if (Log.isLoggable(LogTag.TRANSACTION,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str");
  }
  prepareForSave(true);
  final Conversation conv=mConversation;
  String msgTxt=mText.toString();
  if (requiresMms() || addressContainsEmailToMms(conv,msgTxt)) {
    final Uri mmsUri=mMessageUri;
    final PduPersister persister=PduPersister.getPduPersister(mContext);
    final SlideshowModel slideshow=mSlideshow;
    final SendReq sendReq=makeSendReq(conv,mSubject);
    slideshow.prepareForSend();
    new Thread(new Runnable(){
      public void run(){
        sendMmsWorker(conv,mmsUri,persister,slideshow,sendReq);
      }
    }
).start();
  }
 else {
    final String msgText=mText.toString();
    new Thread(new Runnable(){
      public void run(){
        sendSmsWorker(conv,msgText);
      }
    }
).start();
  }
  mDiscarded=true;
}
Program: 44448
Project: 44448
Buggy source:
private static SendReq makeSendReq(Conversation conv,CharSequence subject){
  String[] dests=conv.getRecipients().getNumbers(true);
  if (dests.length == 0) {
    return null;
  }
  SendReq req=new SendReq();
  EncodedStringValue[] encodedNumbers=EncodedStringValue.encodeStrings(dests);
  if (encodedNumbers != null) {
    req.setTo(encodedNumbers);
  }
  if (!TextUtils.isEmpty(subject)) {
    req.setSubject(new EncodedStringValue(subject.toString()));
  }
  req.setDate(System.currentTimeMillis() / 1000L);
  return req;
}

Fixed version (ground truth):
/** 
 * makeSendReq should always return a non-null SendReq, whether the dest addresses are valid or not. 
 */
private static SendReq makeSendReq(Conversation conv,CharSequence subject){
  String[] dests=conv.getRecipients().getNumbers(true);
  SendReq req=new SendReq();
  EncodedStringValue[] encodedNumbers=EncodedStringValue.encodeStrings(dests);
  if (encodedNumbers != null) {
    req.setTo(encodedNumbers);
  }
  if (!TextUtils.isEmpty(subject)) {
    req.setSubject(new EncodedStringValue(subject.toString()));
  }
  req.setDate(System.currentTimeMillis() / 1000L);
  return req;
}
Program: 44449
Project: 44449
Buggy source:
/** 
 * Send this message over the network.  Will call back with onMessageSent() once it has been dispatched to the telephony stack.  This WorkingMessage object is no longer useful after this method has been called.
 */
public void send(){
  if (Log.isLoggable(LogTag.TRANSACTION,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str");
  }
  prepareForSave(true);
  final Conversation conv=mConversation;
  String msgTxt=mText.toString();
  if (requiresMms() || addressContainsEmailToMms(conv,msgTxt)) {
    final Uri mmsUri=mMessageUri;
    final PduPersister persister=PduPersister.getPduPersister(mContext);
    final SlideshowModel slideshow=mSlideshow;
    final SendReq sendReq=makeSendReq(conv,mSubject);
    if (sendReq != null) {
      slideshow.prepareForSend();
      new Thread(new Runnable(){
        public void run(){
          sendMmsWorker(conv,mmsUri,persister,slideshow,sendReq);
        }
      }
).start();
    }
 else {
      Log.e(LogTag.TAG,"String_Node_Str");
    }
  }
 else {
    final String msgText=mText.toString();
    new Thread(new Runnable(){
      public void run(){
        sendSmsWorker(conv,msgText);
      }
    }
).start();
  }
  mDiscarded=true;
}

Fixed version (ground truth):
/** 
 * Send this message over the network.  Will call back with onMessageSent() once it has been dispatched to the telephony stack.  This WorkingMessage object is no longer useful after this method has been called.
 */
public void send(){
  if (Log.isLoggable(LogTag.TRANSACTION,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str");
  }
  prepareForSave(true);
  final Conversation conv=mConversation;
  String msgTxt=mText.toString();
  if (requiresMms() || addressContainsEmailToMms(conv,msgTxt)) {
    final Uri mmsUri=mMessageUri;
    final PduPersister persister=PduPersister.getPduPersister(mContext);
    final SlideshowModel slideshow=mSlideshow;
    final SendReq sendReq=makeSendReq(conv,mSubject);
    slideshow.prepareForSend();
    new Thread(new Runnable(){
      public void run(){
        sendMmsWorker(conv,mmsUri,persister,slideshow,sendReq);
      }
    }
).start();
  }
 else {
    final String msgText=mText.toString();
    new Thread(new Runnable(){
      public void run(){
        sendSmsWorker(conv,msgText);
      }
    }
).start();
  }
  mDiscarded=true;
}
Program: 44450
Project: 44450
Buggy source:
private static SendReq makeSendReq(Conversation conv,CharSequence subject){
  String[] dests=conv.getRecipients().getNumbers(true);
  if (dests.length == 0) {
    return null;
  }
  SendReq req=new SendReq();
  EncodedStringValue[] encodedNumbers=EncodedStringValue.encodeStrings(dests);
  if (encodedNumbers != null) {
    req.setTo(encodedNumbers);
  }
  if (!TextUtils.isEmpty(subject)) {
    req.setSubject(new EncodedStringValue(subject.toString()));
  }
  req.setDate(System.currentTimeMillis() / 1000L);
  return req;
}

Fixed version (ground truth):
/** 
 * makeSendReq should always return a non-null SendReq, whether the dest addresses are valid or not. 
 */
private static SendReq makeSendReq(Conversation conv,CharSequence subject){
  String[] dests=conv.getRecipients().getNumbers(true);
  SendReq req=new SendReq();
  EncodedStringValue[] encodedNumbers=EncodedStringValue.encodeStrings(dests);
  if (encodedNumbers != null) {
    req.setTo(encodedNumbers);
  }
  if (!TextUtils.isEmpty(subject)) {
    req.setSubject(new EncodedStringValue(subject.toString()));
  }
  req.setDate(System.currentTimeMillis() / 1000L);
  return req;
}
Program: 44451
Project: 44451
Buggy source:
/** 
 * Send this message over the network.  Will call back with onMessageSent() once it has been dispatched to the telephony stack.  This WorkingMessage object is no longer useful after this method has been called.
 */
public void send(){
  if (Log.isLoggable(LogTag.TRANSACTION,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str");
  }
  prepareForSave(true);
  final Conversation conv=mConversation;
  String msgTxt=mText.toString();
  if (requiresMms() || addressContainsEmailToMms(conv,msgTxt)) {
    final Uri mmsUri=mMessageUri;
    final PduPersister persister=PduPersister.getPduPersister(mContext);
    final SlideshowModel slideshow=mSlideshow;
    final SendReq sendReq=makeSendReq(conv,mSubject);
    if (sendReq != null) {
      slideshow.prepareForSend();
      new Thread(new Runnable(){
        public void run(){
          sendMmsWorker(conv,mmsUri,persister,slideshow,sendReq);
        }
      }
).start();
    }
 else {
      Log.e(LogTag.TAG,"String_Node_Str");
    }
  }
 else {
    final String msgText=mText.toString();
    new Thread(new Runnable(){
      public void run(){
        sendSmsWorker(conv,msgText);
      }
    }
).start();
  }
  mDiscarded=true;
}

Fixed version (ground truth):
/** 
 * Send this message over the network.  Will call back with onMessageSent() once it has been dispatched to the telephony stack.  This WorkingMessage object is no longer useful after this method has been called.
 */
public void send(){
  if (Log.isLoggable(LogTag.TRANSACTION,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str");
  }
  prepareForSave(true);
  final Conversation conv=mConversation;
  String msgTxt=mText.toString();
  if (requiresMms() || addressContainsEmailToMms(conv,msgTxt)) {
    final Uri mmsUri=mMessageUri;
    final PduPersister persister=PduPersister.getPduPersister(mContext);
    final SlideshowModel slideshow=mSlideshow;
    final SendReq sendReq=makeSendReq(conv,mSubject);
    slideshow.prepareForSend();
    new Thread(new Runnable(){
      public void run(){
        sendMmsWorker(conv,mmsUri,persister,slideshow,sendReq);
      }
    }
).start();
  }
 else {
    final String msgText=mText.toString();
    new Thread(new Runnable(){
      public void run(){
        sendSmsWorker(conv,msgText);
      }
    }
).start();
  }
  mDiscarded=true;
}
Program: 44452
Project: 44452
Buggy source:
private static SendReq makeSendReq(Conversation conv,CharSequence subject){
  String[] dests=conv.getRecipients().getNumbers(true);
  if (dests.length == 0) {
    return null;
  }
  SendReq req=new SendReq();
  EncodedStringValue[] encodedNumbers=EncodedStringValue.encodeStrings(dests);
  if (encodedNumbers != null) {
    req.setTo(encodedNumbers);
  }
  if (!TextUtils.isEmpty(subject)) {
    req.setSubject(new EncodedStringValue(subject.toString()));
  }
  req.setDate(System.currentTimeMillis() / 1000L);
  return req;
}

Fixed version (ground truth):
/** 
 * makeSendReq should always return a non-null SendReq, whether the dest addresses are valid or not. 
 */
private static SendReq makeSendReq(Conversation conv,CharSequence subject){
  String[] dests=conv.getRecipients().getNumbers(true);
  SendReq req=new SendReq();
  EncodedStringValue[] encodedNumbers=EncodedStringValue.encodeStrings(dests);
  if (encodedNumbers != null) {
    req.setTo(encodedNumbers);
  }
  if (!TextUtils.isEmpty(subject)) {
    req.setSubject(new EncodedStringValue(subject.toString()));
  }
  req.setDate(System.currentTimeMillis() / 1000L);
  return req;
}
Program: 44453
Project: 44453
Buggy source:
private static void updateContact(final Contact c){
  if (c == null) {
    return;
  }
  c.mIsStale=false;
  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);
      }
    }
  }
}

Fixed version (ground truth):
private static void updateContact(final Contact c){
  if (c == null) {
    return;
  }
  c.mIsStale=false;
  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;
      handleLocalNumber(c);
      for (      UpdateListener l : c.mListeners) {
        if (V)         Log.d(TAG,"String_Node_Str" + l);
        l.onUpdate(c);
      }
    }
  }
}
Program: 44454
Project: 44454
Buggy source:
private boolean canAddToContacts(Contact contact){
  final String name=contact.getName();
  if (!TextUtils.isEmpty(contact.getNumber())) {
    char c=contact.getNumber().charAt(0);
    if (isSpecialChar(c)) {
      return false;
    }
  }
  if (!TextUtils.isEmpty(name)) {
    char c=name.charAt(0);
    if (isSpecialChar(c)) {
      return false;
    }
  }
  if (!(Mms.isEmailAddress(name) || Mms.isPhoneNumber(name))) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean canAddToContacts(Contact contact){
  final String name=contact.getName();
  if (!TextUtils.isEmpty(contact.getNumber())) {
    char c=contact.getNumber().charAt(0);
    if (isSpecialChar(c)) {
      return false;
    }
  }
  if (!TextUtils.isEmpty(name)) {
    char c=name.charAt(0);
    if (isSpecialChar(c)) {
      return false;
    }
  }
  if (!(Mms.isEmailAddress(name) || Mms.isPhoneNumber(name) || MessageUtils.isLocalNumber(contact.getNumber()))) {
    return false;
  }
  return true;
}
Program: 44455
Project: 44455
Buggy source:
private static void updateContact(final Contact c){
  if (c == null) {
    return;
  }
  c.mIsStale=false;
  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);
      }
    }
  }
}

Fixed version (ground truth):
private static void updateContact(final Contact c){
  if (c == null) {
    return;
  }
  c.mIsStale=false;
  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;
      handleLocalNumber(c);
      for (      UpdateListener l : c.mListeners) {
        if (V)         Log.d(TAG,"String_Node_Str" + l);
        l.onUpdate(c);
      }
    }
  }
}
Program: 44456
Project: 44456
Buggy source:
private boolean canAddToContacts(Contact contact){
  final String name=contact.getName();
  if (!TextUtils.isEmpty(contact.getNumber())) {
    char c=contact.getNumber().charAt(0);
    if (isSpecialChar(c)) {
      return false;
    }
  }
  if (!TextUtils.isEmpty(name)) {
    char c=name.charAt(0);
    if (isSpecialChar(c)) {
      return false;
    }
  }
  if (!(Mms.isEmailAddress(name) || Mms.isPhoneNumber(name))) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean canAddToContacts(Contact contact){
  final String name=contact.getName();
  if (!TextUtils.isEmpty(contact.getNumber())) {
    char c=contact.getNumber().charAt(0);
    if (isSpecialChar(c)) {
      return false;
    }
  }
  if (!TextUtils.isEmpty(name)) {
    char c=name.charAt(0);
    if (isSpecialChar(c)) {
      return false;
    }
  }
  if (!(Mms.isEmailAddress(name) || Mms.isPhoneNumber(name) || MessageUtils.isLocalNumber(contact.getNumber()))) {
    return false;
  }
  return true;
}
Program: 44457
Project: 44457
Buggy source:
private static void updateContact(final Contact c){
  if (c == null) {
    return;
  }
  c.mIsStale=false;
  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);
      }
    }
  }
}

Fixed version (ground truth):
private static void updateContact(final Contact c){
  if (c == null) {
    return;
  }
  c.mIsStale=false;
  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;
      handleLocalNumber(c);
      for (      UpdateListener l : c.mListeners) {
        if (V)         Log.d(TAG,"String_Node_Str" + l);
        l.onUpdate(c);
      }
    }
  }
}
Program: 44458
Project: 44458
Buggy source:
private boolean canAddToContacts(Contact contact){
  final String name=contact.getName();
  if (!TextUtils.isEmpty(contact.getNumber())) {
    char c=contact.getNumber().charAt(0);
    if (isSpecialChar(c)) {
      return false;
    }
  }
  if (!TextUtils.isEmpty(name)) {
    char c=name.charAt(0);
    if (isSpecialChar(c)) {
      return false;
    }
  }
  if (!(Mms.isEmailAddress(name) || Mms.isPhoneNumber(name))) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
private boolean canAddToContacts(Contact contact){
  final String name=contact.getName();
  if (!TextUtils.isEmpty(contact.getNumber())) {
    char c=contact.getNumber().charAt(0);
    if (isSpecialChar(c)) {
      return false;
    }
  }
  if (!TextUtils.isEmpty(name)) {
    char c=name.charAt(0);
    if (isSpecialChar(c)) {
      return false;
    }
  }
  if (!(Mms.isEmailAddress(name) || Mms.isPhoneNumber(name) || MessageUtils.isLocalNumber(contact.getNumber()))) {
    return false;
  }
  return true;
}
Program: 44459
Project: 44459
Buggy source:
public static boolean isLocalNumber(String number){
  if (Mms.isEmailAddress(number)) {
    return false;
  }
  return PhoneNumberUtils.compare(number,getLocalNumber());
}

Fixed version (ground truth):
public static boolean isLocalNumber(String number){
  if (number == null) {
    return false;
  }
  if (number.indexOf('@') >= 0) {
    return false;
  }
  return PhoneNumberUtils.compare(number,getLocalNumber());
}
Program: 44460
Project: 44460
Buggy source:
private void updateDraftSmsMessage(long thread_id,String contents){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str",thread_id,contents);
  }
  if (thread_id <= 0) {
    return;
  }
  if (TextUtils.isEmpty(contents)) {
    deleteDraftSmsMessage(thread_id);
    return;
  }
  ContentValues values=new ContentValues(3);
  values.put(Sms.THREAD_ID,thread_id);
  values.put(Sms.BODY,contents);
  values.put(Sms.TYPE,Sms.MESSAGE_TYPE_DRAFT);
  SqliteWrapper.insert(mContext,mContentResolver,Sms.CONTENT_URI,values);
  asyncDeleteDraftMmsMessage(thread_id);
}

Fixed version (ground truth):
private void updateDraftSmsMessage(long thread_id,String contents){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str",thread_id,contents);
  }
  if (thread_id <= 0) {
    return;
  }
  ContentValues values=new ContentValues(3);
  values.put(Sms.THREAD_ID,thread_id);
  values.put(Sms.BODY,contents);
  values.put(Sms.TYPE,Sms.MESSAGE_TYPE_DRAFT);
  SqliteWrapper.insert(mContext,mContentResolver,Sms.CONTENT_URI,values);
  asyncDeleteDraftMmsMessage(thread_id);
}
Program: 44461
Project: 44461
Buggy source:
/** 
 * Save this message as a draft in the conversation previously specified to   {@link setConversation}.
 */
public void saveDraft(){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str");
  }
  if (mDiscarded) {
    return;
  }
  if (mConversation == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  prepareForSave(false);
  if (requiresMms()) {
    asyncUpdateDraftMmsMessage(mConversation);
  }
 else {
    asyncUpdateDraftSmsMessage(mConversation,mText.toString());
  }
  mConversation.setDraftState(true);
}

Fixed version (ground truth):
/** 
 * Save this message as a draft in the conversation previously specified to   {@link setConversation}.
 */
public void saveDraft(){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str");
  }
  if (mDiscarded) {
    return;
  }
  if (mConversation == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  prepareForSave(false);
  if (requiresMms()) {
    asyncUpdateDraftMmsMessage(mConversation);
  }
 else {
    String content=mText.toString();
    if (!TextUtils.isEmpty(content)) {
      asyncUpdateDraftSmsMessage(mConversation,content);
    }
  }
  mConversation.setDraftState(true);
}
Program: 44462
Project: 44462
Buggy source:
public static boolean isLocalNumber(String number){
  if (Mms.isEmailAddress(number)) {
    return false;
  }
  return PhoneNumberUtils.compare(number,getLocalNumber());
}

Fixed version (ground truth):
public static boolean isLocalNumber(String number){
  if (number == null) {
    return false;
  }
  if (number.indexOf('@') >= 0) {
    return false;
  }
  return PhoneNumberUtils.compare(number,getLocalNumber());
}
Program: 44463
Project: 44463
Buggy source:
public Bitmap getBitmap(){
  Bitmap bm=mBitmapCache.get();
  if (bm == null) {
    bm=createThumbnailBitmap(THUMBNAIL_BOUNDS_LIMIT,getUri());
    mBitmapCache=new SoftReference<Bitmap>(bm);
  }
  return bm;
}

Fixed version (ground truth):
public Bitmap getBitmap(){
  return internalGetBitmap(getUri());
}
Program: 44464
Project: 44464
Buggy source:
public Bitmap getBitmapWithDrmCheck() throws DrmException {
  Bitmap bm=mBitmapCache.get();
  if (bm == null) {
    bm=createThumbnailBitmap(THUMBNAIL_BOUNDS_LIMIT,getUriWithDrmCheck());
    mBitmapCache=new SoftReference<Bitmap>(bm);
  }
  return bm;
}

Fixed version (ground truth):
public Bitmap getBitmapWithDrmCheck() throws DrmException {
  return internalGetBitmap(getUriWithDrmCheck());
}
Program: 44465
Project: 44465
Buggy source:
public static boolean isLocalNumber(String number){
  if (Mms.isEmailAddress(number)) {
    return false;
  }
  return PhoneNumberUtils.compare(number,getLocalNumber());
}

Fixed version (ground truth):
public static boolean isLocalNumber(String number){
  if (number == null) {
    return false;
  }
  if (number.indexOf('@') >= 0) {
    return false;
  }
  return PhoneNumberUtils.compare(number,getLocalNumber());
}
Program: 44466
Project: 44466
Buggy source:
private void updateDraftSmsMessage(long thread_id,String contents){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str",thread_id,contents);
  }
  if (thread_id <= 0) {
    return;
  }
  if (TextUtils.isEmpty(contents)) {
    deleteDraftSmsMessage(thread_id);
    return;
  }
  ContentValues values=new ContentValues(3);
  values.put(Sms.THREAD_ID,thread_id);
  values.put(Sms.BODY,contents);
  values.put(Sms.TYPE,Sms.MESSAGE_TYPE_DRAFT);
  SqliteWrapper.insert(mContext,mContentResolver,Sms.CONTENT_URI,values);
  asyncDeleteDraftMmsMessage(thread_id);
}

Fixed version (ground truth):
private void updateDraftSmsMessage(long thread_id,String contents){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str",thread_id,contents);
  }
  if (thread_id <= 0) {
    return;
  }
  ContentValues values=new ContentValues(3);
  values.put(Sms.THREAD_ID,thread_id);
  values.put(Sms.BODY,contents);
  values.put(Sms.TYPE,Sms.MESSAGE_TYPE_DRAFT);
  SqliteWrapper.insert(mContext,mContentResolver,Sms.CONTENT_URI,values);
  asyncDeleteDraftMmsMessage(thread_id);
}
Program: 44467
Project: 44467
Buggy source:
/** 
 * Save this message as a draft in the conversation previously specified to   {@link setConversation}.
 */
public void saveDraft(){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str");
  }
  if (mDiscarded) {
    return;
  }
  if (mConversation == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  prepareForSave(false);
  if (requiresMms()) {
    asyncUpdateDraftMmsMessage(mConversation);
  }
 else {
    asyncUpdateDraftSmsMessage(mConversation,mText.toString());
  }
  mConversation.setDraftState(true);
}

Fixed version (ground truth):
/** 
 * Save this message as a draft in the conversation previously specified to   {@link setConversation}.
 */
public void saveDraft(){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str");
  }
  if (mDiscarded) {
    return;
  }
  if (mConversation == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  prepareForSave(false);
  if (requiresMms()) {
    asyncUpdateDraftMmsMessage(mConversation);
  }
 else {
    String content=mText.toString();
    if (!TextUtils.isEmpty(content)) {
      asyncUpdateDraftSmsMessage(mConversation,content);
    }
  }
  mConversation.setDraftState(true);
}
Program: 44468
Project: 44468
Buggy source:
public Bitmap getBitmap(){
  Bitmap bm=mBitmapCache.get();
  if (bm == null) {
    bm=createThumbnailBitmap(THUMBNAIL_BOUNDS_LIMIT,getUri());
    mBitmapCache=new SoftReference<Bitmap>(bm);
  }
  return bm;
}

Fixed version (ground truth):
public Bitmap getBitmap(){
  return internalGetBitmap(getUri());
}
Program: 44469
Project: 44469
Buggy source:
public Bitmap getBitmapWithDrmCheck() throws DrmException {
  Bitmap bm=mBitmapCache.get();
  if (bm == null) {
    bm=createThumbnailBitmap(THUMBNAIL_BOUNDS_LIMIT,getUriWithDrmCheck());
    mBitmapCache=new SoftReference<Bitmap>(bm);
  }
  return bm;
}

Fixed version (ground truth):
public Bitmap getBitmapWithDrmCheck() throws DrmException {
  return internalGetBitmap(getUriWithDrmCheck());
}
Program: 44470
Project: 44470
Buggy source:
private void updateDraftSmsMessage(long thread_id,String contents){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str",thread_id,contents);
  }
  if (thread_id <= 0) {
    return;
  }
  if (TextUtils.isEmpty(contents)) {
    deleteDraftSmsMessage(thread_id);
    return;
  }
  ContentValues values=new ContentValues(3);
  values.put(Sms.THREAD_ID,thread_id);
  values.put(Sms.BODY,contents);
  values.put(Sms.TYPE,Sms.MESSAGE_TYPE_DRAFT);
  SqliteWrapper.insert(mContext,mContentResolver,Sms.CONTENT_URI,values);
  asyncDeleteDraftMmsMessage(thread_id);
}

Fixed version (ground truth):
private void updateDraftSmsMessage(long thread_id,String contents){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str",thread_id,contents);
  }
  if (thread_id <= 0) {
    return;
  }
  ContentValues values=new ContentValues(3);
  values.put(Sms.THREAD_ID,thread_id);
  values.put(Sms.BODY,contents);
  values.put(Sms.TYPE,Sms.MESSAGE_TYPE_DRAFT);
  SqliteWrapper.insert(mContext,mContentResolver,Sms.CONTENT_URI,values);
  asyncDeleteDraftMmsMessage(thread_id);
}
Program: 44471
Project: 44471
Buggy source:
/** 
 * Save this message as a draft in the conversation previously specified to   {@link setConversation}.
 */
public void saveDraft(){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str");
  }
  if (mDiscarded) {
    return;
  }
  if (mConversation == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  prepareForSave(false);
  if (requiresMms()) {
    asyncUpdateDraftMmsMessage(mConversation);
  }
 else {
    asyncUpdateDraftSmsMessage(mConversation,mText.toString());
  }
  mConversation.setDraftState(true);
}

Fixed version (ground truth):
/** 
 * Save this message as a draft in the conversation previously specified to   {@link setConversation}.
 */
public void saveDraft(){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str");
  }
  if (mDiscarded) {
    return;
  }
  if (mConversation == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  prepareForSave(false);
  if (requiresMms()) {
    asyncUpdateDraftMmsMessage(mConversation);
  }
 else {
    String content=mText.toString();
    if (!TextUtils.isEmpty(content)) {
      asyncUpdateDraftSmsMessage(mConversation,content);
    }
  }
  mConversation.setDraftState(true);
}
Program: 44472
Project: 44472
Buggy source:
public static boolean isLocalNumber(String number){
  return PhoneNumberUtils.compare(number,getLocalNumber());
}

Fixed version (ground truth):
public static boolean isLocalNumber(String number){
  if (Mms.isEmailAddress(number)) {
    return false;
  }
  return PhoneNumberUtils.compare(number,getLocalNumber());
}
Program: 44473
Project: 44473
Buggy source:
public Bitmap getBitmap(){
  Bitmap bm=mBitmapCache.get();
  if (bm == null) {
    bm=createThumbnailBitmap(THUMBNAIL_BOUNDS_LIMIT,getUri());
    mBitmapCache=new SoftReference<Bitmap>(bm);
  }
  return bm;
}

Fixed version (ground truth):
public Bitmap getBitmap(){
  return internalGetBitmap(getUri());
}
Program: 44474
Project: 44474
Buggy source:
public Bitmap getBitmapWithDrmCheck() throws DrmException {
  Bitmap bm=mBitmapCache.get();
  if (bm == null) {
    bm=createThumbnailBitmap(THUMBNAIL_BOUNDS_LIMIT,getUriWithDrmCheck());
    mBitmapCache=new SoftReference<Bitmap>(bm);
  }
  return bm;
}

Fixed version (ground truth):
public Bitmap getBitmapWithDrmCheck() throws DrmException {
  return internalGetBitmap(getUriWithDrmCheck());
}
Program: 44475
Project: 44475
Buggy source:
private void updateDraftSmsMessage(long thread_id,String contents){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str",thread_id,contents);
  }
  if (thread_id <= 0) {
    return;
  }
  if (TextUtils.isEmpty(contents)) {
    deleteDraftSmsMessage(thread_id);
    return;
  }
  ContentValues values=new ContentValues(3);
  values.put(Sms.THREAD_ID,thread_id);
  values.put(Sms.BODY,contents);
  values.put(Sms.TYPE,Sms.MESSAGE_TYPE_DRAFT);
  SqliteWrapper.insert(mContext,mContentResolver,Sms.CONTENT_URI,values);
  asyncDeleteDraftMmsMessage(thread_id);
}

Fixed version (ground truth):
private void updateDraftSmsMessage(long thread_id,String contents){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str",thread_id,contents);
  }
  if (thread_id <= 0) {
    return;
  }
  ContentValues values=new ContentValues(3);
  values.put(Sms.THREAD_ID,thread_id);
  values.put(Sms.BODY,contents);
  values.put(Sms.TYPE,Sms.MESSAGE_TYPE_DRAFT);
  SqliteWrapper.insert(mContext,mContentResolver,Sms.CONTENT_URI,values);
  asyncDeleteDraftMmsMessage(thread_id);
}
Program: 44476
Project: 44476
Buggy source:
/** 
 * Save this message as a draft in the conversation previously specified to   {@link setConversation}.
 */
public void saveDraft(){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str");
  }
  if (mDiscarded) {
    return;
  }
  if (mConversation == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  prepareForSave(false);
  if (requiresMms()) {
    asyncUpdateDraftMmsMessage(mConversation);
  }
 else {
    asyncUpdateDraftSmsMessage(mConversation,mText.toString());
  }
  mConversation.setDraftState(true);
}

Fixed version (ground truth):
/** 
 * Save this message as a draft in the conversation previously specified to   {@link setConversation}.
 */
public void saveDraft(){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str");
  }
  if (mDiscarded) {
    return;
  }
  if (mConversation == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  prepareForSave(false);
  if (requiresMms()) {
    asyncUpdateDraftMmsMessage(mConversation);
  }
 else {
    String content=mText.toString();
    if (!TextUtils.isEmpty(content)) {
      asyncUpdateDraftSmsMessage(mConversation,content);
    }
  }
  mConversation.setDraftState(true);
}
Program: 44477
Project: 44477
Buggy source:
private void updateDraftSmsMessage(long thread_id,String contents){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str",thread_id,contents);
  }
  if (thread_id <= 0) {
    return;
  }
  if (TextUtils.isEmpty(contents)) {
    deleteDraftSmsMessage(thread_id);
    return;
  }
  ContentValues values=new ContentValues(3);
  values.put(Sms.THREAD_ID,thread_id);
  values.put(Sms.BODY,contents);
  values.put(Sms.TYPE,Sms.MESSAGE_TYPE_DRAFT);
  SqliteWrapper.insert(mContext,mContentResolver,Sms.CONTENT_URI,values);
  asyncDeleteDraftMmsMessage(thread_id);
}

Fixed version (ground truth):
private void updateDraftSmsMessage(long thread_id,String contents){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str",thread_id,contents);
  }
  if (thread_id <= 0) {
    return;
  }
  ContentValues values=new ContentValues(3);
  values.put(Sms.THREAD_ID,thread_id);
  values.put(Sms.BODY,contents);
  values.put(Sms.TYPE,Sms.MESSAGE_TYPE_DRAFT);
  SqliteWrapper.insert(mContext,mContentResolver,Sms.CONTENT_URI,values);
  asyncDeleteDraftMmsMessage(thread_id);
}
Program: 44478
Project: 44478
Buggy source:
/** 
 * Save this message as a draft in the conversation previously specified to   {@link setConversation}.
 */
public void saveDraft(){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str");
  }
  if (mDiscarded) {
    return;
  }
  if (mConversation == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  prepareForSave(false);
  if (requiresMms()) {
    asyncUpdateDraftMmsMessage(mConversation);
  }
 else {
    asyncUpdateDraftSmsMessage(mConversation,mText.toString());
  }
  mConversation.setDraftState(true);
}

Fixed version (ground truth):
/** 
 * Save this message as a draft in the conversation previously specified to   {@link setConversation}.
 */
public void saveDraft(){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str");
  }
  if (mDiscarded) {
    return;
  }
  if (mConversation == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  prepareForSave(false);
  if (requiresMms()) {
    asyncUpdateDraftMmsMessage(mConversation);
  }
 else {
    String content=mText.toString();
    if (!TextUtils.isEmpty(content)) {
      asyncUpdateDraftSmsMessage(mConversation,content);
    }
  }
  mConversation.setDraftState(true);
}
Program: 44479
Project: 44479
Buggy source:
static Contact get(String number){
  if (Mms.isEmailAddress(number))   return getEmail(number);
synchronized (sInstance) {
    for (    Contact c : sInstance.mCache) {
      if (PhoneNumberUtils.compare(number,c.mNumber)) {
        return c;
      }
    }
    return null;
  }
}

Fixed version (ground truth):
static Contact get(String number){
  if (Mms.isEmailAddress(number))   return getEmail(number);
synchronized (sInstance) {
    for (    Contact c : sInstance.mCache) {
      if (number.equals(c.mNumber) || PhoneNumberUtils.compare(number,c.mNumber)) {
        return c;
      }
    }
    return null;
  }
}
Program: 44480
Project: 44480
Buggy source:
static void dumpCache(){
  if (DEBUG) {
synchronized (sInstance) {
      Log.v(TAG,"String_Node_Str");
      for (      Conversation c : sInstance.mCache) {
        Log.v(TAG,"String_Node_Str" + c + "String_Node_Str"+ c.getThreadId()+ "String_Node_Str"+ c.hashCode());
      }
    }
  }
}

Fixed version (ground truth):
static void dumpCache(){
  if (DEBUG) {
synchronized (sInstance) {
      LogTag.debug("String_Node_Str");
      for (      Conversation c : sInstance.mCache) {
        LogTag.debug("String_Node_Str" + c + "String_Node_Str"+ c.getThreadId()+ "String_Node_Str"+ c.hashCode());
      }
    }
  }
}
Program: 44481
Project: 44481
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 (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);
  }
}

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) {
      LogTag.debug("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: 44482
Project: 44482
Buggy source:
static void remove(long threadId){
  if (DEBUG) {
    Log.v(TAG,"String_Node_Str" + threadId);
    dumpCache();
  }
  for (  Conversation c : sInstance.mCache) {
    if (c.getThreadId() == threadId) {
      sInstance.mCache.remove(c);
      return;
    }
  }
}

Fixed version (ground truth):
static void remove(long threadId){
  if (DEBUG) {
    LogTag.debug("String_Node_Str" + threadId);
    dumpCache();
  }
  for (  Conversation c : sInstance.mCache) {
    if (c.getThreadId() == threadId) {
      sInstance.mCache.remove(c);
      return;
    }
  }
}
Program: 44483
Project: 44483
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) {
    if (DEBUG) {
      Log.v(TAG,"String_Node_Str" + list);
      dumpCache();
    }
    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) {
      LogTag.debug("String_Node_Str" + list);
      dumpCache();
    }
    for (    Conversation c : sInstance.mCache) {
      if (c.getRecipients().equals(list)) {
        return c;
      }
    }
  }
  return null;
}
Program: 44484
Project: 44484
Buggy source:
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);
          try {
            Cache.put(conv);
          }
 catch (          IllegalStateException e) {
            Log.e(TAG,"String_Node_Str");
          }
        }
 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 (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
      LogTag.debug("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);
          try {
            Cache.put(conv);
          }
 catch (          IllegalStateException e) {
            LogTag.error("String_Node_Str");
          }
        }
 else {
          fillFromCursor(context,conv,c,true);
        }
      }
    }
  finally {
      c.close();
    }
    Cache.keepOnly(threadsOnDisk);
  }
}
Program: 44485
Project: 44485
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 (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;
}

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) {
    LogTag.debug("String_Node_Str" + mThreadId);
  }
  if (mThreadId <= 0) {
    mThreadId=getOrCreateThreadId(mContext,mRecipients);
  }
  if (DEBUG) {
    LogTag.debug("String_Node_Str" + mThreadId);
  }
  return mThreadId;
}
Program: 44486
Project: 44486
Buggy source:
public synchronized void clearThreadId(){
  Cache.remove(mThreadId);
  mThreadId=0;
}

Fixed version (ground truth):
public synchronized void clearThreadId(){
  if (Log.isLoggable(LogTag.APP,Log.VERBOSE)) {
    LogTag.debug("String_Node_Str" + mThreadId + "String_Node_Str");
  }
  Cache.remove(mThreadId);
  mThreadId=0;
}
Program: 44487
Project: 44487
Buggy source:
private boolean loadFromThreadId(long threadId){
  Cursor c=mContext.getContentResolver().query(sAllThreadsUri,ALL_THREADS_PROJECTION,"String_Node_Str" + Long.toString(threadId),null,null);
  try {
    if (c.moveToFirst()) {
      fillFromCursor(mContext,this,c,true);
    }
 else {
      Log.e(TAG,"String_Node_Str" + threadId);
      return false;
    }
  }
  finally {
    c.close();
  }
  return true;
}

Fixed version (ground truth):
private boolean loadFromThreadId(long threadId){
  Cursor c=mContext.getContentResolver().query(sAllThreadsUri,ALL_THREADS_PROJECTION,"String_Node_Str" + Long.toString(threadId),null,null);
  try {
    if (c.moveToFirst()) {
      fillFromCursor(mContext,this,c,true);
    }
 else {
      LogTag.error("String_Node_Str" + threadId);
      return false;
    }
  }
  finally {
    c.close();
  }
  return true;
}