Program: 76646
Project: 76646
Buggy source:
void renderVerticalAxisByType(ComputationContext context,double dXEnd,double dZEnd,double dZ,double dStaggeredLabelOffset) throws ChartException {
  final int iDirection=sc.getDirection() != IConstants.FORWARD ? -1 : 1;
  IAxisTypeComputation computation=createAxisTypeComputation(context);
  computation.initialize();
  final double dOffset=axModel.isCategoryAxis() ? (axModel.getScale().isTickBetweenCategories() ? iDirection : -iDirection) * sc.getUnitSize() / 2 : 0;
  final int length=computation instanceof TextAxisTypeComputation ? da.length - 1 : da.length;
  final double x=(iLabelLocation == IConstants.LEFT) ? context.dTick1 - 1 : context.dTick2 + 1;
  for (int i=0; i < length; i++) {
    computation.handlePreEachTick(i);
    int y=(int)da[i];
    if (bRendering3D) {
      context.y3d=(int)da3D[i];
    }
    if ((iWhatToDraw & IConstants.AXIS) == IConstants.AXIS) {
      double dXMinorTick1=((iMinorTickStyle & IConstants.TICK_LEFT) == IConstants.TICK_LEFT) ? (context.dX - IConstants.TICK_SIZE) : context.dX;
      double dXMinorTick2=((iMinorTickStyle & IConstants.TICK_RIGHT) == IConstants.TICK_RIGHT) ? context.dX + IConstants.TICK_SIZE : context.dX;
      if (dXMinorTick1 != dXMinorTick2) {
        if (i != da.length - 1) {
          if (bRenderOrthogonal3DAxis) {
          }
 else {
            LineRenderEvent lreMinor=null;
            for (int k=0; k < daMinor.length - 1; k++) {
              if (computation instanceof LinearAxisTypeComputation) {
                if ((iDirection == -1 && y - daMinor[k] <= da[i + 1]) || (iDirection == 1 && y + daMinor[k] >= da[i + 1])) {
                  continue;
                }
              }
              lreMinor=(LineRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),LineRenderEvent.class);
              lreMinor.setLineAttributes(liaMinorTick);
              lreMinor.setStart(LocationImpl.create(dXMinorTick1,y + iDirection * daMinor[k]));
              lreMinor.setEnd(LocationImpl.create(dXMinorTick2,y + iDirection * daMinor[k]));
              ipr.drawLine(lreMinor);
            }
          }
        }
      }
      if (context.dTick1 != context.dTick2) {
        if (bRenderOrthogonal3DAxis) {
        }
 else {
          lre.setLineAttributes(liaMajorTick);
          lre.getStart().set(context.dTick1,y);
          lre.getEnd().set(context.dTick2,y);
          ipr.drawLine(lre);
        }
        if (iv != null && iDimension == IConstants.TWO_5_D && iv.getType() == IntersectionValue.VALUE) {
          lre.setStart(LocationImpl.create(context.dX,y));
          lre.setEnd(LocationImpl.create(context.dX + dSeriesThickness,y - dSeriesThickness));
          ipr.drawLine(lre);
        }
      }
    }
    if (bRenderAxisLabels && sc.isTickLabelVisible(i)) {
      double sx=x;
      double sx2=dXEnd;
      if (bAxisLabelStaggered && sc.isTickLabelStaggered(i)) {
        if (iLabelLocation == IConstants.LEFT) {
          sx-=dStaggeredLabelOffset;
          sx2+=dStaggeredLabelOffset;
        }
 else {
          sx+=dStaggeredLabelOffset;
          sx2-=dStaggeredLabelOffset;
        }
      }
      ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_AXIS_LABEL,axModel,la,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_AXIS_LABEL,la);
      if (ax.getLabel().isVisible() && la.isVisible()) {
        if (bRendering3D) {
          lo3d.set(sx - pwa.getHorizontalSpacingInPixels(),context.y3d + dOffset,dZEnd + pwa.getHorizontalSpacingInPixels());
          t3dre.setLocation3D(lo3d);
          t3dre.setTextPosition(TextRenderEvent.LEFT);
          t3dre.setAction(TextRenderEvent.RENDER_TEXT_AT_LOCATION);
          dc.addLabel(t3dre);
          lo3d.set(sx2 + pwa.getHorizontalSpacingInPixels(),context.y3d + dOffset,dZ - pwa.getHorizontalSpacingInPixels());
          t3dre.setLocation3D(lo3d);
          t3dre.setTextPosition(TextRenderEvent.RIGHT);
          t3dre.setAction(TextRenderEvent.RENDER_TEXT_AT_LOCATION);
          dc.addLabel(t3dre);
        }
 else {
          lo.set(sx,y + dOffset);
          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 renderVerticalAxisByType(ComputationContext context,double dXEnd,double dZEnd,double dZ,double dStaggeredLabelOffset) throws ChartException {
  final int iDirection=sc.getDirection() != IConstants.FORWARD ? -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;
  final double x=(iLabelLocation == IConstants.LEFT) ? context.dTick1 - 1 : context.dTick2 + 1;
  for (int i=0; i < length; i++) {
    computation.handlePreEachTick(i);
    int y=(int)da[i];
    if (bRendering3D) {
      context.y3d=(int)da3D[i];
    }
    if ((iWhatToDraw & IConstants.AXIS) == IConstants.AXIS) {
      double dXMinorTick1=((iMinorTickStyle & IConstants.TICK_LEFT) == IConstants.TICK_LEFT) ? (context.dX - IConstants.TICK_SIZE) : context.dX;
      double dXMinorTick2=((iMinorTickStyle & IConstants.TICK_RIGHT) == IConstants.TICK_RIGHT) ? context.dX + IConstants.TICK_SIZE : context.dX;
      if (dXMinorTick1 != dXMinorTick2) {
        if (i != da.length - 1) {
          if (bRenderOrthogonal3DAxis) {
          }
 else {
            LineRenderEvent lreMinor=null;
            for (int k=0; k < daMinor.length - 1; k++) {
              if (computation instanceof LinearAxisTypeComputation) {
                if ((iDirection == -1 && y - daMinor[k] <= da[i + 1]) || (iDirection == 1 && y + daMinor[k] >= da[i + 1])) {
                  continue;
                }
              }
              lreMinor=(LineRenderEvent)((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),LineRenderEvent.class);
              lreMinor.setLineAttributes(liaMinorTick);
              lreMinor.setStart(LocationImpl.create(dXMinorTick1,y + iDirection * daMinor[k]));
              lreMinor.setEnd(LocationImpl.create(dXMinorTick2,y + iDirection * daMinor[k]));
              ipr.drawLine(lreMinor);
            }
          }
        }
      }
      if (context.dTick1 != context.dTick2) {
        if (bRenderOrthogonal3DAxis) {
        }
 else {
          lre.setLineAttributes(liaMajorTick);
          lre.getStart().set(context.dTick1,y);
          lre.getEnd().set(context.dTick2,y);
          ipr.drawLine(lre);
        }
        if (iv != null && iDimension == IConstants.TWO_5_D && iv.getType() == IntersectionValue.VALUE) {
          lre.setStart(LocationImpl.create(context.dX,y));
          lre.setEnd(LocationImpl.create(context.dX + dSeriesThickness,y - dSeriesThickness));
          ipr.drawLine(lre);
        }
      }
    }
    if (bRenderAxisLabels && sc.isTickLabelVisible(i)) {
      double sx=x;
      double sx2=dXEnd;
      if (bAxisLabelStaggered && sc.isTickLabelStaggered(i)) {
        if (iLabelLocation == IConstants.LEFT) {
          sx-=dStaggeredLabelOffset;
          sx2+=dStaggeredLabelOffset;
        }
 else {
          sx+=dStaggeredLabelOffset;
          sx2-=dStaggeredLabelOffset;
        }
      }
      ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_AXIS_LABEL,axModel,la,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_AXIS_LABEL,la);
      if (ax.getLabel().isVisible() && la.isVisible()) {
        if (bRendering3D) {
          lo3d.set(sx - pwa.getHorizontalSpacingInPixels(),context.y3d + dOffset,dZEnd + pwa.getHorizontalSpacingInPixels());
          t3dre.setLocation3D(lo3d);
          t3dre.setTextPosition(TextRenderEvent.LEFT);
          t3dre.setAction(TextRenderEvent.RENDER_TEXT_AT_LOCATION);
          dc.addLabel(t3dre);
          lo3d.set(sx2 + pwa.getHorizontalSpacingInPixels(),context.y3d + dOffset,dZ - pwa.getHorizontalSpacingInPixels());
          t3dre.setLocation3D(lo3d);
          t3dre.setTextPosition(TextRenderEvent.RIGHT);
          t3dre.setAction(TextRenderEvent.RENDER_TEXT_AT_LOCATION);
          dc.addLabel(t3dre);
        }
 else {
          lo.set(sx,y + dOffset);
          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();
}