Program: 76647
Project: 76647
Buggy source:
void renderHorizontalAxisByType(ComputationContext context,double dXEnd,double dZEnd,double dZ,double dStaggeredLabelOffset) throws ChartException {
  final int iDirection=sc.getDirection() == IConstants.BACKWARD ? -1 : 1;
  IAxisTypeComputation computation=createAxisTypeComputation(context);
  computation.initialize();
  final double dOffset=axModel.isCategoryAxis() ? (axModel.getScale().isTickBetweenCategories() ? iDirection : 2 * iDirection) * sc.getUnitSize() / 2 : 0;
  final int length=computation instanceof TextAxisTypeComputation ? da.length - 1 : da.length;
  double y=(iLabelLocation == IConstants.ABOVE) ? (bRendering3D ? context.dTick1 + 1 : context.dTick1 - 1) : (bRendering3D ? context.dTick2 - 1 : context.dTick2 + 1);
  for (int i=0; i < length; i++) {
    computation.handlePreEachTick(i);
    int x=(int)da[i];
    if (bRendering3D) {
      context.x3d=(int)da3D[i];
      context.z3d=(int)da3D[i];
    }
    if ((iWhatToDraw & IConstants.AXIS) == IConstants.AXIS) {
      double dYMinorTick1=((iMinorTickStyle & IConstants.TICK_ABOVE) == IConstants.TICK_ABOVE) ? (bRendering3D ? context.dY + IConstants.TICK_SIZE : context.dY - IConstants.TICK_SIZE) : context.dY;
      double dYMinorTick2=((iMinorTickStyle & IConstants.TICK_BELOW) == IConstants.TICK_BELOW) ? (bRendering3D ? context.dY - IConstants.TICK_SIZE : context.dY + IConstants.TICK_SIZE) : context.dY;
      if (dYMinorTick1 != -dYMinorTick2) {
        if (i != da.length - 1) {
          if (bRenderBase3DAxis) {
          }
 else           if (bRenderAncillary3DAxis) {
          }
 else {
            LineRenderEvent lreMinor=null;
            for (int k=0; k < daMinor.length - 1; k++) {
              if (computation instanceof LinearAxisTypeComputation) {
                if ((iDirection == 1 && x + daMinor[k] >= da[i + 1]) || (iDirection == -1 && x - daMinor[k] <= da[i + 1])) {
                  continue;
                }
              }
              lreMinor=(LineRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),LineRenderEvent.class);
              lreMinor.setLineAttributes(liaMinorTick);
              lreMinor.setStart(LocationImpl.create(x + iDirection * daMinor[k],dYMinorTick1));
              lreMinor.setEnd(LocationImpl.create(x + iDirection * daMinor[k],dYMinorTick2));
              ipr.drawLine(lreMinor);
            }
          }
        }
      }
      if (context.dTick1 != context.dTick2) {
        if (bRenderBase3DAxis) {
        }
 else         if (bRenderAncillary3DAxis) {
        }
 else {
          lre.setLineAttributes(liaMajorTick);
          lre.getStart().set(x,context.dTick1);
          lre.getEnd().set(x,context.dTick2);
          ipr.drawLine(lre);
        }
        if (iv != null && iDimension == IConstants.TWO_5_D && iv.getType() == IntersectionValue.VALUE) {
          lre.getStart().set(x,context.dY);
          lre.getEnd().set(x + dSeriesThickness,context.dY - dSeriesThickness);
          ipr.drawLine(lre);
        }
      }
    }
    if (bRenderAxisLabels && sc.isTickLabelVisible(i)) {
      ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_AXIS_LABEL,axModel,la,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_AXIS_LABEL,la);
      double sy=y;
      if (bAxisLabelStaggered && sc.isTickLabelStaggered(i)) {
        if (iLabelLocation == IConstants.ABOVE) {
          sy-=dStaggeredLabelOffset;
        }
 else {
          sy+=dStaggeredLabelOffset;
        }
      }
      if (ax.getLabel().isVisible() && la.isVisible()) {
        if (bRendering3D) {
          if (axisType == IConstants.BASE_AXIS) {
            lo3d.set(context.x3d + dOffset,sy - pwa.getVerticalSpacingInPixels(),dZEnd + pwa.getVerticalSpacingInPixels());
          }
 else {
            lo3d.set(dXEnd + pwa.getVerticalSpacingInPixels(),sy - pwa.getVerticalSpacingInPixels(),context.z3d + dOffset);
          }
          t3dre.setLocation3D(lo3d);
          t3dre.setAction(TextRenderEvent.RENDER_TEXT_AT_LOCATION);
          dc.addLabel(t3dre);
        }
 else {
          lo.set(x + dOffset,sy);
          tre.setAction(TextRenderEvent.RENDER_TEXT_AT_LOCATION);
          ipr.drawText(tre);
        }
      }
      ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_AXIS_LABEL,axModel,la,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_AXIS_LABEL,la);
    }
    computation.handlePostEachTick(i);
  }
  computation.close();
}

