Program: 92790
Project: 92790
Buggy source:
void drawItemData(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;
    int 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;
      x0=rect.x + (int)((currEventTime - time0) * pixelsPerNanoSec);
      int xEnd=rect.x + (int)((time1 - time0) * pixelsPerNanoSec);
      int 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=rect.x + (int)((nextEventTime - time0) * pixelsPerNanoSec);
        if (x1 >= rect.x) {
          _rect1.x=x0 >= rect.x ? x0 : rect.x;
          _rect1.width=(x1 <= xEnd ? x1 : xEnd) - _rect1.x;
          boolean timeSelected=currEventTime <= selectedTime && selectedTime < nextEventTime;
          utilImpl.drawState(_colors,currEvent,_rect1,gc,selected,false,timeSelected);
        }
        lastEvent=currEvent;
        currEvent=nextEvent;
        currEventTime=nextEventTime;
        x0=x1;
      }
    }
    int xEnd=rect.x + rect.width;
    if (x0 < xEnd) {
      _rect1.x=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):
void drawItemData(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;
    int 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;
      x0=rect.x + (int)((currEventTime - time0) * pixelsPerNanoSec);
      int xEnd=rect.x + (int)((time1 - time0) * pixelsPerNanoSec);
      int 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=rect.x + (int)((nextEventTime - time0) * pixelsPerNanoSec);
        if (x1 >= rect.x) {
          _rect1.x=x0 >= rect.x ? x0 : rect.x;
          _rect1.width=(x1 <= xEnd ? x1 : xEnd) - _rect1.x;
          boolean timeSelected=currEventTime <= selectedTime && selectedTime < nextEventTime;
          utilImpl.drawState(_colors,currEvent,_rect1,gc,selected,false,timeSelected);
        }
        lastEvent=currEvent;
        currEvent=nextEvent;
        currEventTime=nextEventTime;
        x0=x1;
      }
    }
    int xEnd=rect.x + rect.width;
    if (x0 < xEnd) {
      _rect1.x=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);
  }
}