Program: 47782
Project: 47782
Buggy source:
/** 
 * Calculates the positions of the tick labels for the axis, storing the results in the tick label list (ready for drawing).
 * @param g2  the graphics device.
 * @param dataArea  the area in which the plot should be drawn.
 * @param edge  the location of the axis.
 * @return The ticks.
 */
@Override protected List<ValueTick> refreshTicksVertical(Graphics2D g2,Rectangle2D dataArea,RectangleEdge edge){
  List<ValueTick> ticks=new java.util.ArrayList<ValueTick>();
  Font tickLabelFont=getTickLabelFont();
  g2.setFont(tickLabelFont);
  double size=getTickUnit().getSize();
  int count=calculateVisibleTickCount();
  double lowestTickValue=calculateLowestVisibleTickValue();
  double previousDrawnTickLabelPos=0.0;
  double previousDrawnTickLabelLength=0.0;
  if (count <= ValueAxis.MAXIMUM_TICK_COUNT) {
    for (int i=0; i < count; i++) {
      double currentTickValue=lowestTickValue + (i * size);
      double yy=valueToJava2D(currentTickValue,dataArea,edge);
      String tickLabel;
      NumberFormat formatter=getNumberFormatOverride();
      if (formatter != null) {
        tickLabel=formatter.format(currentTickValue);
      }
 else {
        tickLabel=valueToString(currentTickValue);
      }
      Rectangle2D bounds=TextUtilities.getTextBounds(tickLabel,g2,g2.getFontMetrics());
      double tickLabelLength=isVerticalTickLabels() ? bounds.getWidth() : bounds.getHeight();
      boolean tickLabelsOverlapping=false;
      if (i > 0) {
        double avgTickLabelLength=(previousDrawnTickLabelLength + tickLabelLength) / 2.0;
        if (Math.abs(yy - previousDrawnTickLabelPos) < avgTickLabelLength) {
          tickLabelsOverlapping=true;
        }
      }
      if (tickLabelsOverlapping) {
        tickLabel="String_Node_Str";
      }
 else {
        previousDrawnTickLabelPos=yy;
        previousDrawnTickLabelLength=tickLabelLength;
      }
      TextAnchor anchor=null;
      TextAnchor rotationAnchor=null;
      double angle=0.0;
      if (isVerticalTickLabels()) {
        anchor=TextAnchor.BOTTOM_CENTER;
        rotationAnchor=TextAnchor.BOTTOM_CENTER;
        if (edge == RectangleEdge.LEFT) {
          angle=-Math.PI / 2.0;
        }
 else {
          angle=Math.PI / 2.0;
        }
      }
 else {
        if (edge == RectangleEdge.LEFT) {
          anchor=TextAnchor.CENTER_RIGHT;
          rotationAnchor=TextAnchor.CENTER_RIGHT;
        }
 else {
          anchor=TextAnchor.CENTER_LEFT;
          rotationAnchor=TextAnchor.CENTER_LEFT;
        }
      }
      ticks.add(new NumberTick(currentTickValue,tickLabel,anchor,rotationAnchor,angle));
    }
  }
  return ticks;
}

Fixed version (ground truth):
/** 
 * Calculates the positions of the tick labels for the axis, storing the results in the tick label list (ready for drawing).
 * @param g2  the graphics device.
 * @param dataArea  the area in which the plot should be drawn.
 * @param edge  the location of the axis.
 * @return The ticks.
 */
@Override protected List<ValueTick> refreshTicksVertical(Graphics2D g2,Rectangle2D dataArea,RectangleEdge edge){
  List<ValueTick> ticks=new java.util.ArrayList<ValueTick>();
  Font tickLabelFont=getTickLabelFont();
  g2.setFont(tickLabelFont);
  double size=getTickUnit().getSize();
  int count=calculateVisibleTickCount();
  double lowestTickValue=calculateLowestVisibleTickValue();
  double previousDrawnTickLabelPos=0.0;
  double previousDrawnTickLabelLength=0.0;
  if (count <= ValueAxis.MAXIMUM_TICK_COUNT) {
    for (int i=0; i < count; i++) {
      double currentTickValue=lowestTickValue + (i * size);
      double yy=valueToJava2D(currentTickValue,dataArea,edge);
      String tickLabel;
      NumberFormat formatter=getNumberFormatOverride();
      if (formatter != null) {
        tickLabel=formatter.format(currentTickValue);
      }
 else {
        tickLabel=valueToString(currentTickValue);
      }
      Rectangle2D bounds=TextUtilities.getTextBounds(tickLabel,g2,g2.getFontMetrics());
      double tickLabelLength=isVerticalTickLabels() ? bounds.getWidth() : bounds.getHeight();
      boolean tickLabelsOverlapping=false;
      if (i > 0) {
        double avgTickLabelLength=(previousDrawnTickLabelLength + tickLabelLength) / 2.0;
        if (Math.abs(yy - previousDrawnTickLabelPos) < avgTickLabelLength) {
          tickLabelsOverlapping=true;
        }
      }
      if (tickLabelsOverlapping) {
        tickLabel="String_Node_Str";
      }
 else {
        previousDrawnTickLabelPos=yy;
        previousDrawnTickLabelLength=tickLabelLength;
      }
      TextAnchor anchor;
      TextAnchor rotationAnchor;
      double angle=0.0;
      if (isVerticalTickLabels()) {
        anchor=TextAnchor.BOTTOM_CENTER;
        rotationAnchor=TextAnchor.BOTTOM_CENTER;
        if (edge == RectangleEdge.LEFT) {
          angle=-Math.PI / 2.0;
        }
 else {
          angle=Math.PI / 2.0;
        }
      }
 else {
        if (edge == RectangleEdge.LEFT) {
          anchor=TextAnchor.CENTER_RIGHT;
          rotationAnchor=TextAnchor.CENTER_RIGHT;
        }
 else {
          anchor=TextAnchor.CENTER_LEFT;
          rotationAnchor=TextAnchor.CENTER_LEFT;
        }
      }
      ticks.add(new NumberTick(currentTickValue,tickLabel,anchor,rotationAnchor,angle));
    }
  }
  return ticks;
}