Program: 70218
Project: 70218
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=computation instanceof TextAxisTypeComputation && bTickBetweenCategories ? iDirection * sc.getUnitSize() / 2 : 0;
  final int length=computation instanceof TextAxisTypeComputation ? da.size() - 1 : da.size();
  final double x=(iLabelLocation == IConstants.LEFT) ? context.dTick1 - 1 : context.dTick2 + 1;
  int yLast=Integer.MIN_VALUE;
  Location loMinorStart=LocationImpl.create(0,0);
  Location loMinorEnd=LocationImpl.create(0,0);
  for (int i=0; i < length; i++) {
    computation.handlePreEachTick(i);
    int y=(int)da.getCoordinate(i);
    boolean bSkipTickLine=(yLast == y);
    if (!bSkipTickLine) {
      yLast=y;
    }
    if (bRendering3D) {
      context.y3d=(int)da3D.getCoordinate(i);
    }
    if ((iWhatToDraw & IConstants.AXIS) == IConstants.AXIS) {
      double dXMinorTick1=((iMinorTickStyle & IConstants.TICK_LEFT) == IConstants.TICK_LEFT) ? (context.dX - pwa.getTickSize()) : context.dX;
      double dXMinorTick2=((iMinorTickStyle & IConstants.TICK_RIGHT) == IConstants.TICK_RIGHT) ? context.dX + pwa.getTickSize() : context.dX;
      if (dXMinorTick1 != dXMinorTick2) {
        if (i != da.size() - 1) {
          if (bRenderOrthogonal3DAxis) {
          }
 else {
            if (!bSkipTickLine) {
              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 && y - daMinor[k] <= da.getCoordinate(i + 1)) || (iDirection == 1 && y + daMinor[k] >= da.getCoordinate(i + 1))) {
                    continue;
                  }
                }
                lreMinor=((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),LineRenderEvent.class);
                lreMinor.setLineAttributes(liaMinorTick);
                loMinorStart.set(dXMinorTick1,y + iDirection * daMinor[k]);
                lreMinor.setStart(loMinorStart);
                loMinorEnd.set(dXMinorTick2,y + iDirection * daMinor[k]);
                lreMinor.setEnd(loMinorEnd);
                ipr.drawLine(lreMinor);
              }
            }
          }
        }
      }
      if (computation instanceof TextAxisTypeComputation && !bTickBetweenCategories && i == 0) {
        continue;
      }
      if (!bSkipTickLine && 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() == IConstants.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);
          if (this.renderer.rtc.isRightToLeftText()) {
            t3dre.setRtlCaption();
          }
          dc.addLabel(t3dre);
        }
 else {
          lo.set(sx,y + dOffset);
          tre.setAction(TextRenderEvent.RENDER_TEXT_AT_LOCATION);
          if (bLabelWithinAxes) {
            if (i == 0) {
              tre.setTextPosition(iLabelLocation | IConstants.POSITION_MOVE_ABOVE);
            }
 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 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 && bTickBetweenCategories ? iDirection * sc.getUnitSize() / 2 : 0;
  final int length=computation instanceof TextAxisTypeComputation ? da.size() - 1 : da.size();
  final double x=(iLabelLocation == IConstants.LEFT) ? context.dTick1 - 1 : context.dTick2 + 1;
  int yLast=Integer.MIN_VALUE;
  Location loMinorStart=LocationImpl.create(0,0);
  Location loMinorEnd=LocationImpl.create(0,0);
  for (int i=0; i < length; i++) {
    computation.handlePreEachTick(i);
    int y=(int)da.getCoordinate(i);
    boolean bSkipTickLine=(yLast == y);
    if (!bSkipTickLine) {
      yLast=y;
    }
    if (bRendering3D) {
      context.y3d=(int)da3D.getCoordinate(i);
    }
    if ((iWhatToDraw & IConstants.AXIS) == IConstants.AXIS) {
      double dXMinorTick1=((iMinorTickStyle & IConstants.TICK_LEFT) == IConstants.TICK_LEFT) ? (context.dX - pwa.getTickSize()) : context.dX;
      double dXMinorTick2=((iMinorTickStyle & IConstants.TICK_RIGHT) == IConstants.TICK_RIGHT) ? context.dX + pwa.getTickSize() : context.dX;
      if (dXMinorTick1 != dXMinorTick2) {
        if (i != da.size() - 1) {
          if (bRenderOrthogonal3DAxis) {
          }
 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 && y - daMinor[k] <= da.getCoordinate(i + 1)) || (iDirection == 1 && y + daMinor[k] >= da.getCoordinate(i + 1))) {
                    continue;
                  }
                }
                lreMinor=((EventObjectCache)ipr).getEventObject(StructureSource.createAxis(axModel),LineRenderEvent.class);
                lreMinor.setLineAttributes(liaMinorTick);
                loMinorStart.set(dXMinorTick1,y + iDirection * daMinor[k]);
                lreMinor.setStart(loMinorStart);
                loMinorEnd.set(dXMinorTick2,y + iDirection * daMinor[k]);
                lreMinor.setEnd(loMinorEnd);
                ipr.drawLine(lreMinor);
              }
            }
          }
        }
      }
      if (computation instanceof TextAxisTypeComputation && !bTickBetweenCategories && i == 0) {
        continue;
      }
      if (!bSkipTickLine && 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() == IConstants.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);
          if (this.renderer.rtc.isRightToLeftText()) {
            t3dre.setRtlCaption();
          }
          dc.addLabel(t3dre);
        }
 else {
          lo.set(sx,y + dOffset);
          tre.setAction(TextRenderEvent.RENDER_TEXT_AT_LOCATION);
          if (bLabelWithinAxes) {
            if (i == 0) {
              tre.setTextPosition(iLabelLocation | IConstants.POSITION_MOVE_ABOVE);
            }
 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();
}