nus-yam/ex-repair huggingface dataset:
Program: 20497
Project: 20497
Buggy source:
/** 
 * Parses a MUCUser packet (extension sub-packet).
 * @param parser the XML parser, positioned at the starting element of the extension.
 * @return a PacketExtension.
 * @throws Exception if a parsing error occurs.
 */
public PacketExtension parseExtension(XmlPullParser parser) throws Exception {
  MUCUser mucUser=new MUCUser();
  boolean done=false;
  while (!done) {
    int eventType=parser.next();
    if (eventType == XmlPullParser.START_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        mucUser.setInvite(parseInvite(parser));
      }
      if (parser.getName().equals("String_Node_Str")) {
        mucUser.setItem(parseItem(parser));
      }
      if (parser.getName().equals("String_Node_Str")) {
        mucUser.setPassword(parser.getText());
      }
      if (parser.getName().equals("String_Node_Str")) {
        mucUser.setStatus(new MUCUser.Status(parser.getAttributeValue("String_Node_Str","String_Node_Str")));
      }
      if (parser.getName().equals("String_Node_Str")) {
        mucUser.setDecline(parseDecline(parser));
      }
      if (parser.getName().equals("String_Node_Str")) {
        mucUser.setDestroy(parseDestroy(parser));
      }
    }
 else     if (eventType == XmlPullParser.END_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        done=true;
      }
    }
  }
  return mucUser;
}

Fixed version (ground truth):
/** 
 * Parses a MUCUser packet (extension sub-packet).
 * @param parser the XML parser, positioned at the starting element of the extension.
 * @return a PacketExtension.
 * @throws Exception if a parsing error occurs.
 */
public PacketExtension parseExtension(XmlPullParser parser) throws Exception {
  MUCUser mucUser=new MUCUser();
  boolean done=false;
  while (!done) {
    int eventType=parser.next();
    if (eventType == XmlPullParser.START_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        mucUser.setInvite(parseInvite(parser));
      }
      if (parser.getName().equals("String_Node_Str")) {
        mucUser.setItem(parseItem(parser));
      }
      if (parser.getName().equals("String_Node_Str")) {
        mucUser.setPassword(parser.nextText());
      }
      if (parser.getName().equals("String_Node_Str")) {
        mucUser.setStatus(new MUCUser.Status(parser.getAttributeValue("String_Node_Str","String_Node_Str")));
      }
      if (parser.getName().equals("String_Node_Str")) {
        mucUser.setDecline(parseDecline(parser));
      }
      if (parser.getName().equals("String_Node_Str")) {
        mucUser.setDestroy(parseDestroy(parser));
      }
    }
 else     if (eventType == XmlPullParser.END_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        done=true;
      }
    }
  }
  return mucUser;
}
Program: 20498
Project: 20498
Buggy source:
private MUCUser.Destroy parseDestroy(XmlPullParser parser) throws Exception {
  boolean done=false;
  MUCUser.Destroy destroy=new MUCUser.Destroy();
  destroy.setJid(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
  while (!done) {
    int eventType=parser.next();
    if (eventType == XmlPullParser.START_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        destroy.setReason(parser.getText());
      }
    }
 else     if (eventType == XmlPullParser.END_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        done=true;
      }
    }
  }
  return destroy;
}

Fixed version (ground truth):
private MUCUser.Destroy parseDestroy(XmlPullParser parser) throws Exception {
  boolean done=false;
  MUCUser.Destroy destroy=new MUCUser.Destroy();
  destroy.setJid(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
  while (!done) {
    int eventType=parser.next();
    if (eventType == XmlPullParser.START_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        destroy.setReason(parser.nextText());
      }
    }
 else     if (eventType == XmlPullParser.END_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        done=true;
      }
    }
  }
  return destroy;
}
Program: 20499
Project: 20499
Buggy source:
private MUCUser.Invite parseInvite(XmlPullParser parser) throws Exception {
  boolean done=false;
  MUCUser.Invite invite=new MUCUser.Invite();
  invite.setFrom(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
  invite.setTo(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
  while (!done) {
    int eventType=parser.next();
    if (eventType == XmlPullParser.START_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        invite.setReason(parser.getText());
      }
    }
 else     if (eventType == XmlPullParser.END_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        done=true;
      }
    }
  }
  return invite;
}

Fixed version (ground truth):
private MUCUser.Invite parseInvite(XmlPullParser parser) throws Exception {
  boolean done=false;
  MUCUser.Invite invite=new MUCUser.Invite();
  invite.setFrom(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
  invite.setTo(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
  while (!done) {
    int eventType=parser.next();
    if (eventType == XmlPullParser.START_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        invite.setReason(parser.nextText());
      }
    }
 else     if (eventType == XmlPullParser.END_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        done=true;
      }
    }
  }
  return invite;
}
Program: 20500
Project: 20500
Buggy source:
private MUCUser.Decline parseDecline(XmlPullParser parser) throws Exception {
  boolean done=false;
  MUCUser.Decline decline=new MUCUser.Decline();
  decline.setFrom(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
  decline.setTo(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
  while (!done) {
    int eventType=parser.next();
    if (eventType == XmlPullParser.START_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        decline.setReason(parser.getText());
      }
    }
 else     if (eventType == XmlPullParser.END_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        done=true;
      }
    }
  }
  return decline;
}

