Program: 190364
Project: 190364
Buggy source:
@Override public void paintComponent(Graphics g){
  super.paintComponent(g);
  if (st == 0) {
    if (model != null) {
      sf=model.getFromFloat() * (double)getWidth();
      st=model.getToFloat() * (double)getWidth();
    }
 else {
      sf=0.0;
      st=(double)getWidth();
    }
  }
  int tmMarginTop=2;
  int tmMarginBottom=4;
  int width=getWidth();
  int height=getHeight();
  settings.update(width,height);
  Graphics2D g2d=(Graphics2D)g;
  g2d.setBackground(settings.background.top);
  g2d.setPaint(settings.background.paint);
  g2d.fillRect(0,tmMarginTop + 1,width,height - tmMarginBottom - 2);
  if (!this.isEnabled()) {
    return;
  }
  if (model == null) {
    return;
  }
  long min=(long)model.getMinValue();
  long max=(long)model.getMaxValue();
  if (max <= min || min == Double.NEGATIVE_INFINITY || max == Double.POSITIVE_INFINITY) {
    return;
  }
  g2d.setRenderingHints(settings.renderingHints);
  int vhw=settings.selection.visibleHookWidth;
  int sw=(int)st - (int)sf;
  if (highlightedComponent != HighlightedComponent.NONE) {
    g2d.setPaint(settings.selection.mouseOverPaint);
switch (highlightedComponent) {
case LEFT_HOOK:
      g2d.fillRect((int)sf,tmMarginTop,vhw,height - tmMarginBottom - 1);
    g2d.setPaint(settings.selection.paint);
  g2d.fillRect((int)sf + vhw,tmMarginTop,sw - vhw,height - tmMarginBottom - 1);
break;
case CENTER_HOOK:
g2d.setPaint(settings.selection.paint);
g2d.fillRect((int)sf,tmMarginTop,vhw,height - tmMarginBottom - 1);
g2d.setPaint(settings.selection.mouseOverPaint);
g2d.fillRect((int)sf + vhw,tmMarginTop,sw - vhw * 2,height - tmMarginBottom - 1);
g2d.setPaint(settings.selection.paint);
g2d.fillRect((int)st - vhw,tmMarginTop,vhw,height - tmMarginBottom - 1);
break;
case RIGHT_HOOK:
g2d.setPaint(settings.selection.paint);
g2d.fillRect((int)sf,tmMarginTop,sw - vhw,height - tmMarginBottom - 1);
g2d.setPaint(settings.selection.mouseOverPaint);
g2d.fillRect((int)st - vhw,tmMarginTop,vhw,height - tmMarginBottom - 1);
break;
}
}
 else {
g2d.setPaint(settings.selection.paint);
g2d.fillRect((int)sf,tmMarginTop,sw,height - tmMarginBottom - 1);
}
if (model.getUnit() == DateTime.class) {
paintUpperRulerForInterval(g2d,new DateTime(new Date(min)),new DateTime(new Date(max)));
}
g2d.setColor(settings.defaultStrokeColor);
g2d.drawRect((int)sf,tmMarginTop,sw,height - tmMarginBottom - 1);
double v=model.getValueFromFloat(currentMousePositionX * (1.0 / width));
v+=model.getMinValue();
if (v != Double.NEGATIVE_INFINITY && v != Double.POSITIVE_INFINITY) {
String str="String_Node_Str";
if (model.getUnit() == DateTime.class) {
DateTime d=new DateTime(new Date((long)v));
if (d != null) {
DateTimeFormatter fmt=DateTimeFormat.forPattern("String_Node_Str");
str=fmt.withLocale(LOCALE).print(d);
}
}
 else {
str=new Double(v).toString();
}
int strw=(int)(settings.tip.fontMetrics.getStringBounds(str,null)).getWidth() + 4;
int px=currentMousePositionX;
if (px + strw >= width) {
px=width - strw;
}
g2d.setPaint(settings.tip.backgroundColor);
g2d.fillRect(px,1,strw,18);
g2d.setPaint(settings.tip.fontColor);
g2d.drawRect(px,1,strw,18);
g2d.setColor(settings.tip.fontColor);
g2d.drawString(str,px + 2,16);
}
}

