nus-yam/ex-repair huggingface dataset:
Program: 20456
Project: 20456
Buggy source:
/** 
 * Initialize the   {@link #debugger}. You can specify a customized   {@link SmackDebugger}by setup the system property <code>smack.debuggerClass</code> to the implementation.
 * @throws IllegalStateException if the reader or writer isn't yet initialized.
 * @throws IllegalArgumentException if the SmackDebugger can't be loaded.
 */
private void initDebugger(){
  if (debugger != null)   return;
  if (reader == null || writer == null) {
    throw new NullPointerException("String_Node_Str");
  }
  Vector<String> debuggers=new Vector<String>();
  String requestedDebugger=null;
  try {
    requestedDebugger=System.getProperty("String_Node_Str");
    debuggers.add(requestedDebugger);
  }
 catch (  Throwable t) {
  }
  debuggers.add("String_Node_Str");
  debuggers.add("String_Node_Str");
  debuggers.add("String_Node_Str");
  for (  String debuggerName : debuggers) {
    try {
      Class<?> debuggerClass=Class.forName(debuggerName);
      Constructor<?> constructor=debuggerClass.getConstructor(Connection.class,ObservableWriter.class,ObservableReader.class);
      debugger=(SmackDebugger)constructor.newInstance(this,writer,reader);
    }
 catch (    Exception e) {
      if (requestedDebugger != null && requestedDebugger.equals(debuggerName))       e.printStackTrace();
      continue;
    }
  }
}

Fixed version (ground truth):
/** 
 * Initialize the   {@link #debugger}. You can specify a customized   {@link SmackDebugger}by setup the system property <code>smack.debuggerClass</code> to the implementation.
 * @throws IllegalStateException if the reader or writer isn't yet initialized.
 * @throws IllegalArgumentException if the SmackDebugger can't be loaded.
 */
private void initDebugger(){
  if (debugger != null)   return;
  if (reader == null || writer == null) {
    throw new NullPointerException("String_Node_Str");
  }
  Vector<String> debuggers=new Vector<String>();
  String requestedDebugger=null;
  try {
    requestedDebugger=System.getProperty("String_Node_Str");
    debuggers.add(requestedDebugger);
  }
 catch (  Throwable t) {
  }
  debuggers.add("String_Node_Str");
  debuggers.add("String_Node_Str");
  debuggers.add("String_Node_Str");
  for (  String debuggerName : debuggers) {
    try {
      Class<?> debuggerClass=Class.forName(debuggerName);
      Constructor<?> constructor=debuggerClass.getConstructor(Connection.class,ObservableWriter.class,ObservableReader.class);
      debugger=(SmackDebugger)constructor.newInstance(this,writer,reader);
      break;
    }
 catch (    Exception e) {
      if (requestedDebugger != null && requestedDebugger.equals(debuggerName))       e.printStackTrace();
      continue;
    }
  }
}
Program: 20457
Project: 20457
Buggy source:
/** 
 * Sets the policy that determines who may associate children with the node.
 * @param policy The policy being set
 */
public void setChildrenAssociationPolicy(ChildrenAssociationPolicy policy){
  addField(ConfigureNodeFields.children_association_policy,FormField.TYPE_LIST_SINGLE);
  setAnswer(ConfigureNodeFields.children_association_policy.getFieldName(),policy.toString());
}

Fixed version (ground truth):
/** 
 * Sets the policy that determines who may associate children with the node.
 * @param policy The policy being set
 */
public void setChildrenAssociationPolicy(ChildrenAssociationPolicy policy){
  addField(ConfigureNodeFields.children_association_policy,FormField.TYPE_LIST_SINGLE);
  List<String> values=new ArrayList<String>(1);
  values.add(policy.toString());
  setAnswer(ConfigureNodeFields.children_association_policy.getFieldName(),values);
}
Program: 20458
Project: 20458
Buggy source:
public GetItemsRequest(String nodeId,String subscriptionId,int maxItems){
  super(PubSubElementType.ITEMS,nodeId);
  subId=subscriptionId;
}

Fixed version (ground truth):
public GetItemsRequest(String nodeId,String subscriptionId,int maxItemsToReturn){
  this(nodeId,maxItemsToReturn);
  subId=subscriptionId;
}
Program: 20460
Project: 20460
Buggy source:
private PayloadType.Audio calculateBestCommonAudioPt(List remoteAudioPts){
  final ArrayList commonAudioPtsHere=new ArrayList();
  final ArrayList commonAudioPtsThere=new ArrayList();
  PayloadType.Audio result=null;
  if (!remoteAudioPts.isEmpty()) {
    commonAudioPtsHere.addAll(localAudioPts);
    commonAudioPtsHere.retainAll(remoteAudioPts);
    commonAudioPtsThere.addAll(remoteAudioPts);
    commonAudioPtsThere.retainAll(localAudioPts);
    if (!commonAudioPtsHere.isEmpty() && !commonAudioPtsThere.isEmpty()) {
      PayloadType.Audio bestPtHere=(PayloadType.Audio)commonAudioPtsHere.get(0);
      PayloadType.Audio bestPtThere=(PayloadType.Audio)commonAudioPtsThere.get(0);
      if (bestPtHere.equals(bestPtThere)) {
        result=bestPtHere;
      }
 else {
        String initiator=session.getInitiator();
        String me=session.getConnection().getUser();
        if (initiator.equals(me)) {
          result=bestPtHere;
        }
 else {
          result=bestPtThere;
        }
      }
    }
  }
  return result;
}

