Program: 6742
Project: 6742
Buggy source:
@Override @Transactional(rollbackFor=Exception.class) public void lovesChanged(MidasUser u,Playlist oldP,Playlist newP) throws IOException {
  long uid=u.getUserId();
  Set<String> curArtists=new HashSet<String>();
  for (  String sid : oldP.getStreamIds()) {
    Stream s=streamDao.getStream(sid);
    curArtists.add(s.getArtist());
  }
  List<String> newArtists=new ArrayList<String>();
  for (  String sid : newP.getStreamIds()) {
    if (!oldP.getStreamIds().contains(sid)) {
      Stream s=streamDao.getStream(sid);
      String artist=s.getArtist();
      if (!curArtists.contains(artist))       newArtists.add(artist);
    }
  }
  if (newArtists.size() > 0) {
    List<String> al=new ArrayList<String>(newArtists);
    Collections.sort(al);
    int msgSizeLimit=140;
    String okMsg="String_Node_Str" + numItems(newArtists,"String_Node_Str") + "String_Node_Str";
    String url=appConfig.getInitParam("String_Node_Str") + "String_Node_Str" + Long.toHexString(uid)+ "String_Node_Str";
    for (int i=0; i < newArtists.size(); i++) {
      StringBuffer sb=new StringBuffer("String_Node_Str");
      for (int j=0; j <= i; j++) {
        if (j != 0)         sb.append("String_Node_Str");
        sb.append(newArtists.get(j));
      }
      if (i < (newArtists.size() - 1)) {
        int numOtherArtists=newArtists.size() - (i + 1);
        sb.append("String_Node_Str").append(numItems(numOtherArtists,"String_Node_Str"));
      }
      sb.append("String_Node_Str");
      String msg=sb.toString();
      if ((msg.length() + url.length()) <= msgSizeLimit)       okMsg=msg;
 else       break;
    }
    MidasUserConfig muc=userConfigDao.getUserConfig(u.getUserId());
    if (muc != null) {
      if (muc.getItem("String_Node_Str") != null) {
        String fbStr=muc.getItem("String_Node_Str");
        if (fbStr == null || Boolean.valueOf(fbStr))         facebook.postSpecialPlaylistToFacebook(muc,uid,"String_Node_Str",okMsg);
      }
      if (muc.getItem("String_Node_Str") != null) {
        String twitStr=muc.getItem("String_Node_Str");
        if (twitStr == null || Boolean.valueOf(twitStr))         twitter.postSpecialPlaylistToTwitter(muc,uid,"String_Node_Str",okMsg);
      }
    }
    event.specialPlaylistPosted(u,uid,"String_Node_Str");
    notification.lovesAdded(u,al);
  }
}

Fixed version (ground truth):
@Override @Transactional(rollbackFor=Exception.class) public void lovesChanged(MidasUser u,Playlist oldP,Playlist newP) throws IOException {
  long uid=u.getUserId();
  Set<String> curArtists=new HashSet<String>();
  for (  String sid : oldP.getStreamIds()) {
    Stream s=streamDao.getStream(sid);
    curArtists.add(s.getArtist());
  }
  Set<String> newArtists=new HashSet<String>();
  for (  String sid : newP.getStreamIds()) {
    if (!oldP.getStreamIds().contains(sid)) {
      Stream s=streamDao.getStream(sid);
      String artist=s.getArtist();
      if (!curArtists.contains(artist))       newArtists.add(artist);
    }
  }
  if (newArtists.size() > 0) {
    List<String> al=new ArrayList<String>(newArtists);
    Collections.sort(al);
    int msgSizeLimit=140;
    String okMsg="String_Node_Str" + numItems(newArtists,"String_Node_Str") + "String_Node_Str";
    String url=appConfig.getInitParam("String_Node_Str") + "String_Node_Str" + Long.toHexString(uid)+ "String_Node_Str";
    for (int i=0; i < newArtists.size(); i++) {
      StringBuffer sb=new StringBuffer("String_Node_Str");
      for (int j=0; j <= i; j++) {
        if (j != 0)         sb.append("String_Node_Str");
        sb.append(al.get(j));
      }
      if (i < (newArtists.size() - 1)) {
        int numOtherArtists=newArtists.size() - (i + 1);
        sb.append("String_Node_Str").append(numItems(numOtherArtists,"String_Node_Str"));
      }
      sb.append("String_Node_Str");
      String msg=sb.toString();
      if ((msg.length() + url.length()) <= msgSizeLimit)       okMsg=msg;
 else       break;
    }
    MidasUserConfig muc=userConfigDao.getUserConfig(u.getUserId());
    if (muc != null) {
      if (muc.getItem("String_Node_Str") != null) {
        String fbStr=muc.getItem("String_Node_Str");
        if (fbStr == null || Boolean.valueOf(fbStr))         facebook.postSpecialPlaylistToFacebook(muc,uid,"String_Node_Str",okMsg);
      }
      if (muc.getItem("String_Node_Str") != null) {
        String twitStr=muc.getItem("String_Node_Str");
        if (twitStr == null || Boolean.valueOf(twitStr))         twitter.postSpecialPlaylistToTwitter(muc,uid,"String_Node_Str",okMsg);
      }
    }
    event.specialPlaylistPosted(u,uid,"String_Node_Str");
    notification.lovesAdded(u,al);
  }
}