Fixed version (ground truth):
@Override public void paintComponent(Graphics g){
  super.paintComponent(g);
  int width=getWidth();
  int height=getHeight();
  if (st == 0) {
    if (model != null) {
      sf=0.0 * (double)width;
      st=1.0 * (double)width;
      newfrom=sf * (1.0 / width);
      newto=st * (1.0 / width);
    }
  }
  int tmMarginTop=2;
  int tmMarginBottom=4;
  settings.update(width,height);
  Graphics2D g2d=(Graphics2D)g;
  g2d.setBackground(settings.background.top);
  g2d.setPaint(settings.background.paint);
  g2d.fillRect(0,tmMarginTop + 1,width,height - tmMarginBottom - 2);
  if (!this.isEnabled()) {
    return;
  }
  if (model == null) {
    return;
  }
  long min=(long)model.getMinValue();
  long max=(long)model.getMaxValue();
  if (max <= min || min == Double.NEGATIVE_INFINITY || max == Double.POSITIVE_INFINITY) {
    return;
  }
  g2d.setRenderingHints(settings.renderingHints);
  int vhw=settings.selection.visibleHookWidth;
  int sw=(int)st - (int)sf;
  if (highlightedComponent != HighlightedComponent.NONE) {
    g2d.setPaint(settings.selection.mouseOverPaint);
switch (highlightedComponent) {
case LEFT_HOOK:
      g2d.fillRect((int)sf,tmMarginTop,vhw,height - tmMarginBottom - 1);
    g2d.setPaint(settings.selection.paint);
  g2d.fillRect((int)sf + vhw,tmMarginTop,sw - vhw,height - tmMarginBottom - 1);
break;
case CENTER_HOOK:
g2d.setPaint(settings.selection.paint);
g2d.fillRect((int)sf,tmMarginTop,vhw,height - tmMarginBottom - 1);
g2d.setPaint(settings.selection.mouseOverPaint);
g2d.fillRect((int)sf + vhw,tmMarginTop,sw - vhw * 2,height - tmMarginBottom - 1);
g2d.setPaint(settings.selection.paint);
g2d.fillRect((int)st - vhw,tmMarginTop,vhw,height - tmMarginBottom - 1);
break;
case RIGHT_HOOK:
g2d.setPaint(settings.selection.paint);
g2d.fillRect((int)sf,tmMarginTop,sw - vhw,height - tmMarginBottom - 1);
g2d.setPaint(settings.selection.mouseOverPaint);
g2d.fillRect((int)st - vhw,tmMarginTop,vhw,height - tmMarginBottom - 1);
break;
}
}
 else {
g2d.setPaint(settings.selection.paint);
g2d.fillRect((int)sf,tmMarginTop,sw,height - tmMarginBottom - 1);
}
if (model.getUnit() == DateTime.class) {
paintUpperRulerForInterval(g2d,new DateTime(new Date(min)),new DateTime(new Date(max)));
}
g2d.setColor(settings.defaultStrokeColor);
g2d.drawRect((int)sf,tmMarginTop,sw,height - tmMarginBottom - 1);
double v=model.getValueFromFloat(currentMousePositionX * (1.0 / width));
v+=model.getMinValue();
if (v != Double.NEGATIVE_INFINITY && v != Double.POSITIVE_INFINITY) {
String str="String_Node_Str";
int strw=0;
if (model.getUnit() == DateTime.class) {
DateTime d=new DateTime(new Date((long)v));
if (d != null) {
DateTimeFormatter fmt=DateTimeFormat.forPattern("String_Node_Str");
str=fmt.withLocale(LOCALE).print(d);
strw=(int)(settings.tip.fontMetrics.getStringBounds(str,null)).getWidth() + 4;
}
}
 else {
str=new Double(v).toString();
strw=(int)(settings.tip.fontMetrics.getStringBounds(str,null)).getWidth() + 14;
}
int px=currentMousePositionX;
if (px + strw >= width) {
px=width - strw;
}
g2d.setPaint(settings.tip.backgroundColor);
g2d.fillRect(px,1,strw,18);
g2d.setPaint(settings.tip.fontColor);
g2d.drawRect(px,1,strw,18);
g2d.setColor(settings.tip.fontColor);
g2d.drawString(str,px + 2,16);
}
}