Program: 94660
Project: 94660
Buggy source:
/** 
 * Read the contents of the packet being sent from the server and handle any events accordingly.
 * @return the String returned from {@link Session#read()}
 */
String read() throws IOException {
  final String input=super.read();
  if (input == null) {
    return null;
  }
  final String[] lines=StringUtils.split(input,"String_Node_Str");
  for (int i=0; i < lines.length; i++) {
    if (lines[i].startsWith("String_Node_Str")) {
      final String[] split=StringUtils.splitOnSpace(lines[i]);
      Contact contact=contactList.getContact(split[4]);
      if (contact == null) {
        contact=new Contact(split[4],split[5]);
      }
      contacts.add(contact);
      fireContactJoinedEvent(contact);
    }
 else     if (lines[i].startsWith("String_Node_Str")) {
      final String[] split=StringUtils.splitOnSpace(lines[i]);
      Contact contact=contactList.getContact(split[2]);
      if (contact == null) {
        contact=new Contact(split[1],split[2]);
      }
      contacts.add(contact);
      fireContactJoinedEvent(contact);
    }
 else     if (lines[i].startsWith("String_Node_Str")) {
      final String[] split=StringUtils.splitOnSpace(lines[i]);
      if (split.length == 2) {
        final Contact contact=findContact(split[1]);
        contacts.remove(contact);
        fireContactLeftEvent(contact);
        if (contacts.isEmpty()) {
          close();
        }
      }
 else {
        fireSessionTimedOutEvent();
        close();
      }
    }
 else     if (lines[i].startsWith("String_Node_Str")) {
      if (input.indexOf("String_Node_Str") != -1) {
        final String trim=input.substring(input.indexOf("String_Node_Str"));
        final String content=StringUtils.splitSubstring(trim,"String_Node_Str",3);
        fireContactIsTypingEvent(findContact(StringUtils.splitOnSpace(content)[1]));
      }
 else       if (input.indexOf("String_Node_Str") != -1) {
        final int index=input.indexOf("String_Node_Str") == -1 ? 2 : 3;
        final String[] contents=StringUtils.split(input,"String_Node_Str",index);
        String[] split=StringUtils.splitOnSpace(contents[index - 2]);
        final Contact contact=findContact(split[1]);
        final int count=Integer.parseInt(split[3]);
        split=StringUtils.split(contents[index - 1],"String_Node_Str");
        final int text=count - (split[0].getBytes("String_Node_Str").length + 4);
        fireMessageReceivedEvent(contact,new String(split[1].getBytes("String_Node_Str"),0,text,"String_Node_Str"));
      }
    }
  }
  return input;
}

Fixed version (ground truth):
/** 
 * Read the contents of the packet being sent from the server and handle any events accordingly.
 * @return the String returned from {@link Session#read()}
 */
String read() throws IOException {
  final String input=super.read();
  if (input == null) {
    return null;
  }
  final String[] lines=StringUtils.split(input,"String_Node_Str");
  for (int i=0; i < lines.length; i++) {
    if (lines[i].startsWith("String_Node_Str")) {
      final String[] split=StringUtils.splitOnSpace(lines[i]);
      Contact contact=contactList.getContact(split[4]);
      if (contact == null) {
        contact=new Contact(split[4],split[5]);
      }
      contacts.add(contact);
      fireContactJoinedEvent(contact);
    }
 else     if (lines[i].startsWith("String_Node_Str")) {
      final String[] split=StringUtils.splitOnSpace(lines[i]);
      Contact contact=contactList.getContact(split[2]);
      if (contact == null) {
        contact=new Contact(split[1],split[2]);
      }
      contacts.add(contact);
      fireContactJoinedEvent(contact);
    }
 else     if (lines[i].startsWith("String_Node_Str")) {
      final String[] split=StringUtils.splitOnSpace(lines[i]);
      if (split.length == 2) {
        final Contact contact=findContact(split[1]);
        contacts.remove(contact);
        fireContactLeftEvent(contact);
        if (contacts.isEmpty()) {
          close();
        }
      }
 else {
        fireSessionTimedOutEvent();
        close();
      }
    }
 else     if (lines[i].startsWith("String_Node_Str")) {
      if (input.indexOf("String_Node_Str") != -1) {
        final String trim=input.substring(input.indexOf("String_Node_Str"));
        final String content=StringUtils.splitSubstring(trim,"String_Node_Str",3);
        fireContactIsTypingEvent(findContact(StringUtils.splitOnSpace(content)[1]));
      }
 else       if (input.indexOf("String_Node_Str") != -1) {
        final int index=input.indexOf("String_Node_Str") == -1 ? 2 : 3;
        final String[] contents=StringUtils.split(input,"String_Node_Str",index);
        String[] split=StringUtils.splitOnSpace(contents[index - 2]);
        final Contact contact=findContact(split[1]);
        final int count=Integer.parseInt(split[3]);
        split=StringUtils.split(contents[index - 1],"String_Node_Str",2);
        final int text=count - (split[0].getBytes("String_Node_Str").length + 4);
        fireMessageReceivedEvent(contact,new String(split[1].getBytes("String_Node_Str"),0,text,"String_Node_Str"));
      }
    }
  }
  return input;
}