Fixed version (ground truth):
private MUCUser.Decline parseDecline(XmlPullParser parser) throws Exception {
  boolean done=false;
  MUCUser.Decline decline=new MUCUser.Decline();
  decline.setFrom(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
  decline.setTo(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
  while (!done) {
    int eventType=parser.next();
    if (eventType == XmlPullParser.START_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        decline.setReason(parser.nextText());
      }
    }
 else     if (eventType == XmlPullParser.END_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        done=true;
      }
    }
  }
  return decline;
}
Program: 20501
Project: 20501
Buggy source:
private MUCUser.Item parseItem(XmlPullParser parser) throws Exception {
  boolean done=false;
  MUCUser.Item item=new MUCUser.Item(parser.getAttributeValue("String_Node_Str","String_Node_Str"),parser.getAttributeValue("String_Node_Str","String_Node_Str"));
  item.setNick(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
  item.setJid(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
  while (!done) {
    int eventType=parser.next();
    if (eventType == XmlPullParser.START_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        item.setActor(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
      }
      if (parser.getName().equals("String_Node_Str")) {
        item.setReason(parser.getText());
      }
    }
 else     if (eventType == XmlPullParser.END_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        done=true;
      }
    }
  }
  return item;
}

Fixed version (ground truth):
private MUCUser.Item parseItem(XmlPullParser parser) throws Exception {
  boolean done=false;
  MUCUser.Item item=new MUCUser.Item(parser.getAttributeValue("String_Node_Str","String_Node_Str"),parser.getAttributeValue("String_Node_Str","String_Node_Str"));
  item.setNick(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
  item.setJid(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
  while (!done) {
    int eventType=parser.next();
    if (eventType == XmlPullParser.START_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        item.setActor(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
      }
      if (parser.getName().equals("String_Node_Str")) {
        item.setReason(parser.nextText());
      }
    }
 else     if (eventType == XmlPullParser.END_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        done=true;
      }
    }
  }
  return item;
}
Program: 20502
Project: 20502
Buggy source:
/** 
 * Process listeners.
 */
private void processListeners(){
  while (!done) {
    Packet sentPacket;
synchronized (sentPackets) {
      while (!done && sentPackets.size() == 0) {
        try {
          sentPackets.wait(2000);
        }
 catch (        InterruptedException ie) {
        }
      }
      if (sentPackets.size() > 0) {
        sentPacket=(Packet)sentPackets.removeLast();
      }
 else {
        sentPacket=null;
      }
    }
    if (sentPacket != null) {
      int size=listeners.size();
      for (int i=0; i < size; i++) {
        ListenerWrapper listenerWrapper=(ListenerWrapper)listeners.get(i);
        if (listenerWrapper != null) {
          listenerWrapper.notifyListener(sentPacket);
        }
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Process listeners.
 */
private void processListeners(){
  while (!done) {
    Packet sentPacket;
synchronized (sentPackets) {
      while (!done && sentPackets.size() == 0) {
        try {
          sentPackets.wait(2000);
        }
 catch (        InterruptedException ie) {
        }
      }
      if (sentPackets.size() > 0) {
        sentPacket=(Packet)sentPackets.removeLast();
      }
 else {
        sentPacket=null;
      }
    }
    if (sentPacket != null) {
synchronized (listeners) {
        if (listeners.size() > 0) {
          for (int i=listeners.size() - 1; i >= 0; i--) {
            if (listeners.get(i) == null) {
              listeners.remove(i);
            }
          }
        }
      }
      int size=listeners.size();
      for (int i=0; i < size; i++) {
        ListenerWrapper listenerWrapper=(ListenerWrapper)listeners.get(i);
        if (listenerWrapper != null) {
          listenerWrapper.notifyListener(sentPacket);
        }
      }
    }
  }
}
Program: 20503
Project: 20503
Buggy source:
/** 
 * Removes a packet listener.
 * @param packetListener the packet listener to remove.
 */
public void removePacketListener(PacketListener packetListener){
synchronized (listeners) {
    listeners.remove(packetListener);
  }
}

Fixed version (ground truth):
/** 
 * Removes a packet listener.
 * @param packetListener the packet listener to remove.
 */
public void removePacketListener(PacketListener packetListener){
synchronized (listeners) {
    for (int i=0; i < listeners.size(); i++) {
      ListenerWrapper wrapper=(ListenerWrapper)listeners.get(i);
      if (wrapper != null && wrapper.packetListener.equals(packetListener)) {
        listeners.set(i,null);
      }
    }
  }
}
Program: 20505
Project: 20505
Buggy source:
/** 
 * Returns the roster entry associated with the given XMPP address or <tt>null</tt> if the user is not an entry in the roster.
 * @param user the XMPP address of the user (eg "jsmith@example.com").
 * @return the roster entry or <tt>null</tt> if it does not exist.
 */
public RosterEntry getEntry(String user){
  if (user == null) {
    return null;
  }
  user=StringUtils.parseBareAddress(user);
synchronized (entries) {
    for (Iterator i=getFiledEntriesList().iterator(); i.hasNext(); ) {
      RosterEntry entry=(RosterEntry)i.next();
      if (entry.getUser().equals(user)) {
        return entry;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the roster entry associated with the given XMPP address or <tt>null</tt> if the user is not an entry in the roster.
 * @param user the XMPP address of the user (eg "jsmith@example.com").
 * @return the roster entry or <tt>null</tt> if it does not exist.
 */
public RosterEntry getEntry(String user){
  if (user == null) {
    return null;
  }
  if (!rosterInitialized) {
    waitUntilInitialized();
  }
  user=StringUtils.parseBareAddress(user);
synchronized (entries) {
    for (Iterator i=entries.iterator(); i.hasNext(); ) {
      RosterEntry entry=(RosterEntry)i.next();
      if (entry.getUser().equals(user)) {
        return entry;
      }
    }
  }
  return null;
}
Program: 20506
Project: 20506
Buggy source:
/** 
 * Returns an iterator the for all the roster groups.
 * @return an iterator for all roster groups.
 */
public Iterator getGroups(){
synchronized (groups) {
    List groupsList=Collections.unmodifiableList(new ArrayList(getGroupsMap().values()));
    return groupsList.iterator();
  }
}

Fixed version (ground truth):
/** 
 * Returns an iterator the for all the roster groups.
 * @return an iterator for all roster groups.
 */
public Iterator getGroups(){
  if (!rosterInitialized) {
    waitUntilInitialized();
  }
synchronized (groups) {
    List groupsList=Collections.unmodifiableList(new ArrayList(groups.values()));
    return groupsList.iterator();
  }
}
Program: 20507
Project: 20507
Buggy source:
/** 
 * Creates a new group.<p> Note: you must add at least one entry to the group for the group to be kept after a logout/login. This is due to the way that XMPP stores group information.
 * @param name the name of the group.
 * @return a new group.
 */
public RosterGroup createGroup(String name){
  if (!rosterInitialized) {
    waitUntilInitialized();
  }
synchronized (groups) {
    if (groups.containsKey(name)) {
      throw new IllegalArgumentException("String_Node_Str" + name + "String_Node_Str");
    }
    RosterGroup group=new RosterGroup(name,connection);
    groups.put(name,group);
    return group;
  }
}

Fixed version (ground truth):
/** 
 * Creates a new group.<p> Note: you must add at least one entry to the group for the group to be kept after a logout/login. This is due to the way that XMPP stores group information.
 * @param name the name of the group.
 * @return a new group.
 */
public RosterGroup createGroup(String name){
synchronized (groups) {
    if (groups.containsKey(name)) {
      throw new IllegalArgumentException("String_Node_Str" + name + "String_Node_Str");
    }
    RosterGroup group=new RosterGroup(name,connection);
    groups.put(name,group);
    return group;
  }
}
Program: 20508
Project: 20508
Buggy source:
/** 
 * Returns a count of the unfiled entries in the roster. An unfiled entry is an entry that doesn't belong to any groups.
 * @return the number of unfiled entries in the roster.
 */
public int getUnfiledEntryCount(){
synchronized (unfiledEntries) {
    return unfiledEntries.size();
  }
}

Fixed version (ground truth):
/** 
 * Returns a count of the unfiled entries in the roster. An unfiled entry is an entry that doesn't belong to any groups.
 * @return the number of unfiled entries in the roster.
 */
public int getUnfiledEntryCount(){
  if (!rosterInitialized) {
    waitUntilInitialized();
  }
synchronized (unfiledEntries) {
    return unfiledEntries.size();
  }
}
Program: 20509
Project: 20509
Buggy source:
/** 
 * Returns true if the specified XMPP address is an entry in the roster.
 * @param user the XMPP address of the user (eg "jsmith@example.com").
 * @return true if the XMPP address is an entry in the roster.
 */
public boolean contains(String user){
  if (user == null) {
    return false;
  }
  user=StringUtils.parseBareAddress(user);
synchronized (entries) {
    for (Iterator i=getFiledEntriesList().iterator(); i.hasNext(); ) {
      RosterEntry entry=(RosterEntry)i.next();
      if (entry.getUser().equals(user)) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Returns true if the specified XMPP address is an entry in the roster.
 * @param user the XMPP address of the user (eg "jsmith@example.com").
 * @return true if the XMPP address is an entry in the roster.
 */
public boolean contains(String user){
  if (user == null) {
    return false;
  }
  if (!rosterInitialized) {
    waitUntilInitialized();
  }
  user=StringUtils.parseBareAddress(user);
synchronized (entries) {
    for (Iterator i=entries.iterator(); i.hasNext(); ) {
      RosterEntry entry=(RosterEntry)i.next();
      if (entry.getUser().equals(user)) {
        return true;
      }
    }
  }
  return false;
}
Program: 20510
Project: 20510
Buggy source:
/** 
 * Returns an Iterator for the unfiled roster entries. An unfiled entry is an entry that doesn't belong to any groups.
 * @return an iterator the unfiled roster entries.
 */
public Iterator getUnfiledEntries(){
synchronized (unfiledEntries) {
    return Collections.unmodifiableList(new ArrayList(unfiledEntries)).iterator();
  }
}

Fixed version (ground truth):
/** 
 * Returns an Iterator for the unfiled roster entries. An unfiled entry is an entry that doesn't belong to any groups.
 * @return an iterator the unfiled roster entries.
 */
public Iterator getUnfiledEntries(){
  if (!rosterInitialized) {
    waitUntilInitialized();
  }
synchronized (unfiledEntries) {
    return Collections.unmodifiableList(new ArrayList(unfiledEntries)).iterator();
  }
}
Program: 20511
Project: 20511
Buggy source:
/** 
 * Process listeners.
 */
private void processListeners(){
  while (!done) {
    Packet sentPacket;
synchronized (sentPackets) {
      while (sentPackets.size() == 0) {
        try {
          sentPackets.wait();
        }
 catch (        InterruptedException ie) {
        }
      }
      sentPacket=(Packet)sentPackets.removeLast();
    }
    int size=listeners.size();
    for (int i=0; i < size; i++) {
      ListenerWrapper listenerWrapper=(ListenerWrapper)listeners.get(i);
      if (listenerWrapper != null) {
        listenerWrapper.notifyListener(sentPacket);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Process listeners.
 */
private void processListeners(){
  while (!done) {
    Packet sentPacket;
synchronized (sentPackets) {
      while (!done && sentPackets.size() == 0) {
        try {
          sentPackets.wait(2000);
        }
 catch (        InterruptedException ie) {
        }
      }
      if (sentPackets.size() > 0) {
        sentPacket=(Packet)sentPackets.removeLast();
      }
 else {
        sentPacket=null;
      }
    }
    if (sentPacket != null) {
      int size=listeners.size();
      for (int i=0; i < size; i++) {
        ListenerWrapper listenerWrapper=(ListenerWrapper)listeners.get(i);
        if (listenerWrapper != null) {
          listenerWrapper.notifyListener(sentPacket);
        }
      }
    }
  }
}
Program: 20512
Project: 20512
Buggy source:
/** 
 * Returns the next available packet from the queue for writing.
 * @return the next packet for writing.
 */
private Packet nextPacket(){
synchronized (queue) {
    while (queue.size() == 0) {
      try {
        queue.wait();
      }
 catch (      InterruptedException ie) {
      }
    }
    return (Packet)queue.removeLast();
  }
}

Fixed version (ground truth):
/** 
 * Returns the next available packet from the queue for writing.
 * @return the next packet for writing.
 */
private Packet nextPacket(){
synchronized (queue) {
    while (!done && queue.size() == 0) {
      try {
        queue.wait(2000);
      }
 catch (      InterruptedException ie) {
      }
    }
    if (queue.size() > 0) {
      return (Packet)queue.removeLast();
    }
 else {
      return null;
    }
  }
}
Program: 20513
Project: 20513
Buggy source:
private void writePackets(){
  try {
    StringBuffer stream=new StringBuffer();
    stream.append("String_Node_Str");
    stream.append("String_Node_Str" + connection.getHost() + "String_Node_Str");
    stream.append("String_Node_Str");
    stream.append("String_Node_Str");
    writer.write(stream.toString());
    writer.flush();
    stream=null;
    while (!done) {
      Packet packet=nextPacket();
      writer.write(packet.toXML());
      writer.flush();
    }
    try {
      writer.write("String_Node_Str");
      writer.flush();
    }
 catch (    Exception e) {
    }
 finally {
      try {
        writer.close();
      }
 catch (      Exception e) {
      }
    }
  }
 catch (  IOException ioe) {
    if (!done) {
      done=true;
      connection.packetReader.notifyConnectionError(ioe);
    }
  }
}

Fixed version (ground truth):
private void writePackets(){
  try {
    StringBuffer stream=new StringBuffer();
    stream.append("String_Node_Str");
    stream.append("String_Node_Str" + connection.getHost() + "String_Node_Str");
    stream.append("String_Node_Str");
    stream.append("String_Node_Str");
    writer.write(stream.toString());
    writer.flush();
    stream=null;
    while (!done) {
      Packet packet=nextPacket();
      if (packet != null) {
        writer.write(packet.toXML());
        writer.flush();
      }
    }
    try {
      writer.write("String_Node_Str");
      writer.flush();
    }
 catch (    Exception e) {
    }
 finally {
      try {
        writer.close();
      }
 catch (      Exception e) {
      }
    }
  }
 catch (  IOException ioe) {
    if (!done) {
      done=true;
      connection.packetReader.notifyConnectionError(ioe);
    }
  }
}
Program: 20514
Project: 20514
Buggy source:
/** 
 * Returns the name portion of a XMPP address. For example, for the address "matt@jivesoftware.com/Smack", "jivesoftware.com" would be returned. If no server is present in the address, the empty string will be returned.
 * @param XMPPAddress the XMPP address.
 * @return the resource portion of the XMPP address.
 */
public static String parseServer(String XMPPAddress){
  if (XMPPAddress == null) {
    return null;
  }
  int atIndex=XMPPAddress.indexOf("String_Node_Str");
  if (atIndex + 1 > XMPPAddress.length() || atIndex < 0) {
    return "String_Node_Str";
  }
  int slashIndex=XMPPAddress.indexOf("String_Node_Str");
  if (slashIndex > 0) {
    return XMPPAddress.substring(atIndex + 1,slashIndex);
  }
 else {
    return XMPPAddress.substring(atIndex + 1);
  }
}

Fixed version (ground truth):
/** 
 * Returns the name portion of a XMPP address. For example, for the address "matt@jivesoftware.com/Smack", "jivesoftware.com" would be returned. If no server is present in the address, the empty string will be returned.
 * @param XMPPAddress the XMPP address.
 * @return the resource portion of the XMPP address.
 */
public static String parseServer(String XMPPAddress){
  if (XMPPAddress == null) {
    return null;
  }
  int atIndex=XMPPAddress.indexOf("String_Node_Str");
  if (atIndex + 1 > XMPPAddress.length()) {
    return "String_Node_Str";
  }
  int slashIndex=XMPPAddress.indexOf("String_Node_Str");
  if (slashIndex > 0) {
    return XMPPAddress.substring(atIndex + 1,slashIndex);
  }
 else {
    return XMPPAddress.substring(atIndex + 1);
  }
}
Program: 20515
Project: 20515
Buggy source:
/** 
 * Sets the name of the group.
 * @param name the name of the group.
 */
public void setName(String name){
  this.name=name;
synchronized (entries) {
    for (int i=0; i < entries.size(); i++) {
      RosterPacket packet=new RosterPacket();
      packet.setType(IQ.Type.SET);
      RosterEntry entry=(RosterEntry)entries.get(i);
      packet.addRosterItem(RosterEntry.toRosterItem(entry));
      connection.sendPacket(packet);
    }
  }
}

Fixed version (ground truth):
/** 
 * Sets the name of the group. Changing the group's name is like moving all the group entries of the group to a new group specified by the new name. Since this group won't have entries  it will be removed from the roster. This means that all the references to this object will  be invalid and will need to be updated to the new group specified by the new name.
 * @param name the name of the group.
 */
public void setName(String name){
synchronized (entries) {
    for (int i=0; i < entries.size(); i++) {
      RosterPacket packet=new RosterPacket();
      packet.setType(IQ.Type.SET);
      RosterEntry entry=(RosterEntry)entries.get(i);
      RosterPacket.Item item=RosterEntry.toRosterItem(entry);
      item.removeGroupName(this.name);
      item.addGroupName(name);
      packet.addRosterItem(item);
      connection.sendPacket(packet);
    }
  }
}
Program: 20516
Project: 20516
Buggy source:
/** 
 * Parses error sub-packets.
 * @param parser the XML parser.
 * @return an error sub-packet.
 * @throws Exception if an exception occurs while parsing the packet.
 */
private XMPPError parseError(XmlPullParser parser) throws Exception {
  String errorCode=null;
  for (int i=0; i < parser.getAttributeCount(); i++) {
    if (parser.getAttributeName(i).equals("String_Node_Str")) {
      errorCode=parser.getAttributeValue("String_Node_Str","String_Node_Str");
    }
  }
  String message=parser.nextText();
  while (true) {
    if (parser.getEventType() == XmlPullParser.END_TAG && parser.getName().equals("String_Node_Str")) {
      break;
    }
  }
  return new XMPPError(Integer.parseInt(errorCode),message);
}

Fixed version (ground truth):
/** 
 * Parses error sub-packets.
 * @param parser the XML parser.
 * @return an error sub-packet.
 * @throws Exception if an exception occurs while parsing the packet.
 */
private XMPPError parseError(XmlPullParser parser) throws Exception {
  String errorCode=null;
  String message=null;
  for (int i=0; i < parser.getAttributeCount(); i++) {
    if (parser.getAttributeName(i).equals("String_Node_Str")) {
      errorCode=parser.getAttributeValue("String_Node_Str","String_Node_Str");
    }
  }
  try {
    message=parser.nextText();
  }
 catch (  XmlPullParserException ex) {
  }
  while (true) {
    if (parser.getEventType() == XmlPullParser.END_TAG && parser.getName().equals("String_Node_Str")) {
      break;
    }
    parser.next();
  }
  return new XMPPError(Integer.parseInt(errorCode),message);
}
Program: 20517
Project: 20517
Buggy source:
/** 
 * Shuts the packet reader down.
 */
public void shutdown(){
  done=true;
synchronized (connectionListeners) {
    for (Iterator i=connectionListeners.iterator(); i.hasNext(); ) {
      ConnectionListener listener=(ConnectionListener)i.next();
      listener.connectionClosed();
    }
  }
}

Fixed version (ground truth):
/** 
 * Shuts the packet reader down.
 */
public void shutdown(){
  if (!done) {
synchronized (connectionListeners) {
      for (Iterator i=connectionListeners.iterator(); i.hasNext(); ) {
        ConnectionListener listener=(ConnectionListener)i.next();
        listener.connectionClosed();
      }
    }
  }
  done=true;
}
Program: 20520
Project: 20520
Buggy source:
/** 
 * Sets the name associated with this entry.
 * @param name the name.
 */
public void setName(String name){
  if (this.name.equals(name)) {
    return;
  }
  this.name=name;
  RosterPacket packet=new RosterPacket();
  packet.setType(IQ.Type.SET);
  packet.addRosterItem(toRosterItem(this));
  connection.sendPacket(packet);
}

Fixed version (ground truth):
/** 
 * Sets the name associated with this entry.
 * @param name the name.
 */
public void setName(String name){
  if (name != null && this.name.equals(name)) {
    return;
  }
  this.name=name;
  RosterPacket packet=new RosterPacket();
  packet.setType(IQ.Type.SET);
  packet.addRosterItem(toRosterItem(this));
  connection.sendPacket(packet);
}
Program: 20522
Project: 20522
Buggy source:
private static Error parseError(XmlPullParser parser) throws Exception {
  String errorCode=null;
  for (int i=0; i < parser.getAttributeCount(); i++) {
    if (parser.getAttributeName(i).equals("String_Node_Str")) {
      errorCode=parser.getAttributeValue("String_Node_Str","String_Node_Str");
    }
  }
  String message=parser.nextText();
  while (true) {
    if (parser.getEventType() == parser.END_TAG && parser.getName().equals("String_Node_Str")) {
      break;
    }
    parser.next();
  }
  return new Error(Integer.parseInt(errorCode),message);
}

Fixed version (ground truth):
private static XMPPError parseError(XmlPullParser parser) throws Exception {
  String errorCode=null;
  for (int i=0; i < parser.getAttributeCount(); i++) {
    if (parser.getAttributeName(i).equals("String_Node_Str")) {
      errorCode=parser.getAttributeValue("String_Node_Str","String_Node_Str");
    }
  }
  String message=parser.nextText();
  while (true) {
    if (parser.getEventType() == parser.END_TAG && parser.getName().equals("String_Node_Str")) {
      break;
    }
    parser.next();
  }
  return new XMPPError(Integer.parseInt(errorCode),message);
}
Program: 20524
Project: 20524
Buggy source:
@Override public CharSequence decorateScript(Component component,CharSequence script){
  return "String_Node_Str" + script;
}

Fixed version (ground truth):
@Override public CharSequence decorateScript(final Component component,final CharSequence script){
  return LATCH + script;
}
Program: 20525
Project: 20525
Buggy source:
@Override public CharSequence decorateOnFailureScript(Component component,CharSequence script){
  return "String_Node_Str";
}

Fixed version (ground truth):
@Override public CharSequence decorateOnFailureScript(final Component component,final CharSequence script){
  return RESET + script;
}
Program: 20526
Project: 20526
Buggy source:
@Override public CharSequence decorateOnSuccessScript(Component component,CharSequence script){
  return "String_Node_Str";
}

Fixed version (ground truth):
@Override public CharSequence decorateOnSuccessScript(final Component component,final CharSequence script){
  return RESET + script;
}
Program: 20527
Project: 20527
Buggy source:
/** 
 * @param invitation
 * @param comment    if not-null comment will be updated
 */
private void _save(final Invitation invitation,String comment){
  validate(invitation);
  boolean isNew=invitation.isNew();
  boolean isNotifyManager=false;
  Invitation origInvitation=null;
  if (!isNew) {
    invitationRepo.detach(invitation);
    origInvitation=invitationRepo.findOne(invitation.getId());
    Check.isTrue(invitation != origInvitation);
    if (origInvitation.getStatus() != invitation.getStatus()) {
      invitation.setDate(new Date());
      if (origInvitation.getStatus() == RSVPStatus.ACCEPTED) {
        if (!securityService.getUser().isManager() && !origInvitation.getEvent().isCanceled()) {
          isNotifyManager=true;
        }
      }
    }
    if (invitation.getDate() == null) {
      invitation.setDate(new Date());
    }
    Comment origComment=commentManager.findByInvitationAndAuthor(origInvitation,securityService.getUser(),0);
    activityManager.onInvitationUpdated(invitation,origInvitation,comment,(origComment == null) ? null : origComment.getText());
  }
  invitationRepo.save(invitation);
  if (comment != null) {
    commentManager.updateComment(invitation,comment,securityService.getUser());
  }
  if (isNotifyManager) {
    try {
      notificationService.sendStatusChangedMessage(invitation);
    }
 catch (    Exception e) {
      log.error("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
/** 
 * @param invitation
 * @param comment    if not-null comment will be updated
 */
private void _save(final Invitation invitation,String comment){
  validate(invitation);
  boolean isNew=invitation.isNew();
  boolean isNotifyManager=false;
  Invitation origInvitation=null;
  if (!isNew) {
    invitationRepo.detach(invitation);
    origInvitation=invitationRepo.findOne(invitation.getId());
    Check.isTrue(invitation != origInvitation);
    if (origInvitation.getStatus() != invitation.getStatus()) {
      invitation.setDate(new Date());
      if (origInvitation.getStatus() == RSVPStatus.ACCEPTED) {
        if (!securityService.getUser().isManager() && !origInvitation.getEvent().isCanceled()) {
          isNotifyManager=true;
        }
      }
    }
    if (invitation.getDate() == null) {
      invitation.setDate(new Date());
    }
    Comment origComment=commentManager.findByInvitationAndAuthor(origInvitation,securityService.getUser(),0);
    activityManager.onInvitationUpdated(invitation,origInvitation,comment,(origComment == null) ? null : origComment.getText());
  }
  invitationRepo.save(invitation);
  if (comment != null) {
    commentManager.updateOrRemoveComment(invitation,comment,securityService.getUser());
  }
  if (isNotifyManager) {
    try {
      notificationService.sendStatusChangedMessage(invitation);
    }
 catch (    Exception e) {
      log.error("String_Node_Str",e);
    }
  }
}
Program: 20528
Project: 20528
Buggy source:
/** 
 * Searches for user-cal-items that match the event date. if autoDecline is true the invitation will be declined.
 * @return true if invitation is auto declined.
 */
private boolean checkForAutoDecline(Invitation invitation){
  DateTime eventDate=invitation.getEvent().getDateTime();
  List<CalItem> list=calendarManager.findAllByUserAndRange(invitation.getUser(),eventDate,eventDate);
  for (  CalItem calItem : list) {
    if (calItem.isAutoDecline()) {
      invitation.setStatus(RSVPStatus.DECLINED);
      invitationRepo.save(invitation);
      String comment;
      if (calItem.getType() == CalItem.Type.OTHER) {
        comment=calItem.getSummary();
      }
 else {
        comment=messageSource.getMessage(CalItem.Type.getResourceKey(calItem.getType()));
      }
      if (calItem.isSingleDay()) {
        comment+=String.format("String_Node_Str",Dates.formatDateShort(calItem.getStartDateTime().toDate()));
      }
 else {
        comment+=String.format("String_Node_Str",Dates.formatDateShort(calItem.getStartDateTime().toDate()),Dates.formatDateShort(calItem.getEndDateTime().toDate()));
      }
      commentManager.updateComment(invitation,comment,invitation.getUser());
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Searches for user-cal-items that match the event date. if autoDecline is true the invitation will be declined.
 * @return true if invitation is auto declined.
 */
private boolean checkForAutoDecline(Invitation invitation){
  DateTime eventDate=invitation.getEvent().getDateTime();
  List<CalItem> list=calendarManager.findAllByUserAndRange(invitation.getUser(),eventDate,eventDate);
  for (  CalItem calItem : list) {
    if (calItem.isAutoDecline()) {
      invitation.setStatus(RSVPStatus.DECLINED);
      invitationRepo.save(invitation);
      String comment;
      if (calItem.getType() == CalItem.Type.OTHER) {
        comment=calItem.getSummary();
      }
 else {
        comment=messageSource.getMessage(CalItem.Type.getResourceKey(calItem.getType()));
      }
      if (calItem.isSingleDay()) {
        comment+=String.format("String_Node_Str",Dates.formatDateShort(calItem.getStartDateTime().toDate()));
      }
 else {
        comment+=String.format("String_Node_Str",Dates.formatDateShort(calItem.getStartDateTime().toDate()),Dates.formatDateShort(calItem.getEndDateTime().toDate()));
      }
      commentManager.updateOrRemoveComment(invitation,comment,invitation.getUser());
      return true;
    }
  }
  return false;
}
Program: 20529
Project: 20529
Buggy source:
@Override @Transactional(readOnly=false,propagation=Propagation.REQUIRED) public void onInvitationUpdated(final Invitation invitation){
  Invitation origInvitation=invitationManager.loadById(invitation.getId(),Invitation_.event,Invitation_.user);
  Check.isTrue(invitation != origInvitation);
  Activity entity=newInstance();
  InvitationUpdateMessage message=new InvitationUpdateMessage(origInvitation.getEvent());
  message.setUserName(origInvitation.getName());
  boolean changed=false;
  if (!entity.getUser().equals(origInvitation.getUser())) {
    message.setManagerName(entity.getUser().getFullname());
    changed=true;
  }
  if (invitation.getComment() != null && ObjectUtils.notEqual(invitation.getComment(),origInvitation.getComment())) {
    message.setComment(invitation.getComment());
    changed=true;
  }
  if (invitation.getManagerComment() != null && ObjectUtils.notEqual(invitation.getManagerComment(),origInvitation.getManagerComment())) {
    message.setManagerComment(invitation.getManagerComment());
    changed=true;
  }
  if (ObjectUtils.notEqual(invitation.getStatus(),origInvitation.getStatus())) {
    message.setStatus(invitation.getStatus());
    changed=true;
  }
  entity.setMessage(message);
  if (changed) {
    removeDuplicates(entity,message);
    save(entity);
  }
}

Fixed version (ground truth):
@Override @Transactional(readOnly=false,propagation=Propagation.REQUIRED) public void onInvitationUpdated(final Invitation invitation){
  Invitation origInvitation=invitationManager.loadById(invitation.getId(),Invitation_.event,Invitation_.user);
  Check.isTrue(invitation != origInvitation);
  Activity entity=newInstance();
  InvitationUpdateMessage message=new InvitationUpdateMessage(origInvitation.getEvent());
  message.setUserName(origInvitation.getName());
  boolean changed=false;
  if (origInvitation.getEvent().isCanceled()) {
    return;
  }
  if (!entity.getUser().equals(origInvitation.getUser())) {
    message.setManagerName(entity.getUser().getFullname());
    changed=true;
  }
  if (invitation.getComment() != null && ObjectUtils.notEqual(invitation.getComment(),origInvitation.getComment())) {
    message.setComment(invitation.getComment());
    changed=true;
  }
  if (invitation.getManagerComment() != null && ObjectUtils.notEqual(invitation.getManagerComment(),origInvitation.getManagerComment())) {
    message.setManagerComment(invitation.getManagerComment());
    changed=true;
  }
  if (ObjectUtils.notEqual(invitation.getStatus(),origInvitation.getStatus())) {
    message.setStatus(invitation.getStatus());
    changed=true;
  }
  entity.setMessage(message);
  if (changed) {
    removeDuplicates(entity,message);
    save(entity);
  }
}
Program: 20530
Project: 20530
Buggy source:
@Override @Transactional(readOnly=false) public void save(final Invitation invitation){
  validate(invitation);
  boolean isNew=invitation.isNew();
  boolean isNotifyManager=false;
  Invitation origInvitation=null;
  if (!isNew) {
    invitationRepo.detach(invitation);
    origInvitation=invitationRepo.findOne(invitation.getId());
    Check.isTrue(invitation != origInvitation);
    if (origInvitation.getStatus() != invitation.getStatus()) {
      invitation.setDate(new Date());
      if (origInvitation.getStatus() == RSVPStatus.ACCEPTED) {
        if (!securityService.getUser().isManager()) {
          isNotifyManager=true;
        }
      }
    }
    if (invitation.getDate() == null) {
      invitation.setDate(new Date());
    }
    activityManager.onInvitationUpdated(invitation);
  }
  invitationRepo.save(invitation);
  if (isNotifyManager) {
    try {
      notificationService.sendStatusChangedMessage(invitation);
    }
 catch (    Exception e) {
      log.error("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@Override @Transactional(readOnly=false) public void save(final Invitation invitation){
  validate(invitation);
  boolean isNew=invitation.isNew();
  boolean isNotifyManager=false;
  Invitation origInvitation=null;
  if (!isNew) {
    invitationRepo.detach(invitation);
    origInvitation=invitationRepo.findOne(invitation.getId());
    Check.isTrue(invitation != origInvitation);
    if (origInvitation.getStatus() != invitation.getStatus()) {
      invitation.setDate(new Date());
      if (origInvitation.getStatus() == RSVPStatus.ACCEPTED) {
        if (!securityService.getUser().isManager() && !origInvitation.getEvent().isCanceled()) {
          isNotifyManager=true;
        }
      }
    }
    if (invitation.getDate() == null) {
      invitation.setDate(new Date());
    }
    activityManager.onInvitationUpdated(invitation);
  }
  invitationRepo.save(invitation);
  if (isNotifyManager) {
    try {
      notificationService.sendStatusChangedMessage(invitation);
    }
 catch (    Exception e) {
      log.error("String_Node_Str",e);
    }
  }
}
Program: 20531
Project: 20531
Buggy source:
@Test public void testRender(){
  wicketTester.startComponentInPage(new VenueEditPanel(new VenueModel()));
  wicketTester.dumpComponentWithPage();
}

Fixed version (ground truth):
@Test public void testRender(){
  wicketTester.startComponentInPage(new VenueEditPanel(new VenueModel()));
  wicketTester.dumpComponentWithPage();
  wicketTester.assertContains("String_Node_Str");
}
Program: 20532
Project: 20532
Buggy source:
public EventPage(IModel<Event> model){
  super(model);
  init(model);
}

Fixed version (ground truth):
public EventPage(IModel<Event> model){
  super(model);
  init(model);
  log.warn("String_Node_Str");
}
Program: 20534
Project: 20534
Buggy source:
@Override protected void populateItem(final ListItem<Event> item){
  final Event event=item.getModelObject();
  final EventModel eventModel=new EventModel(item.getModel());
  if (isNextEvent(event,getList())) {
    item.add(AttributeModifier.append("String_Node_Str","String_Node_Str"));
  }
  Link link=Links.eventLink("String_Node_Str",event.getId());
  item.add(link);
  link.add(new Label("String_Node_Str",Dates.formatDateShortWithWeekday(event.getDate())));
  link.add(new Label("String_Node_Str",Dates.formatTimeShort(event.getTime())));
  item.add(new Label("String_Node_Str",new ResourceModel(EventType.from(event).getResourceKey())));
  item.add(new Label("String_Node_Str",event.getTeam().getName()));
  item.add(new Label("String_Node_Str",event.getSummary()));
  final Invitation invitation=getInvitation(event,userModel.getObject());
  RSVPStatus status=invitation.getStatus();
  item.add(new QuickResponseLabel("String_Node_Str",status == RSVPStatus.NORESPONSE ? null : status){
    @Override protected void submitStatus(    final RSVPStatus status){
      responseManager.respond(eventModel.getId(),userModel.getId(),status);
    }
    @Override public boolean isEnabled(){
      return !eventManager.isEventClosed(event);
    }
  }
);
}

Fixed version (ground truth):
@Override protected void populateItem(final ListItem<Event> item){
  final Event event=item.getModelObject();
  final EventModel eventModel=new EventModel(item.getModel());
  if (isNextEvent(event,getList())) {
    item.add(AttributeModifier.append("String_Node_Str","String_Node_Str"));
  }
  Link link=Links.eventLink("String_Node_Str",event.getId());
  item.add(link);
  link.add(new Label("String_Node_Str",Dates.formatDateShortWithWeekday(event.getDate())));
  link.add(new Label("String_Node_Str",Dates.formatTimeShort(event.getTime())));
  item.add(new Label("String_Node_Str",new ResourceModel(EventType.from(event).getResourceKey())));
  item.add(new Label("String_Node_Str",event.getTeam().getName()));
  item.add(new Label("String_Node_Str",event.getSummary()));
  final Invitation invitation=getInvitation(event,userModel.getObject());
  RSVPStatus status=invitation.getStatus();
  item.add(new QuickResponseLabel("String_Node_Str",status == RSVPStatus.NORESPONSE ? null : status){
    @Override protected void submitStatus(    final RSVPStatus status){
      responseManager.respond(eventModel.getId(),userModel.getId(),status);
    }
    @Override public boolean isEnabled(){
      return !eventManager.isEventClosed(item.getModelObject());
    }
  }
);
}
Program: 20535
Project: 20535
Buggy source:
@Override public boolean isEnabled(){
  return !eventManager.isEventClosed(event);
}

Fixed version (ground truth):
@Override public boolean isEnabled(){
  return !eventManager.isEventClosed(item.getModelObject());
}
Program: 20536
Project: 20536
Buggy source:
public synchronized static void setViolationMessageRenderer(final ViolationMessageRenderer renderer){
  Assert.parameterNotNull(renderer,"String_Node_Str");
  final Application app=Application.get();
  app.setMetaData(violationMessageRendererKey,renderer);
}

Fixed version (ground truth):
public synchronized static void setViolationMessageRenderer(final ViolationMessageRenderer renderer){
  Preconditions.checkNotNull(renderer,"String_Node_Str");
  final Application app=Application.get();
  app.setMetaData(violationMessageRendererKey,renderer);
}
Program: 20537
Project: 20537
Buggy source:
public WicketSessionLocaleMessageInterpolator(final MessageInterpolator delegate){
  this.delegate=delegate;
  Assert.parameterNotNull(delegate,"String_Node_Str");
}

Fixed version (ground truth):
public WicketSessionLocaleMessageInterpolator(final MessageInterpolator delegate){
  this.delegate=delegate;
  Preconditions.checkNotNull(delegate,"String_Node_Str");
}
Program: 20538
Project: 20538
Buggy source:
@Override public InternetAddress[] convert(final Invitation element){
  return element.getInternetAddresses();
}

Fixed version (ground truth):
@Override public InternetAddress[] convert(final Invitation element){
  if (element.hasEmail()) {
    return element.getInternetAddresses();
  }
 else {
    return null;
  }
}
Program: 20539
Project: 20539
Buggy source:
public static ExternalLink mailLink(final String id,String emailAddress,final String label){
  if (label == null) {
    return new ExternalLink(id,"String_Node_Str" + emailAddress);
  }
 else {
    return new ExternalLink(id,"String_Node_Str" + emailAddress,label);
  }
}

Fixed version (ground truth):
public static ExternalLink mailLink(final String id,List<InternetAddress> emailAddresses){
  List<String> stringList=Collections.convert(emailAddresses,new Collections.IElementConverter<InternetAddress,String>(){
    @Override public String convert(    final InternetAddress ia){
      return ia.getAddress();
    }
  }
);
  String href=StringUtils.join(stringList,"String_Node_Str");
  href="String_Node_Str" + URLEncoder.encode(href);
  return new ExternalLink(id,href);
}
Program: 20540
Project: 20540
Buggy source:
public EventSecondaryPanel(IModel<Event> model){
  setRenderBodyOnly(true);
  add(createEventSelectPanel(model));
  final IModel<Invitation> invitationModel=getInvitationModel(model);
  InvitationFormPanel invitationFormPanel=new InvitationFormPanel(AjaxSlideTogglePanel.WRAPPED_PANEL_ID,invitationModel){
    @Override protected void onSubmit(    final Invitation invitation,    final AjaxRequestTarget target){
      invitationManager.save(invitation);
      AjaxEventSender.entityEvent(this,Invitation.class);
    }
  }
;
  invitationFormPanel.setVisible(invitationModel.getObject() != null && invitationModel.getObject().getStatus() == RSVPStatus.NORESPONSE);
  add(new AjaxSlideTogglePanel("String_Node_Str","String_Node_Str",invitationFormPanel){
    @Override public boolean isVisible(){
      return invitationModel.getObject() != null;
    }
  }
);
  add(new EventDetailsPanel(model,View.PLAYER));
  add(Links.mailLink("String_Node_Str",getAllEmailAddresses(model.getObject()),null));
  add(Links.mailLink("String_Node_Str",getManagerEmailAddress(model.getObject()),null));
}

Fixed version (ground truth):
public EventSecondaryPanel(IModel<Event> model){
  setRenderBodyOnly(true);
  add(createEventSelectPanel(model));
  final IModel<Invitation> invitationModel=getInvitationModel(model);
  InvitationFormPanel invitationFormPanel=new InvitationFormPanel(AjaxSlideTogglePanel.WRAPPED_PANEL_ID,invitationModel){
    @Override protected void onSubmit(    final Invitation invitation,    final AjaxRequestTarget target){
      invitationManager.save(invitation);
      AjaxEventSender.entityEvent(this,Invitation.class);
    }
  }
;
  invitationFormPanel.setVisible(invitationModel.getObject() != null && invitationModel.getObject().getStatus() == RSVPStatus.NORESPONSE);
  add(new AjaxSlideTogglePanel("String_Node_Str","String_Node_Str",invitationFormPanel){
    @Override public boolean isVisible(){
      return invitationModel.getObject() != null;
    }
  }
);
  add(new EventDetailsPanel(model,View.PLAYER));
  add(Links.mailLink("String_Node_Str",invitationManager.getAddressesForfAllInvitees(model.getObject())));
  add(Links.mailLink("String_Node_Str",getManagerEmailAddress(model.getObject()),null));
}
Program: 20541
Project: 20541
Buggy source:
public void setLatLng(LatLng latLng){
  this.lat=latLng.getLat();
  this.lng=latLng.getLng();
}

Fixed version (ground truth):
public void setLatLng(LatLng latLng){
  if (latLng == null) {
    this.lat=null;
    this.lng=null;
  }
 else {
    this.lat=latLng.getLat();
    this.lng=latLng.getLng();
  }
}