Program: 73221
Project: 73221
Buggy source:
/** 
 * Computes tick count
 * @return tick count
 */
public final int getTickCount() throws ChartException {
  if (this.oStepNumber != null) {
    if (bCategoryScale || (iType & NUMERICAL) != NUMERICAL) {
      logger.log(new ChartException(ChartEnginePlugin.ID,ChartException.GENERATION,"String_Node_Str",Messages.getResourceBundle(rtc.getULocale())));
    }
 else {
      return this.oStepNumber.intValue() + 1;
    }
  }
  int nTicks=2;
  if (isCategoryScale()) {
    if (dsiData != null) {
      nTicks=dsiData.size() + 1;
      if (!bTickBetweenCategories) {
        nTicks++;
      }
    }
  }
 else   if ((iType & NUMERICAL) == NUMERICAL) {
    if ((iType & LINEAR) == LINEAR) {
      double dMax=asDouble(oMaximum).doubleValue();
      double dMin=asDouble(oMinimum).doubleValue();
      double dStep=asDouble(oStep).doubleValue();
      if (!ChartUtil.mathEqual(dMax,dMin)) {
        long lNTicks=Math.round((dMax - dMin) / dStep);
        if ((lNTicks > TICKS_MAX) || (lNTicks < 2)) {
          if (lNTicks > TICKS_MAX) {
            nTicks=TICKS_MAX;
          }
 else {
            nTicks=2;
          }
          dStep=dMax / (nTicks - 1) - dMin / (nTicks - 1);
          checkValible(dStep,Messages.getString("String_Node_Str"));
          oStep=new Double(dStep);
        }
 else {
          nTicks=(int)Math.ceil(lNTicks - 0.5) + 1;
        }
      }
 else       nTicks=5;
    }
 else     if ((iType & LOGARITHMIC) == LOGARITHMIC) {
      double dMax=asDouble(oMaximum).doubleValue();
      double dMin=asDouble(oMinimum).doubleValue();
      double dStep=asDouble(oStep).doubleValue();
      double dMaxLog=(Math.log(dMax) / LOG_10);
      double dMinLog=(Math.log(dMin) / LOG_10);
      double dStepLog=(Math.log(dStep) / LOG_10);
      nTicks=(int)Math.ceil((dMaxLog - dMinLog) / dStepLog) + 1;
    }
  }
 else   if ((iType & DATE_TIME) == DATE_TIME) {
    final CDateTime cdt1=(CDateTime)oMinimum;
    final CDateTime cdt2=(CDateTime)oMaximum;
    double diff=CDateTime.computeDifference(cdt2,cdt1,asInteger(oUnit)) / asInteger(oStep);
    nTicks=(int)Math.round(diff) + 1;
  }
 else {
    throw new ChartException(ChartEnginePlugin.ID,ChartException.GENERATION,"String_Node_Str",Messages.getResourceBundle(rtc.getULocale()));
  }
  if (nTicks > 10000) {
    nTicks=10000;
  }
  if (nTicks < 2) {
    nTicks=2;
  }
  return nTicks;
}

Fixed version (ground truth):
/** 
 * Computes tick count
 * @return tick count
 */
public final int getTickCount() throws ChartException {
  if (this.oStepNumber != null) {
    if (bCategoryScale || (iType & NUMERICAL) != NUMERICAL) {
      logger.log(new ChartException(ChartEnginePlugin.ID,ChartException.GENERATION,"String_Node_Str",Messages.getResourceBundle(rtc.getULocale())));
    }
 else {
      return this.oStepNumber.intValue() + 1;
    }
  }
  int nTicks=2;
  if (isCategoryScale()) {
    if (dsiData != null) {
      nTicks=dsiData.size() + 1;
      if (!bTickBetweenCategories) {
        nTicks++;
      }
    }
  }
 else   if ((iType & NUMERICAL) == NUMERICAL) {
    if ((iType & LINEAR) == LINEAR) {
      double dMax=asDouble(oMaximum).doubleValue();
      double dMin=asDouble(oMinimum).doubleValue();
      double dStep=asDouble(oStep).doubleValue();
      if (!ChartUtil.mathEqual(dMax,dMin)) {
        double lNTicks=Math.ceil((dMax - dMin) / dStep - 0.5) + 1;
        if ((lNTicks > TICKS_MAX) || (lNTicks < 2)) {
          if (lNTicks > TICKS_MAX) {
            nTicks=TICKS_MAX;
          }
 else {
            nTicks=2;
          }
          dStep=dMax / (nTicks - 1) - dMin / (nTicks - 1);
          checkValible(dStep,Messages.getString("String_Node_Str"));
          oStep=new Double(dStep);
        }
 else {
          nTicks=(int)lNTicks;
        }
      }
 else       nTicks=5;
    }
 else     if ((iType & LOGARITHMIC) == LOGARITHMIC) {
      double dMax=asDouble(oMaximum).doubleValue();
      double dMin=asDouble(oMinimum).doubleValue();
      double dStep=asDouble(oStep).doubleValue();
      double dMaxLog=(Math.log(dMax) / LOG_10);
      double dMinLog=(Math.log(dMin) / LOG_10);
      double dStepLog=(Math.log(dStep) / LOG_10);
      nTicks=(int)Math.ceil((dMaxLog - dMinLog) / dStepLog) + 1;
    }
  }
 else   if ((iType & DATE_TIME) == DATE_TIME) {
    final CDateTime cdt1=(CDateTime)oMinimum;
    final CDateTime cdt2=(CDateTime)oMaximum;
    double diff=CDateTime.computeDifference(cdt2,cdt1,asInteger(oUnit)) / asInteger(oStep);
    nTicks=(int)Math.round(diff) + 1;
  }
 else {
    throw new ChartException(ChartEnginePlugin.ID,ChartException.GENERATION,"String_Node_Str",Messages.getResourceBundle(rtc.getULocale()));
  }
  if (nTicks > 10000) {
    nTicks=10000;
  }
  if (nTicks < 2) {
    nTicks=2;
  }
  return nTicks;
}