Program: 69332
Project: 69332
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=computation instanceof TextAxisTypeComputation && bTickBetweenCategories ? iDirection * sc.getUnitSize() / 2 : 0;
  final int length=computation instanceof TextAxisTypeComputation ? da.size() - 1 : da.size();
  double y=(iLabelLocation == IConstants.ABOVE) ? (bRendering3D ? context.dTick1 + 1 : context.dTick1 - 1) : (bRendering3D ? context.dTick2 - 1 : context.dTick2 + 1);
  int xLast=Integer.MIN_VALUE;
  Location loMinorStart=goFactory.createLocation(0,0);
  Location loMinorEnd=goFactory.createLocation(0,0);
  for (int i=0; i < length; i++) {
    computation.handlePreEachTick(i);
    int x=(int)da.getCoordinate(i);
    boolean bSkipTickLine=(x == xLast);
    if (!bSkipTickLine) {
      xLast=x;
    }
    if (bRendering3D) {
      context.x3d=(int)da3D.getCoordinate(i);
      context.z3d=(int)da3D.getCoordinate(i);
    }
    if ((iWhatToDraw & IConstants.AXIS) == IConstants.AXIS) {
      double dYMinorTick1=((iMinorTickStyle & IConstants.TICK_ABOVE) == IConstants.TICK_ABOVE) ? (bRendering3D ? context.dY + pwa.getTickSize() : context.dY - pwa.getTickSize()) : context.dY;
      double dYMinorTick2=((iMinorTickStyle & IConstants.TICK_BELOW) == IConstants.TICK_BELOW) ? (bRendering3D ? context.dY - pwa.getTickSize() : context.dY + pwa.getTickSize()) : context.dY;
      if (dYMinorTick1 != -dYMinorTick2) {
        if (i != da.size() - 1) {
          if (bRenderBase3DAxis) {
          }
 else           if (bRenderAncillary3DAxis) {
          }
 else {
            if (!bSkipTickLine && ((i > 0 && i < length - 1) || !axModel.isCategoryAxis() || bTickBetweenCategories)) {
              LineRenderEvent lreMinor=null;
              int minorStep=(int)(1d / da.getStep());
              if (minorStep < 1) {
                minorStep=1;
              }
              for (int k=0; k < daMinor.length - 1; k+=minorStep) {
                if (computation instanceof LinearAxisTypeComputation) {
                  if ((iDirection == 1 && x + daMinor[k] >= da.getCoordinate(i + 1)) || (iDirection == -1 && x - daMinor[k] <= da.getCoordinate(i + 1))) {
                    continue;
                  }
                }
                lreMinor=((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),LineRenderEvent.class);
                lreMinor.setLineAttributes(liaMinorTick);
                loMinorStart.set(x + iDirection * daMinor[k],dYMinorTick1);
                lreMinor.setStart(loMinorStart);
                loMinorEnd.set(x + iDirection * daMinor[k],dYMinorTick2);
                lreMinor.setEnd(loMinorEnd);
                ipr.drawLine(lreMinor);
              }
            }
          }
        }
      }
      if (computation instanceof TextAxisTypeComputation && !bTickBetweenCategories && i == 0) {
        continue;
      }
      if (!bSkipTickLine && 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() == IConstants.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);
          if (this.renderer.rtc.isRightToLeftText()) {
            t3dre.setRtlCaption();
          }
          dc.addLabel(t3dre);
        }
 else {
          lo.set(x + dOffset,sy);
          tre.setAction(TextRenderEvent.RENDER_TEXT_AT_LOCATION);
          if (bLabelWithinAxes) {
            if (i == 0) {
              tre.setTextPosition(iLabelLocation | IConstants.POSITION_MOVE_RIGHT);
            }
 else {
              tre.setTextPosition(iLabelLocation);
            }
          }
          if (this.renderer.rtc.isRightToLeftText()) {
            tre.setRtlCaption();
          }
          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 && bTickBetweenCategories ? iDirection * sc.getUnitSize() / 2 : 0;
  final int length=computation instanceof TextAxisTypeComputation ? da.size() - 1 : da.size();
  double y=(iLabelLocation == IConstants.ABOVE) ? (bRendering3D ? context.dTick1 + 1 : context.dTick1 - 1) : (bRendering3D ? context.dTick2 - 1 : context.dTick2 + 1);
  int xLast=Integer.MIN_VALUE;
  Location loMinorStart=goFactory.createLocation(0,0);
  Location loMinorEnd=goFactory.createLocation(0,0);
  for (int i=0; i < length; i++) {
    computation.handlePreEachTick(i);
    int x=(int)da.getCoordinate(i);
    boolean bSkipTickLine=(x == xLast);
    if (!bSkipTickLine) {
      xLast=x;
    }
    if (bRendering3D) {
      context.x3d=(int)da3D.getCoordinate(i);
      context.z3d=(int)da3D.getCoordinate(i);
    }
    if ((iWhatToDraw & IConstants.AXIS) == IConstants.AXIS) {
      double dYMinorTick1=((iMinorTickStyle & IConstants.TICK_ABOVE) == IConstants.TICK_ABOVE) ? (bRendering3D ? context.dY + pwa.getTickSize() : context.dY - pwa.getTickSize()) : context.dY;
      double dYMinorTick2=((iMinorTickStyle & IConstants.TICK_BELOW) == IConstants.TICK_BELOW) ? (bRendering3D ? context.dY - pwa.getTickSize() : context.dY + pwa.getTickSize()) : context.dY;
      if (!ChartUtil.mathEqual(dYMinorTick1,-dYMinorTick2)) {
        if (i != da.size() - 1) {
          if (bRenderBase3DAxis) {
          }
 else           if (bRenderAncillary3DAxis) {
          }
 else {
            if (!bSkipTickLine && ((i > 0 && i < length - 1) || !axModel.isCategoryAxis() || bTickBetweenCategories)) {
              LineRenderEvent lreMinor=null;
              int minorStep=(int)(1d / da.getStep());
              if (minorStep < 1) {
                minorStep=1;
              }
              for (int k=0; k < daMinor.length - 1; k+=minorStep) {
                if (computation instanceof LinearAxisTypeComputation) {
                  if ((iDirection == 1 && x + daMinor[k] >= da.getCoordinate(i + 1)) || (iDirection == -1 && x - daMinor[k] <= da.getCoordinate(i + 1))) {
                    continue;
                  }
                }
                lreMinor=((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),LineRenderEvent.class);
                lreMinor.setLineAttributes(liaMinorTick);
                loMinorStart.set(x + iDirection * daMinor[k],dYMinorTick1);
                lreMinor.setStart(loMinorStart);
                loMinorEnd.set(x + iDirection * daMinor[k],dYMinorTick2);
                lreMinor.setEnd(loMinorEnd);
                ipr.drawLine(lreMinor);
              }
            }
          }
        }
      }
      if (computation instanceof TextAxisTypeComputation && !bTickBetweenCategories && i == 0) {
        continue;
      }
      if (!bSkipTickLine && !ChartUtil.mathEqual(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() == IConstants.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);
          if (this.renderer.rtc.isRightToLeftText()) {
            t3dre.setRtlCaption();
          }
          dc.addLabel(t3dre);
        }
 else {
          lo.set(x + dOffset,sy);
          tre.setAction(TextRenderEvent.RENDER_TEXT_AT_LOCATION);
          if (bLabelWithinAxes) {
            if (i == 0) {
              tre.setTextPosition(iLabelLocation | IConstants.POSITION_MOVE_RIGHT);
            }
 else {
              tre.setTextPosition(iLabelLocation);
            }
          }
          if (this.renderer.rtc.isRightToLeftText()) {
            tre.setRtlCaption();
          }
          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();
}