Program: 47860
Project: 47860
Buggy source:
/** 
 * Returns the space required to draw the axis.
 * @param g2  the graphics device.
 * @param plot  the plot that the axis belongs to.
 * @param plotArea  the area within which the plot should be drawn.
 * @param edge  the axis location.
 * @param space  the space already reserved (for other axes).
 * @return The space required to draw the axis (including pre-reservedspace).
 */
@Override public AxisSpace reserveSpace(Graphics2D g2,Plot plot,Rectangle2D plotArea,RectangleEdge edge,AxisSpace space){
  if (space == null) {
    space=new AxisSpace();
  }
  if (!isVisible()) {
    return space;
  }
  double dimension=getFixedDimension();
  if (dimension > 0.0) {
    space.ensureAtLeast(dimension,edge);
  }
  double tickLabelHeight=0.0;
  double tickLabelWidth=0.0;
  if (isTickLabelsVisible()) {
    g2.setFont(getTickLabelFont());
    List ticks=refreshTicks(g2,new AxisState(),plotArea,edge);
    if (RectangleEdge.isTopOrBottom(edge)) {
      tickLabelHeight=findMaximumTickLabelHeight(ticks,g2,plotArea,isVerticalTickLabels());
    }
 else     if (RectangleEdge.isLeftOrRight(edge)) {
      tickLabelWidth=findMaximumTickLabelWidth(ticks,g2,plotArea,isVerticalTickLabels());
    }
  }
  Rectangle2D labelEnclosure=getLabelEnclosure(g2,edge);
  double labelHeight=0.0;
  double labelWidth=0.0;
  if (RectangleEdge.isTopOrBottom(edge)) {
    labelHeight=labelEnclosure.getHeight();
    space.add(labelHeight + tickLabelHeight,edge);
  }
 else   if (RectangleEdge.isLeftOrRight(edge)) {
    labelWidth=labelEnclosure.getWidth();
    space.add(labelWidth + tickLabelWidth,edge);
  }
  return space;
}

Fixed version (ground truth):
/** 
 * Returns the space required to draw the axis.
 * @param g2  the graphics device.
 * @param plot  the plot that the axis belongs to.
 * @param plotArea  the area within which the plot should be drawn.
 * @param edge  the axis location.
 * @param space  the space already reserved (for other axes).
 * @return The space required to draw the axis (including pre-reservedspace).
 */
@Override public AxisSpace reserveSpace(Graphics2D g2,Plot plot,Rectangle2D plotArea,RectangleEdge edge,AxisSpace space){
  if (space == null) {
    space=new AxisSpace();
  }
  if (!isVisible()) {
    return space;
  }
  double dimension=getFixedDimension();
  if (dimension > 0.0) {
    space.add(dimension,edge);
    return space;
  }
  double tickLabelHeight=0.0;
  double tickLabelWidth=0.0;
  if (isTickLabelsVisible()) {
    g2.setFont(getTickLabelFont());
    List ticks=refreshTicks(g2,new AxisState(),plotArea,edge);
    if (RectangleEdge.isTopOrBottom(edge)) {
      tickLabelHeight=findMaximumTickLabelHeight(ticks,g2,plotArea,isVerticalTickLabels());
    }
 else     if (RectangleEdge.isLeftOrRight(edge)) {
      tickLabelWidth=findMaximumTickLabelWidth(ticks,g2,plotArea,isVerticalTickLabels());
    }
  }
  Rectangle2D labelEnclosure=getLabelEnclosure(g2,edge);
  double labelHeight;
  double labelWidth;
  if (RectangleEdge.isTopOrBottom(edge)) {
    labelHeight=labelEnclosure.getHeight();
    space.add(labelHeight + tickLabelHeight,edge);
  }
 else   if (RectangleEdge.isLeftOrRight(edge)) {
    labelWidth=labelEnclosure.getWidth();
    space.add(labelWidth + tickLabelWidth,edge);
  }
  return space;
}