Program: 70977
Project: 70977
Buggy source:
/** 
 * @param la
 * @param iLabelLocation
 * @param iOrientation
 * @param dStart
 * @param dEnd
 * @param bConsiderStartEndLabels
 * @param aax
 */
public final int computeTicks(IDisplayServer xs,Label la,int iLabelLocation,int iOrientation,double dStart,double dEnd,boolean bConsiderStartLabel,boolean bConsiderEndLabel,AllAxes aax) throws ChartException {
  boolean bMaxIsNotIntegralMultipleOfStep=false;
  int nTicks=0;
  double dLength=0;
  double dTickGap=0;
  int iDirection=(iScaleDirection == AUTO) ? ((iOrientation == HORIZONTAL) ? FORWARD : BACKWARD) : iScaleDirection;
  if (bConsiderStartLabel || bConsiderEndLabel) {
    computeAxisStartEndShifts(xs,la,iOrientation,iLabelLocation,aax);
    if (!bLabelWithinAxes && bConsiderStartLabel) {
      dStart+=dStartShift * iDirection;
    }
    if (bConsiderEndLabel) {
      dEnd+=dEndShift * -iDirection;
    }
  }
  this.dStart=dStart;
  this.dEnd=dEnd;
  nTicks=getTickCount();
  dLength=Math.abs(dStart - dEnd);
  if (!bCategoryScale && (iType & NUMERICAL) == NUMERICAL && (iType & LINEAR) == LINEAR) {
    double dMax=asDouble(oMaximum).doubleValue();
    double dMin=asDouble(oMinimum).doubleValue();
    double dStep=asDouble(oStep).doubleValue();
    bMaxIsNotIntegralMultipleOfStep=!ChartUtil.mathEqual(dMax / dStep,(int)(dMax / dStep));
    if (bStepFixed && oStepNumber != null) {
      dTickGap=dLength / (oStepNumber.intValue()) * iDirection;
    }
 else {
      double dStepSize=asDouble(oStep).doubleValue();
      dTickGap=Math.min(Math.abs(dStepSize / (dMax - dMin) * dLength),dLength) * iDirection;
    }
  }
 else {
    if (isTickBetweenCategories()) {
      dTickGap=dLength / (nTicks - 1) * iDirection;
    }
 else {
      dTickGap=dLength / (nTicks - 2) * iDirection;
    }
  }
  if (nTicks > TICKS_MAX && bStepFixed && !bCategoryScale) {
    throw new ChartException(ChartEnginePlugin.ID,ChartException.GENERATION,"String_Node_Str",Messages.getResourceBundle(rtc.getULocale()));
  }
  AxisTickCoordinates atc=new AxisTickCoordinates(nTicks,dStart,dEnd,dTickGap,!bCategoryScale || isTickBetweenCategories());
  setTickCordinates(null);
  setEndPoints(dStart,dEnd);
  setTickCordinates(atc);
  if (bStepFixed && oStepNumber == null && (nTicks > 2) && bMaxIsNotIntegralMultipleOfStep) {
    if (!checkFit(xs,la,iLabelLocation)) {
      nTicks--;
      AxisTickCoordinates atc1=new AxisTickCoordinates(nTicks,dStart,dEnd,dTickGap,!bCategoryScale || isTickBetweenCategories());
      setTickCordinates(null);
      setTickCordinates(atc1);
    }
  }
  checkTickLabelsVisibility(xs,la,iLabelLocation);
  return nTicks;
}

Fixed version (ground truth):
/** 
 * @param la
 * @param iLabelLocation
 * @param iOrientation
 * @param dStart
 * @param dEnd
 * @param bConsiderStartEndLabels
 * @param aax
 */
public final int computeTicks(IDisplayServer xs,Label la,int iLabelLocation,int iOrientation,double dStart,double dEnd,boolean bConsiderStartLabel,boolean bConsiderEndLabel,AllAxes aax) throws ChartException {
  boolean bMaxIsNotIntegralMultipleOfStep=false;
  int nTicks=0;
  double dLength=0;
  double dTickGap=0;
  int iDirection=(iScaleDirection == AUTO) ? ((iOrientation == HORIZONTAL) ? FORWARD : BACKWARD) : iScaleDirection;
  if (bConsiderStartLabel || bConsiderEndLabel) {
    computeAxisStartEndShifts(xs,la,iOrientation,iLabelLocation,aax);
    if (!bLabelWithinAxes && bConsiderStartLabel) {
      double dNewStart=dStart + dStartShift * iDirection;
      if (dEnd > dStart && dNewStart > dEnd - 1) {
        dNewStart=dEnd - 1;
      }
 else       if (dEnd < dStart && dNewStart < dEnd + 1) {
        dNewStart=dEnd + 1;
      }
      dStartShift=(dNewStart - dStart) / iDirection;
      dStart=dNewStart;
    }
    if (bConsiderEndLabel) {
      double dNewEnd=dEnd + dEndShift * -iDirection;
      if (dEnd > dStart && dNewEnd < dStart + 1) {
        dNewEnd=dStart + 1;
      }
 else       if (dEnd < dStart && dNewEnd > dStart - 1) {
        dNewEnd=dStart - 1;
      }
      dEndShift=(dNewEnd - dEnd) / -iDirection;
      dEnd=dNewEnd;
    }
  }
  this.dStart=dStart;
  this.dEnd=dEnd;
  nTicks=getTickCount();
  dLength=Math.abs(dStart - dEnd);
  if (!bCategoryScale && (iType & NUMERICAL) == NUMERICAL && (iType & LINEAR) == LINEAR) {
    double dMax=asDouble(oMaximum).doubleValue();
    double dMin=asDouble(oMinimum).doubleValue();
    double dStep=asDouble(oStep).doubleValue();
    bMaxIsNotIntegralMultipleOfStep=!ChartUtil.mathEqual(dMax / dStep,(int)(dMax / dStep));
    if (bStepFixed && oStepNumber != null) {
      dTickGap=dLength / (oStepNumber.intValue()) * iDirection;
    }
 else {
      double dStepSize=asDouble(oStep).doubleValue();
      dTickGap=Math.min(Math.abs(dStepSize / (dMax - dMin) * dLength),dLength) * iDirection;
    }
  }
 else {
    if (isTickBetweenCategories()) {
      dTickGap=dLength / (nTicks - 1) * iDirection;
    }
 else {
      dTickGap=dLength / (nTicks - 2) * iDirection;
    }
  }
  if (nTicks > TICKS_MAX && bStepFixed && !bCategoryScale) {
    throw new ChartException(ChartEnginePlugin.ID,ChartException.GENERATION,"String_Node_Str",Messages.getResourceBundle(rtc.getULocale()));
  }
  AxisTickCoordinates atc=new AxisTickCoordinates(nTicks,dStart,dEnd,dTickGap,!bCategoryScale || isTickBetweenCategories());
  setTickCordinates(null);
  setEndPoints(dStart,dEnd);
  setTickCordinates(atc);
  if (bStepFixed && oStepNumber == null && (nTicks > 2) && bMaxIsNotIntegralMultipleOfStep) {
    if (!checkFit(xs,la,iLabelLocation)) {
      nTicks--;
      AxisTickCoordinates atc1=new AxisTickCoordinates(nTicks,dStart,dEnd,dTickGap,!bCategoryScale || isTickBetweenCategories());
      setTickCordinates(null);
      setTickCordinates(atc1);
    }
  }
  checkTickLabelsVisibility(xs,la,iLabelLocation);
  return nTicks;
}