Program: 76407
Project: 76407
Buggy source:
/** 
 * Respond to a state changed event.
 */
public void processStateChanged(PNProcessEvent event){
  final int state=event.getCurrentState();
  Actor actor=event.getActor();
  Node node=(Node)nodeMap.get(actor);
  LabelWrapper wrapper=(LabelWrapper)_graphPane.getGraphView().getNodeFigure(node);
  final BasicFigure figure=(BasicFigure)wrapper.getChild();
  try {
    SwingUtilities.invokeAndWait(new Runnable(){
      public void run(){
switch (state) {
case PNProcessEvent.PROCESS_BLOCKED:
          figure.setFillPaint(Color.red);
        break;
case PNProcessEvent.PROCESS_FINISHED:
      figure.setFillPaint(Color.black);
    break;
case PNProcessEvent.PROCESS_PAUSED:
  figure.setFillPaint(Color.yellow);
break;
case PNProcessEvent.PROCESS_RUNNING:
figure.setFillPaint(Color.green);
break;
default :
System.out.println("String_Node_Str" + state);
}
}
}
);
}
 catch (Exception e) {
}
ComponentEntity ce=(ComponentEntity)actor;
String name=ce.getName();
TraceModel model=tracePane.getTraceView().getTraceModel();
TraceModel.Trace trace=model.getTrace(name);
int id=trace.getID();
int colorState=3;
switch (state) {
case PNProcessEvent.PROCESS_BLOCKED:
colorState=0;
break;
case PNProcessEvent.PROCESS_FINISHED:
colorState=7;
break;
case PNProcessEvent.PROCESS_PAUSED:
colorState=2;
break;
case PNProcessEvent.PROCESS_RUNNING:
colorState=3;
break;
}
double currentTime=(double)(System.currentTimeMillis() - _start);
final TraceModel.Element element=new TraceModel.Element(currentTime,currentTime + 1,colorState);
element.closure=TraceModel.Element.OPEN_END;
trace.add(element);
final TraceModel.Element current=_currentElement[id];
current.closure=0;
final int msize=model.size();
final TraceModel.Element temp[]=new TraceModel.Element[msize];
for (int i=0; i < msize; i++) {
_currentElement[i].stopTime=currentTime;
temp[i]=_currentElement[i];
}
try {
SwingUtilities.invokeAndWait(new Runnable(){
public void run(){
TraceView v=tracePane.getTraceView();
for (int i=0; i < msize; i++) {
v.updateTraceElement(temp[i]);
}
v.drawTraceElement(element);
}
}
);
}
 catch (Exception e) {
System.out.println(e);
}
_currentElement[id]=element;
}

Fixed version (ground truth):
/** 
 * Respond to a state changed event.
 */
public void processStateChanged(PNProcessEvent event){
  final int state=event.getCurrentState();
  Actor actor=event.getActor();
  Node node=(Node)_nodeMap.get(actor);
  LabelWrapper wrapper=(LabelWrapper)_graphPane.getGraphView().getNodeFigure(node);
  final BasicFigure figure=(BasicFigure)wrapper.getChild();
  try {
    SwingUtilities.invokeAndWait(new Runnable(){
      public void run(){
switch (state) {
case PNProcessEvent.PROCESS_BLOCKED:
          figure.setFillPaint(Color.red);
        break;
case PNProcessEvent.PROCESS_FINISHED:
      figure.setFillPaint(Color.black);
    break;
case PNProcessEvent.PROCESS_PAUSED:
  figure.setFillPaint(Color.yellow);
break;
case PNProcessEvent.PROCESS_RUNNING:
figure.setFillPaint(Color.green);
break;
default :
System.out.println("String_Node_Str" + state);
}
}
}
);
}
 catch (Exception e) {
}
ComponentEntity ce=(ComponentEntity)actor;
String name=ce.getName();
TraceModel model=_tracePan.getTraceView().getTraceModel();
TraceModel.Trace trace=model.getTrace(name);
int id=trace.getID();
int colorState=3;
switch (state) {
case PNProcessEvent.PROCESS_BLOCKED:
colorState=0;
break;
case PNProcessEvent.PROCESS_FINISHED:
colorState=7;
break;
case PNProcessEvent.PROCESS_PAUSED:
colorState=2;
break;
case PNProcessEvent.PROCESS_RUNNING:
colorState=3;
break;
}
double currentTime=(double)(System.currentTimeMillis() - _start);
final TraceModel.Element element=new TraceModel.Element(currentTime,currentTime + 1,colorState);
element.closure=TraceModel.Element.OPEN_END;
trace.add(element);
final TraceModel.Element current=_currentElement[id];
current.closure=0;
final int msize=model.size();
final TraceModel.Element temp[]=new TraceModel.Element[msize];
for (int i=0; i < msize; i++) {
_currentElement[i].stopTime=currentTime;
temp[i]=_currentElement[i];
}
try {
SwingUtilities.invokeAndWait(new Runnable(){
public void run(){
TraceView v=_tracePan.getTraceView();
for (int i=0; i < msize; i++) {
v.updateTraceElement(temp[i]);
}
v.drawTraceElement(element);
}
}
);
}
 catch (Exception e) {
System.out.println(e);
}
_currentElement[id]=element;
}