Program: 6670
Project: 6670
Buggy source:
public void applyData(AgentMessage agentMessage,boolean isLogging){
  int jvm_id=agentMessage.getJvmId();
  JVM jvm=null;
synchronized (IDsToJVMs) {
    jvm=IDsToJVMs.get(jvm_id);
    if (jvm == null) {
      jvm=new JVM(jvm_id,"String_Node_Str");
      IDsToJVMs.put(jvm_id,jvm);
      ((ThreadTableModel)getTableModel()).setCurrentJVM(jvm);
      setCurrentJVM(jvm);
    }
  }
  if (isLogging) {
    addAgentMessage(jvm_id,agentMessage);
  }
  if (agentMessage.hasThreadEvent()) {
    for (    de.fu.profiler.model.AgentMessageProtos.AgentMessage.Thread thread : agentMessage.getThreadEvent().getThreadList()) {
      updateThreadInfo(jvm,agentMessage,thread);
    }
  }
  if (agentMessage.hasMonitorEvent()) {
    de.fu.profiler.model.AgentMessageProtos.AgentMessage.Thread thread=agentMessage.getMonitorEvent().getThread();
    ThreadInfo threadInfo=jvm.getThread(thread.getId());
    if (threadInfo == null) {
      threadInfo=new ThreadInfo(thread.getId(),thread.getName(),thread.getPriority(),thread.getState().toString(),thread.getIsContextClassLoaderSet());
      addThreadInfo(jvm_id,threadInfo);
    }
    String stateChangeNotification=null;
    if (!threadInfo.getState().equals(agentMessage.getMonitorEvent().getThread().getState().toString())) {
      stateChangeNotification=agentMessage.getTimestamp() + "String_Node_Str" + threadInfo.getName()+ "String_Node_Str"+ threadInfo.getState()+ "String_Node_Str"+ agentMessage.getMonitorEvent().getThread().getState().toString();
    }
    setThreadInfoState(jvm_id,threadInfo,agentMessage.getMonitorEvent().getThread().getState().toString());
    updateThreadInfo(jvm,agentMessage,thread);
    NotifyWaitLogEntry notifyWaitLogEntry=null;
    String monitorStatus=null;
switch (agentMessage.getMonitorEvent().getEventType()) {
case WAIT:
      monitorStatus=threadInfo.getName() + "String_Node_Str" + "String_Node_Str"+ agentMessage.getMonitorEvent().getClassName()+ "String_Node_Str"+ agentMessage.getMonitorEvent().getMethodName()+ "String_Node_Str";
    if (stateChangeNotification != null) {
      monitorStatus+=stateChangeNotification + "String_Node_Str";
    }
  notifyWaitLogEntry=new NotifyWaitLogEntry(threadInfo,threadInfo.getState(),NotifyWaitLogEntry.Type.INVOKED_WAIT,agentMessage.getMonitorEvent().getMethodName(),agentMessage.getMonitorEvent().getClassName());
setThreadInfoMonitorStatus(jvm_id,threadInfo,agentMessage.getTimestamp(),monitorStatus,false,notifyWaitLogEntry);
threadInfo.increaseWaitCounter();
break;
case WAITED:
monitorStatus=threadInfo.getName() + "String_Node_Str" + "String_Node_Str"+ agentMessage.getMonitorEvent().getClassName()+ "String_Node_Str"+ agentMessage.getMonitorEvent().getMethodName()+ "String_Node_Str";
if (stateChangeNotification != null) {
monitorStatus+=stateChangeNotification + "String_Node_Str";
}
notifyWaitLogEntry=new NotifyWaitLogEntry(threadInfo,threadInfo.getState(),NotifyWaitLogEntry.Type.LEFT_WAIT,agentMessage.getMonitorEvent().getMethodName(),agentMessage.getMonitorEvent().getClassName());
setThreadInfoMonitorStatus(jvm_id,threadInfo,agentMessage.getTimestamp(),monitorStatus,false,notifyWaitLogEntry);
break;
case NOTIFY_ALL:
monitorStatus=threadInfo.getName() + "String_Node_Str" + "String_Node_Str"+ agentMessage.getMonitorEvent().getClassName()+ "String_Node_Str"+ agentMessage.getMonitorEvent().getMethodName()+ "String_Node_Str";
if (stateChangeNotification != null) {
monitorStatus+=stateChangeNotification + "String_Node_Str";
}
notifyWaitLogEntry=new NotifyWaitLogEntry(threadInfo,threadInfo.getState(),NotifyWaitLogEntry.Type.INVOKED_NOTIFY_ALL,agentMessage.getMonitorEvent().getMethodName(),agentMessage.getMonitorEvent().getClassName());
setThreadInfoMonitorStatus(jvm_id,threadInfo,agentMessage.getTimestamp(),monitorStatus,false,notifyWaitLogEntry);
break;
case NOTIFY:
monitorStatus=threadInfo.getName() + "String_Node_Str" + "String_Node_Str"+ agentMessage.getMonitorEvent().getClassName()+ "String_Node_Str"+ agentMessage.getMonitorEvent().getMethodName()+ "String_Node_Str";
if (stateChangeNotification != null) {
monitorStatus+=stateChangeNotification + "String_Node_Str";
}
notifyWaitLogEntry=new NotifyWaitLogEntry(threadInfo,threadInfo.getState(),NotifyWaitLogEntry.Type.INVOKED_NOTIFY,agentMessage.getMonitorEvent().getMethodName(),agentMessage.getMonitorEvent().getClassName());
setThreadInfoMonitorStatus(jvm_id,threadInfo,agentMessage.getTimestamp(),monitorStatus,false,notifyWaitLogEntry);
break;
case CONTENDED:
setThreadInfoMonitorStatus(jvm_id,threadInfo,agentMessage.getTimestamp(),threadInfo.getName() + "String_Node_Str" + agentMessage.getMonitorEvent().getClassName()+ "String_Node_Str"+ agentMessage.getMonitorEvent().getMethodName()+ "String_Node_Str",true,null);
break;
case ENTERED:
setThreadInfoMonitorStatus(jvm_id,threadInfo,agentMessage.getTimestamp(),threadInfo.getName() + "String_Node_Str" + agentMessage.getMonitorEvent().getClassName()+ "String_Node_Str"+ agentMessage.getMonitorEvent().getMethodName()+ "String_Node_Str",true,null);
break;
}
if (agentMessage.getMonitorEvent().hasMonitor()) {
Monitor monitor=new Monitor(agentMessage.getMonitorEvent().getMonitor().getId(),agentMessage.getMonitorEvent().getClassName(),agentMessage.getMonitorEvent().getMonitor().getEntryCount(),agentMessage.getMonitorEvent().getMonitor().getWaiterCount(),agentMessage.getMonitorEvent().getMonitor().getNotifyWaiterCount());
updateMonitorInfo(currentJVM,agentMessage,monitor);
}
}
}