Fixed version (ground truth):
private PayloadType.Audio calculateBestCommonAudioPt(List remoteAudioPts){
  final ArrayList<PayloadType> commonAudioPtsHere=new ArrayList<PayloadType>();
  final ArrayList<PayloadType> commonAudioPtsThere=new ArrayList<PayloadType>();
  PayloadType.Audio result=null;
  if (!remoteAudioPts.isEmpty()) {
    commonAudioPtsHere.addAll(localAudioPts);
    commonAudioPtsHere.retainAll(remoteAudioPts);
    commonAudioPtsThere.addAll(remoteAudioPts);
    commonAudioPtsThere.retainAll(localAudioPts);
    if (!commonAudioPtsHere.isEmpty() && !commonAudioPtsThere.isEmpty()) {
      PayloadType.Audio bestPtHere=null;
      if (bestPtHere == null)       for (      PayloadType payloadType : commonAudioPtsHere)       if (payloadType instanceof PayloadType.Audio) {
        bestPtHere=(PayloadType.Audio)payloadType;
        break;
      }
      PayloadType.Audio bestPtThere=null;
      for (      PayloadType payloadType : commonAudioPtsThere)       if (payloadType instanceof PayloadType.Audio) {
        bestPtThere=(PayloadType.Audio)payloadType;
        break;
      }
      if (session.getInitiator().equals(session.getConnection().getUser()))       result=bestPtHere;
 else       result=bestPtThere;
    }
  }
  return result;
}
Program: 20462
Project: 20462
Buggy source:
public void testCompleteMulti(){
  try {
    XMPPConnection x0=getConnection(0);
    XMPPConnection x1=getConnection(1);
    ICETransportManager icetm0=new ICETransportManager(x0,"String_Node_Str",3478);
    ICETransportManager icetm1=new ICETransportManager(x1,"String_Node_Str",3478);
    final JingleManager jm0=new JingleManager(x0,icetm0);
    final JingleManager jm1=new JingleManager(x1,icetm1);
    jm0.addCreationListener(icetm0);
    jm1.addCreationListener(icetm1);
    MultiMediaManager jingleMediaManager0=new MultiMediaManager();
    jingleMediaManager0.addMediaManager(new SpeexMediaManager());
    jingleMediaManager0.addMediaManager(new JmfMediaManager());
    JingleMediaManager jingleMediaManager1=new JmfMediaManager();
    jm0.setMediaManager(jingleMediaManager0);
    jm1.setMediaManager(jingleMediaManager1);
    jm1.addJingleSessionRequestListener(new JingleSessionRequestListener(){
      public void sessionRequested(      final JingleSessionRequest request){
        try {
          IncomingJingleSession session=request.accept(jm1.getMediaManager().getPayloads());
          session.start(request);
        }
 catch (        XMPPException e) {
          e.printStackTrace();
        }
      }
    }
);
    OutgoingJingleSession js0=jm0.createOutgoingJingleSession(x1.getUser());
    js0.start();
    Thread.sleep(60000);
    js0.terminate();
    Thread.sleep(6000);
    x0.disconnect();
    x1.disconnect();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void testCompleteMulti(){
  try {
    XMPPConnection x0=getConnection(0);
    XMPPConnection x1=getConnection(1);
    final JingleManager jm0=new JingleManager(x0,new BasicTransportManager());
    final JingleManager jm1=new JingleManager(x1,new BasicTransportManager());
    MultiMediaManager jingleMediaManager0=new MultiMediaManager();
    jingleMediaManager0.addMediaManager(new SpeexMediaManager());
    jingleMediaManager0.addMediaManager(new JmfMediaManager());
    jingleMediaManager0.addMediaManager(new JmfMediaManager());
    MultiMediaManager jingleMediaManager1=new MultiMediaManager();
    jingleMediaManager1.addMediaManager(new JmfMediaManager());
    jingleMediaManager1.addMediaManager(new SpeexMediaManager());
    jm0.setMediaManager(jingleMediaManager0);
    jm1.setMediaManager(jingleMediaManager1);
    jm1.addJingleSessionRequestListener(new JingleSessionRequestListener(){
      public void sessionRequested(      final JingleSessionRequest request){
        try {
          IncomingJingleSession session=request.accept(jm1.getMediaManager().getPayloads());
          session.start(request);
        }
 catch (        XMPPException e) {
          e.printStackTrace();
        }
      }
    }
);
    OutgoingJingleSession js0=jm0.createOutgoingJingleSession(x1.getUser());
    js0.start();
    Thread.sleep(60000);
    js0.terminate();
    Thread.sleep(6000);
    x0.disconnect();
    x1.disconnect();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 20463
Project: 20463
Buggy source:
public void presenceChanged(Presence presence){
  String xmppAddress=presence.getFrom();
  JingleSession aux=null;
  for (  JingleSession jingleSession : jingleSessions) {
    if (jingleSession.getInitiator().equals(xmppAddress) || jingleSession.getResponder().equals(xmppAddress)) {
      aux=jingleSession;
    }
  }
  if (aux != null)   try {
    aux.terminate();
  }
 catch (  XMPPException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void presenceChanged(Presence presence){
  if (!presence.isAvailable()) {
    String xmppAddress=presence.getFrom();
    JingleSession aux=null;
    for (    JingleSession jingleSession : jingleSessions) {
      if (jingleSession.getInitiator().equals(xmppAddress) || jingleSession.getResponder().equals(xmppAddress)) {
        aux=jingleSession;
      }
    }
    if (aux != null)     try {
      aux.terminate();
    }
 catch (    XMPPException e) {
      e.printStackTrace();
    }
  }
}
Program: 20464
Project: 20464
Buggy source:
/** 
 * Returns an array of class loaders to load resources from.
 * @return an array of ClassLoader instances.
 */
private static ClassLoader[] getClassLoaders(){
  ClassLoader[] classLoaders=new ClassLoader[2];
  classLoaders[0]=SmackConfiguration.class.getClassLoader();
  classLoaders[1]=Thread.currentThread().getContextClassLoader();
  return classLoaders;
}

Fixed version (ground truth):
/** 
 * Returns an array of class loaders to load resources from.
 * @return an array of ClassLoader instances.
 */
private static ClassLoader[] getClassLoaders(){
  ClassLoader[] classLoaders=new ClassLoader[2];
  classLoaders[0]=SmackConfiguration.class.getClassLoader();
  classLoaders[1]=Thread.currentThread().getContextClassLoader();
  List<ClassLoader> loaders=new ArrayList<ClassLoader>();
  for (  ClassLoader classLoader : classLoaders) {
    if (classLoader != null) {
      loaders.add(classLoader);
    }
  }
  return (ClassLoader[])loaders.toArray();
}
Program: 20465
Project: 20465
Buggy source:
/** 
 * Returns an array of class loaders to load resources from.
 * @return an array of ClassLoader instances.
 */
private static ClassLoader[] getClassLoaders(){
  ClassLoader[] classLoaders=new ClassLoader[2];
  classLoaders[0]=ProviderManager.class.getClassLoader();
  classLoaders[1]=Thread.currentThread().getContextClassLoader();
  return classLoaders;
}

Fixed version (ground truth):
/** 
 * Returns an array of class loaders to load resources from.
 * @return an array of ClassLoader instances.
 */
private static ClassLoader[] getClassLoaders(){
  ClassLoader[] classLoaders=new ClassLoader[2];
  classLoaders[0]=ProviderManager.class.getClassLoader();
  classLoaders[1]=Thread.currentThread().getContextClassLoader();
  List<ClassLoader> loaders=new ArrayList<ClassLoader>();
  for (  ClassLoader classLoader : classLoaders) {
    if (classLoader != null) {
      loaders.add(classLoader);
    }
  }
  return (ClassLoader[])loaders.toArray();
}
Program: 20467
Project: 20467
Buggy source:
/** 
 * Returns an array of class loaders to load resources from.
 * @return an array of ClassLoader instances.
 */
private static ClassLoader[] getClassLoaders(){
  ClassLoader[] classLoaders=new ClassLoader[2];
  classLoaders[0]=SmackConfiguration.class.getClassLoader();
  classLoaders[1]=Thread.currentThread().getContextClassLoader();
  List<ClassLoader> loaders=new ArrayList<ClassLoader>();
  for (  ClassLoader classLoader : classLoaders) {
    if (classLoader != null) {
      loaders.add(classLoader);
    }
  }
  return (ClassLoader[])loaders.toArray();
}

Fixed version (ground truth):
/** 
 * Returns an array of class loaders to load resources from.
 * @return an array of ClassLoader instances.
 */
private static ClassLoader[] getClassLoaders(){
  ClassLoader[] classLoaders=new ClassLoader[2];
  classLoaders[0]=SmackConfiguration.class.getClassLoader();
  classLoaders[1]=Thread.currentThread().getContextClassLoader();
  List<ClassLoader> loaders=new ArrayList<ClassLoader>();
  for (  ClassLoader classLoader : classLoaders) {
    if (classLoader != null) {
      loaders.add(classLoader);
    }
  }
  return loaders.toArray(new ClassLoader[loaders.size()]);
}
Program: 20468
Project: 20468
Buggy source:
/** 
 * Returns an array of class loaders to load resources from.
 * @return an array of ClassLoader instances.
 */
private static ClassLoader[] getClassLoaders(){
  ClassLoader[] classLoaders=new ClassLoader[2];
  classLoaders[0]=ProviderManager.class.getClassLoader();
  classLoaders[1]=Thread.currentThread().getContextClassLoader();
  List<ClassLoader> loaders=new ArrayList<ClassLoader>();
  for (  ClassLoader classLoader : classLoaders) {
    if (classLoader != null) {
      loaders.add(classLoader);
    }
  }
  return (ClassLoader[])loaders.toArray();
}

Fixed version (ground truth):
/** 
 * Returns an array of class loaders to load resources from.
 * @return an array of ClassLoader instances.
 */
private static ClassLoader[] getClassLoaders(){
  ClassLoader[] classLoaders=new ClassLoader[2];
  classLoaders[0]=ProviderManager.class.getClassLoader();
  classLoaders[1]=Thread.currentThread().getContextClassLoader();
  List<ClassLoader> loaders=new ArrayList<ClassLoader>();
  for (  ClassLoader classLoader : classLoaders) {
    if (classLoader != null) {
      loaders.add(classLoader);
    }
  }
  return loaders.toArray(new ClassLoader[loaders.size()]);
}
Program: 20469
Project: 20469
Buggy source:
/** 
 * Parses a XHTMLExtension 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 {
  XHTMLExtension xhtmlExtension=new XHTMLExtension();
  boolean done=false;
  StringBuffer buffer=new StringBuffer();
  ;
  while (!done) {
    int eventType=parser.next();
    if (eventType == XmlPullParser.START_TAG) {
      if (parser.getName().equals("String_Node_Str"))       buffer=new StringBuffer();
      buffer.append(parser.getText());
    }
 else     if (eventType == XmlPullParser.TEXT) {
      if (buffer != null)       buffer.append(parser.getText());
    }
 else     if (eventType == XmlPullParser.END_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        buffer.append(parser.getText());
        xhtmlExtension.addBody(buffer.toString());
      }
 else       if (parser.getName().equals(xhtmlExtension.getElementName())) {
        done=true;
      }
 else       buffer.append(parser.getText());
    }
  }
  return xhtmlExtension;
}

Fixed version (ground truth):
/** 
 * Parses a XHTMLExtension 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 {
  XHTMLExtension xhtmlExtension=new XHTMLExtension();
  boolean done=false;
  StringBuffer buffer=new StringBuffer();
  int startDepth=parser.getDepth();
  int depth=parser.getDepth();
  String lastTag="String_Node_Str";
  while (!done) {
    int eventType=parser.next();
    if (eventType == XmlPullParser.START_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        buffer=new StringBuffer();
        depth=parser.getDepth();
      }
      lastTag=parser.getText();
      buffer.append(parser.getText());
    }
 else     if (eventType == XmlPullParser.TEXT) {
      if (buffer != null) {
        buffer.append(StringUtils.escapeForXML(parser.getText()));
      }
    }
 else     if (eventType == XmlPullParser.END_TAG) {
      if (parser.getName().equals("String_Node_Str") || parser.getDepth() <= depth) {
        buffer.append(parser.getText());
        xhtmlExtension.addBody(buffer.toString());
      }
 else       if (parser.getName().equals(xhtmlExtension.getElementName()) || parser.getDepth() <= startDepth) {
        done=true;
      }
 else {
        if (!lastTag.equals(parser.getText())) {
          buffer.append(parser.getText());
        }
      }
    }
  }
  return xhtmlExtension;
}
Program: 20470
Project: 20470
Buggy source:
public void run(){
  while (!done) {
synchronized (writer) {
      try {
        writer.write("String_Node_Str");
        writer.flush();
      }
 catch (      Exception e) {
      }
    }
    try {
      Thread.sleep(delay);
    }
 catch (    InterruptedException ie) {
    }
  }
}

Fixed version (ground truth):
public void run(){
  try {
    Thread.sleep(15000);
  }
 catch (  InterruptedException ie) {
  }
  while (!done) {
synchronized (writer) {
      try {
        writer.write("String_Node_Str");
        writer.flush();
      }
 catch (      Exception e) {
      }
    }
    try {
      Thread.sleep(delay);
    }
 catch (    InterruptedException ie) {
    }
  }
}
Program: 20471
Project: 20471
Buggy source:
private static BookmarkedConference getConferenceStorage(XmlPullParser parser) throws Exception {
  BookmarkedConference conf=new BookmarkedConference();
  String name=parser.getAttributeValue("String_Node_Str","String_Node_Str");
  String autojoin=parser.getAttributeValue("String_Node_Str","String_Node_Str");
  String jid=parser.getAttributeValue("String_Node_Str","String_Node_Str");
  conf.setName(name);
  conf.setAutoJoin(Boolean.parseBoolean(autojoin));
  conf.setJid(jid);
  boolean done=false;
  while (!done) {
    int eventType=parser.next();
    if (eventType == XmlPullParser.START_TAG && "String_Node_Str".equals(parser.getName())) {
      conf.setNickname(parser.nextText());
    }
 else     if (eventType == XmlPullParser.START_TAG && "String_Node_Str".equals(parser.getName())) {
      conf.setPassword(parser.nextText());
    }
 else     if (eventType == XmlPullParser.END_TAG) {
      if ("String_Node_Str".equals(parser.getName())) {
        done=true;
      }
    }
  }
  return conf;
}

Fixed version (ground truth):
private static BookmarkedConference getConferenceStorage(XmlPullParser parser) throws Exception {
  BookmarkedConference conf=new BookmarkedConference();
  String name=parser.getAttributeValue("String_Node_Str","String_Node_Str");
  String autojoin=parser.getAttributeValue("String_Node_Str","String_Node_Str");
  String jid=parser.getAttributeValue("String_Node_Str","String_Node_Str");
  conf.setName(name);
  conf.setAutoJoin(Boolean.valueOf(autojoin).booleanValue());
  conf.setJid(jid);
  boolean done=false;
  while (!done) {
    int eventType=parser.next();
    if (eventType == XmlPullParser.START_TAG && "String_Node_Str".equals(parser.getName())) {
      conf.setNickname(parser.nextText());
    }
 else     if (eventType == XmlPullParser.START_TAG && "String_Node_Str".equals(parser.getName())) {
      conf.setPassword(parser.nextText());
    }
 else     if (eventType == XmlPullParser.END_TAG) {
      if ("String_Node_Str".equals(parser.getName())) {
        done=true;
      }
    }
  }
  return conf;
}
Program: 20472
Project: 20472
Buggy source:
public String toXML(){
  StringBuffer buf=new StringBuffer();
  buf.append("String_Node_Str").append(getElementName()).append("String_Node_Str").append(getNamespace()).append("String_Node_Str");
  buf.append("String_Node_Str").append(UTC_FORMAT.format(stamp)).append("String_Node_Str");
  if (from != null && from.length() > 0) {
    buf.append("String_Node_Str").append(from).append("String_Node_Str");
  }
  buf.append("String_Node_Str");
  if (reason != null && reason.length() > 0) {
    buf.append(reason);
  }
  buf.append("String_Node_Str").append(getElementName()).append("String_Node_Str");
  return buf.toString();
}

Fixed version (ground truth):
public String toXML(){
  StringBuffer buf=new StringBuffer();
  buf.append("String_Node_Str").append(getElementName()).append("String_Node_Str").append(getNamespace()).append("String_Node_Str");
  buf.append("String_Node_Str");
synchronized (UTC_FORMAT) {
    buf.append(UTC_FORMAT.format(stamp));
  }
  buf.append("String_Node_Str");
  if (from != null && from.length() > 0) {
    buf.append("String_Node_Str").append(from).append("String_Node_Str");
  }
  buf.append("String_Node_Str");
  if (reason != null && reason.length() > 0) {
    buf.append(reason);
  }
  buf.append("String_Node_Str").append(getElementName()).append("String_Node_Str");
  return buf.toString();
}
Program: 20473
Project: 20473
Buggy source:
public PacketExtension parseExtension(XmlPullParser parser) throws Exception {
  Date stamp=null;
  try {
    stamp=DelayInformation.UTC_FORMAT.parse(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
  }
 catch (  ParseException e) {
    try {
      stamp=DelayInformation.NEW_UTC_FORMAT.parse(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
    }
 catch (    ParseException e1) {
      SimpleDateFormat formatter=new SimpleDateFormat("String_Node_Str");
      formatter.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
      stamp=formatter.parse(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
    }
  }
  DelayInformation delayInformation=new DelayInformation(stamp);
  delayInformation.setFrom(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
  delayInformation.setReason(parser.nextText());
  return delayInformation;
}

Fixed version (ground truth):
public PacketExtension parseExtension(XmlPullParser parser) throws Exception {
  Date stamp=null;
  try {
synchronized (DelayInformation.UTC_FORMAT) {
      stamp=DelayInformation.UTC_FORMAT.parse(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
    }
  }
 catch (  ParseException e) {
    try {
synchronized (DelayInformation.NEW_UTC_FORMAT) {
        stamp=DelayInformation.NEW_UTC_FORMAT.parse(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
      }
    }
 catch (    ParseException e1) {
      SimpleDateFormat formatter=new SimpleDateFormat("String_Node_Str");
      formatter.setTimeZone(TimeZone.getTimeZone("String_Node_Str"));
      stamp=formatter.parse(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
    }
  }
  DelayInformation delayInformation=new DelayInformation(stamp);
  delayInformation.setFrom(parser.getAttributeValue("String_Node_Str","String_Node_Str"));
  delayInformation.setReason(parser.nextText());
  return delayInformation;
}
Program: 20474
Project: 20474
Buggy source:
/** 
 * Set generic VCard field.
 * @param field value of field. Possible values: NICKNAME, PHOTO, BDAY, JABBERID, MAILER, TZ,GEO, TITLE, ROLE, LOGO, NOTE, PRODID, REV, SORT-STRING, SOUND, UID, URL, DESC.
 */
public String getField(String field){
  return (String)otherSimpleFields.get(field);
}

Fixed version (ground truth):
/** 
 * Set generic VCard field.
 * @param field value of field. Possible values: FN, NICKNAME, PHOTO, BDAY, JABBERID, MAILER, TZ,GEO, TITLE, ROLE, LOGO, NOTE, PRODID, REV, SORT-STRING, SOUND, UID, URL, DESC.
 */
public String getField(String field){
  if ("String_Node_Str".equals(field)) {
    return buildFullName();
  }
  return (String)otherSimpleFields.get(field);
}
Program: 20475
Project: 20475
Buggy source:
private void buildActualContent(){
  if (hasNameField()) {
    appendFN();
    appendN();
  }
  appendOrganization();
  appendGenericFields();
  appendEmail(emailWork,"String_Node_Str");
  appendEmail(emailHome,"String_Node_Str");
  appendPhones(workPhones,"String_Node_Str");
  appendPhones(homePhones,"String_Node_Str");
  appendAddress(workAddr,"String_Node_Str");
  appendAddress(homeAddr,"String_Node_Str");
}

Fixed version (ground truth):
private void buildActualContent(){
  if (hasNameField()) {
    appendTag("String_Node_Str",getFullName());
    appendN();
  }
  appendOrganization();
  appendGenericFields();
  appendEmail(emailWork,"String_Node_Str");
  appendEmail(emailHome,"String_Node_Str");
  appendPhones(workPhones,"String_Node_Str");
  appendPhones(homePhones,"String_Node_Str");
  appendAddress(workAddr,"String_Node_Str");
  appendAddress(homeAddr,"String_Node_Str");
}
Program: 20476
Project: 20476
Buggy source:
private boolean hasNameField(){
  return firstName != null || lastName != null || middleName != null;
}

Fixed version (ground truth):
private boolean hasNameField(){
  return firstName != null || lastName != null || middleName != null || otherSimpleFields.containsKey("String_Node_Str");
}
Program: 20477
Project: 20477
Buggy source:
private void appendGenericFields(){
  Iterator it=otherSimpleFields.entrySet().iterator();
  while (it.hasNext()) {
    Map.Entry entry=(Map.Entry)it.next();
    appendTag(entry.getKey().toString(),(String)entry.getValue());
  }
}

Fixed version (ground truth):
private void appendGenericFields(){
  Iterator it=otherSimpleFields.entrySet().iterator();
  while (it.hasNext()) {
    Map.Entry entry=(Map.Entry)it.next();
    String tag=entry.getKey().toString();
    if ("String_Node_Str".equals(tag))     continue;
    appendTag(tag,(String)entry.getValue());
  }
}
Program: 20478
Project: 20478
Buggy source:
private void setupEmails(){
  NodeList nodes=document.getElementsByTagName("String_Node_Str");
  for (int i=0; i < nodes.getLength(); i++) {
    Element element=(Element)nodes.item(i);
    if ("String_Node_Str".equals(element.getParentNode().getFirstChild().getNodeName())) {
      vCard.setEmailWork(getTextContent(element));
    }
 else {
      vCard.setEmailHome(getTextContent(element));
    }
  }
}

Fixed version (ground truth):
private void setupEmails(){
  NodeList nodes=document.getElementsByTagName("String_Node_Str");
  if (nodes == null)   return;
  for (int i=0; i < nodes.getLength(); i++) {
    Element element=(Element)nodes.item(i);
    if ("String_Node_Str".equals(element.getParentNode().getFirstChild().getNodeName())) {
      vCard.setEmailHome(getTextContent(element));
    }
 else {
      vCard.setEmailWork(getTextContent(element));
    }
  }
}
Program: 20479
Project: 20479
Buggy source:
private String getTagContents(String tag){
  NodeList nodes=document.getElementsByTagName(tag);
  if (nodes.getLength() == 1) {
    return getTextContent(nodes.item(0));
  }
  return null;
}

Fixed version (ground truth):
private String getTagContents(String tag){
  NodeList nodes=document.getElementsByTagName(tag);
  if (nodes != null && nodes.getLength() == 1) {
    return getTextContent(nodes.item(0));
  }
  return null;
}
Program: 20480
Project: 20480
Buggy source:
public IQ parseIQ(XmlPullParser parser) throws Exception {
  StringBuffer sb=new StringBuffer();
  try {
    int event=parser.getEventType();
    while (true) {
switch (event) {
case XmlPullParser.TEXT:
        sb.append(parser.getText());
      break;
case XmlPullParser.START_TAG:
    sb.append('<' + parser.getName() + '>');
  break;
case XmlPullParser.END_TAG:
sb.append("String_Node_Str" + parser.getName() + '>');
break;
default :
}
if (event == XmlPullParser.END_TAG && "String_Node_Str".equals(parser.getName())) break;
event=parser.next();
}
}
 catch (XmlPullParserException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
String xmlText=sb.toString();
VCard vCard=new VCard();
try {
DocumentBuilderFactory documentBuilderFactory=DocumentBuilderFactory.newInstance();
DocumentBuilder documentBuilder=documentBuilderFactory.newDocumentBuilder();
Document document=documentBuilder.parse(new ByteArrayInputStream(xmlText.getBytes()));
new VCardReader(vCard,document).initializeFields();
}
 catch (Exception e) {
e.printStackTrace(System.err);
}
return vCard;
}

Fixed version (ground truth):
public IQ parseIQ(XmlPullParser parser) throws Exception {
  StringBuffer sb=new StringBuffer();
  try {
    int event=parser.getEventType();
    while (true) {
switch (event) {
case XmlPullParser.TEXT:
        sb.append(parser.getText());
      break;
case XmlPullParser.START_TAG:
    sb.append('<').append(parser.getName()).append('>');
  break;
case XmlPullParser.END_TAG:
sb.append("String_Node_Str").append(parser.getName()).append('>');
break;
default :
}
if (event == XmlPullParser.END_TAG && "String_Node_Str".equals(parser.getName())) break;
event=parser.next();
}
}
 catch (XmlPullParserException e) {
e.printStackTrace();
}
catch (IOException e) {
e.printStackTrace();
}
String xmlText=sb.toString();
return _createVCardFromXml(xmlText);
}
Program: 20481
Project: 20481
Buggy source:
private void setupSimpleFields(){
  NodeList childNodes=document.getDocumentElement().getChildNodes();
  for (int i=0; i < childNodes.getLength(); i++) {
    Node node=childNodes.item(i);
    if (node instanceof Element) {
      Element element=(Element)node;
      if ("String_Node_Str".equals(element.getNodeName()))       continue;
      if (element.getChildNodes().getLength() == 0) {
        vCard.setField(element.getNodeName(),"String_Node_Str");
      }
 else       if (element.getChildNodes().getLength() == 1 && element.getChildNodes().item(0) instanceof Text) {
        vCard.setField(element.getNodeName(),getTextContent(element));
      }
    }
  }
}

Fixed version (ground truth):
private void setupSimpleFields(){
  NodeList childNodes=document.getDocumentElement().getChildNodes();
  for (int i=0; i < childNodes.getLength(); i++) {
    Node node=childNodes.item(i);
    if (node instanceof Element) {
      Element element=(Element)node;
      String field=element.getNodeName();
      if (element.getChildNodes().getLength() == 0) {
        vCard.setField(field,"String_Node_Str");
      }
 else       if (element.getChildNodes().getLength() == 1 && element.getChildNodes().item(0) instanceof Text) {
        vCard.setField(field,getTextContent(element));
      }
    }
  }
}
Program: 20482
Project: 20482
Buggy source:
public void initializeFields(){
  vCard.setFirstName(getTagContents("String_Node_Str"));
  vCard.setLastName(getTagContents("String_Node_Str"));
  vCard.setMiddleName(getTagContents("String_Node_Str"));
  vCard.setEncodedImage(getTagContents("String_Node_Str"));
  setupEmails();
  vCard.setOrganization(getTagContents("String_Node_Str"));
  vCard.setOrganizationUnit(getTagContents("String_Node_Str"));
  setupSimpleFields();
  setupPhones("String_Node_Str",true);
  setupPhones("String_Node_Str",false);
  setupAddress("String_Node_Str",true);
  setupAddress("String_Node_Str",false);
}

Fixed version (ground truth):
public void initializeFields(){
  vCard.setFirstName(getTagContents("String_Node_Str"));
  vCard.setLastName(getTagContents("String_Node_Str"));
  vCard.setMiddleName(getTagContents("String_Node_Str"));
  vCard.setEncodedImage(getTagContents("String_Node_Str"));
  setupEmails();
  vCard.setOrganization(getTagContents("String_Node_Str"));
  vCard.setOrganizationUnit(getTagContents("String_Node_Str"));
  setupSimpleFields();
  setupPhones();
  setupAddresses();
}
Program: 20483
Project: 20483
Buggy source:
private void setupPhones(String type,boolean work){
  NodeList allPhones=document.getElementsByTagName("String_Node_Str");
  for (int i=0; i < allPhones.getLength(); i++) {
    Element node=(Element)allPhones.item(i);
    if (type.equals(node.getChildNodes().item(1).getNodeName())) {
      String code=node.getFirstChild().getNodeName();
      String value=getTextContent(node.getChildNodes().item(2));
      if (work) {
        vCard.setPhoneWork(code,value);
      }
 else {
        vCard.setPhoneHome(code,value);
      }
    }
  }
}

Fixed version (ground truth):
private void setupPhones(){
  NodeList allPhones=document.getElementsByTagName("String_Node_Str");
  if (allPhones == null)   return;
  for (int i=0; i < allPhones.getLength(); i++) {
    NodeList nodes=allPhones.item(i).getChildNodes();
    String type=null;
    String code=null;
    String value=null;
    for (int j=0; j < nodes.getLength(); j++) {
      Node node=nodes.item(j);
      if (node.getNodeType() != Node.ELEMENT_NODE)       continue;
      String nodeName=node.getNodeName();
      if ("String_Node_Str".equals(nodeName)) {
        value=getTextContent(node);
      }
 else       if (isWorkHome(nodeName)) {
        type=nodeName;
      }
 else {
        code=nodeName;
      }
    }
    if (code == null || value == null)     continue;
    if ("String_Node_Str".equals(type)) {
      vCard.setPhoneHome(code,value);
    }
 else {
      vCard.setPhoneWork(code,value);
    }
  }
}
Program: 20484
Project: 20484
Buggy source:
public void testBigFunctional() throws XMPPException {
  VCard origVCard=new VCard();
  origVCard.setFirstName("String_Node_Str");
  origVCard.setLastName("String_Node_Str");
  origVCard.setEmailHome("String_Node_Str");
  origVCard.setJabberId("String_Node_Str");
  origVCard.setOrganization("String_Node_Str");
  origVCard.setNickName("String_Node_Str");
  origVCard.setField("String_Node_Str","String_Node_Str");
  origVCard.setAddressFieldHome("String_Node_Str","String_Node_Str");
  origVCard.setPhoneWork("String_Node_Str","String_Node_Str");
  origVCard.save(getConnection(0));
  VCard loaded=new VCard();
  try {
    loaded.load(getConnection(0));
  }
 catch (  XMPPException e) {
    e.printStackTrace();
    fail(e.getMessage());
  }
  assertEquals("String_Node_Str",origVCard,loaded);
  loaded=new VCard();
  try {
    loaded.load(getConnection(1),getBareJID(0));
  }
 catch (  XMPPException e) {
    e.printStackTrace();
    fail(e.getMessage());
  }
  assertEquals("String_Node_Str",origVCard,loaded);
}

Fixed version (ground truth):
public void testBigFunctional() throws XMPPException {
  VCard origVCard=new VCard();
  origVCard.setFirstName("String_Node_Str");
  origVCard.setLastName("String_Node_Str");
  origVCard.setEmailHome("String_Node_Str");
  origVCard.setEmailWork("String_Node_Str");
  origVCard.setJabberId("String_Node_Str");
  origVCard.setOrganization("String_Node_Str");
  origVCard.setNickName("String_Node_Str");
  origVCard.setField("String_Node_Str","String_Node_Str");
  origVCard.setAddressFieldHome("String_Node_Str","String_Node_Str");
  origVCard.setAddressFieldWork("String_Node_Str","String_Node_Str");
  origVCard.setPhoneWork("String_Node_Str","String_Node_Str");
  origVCard.setPhoneHome("String_Node_Str","String_Node_Str");
  origVCard.save(getConnection(0));
  VCard loaded=new VCard();
  try {
    loaded.load(getConnection(0));
  }
 catch (  XMPPException e) {
    e.printStackTrace();
    fail(e.getMessage());
  }
  assertEquals("String_Node_Str",origVCard.toString(),loaded.toString());
  loaded=new VCard();
  try {
    loaded.load(getConnection(1),getBareJID(0));
  }
 catch (  XMPPException e) {
    e.printStackTrace();
    fail(e.getMessage());
  }
  assertEquals("String_Node_Str",origVCard.toString(),loaded.toString());
}
Program: 20486
Project: 20486
Buggy source:
protected void setUp() throws Exception {
  XMPPConnection.DEBUG_ENABLED=false;
  super.setUp();
  try {
    muc=new MultiUserChat(getConnection(0),room);
    muc.create("String_Node_Str");
    muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));
  }
 catch (  Exception e) {
    fail(e.getMessage());
  }
}

Fixed version (ground truth):
protected void setUp() throws Exception {
  XMPPConnection.DEBUG_ENABLED=false;
  super.setUp();
  room="String_Node_Str" + getMUCDomain();
  try {
    muc=new MultiUserChat(getConnection(0),room);
    muc.create("String_Node_Str");
    muc.sendConfigurationForm(new Form(Form.TYPE_SUBMIT));
  }
 catch (  Exception e) {
    fail(e.getMessage());
  }
}
Program: 20488
Project: 20488
Buggy source:
public IQ parseIQ(XmlPullParser parser) throws Exception {
  MUCOwner mucOwner=new MUCOwner();
  boolean done=false;
  MUCOwner.Item item=null;
  while (!done) {
    int eventType=parser.next();
    if (eventType == XmlPullParser.START_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        mucOwner.addItem(parseItem(parser));
      }
      if (parser.getName().equals("String_Node_Str")) {
        mucOwner.setDestroy(parseDestroy(parser));
      }
 else {
        mucOwner.addExtension(PacketParserUtils.parsePacketExtension(parser.getName(),parser.getNamespace(),parser));
      }
    }
 else     if (eventType == XmlPullParser.END_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        done=true;
      }
    }
  }
  return mucOwner;
}

Fixed version (ground truth):
public IQ parseIQ(XmlPullParser parser) throws Exception {
  MUCOwner mucOwner=new MUCOwner();
  boolean done=false;
  MUCOwner.Item item=null;
  while (!done) {
    int eventType=parser.next();
    if (eventType == XmlPullParser.START_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        mucOwner.addItem(parseItem(parser));
      }
 else       if (parser.getName().equals("String_Node_Str")) {
        mucOwner.setDestroy(parseDestroy(parser));
      }
 else {
        mucOwner.addExtension(PacketParserUtils.parsePacketExtension(parser.getName(),parser.getNamespace(),parser));
      }
    }
 else     if (eventType == XmlPullParser.END_TAG) {
      if (parser.getName().equals("String_Node_Str")) {
        done=true;
      }
    }
  }
  return mucOwner;
}
Program: 20489
Project: 20489
Buggy source:
/** 
 * Returns the server 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 server 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";
  }
  if (atIndex < 0) {
    atIndex=0;
  }
  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 server 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 server 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: 20490
Project: 20490
Buggy source:
/** 
 * Returns the Smack version information, e.g. "1.3.0".
 * @return the Smack version information.
 */
public static String getVersion(){
  return SMACK_VERSION;
}

Fixed version (ground truth):
/** 
 * Returns the Smack version information, eg "1.3.0".
 * @return the Smack version information.
 */
public static String getVersion(){
  return SMACK_VERSION;
}
Program: 20491
Project: 20491
Buggy source:
/** 
 * Sets the NodeInformationProvider responsible for providing information  (i.e. items) related to a given node. Every time this client receives a disco request regarding the items of a given node, the provider associated to that node will be the  responsible for providing the requested information.<p> In MUC, a node could be 'http://jabber.org/protocol/muc#rooms' which means that the NodeInformationProvider will provide information about the rooms where the user has joined. 
 * @param node the node whose items will be provided by the NodeInformationProvider.
 * @return the NodeInformationProvider responsible for providing items related to the node.
 */
public void setNodeInformationProvider(String node,NodeInformationProvider listener){
  nodeInformationProviders.put(node,listener);
}

Fixed version (ground truth):
/** 
 * Sets the NodeInformationProvider responsible for providing information  (ie items) related to a given node. Every time this client receives a disco request regarding the items of a given node, the provider associated to that node will be the  responsible for providing the requested information.<p> In MUC, a node could be 'http://jabber.org/protocol/muc#rooms' which means that the NodeInformationProvider will provide information about the rooms where the user has joined. 
 * @param node the node whose items will be provided by the NodeInformationProvider.
 * @param listener the NodeInformationProvider responsible for providing items relatedto the node.
 */
public void setNodeInformationProvider(String node,NodeInformationProvider listener){
  nodeInformationProviders.put(node,listener);
}
Program: 20492
Project: 20492
Buggy source:
/** 
 * Returns the NodeInformationProvider responsible for providing information  (i.e. items) related to a given node or <tt>null</null> if none.<p> In MUC, a node could be 'http://jabber.org/protocol/muc#rooms' which means that the NodeInformationProvider will provide information about the rooms where the user has joined.
 * @param node the node that contains items associated with an entity not addressable as a JID.
 * @return the NodeInformationProvider responsible for providing information related to a given node.
 */
private NodeInformationProvider getNodeInformationProvider(String node){
  return (NodeInformationProvider)nodeInformationProviders.get(node);
}

Fixed version (ground truth):
/** 
 * Returns the NodeInformationProvider responsible for providing information  (ie items) related to a given node or <tt>null</null> if none.<p> In MUC, a node could be 'http://jabber.org/protocol/muc#rooms' which means that the NodeInformationProvider will provide information about the rooms where the user has joined.
 * @param node the node that contains items associated with an entity not addressable as a JID.
 * @return the NodeInformationProvider responsible for providing information related to a given node.
 */
private NodeInformationProvider getNodeInformationProvider(String node){
  return (NodeInformationProvider)nodeInformationProviders.get(node);
}
Program: 20493
Project: 20493
Buggy source:
/** 
 * Removes the NodeInformationProvider responsible for providing information  (i.e. items) related to a given node. This means that no more information will be  available for the specified node. In MUC, a node could be 'http://jabber.org/protocol/muc#rooms' which means that the NodeInformationProvider will provide information about the rooms where the user has joined. 
 * @param node the node to remove the associated NodeInformationProvider.
 */
public void removeNodeInformationProvider(String node){
  nodeInformationProviders.remove(node);
}

Fixed version (ground truth):
/** 
 * Removes the NodeInformationProvider responsible for providing information  (ie items) related to a given node. This means that no more information will be available for the specified node. In MUC, a node could be 'http://jabber.org/protocol/muc#rooms' which means that the NodeInformationProvider will provide information about the rooms where the user has joined. 
 * @param node the node to remove the associated NodeInformationProvider.
 */
public void removeNodeInformationProvider(String node){
  nodeInformationProviders.remove(node);
}
Program: 20495
Project: 20495
Buggy source:
public String getChildElementXML(){
  StringBuffer buf=new StringBuffer();
  buf.append("String_Node_Str");
  if (getNode() != null) {
    buf.append("String_Node_Str");
    buf.append(getNode());
  }
  buf.append("String_Node_Str");
synchronized (identities) {
    for (int i=0; i < identities.size(); i++) {
      Identity identity=(Identity)identities.get(i);
      buf.append(identity.toXML());
    }
  }
synchronized (features) {
    for (int i=0; i < features.size(); i++) {
      Feature feature=(Feature)features.get(i);
      buf.append(feature.toXML());
    }
  }
  buf.append("String_Node_Str");
  return buf.toString();
}

Fixed version (ground truth):
public String getChildElementXML(){
  StringBuffer buf=new StringBuffer();
  buf.append("String_Node_Str");
  if (getNode() != null) {
    buf.append("String_Node_Str");
    buf.append(getNode());
    buf.append("String_Node_Str");
  }
  buf.append("String_Node_Str");
synchronized (identities) {
    for (int i=0; i < identities.size(); i++) {
      Identity identity=(Identity)identities.get(i);
      buf.append(identity.toXML());
    }
  }
synchronized (features) {
    for (int i=0; i < features.size(); i++) {
      Feature feature=(Feature)features.get(i);
      buf.append(feature.toXML());
    }
  }
  buf.append("String_Node_Str");
  return buf.toString();
}
Program: 20496
Project: 20496
Buggy source:
public String getChildElementXML(){
  StringBuffer buf=new StringBuffer();
  buf.append("String_Node_Str");
  if (getNode() != null) {
    buf.append("String_Node_Str");
    buf.append(getNode());
  }
  buf.append("String_Node_Str");
synchronized (items) {
    for (int i=0; i < items.size(); i++) {
      Item item=(Item)items.get(i);
      buf.append(item.toXML());
    }
  }
  buf.append("String_Node_Str");
  return buf.toString();
}

Fixed version (ground truth):
public String getChildElementXML(){
  StringBuffer buf=new StringBuffer();
  buf.append("String_Node_Str");
  if (getNode() != null) {
    buf.append("String_Node_Str");
    buf.append(getNode());
    buf.append("String_Node_Str");
  }
  buf.append("String_Node_Str");
synchronized (items) {
    for (int i=0; i < items.size(); i++) {
      Item item=(Item)items.get(i);
      buf.append(item.toXML());
    }
  }
  buf.append("String_Node_Str");
  return buf.toString();
}