Fixed version (ground truth):
void renderHorizontalAxisByType(ComputationContext context,double dXEnd,double dZEnd,double dZ,double dStaggeredLabelOffset) throws ChartException {
  final int iDirection=sc.getDirection() == IConstants.BACKWARD ? -1 : 1;
  IAxisTypeComputation computation=createAxisTypeComputation(context);
  computation.initialize();
  final double dOffset=computation instanceof TextAxisTypeComputation ? iDirection * sc.getUnitSize() / 2 : 0;
  final int length=computation instanceof TextAxisTypeComputation ? da.length - 1 : da.length;
  double y=(iLabelLocation == IConstants.ABOVE) ? (bRendering3D ? context.dTick1 + 1 : context.dTick1 - 1) : (bRendering3D ? context.dTick2 - 1 : context.dTick2 + 1);
  for (int i=0; i < length; i++) {
    computation.handlePreEachTick(i);
    int x=(int)da[i];
    if (bRendering3D) {
      context.x3d=(int)da3D[i];
      context.z3d=(int)da3D[i];
    }
    if ((iWhatToDraw & IConstants.AXIS) == IConstants.AXIS) {
      double dYMinorTick1=((iMinorTickStyle & IConstants.TICK_ABOVE) == IConstants.TICK_ABOVE) ? (bRendering3D ? context.dY + IConstants.TICK_SIZE : context.dY - IConstants.TICK_SIZE) : context.dY;
      double dYMinorTick2=((iMinorTickStyle & IConstants.TICK_BELOW) == IConstants.TICK_BELOW) ? (bRendering3D ? context.dY - IConstants.TICK_SIZE : context.dY + IConstants.TICK_SIZE) : context.dY;
      if (dYMinorTick1 != -dYMinorTick2) {
        if (i != da.length - 1) {
          if (bRenderBase3DAxis) {
          }
 else           if (bRenderAncillary3DAxis) {
          }
 else {
            LineRenderEvent lreMinor=null;
            for (int k=0; k < daMinor.length - 1; k++) {
              if (computation instanceof LinearAxisTypeComputation) {
                if ((iDirection == 1 && x + daMinor[k] >= da[i + 1]) || (iDirection == -1 && x - daMinor[k] <= da[i + 1])) {
                  continue;
                }
              }
              lreMinor=(LineRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),LineRenderEvent.class);
              lreMinor.setLineAttributes(liaMinorTick);
              lreMinor.setStart(LocationImpl.create(x + iDirection * daMinor[k],dYMinorTick1));
              lreMinor.setEnd(LocationImpl.create(x + iDirection * daMinor[k],dYMinorTick2));
              ipr.drawLine(lreMinor);
            }
          }
        }
      }
      if (context.dTick1 != context.dTick2) {
        if (bRenderBase3DAxis) {
        }
 else         if (bRenderAncillary3DAxis) {
        }
 else {
          lre.setLineAttributes(liaMajorTick);
          lre.getStart().set(x,context.dTick1);
          lre.getEnd().set(x,context.dTick2);
          ipr.drawLine(lre);
        }
        if (iv != null && iDimension == IConstants.TWO_5_D && iv.getType() == IntersectionValue.VALUE) {
          lre.getStart().set(x,context.dY);
          lre.getEnd().set(x + dSeriesThickness,context.dY - dSeriesThickness);
          ipr.drawLine(lre);
        }
      }
    }
    if (bRenderAxisLabels && sc.isTickLabelVisible(i)) {
      ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_AXIS_LABEL,axModel,la,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_AXIS_LABEL,la);
      double sy=y;
      if (bAxisLabelStaggered && sc.isTickLabelStaggered(i)) {
        if (iLabelLocation == IConstants.ABOVE) {
          sy-=dStaggeredLabelOffset;
        }
 else {
          sy+=dStaggeredLabelOffset;
        }
      }
      if (ax.getLabel().isVisible() && la.isVisible()) {
        if (bRendering3D) {
          if (axisType == IConstants.BASE_AXIS) {
            lo3d.set(context.x3d + dOffset,sy - pwa.getVerticalSpacingInPixels(),dZEnd + pwa.getVerticalSpacingInPixels());
          }
 else {
            lo3d.set(dXEnd + pwa.getVerticalSpacingInPixels(),sy - pwa.getVerticalSpacingInPixels(),context.z3d + dOffset);
          }
          t3dre.setLocation3D(lo3d);
          t3dre.setAction(TextRenderEvent.RENDER_TEXT_AT_LOCATION);
          dc.addLabel(t3dre);
        }
 else {
          lo.set(x + dOffset,sy);
          tre.setAction(TextRenderEvent.RENDER_TEXT_AT_LOCATION);
          ipr.drawText(tre);
        }
      }
      ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_AXIS_LABEL,axModel,la,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_AXIS_LABEL,la);
    }
    computation.handlePostEachTick(i);
  }
  computation.close();
}