Fixed version (ground truth):
public void applyData(AgentMessage agentMessage,boolean isLogging){
  int jvm_id=agentMessage.getJvmId();
  JVM jvm=null;
synchronized (IDsToJVMs) {
    jvm=IDsToJVMs.get(jvm_id);
    if (jvm == null) {
      jvm=new JVM(jvm_id,"String_Node_Str");
      IDsToJVMs.put(jvm_id,jvm);
      ((ThreadTableModel)getTableModel()).setCurrentJVM(jvm);
      setCurrentJVM(jvm);
    }
  }
  if (isLogging) {
    addAgentMessage(jvm_id,agentMessage);
  }
  if (agentMessage.hasThreadEvent()) {
    for (    de.fu.profiler.model.AgentMessageProtos.AgentMessage.Thread thread : agentMessage.getThreadEvent().getThreadList()) {
      updateThreadInfo(jvm,agentMessage,thread);
    }
  }
  if (agentMessage.hasMonitorEvent()) {
    de.fu.profiler.model.AgentMessageProtos.AgentMessage.Thread thread=agentMessage.getMonitorEvent().getThread();
    ThreadInfo threadInfo=jvm.getThread(thread.getId());
    if (threadInfo == null) {
      threadInfo=new ThreadInfo(thread.getId(),thread.getName(),thread.getPriority(),thread.getState().toString(),thread.getIsContextClassLoaderSet(),agentMessage.getTimestamp());
      addThreadInfo(jvm_id,threadInfo);
    }
    String stateChangeNotification=null;
    if (!threadInfo.getState().equals(agentMessage.getMonitorEvent().getThread().getState().toString())) {
      stateChangeNotification=agentMessage.getTimestamp() + "String_Node_Str" + threadInfo.getName()+ "String_Node_Str"+ threadInfo.getState()+ "String_Node_Str"+ agentMessage.getMonitorEvent().getThread().getState().toString();
    }
    setThreadInfoState(jvm_id,threadInfo,agentMessage.getMonitorEvent().getThread().getState().toString());
    updateThreadInfo(jvm,agentMessage,thread);
    NotifyWaitLogEntry notifyWaitLogEntry=null;
    String monitorStatus=null;
switch (agentMessage.getMonitorEvent().getEventType()) {
case WAIT:
      monitorStatus=threadInfo.getName() + "String_Node_Str" + "String_Node_Str"+ agentMessage.getMonitorEvent().getClassName()+ "String_Node_Str"+ agentMessage.getMonitorEvent().getMethodName()+ "String_Node_Str";
    if (stateChangeNotification != null) {
      monitorStatus+=stateChangeNotification + "String_Node_Str";
    }
  notifyWaitLogEntry=new NotifyWaitLogEntry(threadInfo,threadInfo.getState(),NotifyWaitLogEntry.Type.INVOKED_WAIT,agentMessage.getMonitorEvent().getMethodName(),agentMessage.getMonitorEvent().getClassName());
setThreadInfoMonitorStatus(jvm_id,threadInfo,agentMessage.getTimestamp(),monitorStatus,false,notifyWaitLogEntry);
threadInfo.increaseWaitCounter();
break;
case WAITED:
monitorStatus=threadInfo.getName() + "String_Node_Str" + "String_Node_Str"+ agentMessage.getMonitorEvent().getClassName()+ "String_Node_Str"+ agentMessage.getMonitorEvent().getMethodName()+ "String_Node_Str";
if (stateChangeNotification != null) {
monitorStatus+=stateChangeNotification + "String_Node_Str";
}
notifyWaitLogEntry=new NotifyWaitLogEntry(threadInfo,threadInfo.getState(),NotifyWaitLogEntry.Type.LEFT_WAIT,agentMessage.getMonitorEvent().getMethodName(),agentMessage.getMonitorEvent().getClassName());
setThreadInfoMonitorStatus(jvm_id,threadInfo,agentMessage.getTimestamp(),monitorStatus,false,notifyWaitLogEntry);
break;
case NOTIFY_ALL:
monitorStatus=threadInfo.getName() + "String_Node_Str" + "String_Node_Str"+ agentMessage.getMonitorEvent().getClassName()+ "String_Node_Str"+ agentMessage.getMonitorEvent().getMethodName()+ "String_Node_Str";
if (stateChangeNotification != null) {
monitorStatus+=stateChangeNotification + "String_Node_Str";
}
notifyWaitLogEntry=new NotifyWaitLogEntry(threadInfo,threadInfo.getState(),NotifyWaitLogEntry.Type.INVOKED_NOTIFY_ALL,agentMessage.getMonitorEvent().getMethodName(),agentMessage.getMonitorEvent().getClassName());
setThreadInfoMonitorStatus(jvm_id,threadInfo,agentMessage.getTimestamp(),monitorStatus,false,notifyWaitLogEntry);
break;
case NOTIFY:
monitorStatus=threadInfo.getName() + "String_Node_Str" + "String_Node_Str"+ agentMessage.getMonitorEvent().getClassName()+ "String_Node_Str"+ agentMessage.getMonitorEvent().getMethodName()+ "String_Node_Str";
if (stateChangeNotification != null) {
monitorStatus+=stateChangeNotification + "String_Node_Str";
}
notifyWaitLogEntry=new NotifyWaitLogEntry(threadInfo,threadInfo.getState(),NotifyWaitLogEntry.Type.INVOKED_NOTIFY,agentMessage.getMonitorEvent().getMethodName(),agentMessage.getMonitorEvent().getClassName());
setThreadInfoMonitorStatus(jvm_id,threadInfo,agentMessage.getTimestamp(),monitorStatus,false,notifyWaitLogEntry);
break;
case CONTENDED:
setThreadInfoMonitorStatus(jvm_id,threadInfo,agentMessage.getTimestamp(),threadInfo.getName() + "String_Node_Str" + agentMessage.getMonitorEvent().getClassName()+ "String_Node_Str"+ agentMessage.getMonitorEvent().getMethodName()+ "String_Node_Str",true,null);
break;
case ENTERED:
setThreadInfoMonitorStatus(jvm_id,threadInfo,agentMessage.getTimestamp(),threadInfo.getName() + "String_Node_Str" + agentMessage.getMonitorEvent().getClassName()+ "String_Node_Str"+ agentMessage.getMonitorEvent().getMethodName()+ "String_Node_Str",true,null);
break;
}
if (agentMessage.getMonitorEvent().hasMonitor()) {
Monitor monitor=new Monitor(agentMessage.getMonitorEvent().getMonitor().getId(),agentMessage.getMonitorEvent().getClassName(),agentMessage.getMonitorEvent().getMonitor().getEntryCount(),agentMessage.getMonitorEvent().getMonitor().getWaiterCount(),agentMessage.getMonitorEvent().getMonitor().getNotifyWaiterCount());
updateMonitorInfo(currentJVM,agentMessage,monitor);
}
}
}