Program: 92792
Project: 92792
Buggy source:
/** 
 * Represent the event in series of bursts rather than sequence of states
 * @param item
 * @param rect - The container rectangle to be colored to different states
 * @param time0 - Base time of all events
 * @param time1 - End time of all events
 * @param endTime
 * @param selectedTime
 * @param gc
 */
void drawItemDataBurst(Item item,Rectangle rect,long time0,long time1,long endTime,long selectedTime,GC gc){
  if (rect.isEmpty())   return;
  if (time1 <= time0) {
    gc.setBackground(_colors.getBkColor(false,false,false));
    gc.fillRectangle(rect);
    return;
  }
  Utils.init(_rect1,rect);
  boolean selected=item._selected;
  double pixelsPerNanoSec=(rect.width <= RIGHT_MARGIN) ? 0 : (double)(rect.width - RIGHT_MARGIN) / (time1 - time0);
  boolean group=item instanceof GroupItem;
  if (group) {
  }
 else   if (item instanceof TraceItem) {
    ITmfTimeAnalysisEntry trace=((TraceItem)item)._trace;
    double x0=rect.x;
    Iterator<ITimeEvent> iterator=trace.getTraceEventsIterator();
    ITimeEvent lastEvent=null;
    if (iterator.hasNext()) {
      ITimeEvent currEvent=iterator.next();
      ITimeEvent nextEvent=null;
      long currEventTime=currEvent.getTime();
      long nextEventTime=currEventTime;
      double step=(double)((currEventTime - time0) * pixelsPerNanoSec);
      x0=rect.x + step;
      double xEnd=rect.x + (double)((time1 - time0) * pixelsPerNanoSec);
      double x1=-1;
      int idx=1;
      _rect1.y+=3;
      _rect1.height-=6;
      fillSpace(rect,gc,selected);
      while (x0 <= xEnd && null != currEvent) {
        boolean stopped=false;
        if (iterator.hasNext()) {
          nextEvent=iterator.next();
          nextEventTime=nextEvent.getTime();
          idx++;
        }
 else         if (stopped) {
          nextEvent=null;
          nextEventTime=time1;
        }
 else {
          nextEvent=null;
          nextEventTime=endTime;
        }
        x1=x0 + (int)2;
        if (x1 >= rect.x && x0 <= xEnd) {
          _rect1.x=(int)(x0 >= rect.x ? x0 : rect.x);
          _rect1.width=(int)((x1 <= xEnd ? x1 : xEnd) - _rect1.x);
          boolean timeSelected=currEventTime <= selectedTime && selectedTime < nextEventTime;
          utilImpl.drawState(_colors,currEvent,_rect1,gc,selected,false,timeSelected);
          _rect1.x+=_rect1.width;
          x0=x1;
        }
        fillSpace(rect,gc,selected);
        lastEvent=currEvent;
        currEvent=nextEvent;
        currEventTime=nextEventTime;
        x0=rect.x + (double)((nextEventTime - time0) * pixelsPerNanoSec);
      }
    }
    int xEnd=rect.x + rect.width;
    if (x0 < xEnd) {
      _rect1.x=(int)(x0 >= rect.x ? x0 : rect.x);
      _rect1.width=xEnd - _rect1.x;
      gc.setBackground(_colors.getBkColor(selected,_isInFocus,false));
      gc.fillRectangle(_rect1);
      gc.setForeground(_colors.getColor(utilImpl.getEventColorVal(lastEvent)));
      int midy=_rect1.y + _rect1.height / 2;
      int lw=gc.getLineWidth();
      gc.setLineWidth(2);
      gc.drawLine(_rect1.x,midy,_rect1.x + _rect1.width,midy);
      gc.setLineWidth(lw);
    }
  }
  int x=rect.x + (int)((selectedTime - time0) * pixelsPerNanoSec);
  if (x >= rect.x && x < rect.x + rect.width) {
    gc.setForeground(_colors.getColor(TraceColorScheme.SELECTED_TIME));
    if (group)     gc.drawLine(x,rect.y + rect.height - 1,x,rect.y + rect.height);
 else     gc.drawLine(x,rect.y,x,rect.y + rect.height);
  }
}

