Program: 141846
Project: 141846
Buggy source:
public synchronized void updateStatOnConnection(String connectionId,int mode,String nodeName) throws AttributeNotFoundException, InstanceNotFoundException, MBeanException, ReflectionException, MalformedObjectNameException, NullPointerException {
  StatBean bean;
  String key=connectionId;
  javax.management.ObjectName routeMBean=null;
  java.util.Iterator<javax.management.ObjectName> iterator=this.processors.iterator();
  while (iterator.hasNext()) {
    routeMBean=iterator.next();
    if (("String_Node_Str" + nodeName + "String_Node_Str").equals(routeMBean.getKeyProperty("String_Node_Str"))) {
      break;
    }
  }
  if (connectionId.contains("String_Node_Str")) {
    String firstKey=null;
    String connectionName=connectionId.split("String_Node_Str")[0];
    int nbKeys=0;
    for (    String myKey : keysList) {
      if (myKey.startsWith(connectionName + "String_Node_Str")) {
        if (firstKey == null) {
          firstKey=myKey;
        }
        nbKeys++;
        if (nbKeys == 4) {
          break;
        }
      }
    }
    if (nbKeys == 4) {
      keysList.remove(firstKey);
    }
  }
  if (keysList.contains(key)) {
    int keyNb=keysList.indexOf(key);
    keysList.remove(key);
    keysList.add(keyNb,key);
  }
 else {
    keysList.add(key);
  }
  if (processStats.containsKey(key)) {
    bean=processStats.get(key);
  }
 else {
    bean=new StatBean(connectionId);
  }
  bean.setState(mode);
  bean.setEndTime(System.currentTimeMillis());
  if (routeMBean != null) {
    bean.setNbLine(Integer.parseInt(mBeanServer.getAttribute(routeMBean,"String_Node_Str").toString()));
  }
  processStats.put(key,bean);
  if (mode == BEGIN) {
    bean.setNbLine(0);
    long newStatsUpdate=System.currentTimeMillis();
    if (lastStatsUpdate == 0 || lastStatsUpdate + 250 < newStatsUpdate) {
      sendMessages();
      lastStatsUpdate=newStatsUpdate;
    }
  }
  if (debug) {
    sendMessages();
  }
}

Fixed version (ground truth):
public synchronized void updateStatOnConnection(String connectionId,int mode,String nodeName) throws AttributeNotFoundException, InstanceNotFoundException, MBeanException, ReflectionException, MalformedObjectNameException, NullPointerException {
  StatBean bean;
  String key=connectionId;
  javax.management.ObjectName routeMBean=null;
  java.util.Iterator<javax.management.ObjectName> iterator=this.processors.iterator();
  while (iterator.hasNext()) {
    routeMBean=iterator.next();
    if (("String_Node_Str" + nodeName + "String_Node_Str").equals(routeMBean.getKeyProperty("String_Node_Str"))) {
      break;
    }
    routeMBean=null;
  }
  if (connectionId.contains("String_Node_Str")) {
    String firstKey=null;
    String connectionName=connectionId.split("String_Node_Str")[0];
    int nbKeys=0;
    for (    String myKey : keysList) {
      if (myKey.startsWith(connectionName + "String_Node_Str")) {
        if (firstKey == null) {
          firstKey=myKey;
        }
        nbKeys++;
        if (nbKeys == 4) {
          break;
        }
      }
    }
    if (nbKeys == 4) {
      keysList.remove(firstKey);
    }
  }
  if (keysList.contains(key)) {
    int keyNb=keysList.indexOf(key);
    keysList.remove(key);
    keysList.add(keyNb,key);
  }
 else {
    keysList.add(key);
  }
  if (processStats.containsKey(key)) {
    bean=processStats.get(key);
  }
 else {
    bean=new StatBean(connectionId);
  }
  bean.setState(mode);
  bean.setEndTime(System.currentTimeMillis());
  if (routeMBean != null) {
    bean.setNbLine(Integer.parseInt(mBeanServer.getAttribute(routeMBean,"String_Node_Str").toString()));
  }
  processStats.put(key,bean);
  if (mode == BEGIN) {
    bean.setNbLine(0);
    long newStatsUpdate=System.currentTimeMillis();
    if (lastStatsUpdate == 0 || lastStatsUpdate + 250 < newStatsUpdate) {
      sendMessages();
      lastStatsUpdate=newStatsUpdate;
    }
  }
  if (debug) {
    sendMessages();
  }
}