Fixed version (ground truth):
/** 
 * Represent the event in series of bursts rather than sequence of states
 * @param item
 * @param rect - The container rectangle to be colored to different states
 * @param time0 - Base time of all events
 * @param time1 - End time of all events
 * @param endTime
 * @param selectedTime
 * @param gc
 */
void drawItemDataBurst(Item item,Rectangle rect,long time0,long time1,long endTime,long selectedTime,GC gc){
  if (rect.isEmpty())   return;
  if (time1 <= time0) {
    gc.setBackground(_colors.getBkColor(false,false,false));
    gc.fillRectangle(rect);
    return;
  }
  Utils.init(_rect1,rect);
  boolean selected=item._selected;
  double pixelsPerNanoSec=(rect.width <= RIGHT_MARGIN) ? 0 : (double)(rect.width - RIGHT_MARGIN) / (time1 - time0);
  boolean group=item instanceof GroupItem;
  if (group) {
  }
 else   if (item instanceof TraceItem) {
    ITmfTimeAnalysisEntry trace=((TraceItem)item)._trace;
    double x0=rect.x;
    Iterator<ITimeEvent> iterator=trace.getTraceEventsIterator();
    ITimeEvent lastEvent=null;
    if (iterator.hasNext()) {
      ITimeEvent currEvent=iterator.next();
      ITimeEvent nextEvent=null;
      long currEventTime=currEvent.getTime();
      long nextEventTime=currEventTime;
      double step=(double)((currEventTime - time0) * pixelsPerNanoSec);
      x0=rect.x + step;
      double xEnd=rect.x + (double)((time1 - time0) * pixelsPerNanoSec);
      double x1=-1;
      _rect1.y+=3;
      _rect1.height-=6;
      fillSpace(rect,gc,selected);
      while (x0 <= xEnd && null != currEvent) {
        boolean stopped=false;
        if (iterator.hasNext()) {
          nextEvent=iterator.next();
          nextEventTime=nextEvent.getTime();
        }
 else         if (stopped) {
          nextEvent=null;
          nextEventTime=time1;
        }
 else {
          nextEvent=null;
          nextEventTime=endTime;
        }
        x1=x0 + (int)2;
        if (x1 >= rect.x && x0 <= xEnd) {
          _rect1.x=(int)(x0 >= rect.x ? x0 : rect.x);
          _rect1.width=(int)((x1 <= xEnd ? x1 : xEnd) - _rect1.x);
          boolean timeSelected=currEventTime <= selectedTime && selectedTime < nextEventTime;
          utilImpl.drawState(_colors,currEvent,_rect1,gc,selected,false,timeSelected);
          _rect1.x+=_rect1.width;
          x0=x1;
        }
        fillSpace(rect,gc,selected);
        lastEvent=currEvent;
        currEvent=nextEvent;
        currEventTime=nextEventTime;
        x0=rect.x + (double)((nextEventTime - time0) * pixelsPerNanoSec);
      }
    }
    int xEnd=rect.x + rect.width;
    if (x0 < xEnd) {
      _rect1.x=(int)(x0 >= rect.x ? x0 : rect.x);
      _rect1.width=xEnd - _rect1.x;
      gc.setBackground(_colors.getBkColor(selected,_isInFocus,false));
      gc.fillRectangle(_rect1);
      gc.setForeground(_colors.getColor(utilImpl.getEventColorVal(lastEvent)));
      int midy=_rect1.y + _rect1.height / 2;
      int lw=gc.getLineWidth();
      gc.setLineWidth(2);
      gc.drawLine(_rect1.x,midy,_rect1.x + _rect1.width,midy);
      gc.setLineWidth(lw);
    }
  }
  int x=rect.x + (int)((selectedTime - time0) * pixelsPerNanoSec);
  if (x >= rect.x && x < rect.x + rect.width) {
    gc.setForeground(_colors.getColor(TraceColorScheme.SELECTED_TIME));
    if (group)     gc.drawLine(x,rect.y + rect.height - 1,x,rect.y + rect.height);
 else     gc.drawLine(x,rect.y,x,rect.y + rect.height);
  }
}