Program: 67053
Project: 67053
Buggy source:
private static void adjustDataSets(Series[] seriesArray,BigDecimal bnMinFixed,BigDecimal bnMaxFixed) throws ChartException {
  IDataSetProcessor idsp;
  boolean hasBigNumber=false;
  Number[] doaDataSet=null;
  BigDecimal bnMin=null;
  BigDecimal bnMax=null;
  for (  Series series : seriesArray) {
    DataSet ds=series.getDataSet();
    hasBigNumber=((DataSetImpl)ds).isBigNumber();
    if (hasBigNumber) {
      break;
    }
  }
  if (hasBigNumber) {
    for (    Series series : seriesArray) {
      DataSet ds=series.getDataSet();
      idsp=PluginSettings.instance().getDataSetProcessor(series.getClass());
      if (bnMin == null) {
        bnMin=NumberUtil.asBigDecimal((Number)idsp.getMinimum(ds));
        bnMax=NumberUtil.asBigDecimal((Number)idsp.getMaximum(ds));
        continue;
      }
      bnMin=bnMin.min(NumberUtil.asBigDecimal((Number)idsp.getMinimum(ds)));
      bnMax=bnMax.max(NumberUtil.asBigDecimal((Number)idsp.getMaximum(ds)));
    }
    bnMin=bnMinFixed != null ? bnMinFixed : bnMin;
    bnMax=bnMaxFixed != null ? bnMaxFixed : bnMax;
    BigDecimal absMax=bnMax.abs();
    if (absMax.compareTo(NumberUtil.DOUBLE_MIN) < 0) {
      BigDecimal divisor=BigDecimal.ONE.divide(NumberUtil.HUNDRED.divide(bnMin,NumberUtil.DEFAULT_MATHCONTEXT),NumberUtil.DEFAULT_MATHCONTEXT);
      for (      Series series : seriesArray) {
        DataSet ds=series.getDataSet();
        idsp=PluginSettings.instance().getDataSetProcessor(series.getClass());
        if (ds.getValues() instanceof Number[]) {
          doaDataSet=(Number[])ds.getValues();
          Number[] numbers=new BigNumber[doaDataSet.length];
          for (int j=0; j < doaDataSet.length; j++) {
            numbers[j]=NumberUtil.asBigNumber(doaDataSet[j],divisor);
          }
          ds.setValues(numbers);
        }
 else         if (ds.getValues() instanceof NumberDataPointEntry[]) {
          NumberDataPointEntry[] ndpe=(NumberDataPointEntry[])ds.getValues();
          for (int j=0; j < ndpe.length; j++) {
            Number[] nums=ndpe[j].getNumberData();
            if (nums == null || nums.length == 0) {
              continue;
            }
            Number[] newNums=new BigNumber[nums.length];
            for (int k=0; k < nums.length; k++) {
              newNums[k]=NumberUtil.asBigNumber(nums[k],divisor);
            }
            ndpe[j].setNumberData(newNums);
          }
        }
      }
    }
 else     if (absMax.compareTo(NumberUtil.DOUBLE_MAX) <= 0) {
      for (      Series series : seriesArray) {
        DataSet ds=series.getDataSet();
        ((DataSetImpl)ds).setIsBigNumber(false);
        idsp=PluginSettings.instance().getDataSetProcessor(series.getClass());
        if (ds.getValues() instanceof Number[]) {
          doaDataSet=(Number[])ds.getValues();
          Number[] newDoaDataSet=new Double[doaDataSet.length];
          for (int j=0; j < doaDataSet.length; j++) {
            newDoaDataSet[j]=NumberUtil.asDouble(doaDataSet[j]);
          }
          ds.setValues(newDoaDataSet);
        }
 else         if (ds.getValues() instanceof NumberDataPointEntry[]) {
          NumberDataPointEntry[] ndpe=(NumberDataPointEntry[])ds.getValues();
          for (int j=0; j < ndpe.length; j++) {
            Number[] nums=ndpe[j].getNumberData();
            if (nums == null || nums.length == 0) {
              continue;
            }
            Number[] newNums=new Number[nums.length];
            for (int k=0; k < nums.length; k++) {
              newNums[k]=NumberUtil.asDouble(nums[k]);
            }
            ndpe[j].setNumberData(newNums);
          }
        }
      }
    }
 else {
      BigDecimal divisor=bnMax.divide(NumberUtil.DEFAULT_DIVISOR,NumberUtil.DEFAULT_MATHCONTEXT);
      for (      Series series : seriesArray) {
        DataSet ds=series.getDataSet();
        idsp=PluginSettings.instance().getDataSetProcessor(series.getClass());
        if (ds.getValues() instanceof Number[]) {
          doaDataSet=(Number[])ds.getValues();
          Number[] numbers=new BigNumber[doaDataSet.length];
          for (int j=0; j < doaDataSet.length; j++) {
            numbers[j]=NumberUtil.asBigNumber(doaDataSet[j],divisor);
          }
          ds.setValues(numbers);
        }
 else         if (ds.getValues() instanceof NumberDataPointEntry[]) {
          NumberDataPointEntry[] ndpe=(NumberDataPointEntry[])ds.getValues();
          for (int j=0; j < ndpe.length; j++) {
            Number[] nums=ndpe[j].getNumberData();
            if (nums == null || nums.length == 0) {
              continue;
            }
            Number[] newNums=new BigNumber[nums.length];
            for (int k=0; k < nums.length; k++) {
              newNums[k]=NumberUtil.asBigNumber(nums[k],divisor);
            }
            ndpe[j].setNumberData(newNums);
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
private static void adjustDataSets(Series[] seriesArray,BigDecimal bnMinFixed,BigDecimal bnMaxFixed) throws ChartException {
  IDataSetProcessor idsp;
  boolean hasBigNumber=false;
  Number[] doaDataSet=null;
  BigDecimal bnMin=null;
  BigDecimal bnMax=null;
  for (  Series series : seriesArray) {
    DataSet ds=series.getDataSet();
    hasBigNumber=((DataSetImpl)ds).isBigNumber();
    if (hasBigNumber) {
      break;
    }
  }
  if (hasBigNumber) {
    for (    Series series : seriesArray) {
      DataSet ds=series.getDataSet();
      idsp=PluginSettings.instance().getDataSetProcessor(series.getClass());
      if (bnMin == null) {
        Object tmp=idsp.getMinimum(ds);
        if (tmp != null)         bnMin=NumberUtil.asBigDecimal((Number)tmp);
        tmp=idsp.getMaximum(ds);
        if (tmp != null)         bnMax=NumberUtil.asBigDecimal((Number)tmp);
        continue;
      }
      Object tmp=idsp.getMinimum(ds);
      if (tmp != null)       bnMin=bnMin.min(NumberUtil.asBigDecimal((Number)tmp));
      tmp=idsp.getMaximum(ds);
      if (tmp != null)       bnMax=bnMax.max(NumberUtil.asBigDecimal((Number)tmp));
    }
    if (bnMin == null || bnMax == null) {
      return;
    }
    bnMin=bnMinFixed != null ? bnMinFixed : bnMin;
    bnMax=bnMaxFixed != null ? bnMaxFixed : bnMax;
    BigDecimal absMax=bnMax.abs();
    if (absMax.compareTo(NumberUtil.DOUBLE_MIN) < 0) {
      BigDecimal divisor=BigDecimal.ONE.divide(NumberUtil.HUNDRED.divide(bnMin,NumberUtil.DEFAULT_MATHCONTEXT),NumberUtil.DEFAULT_MATHCONTEXT);
      for (      Series series : seriesArray) {
        DataSet ds=series.getDataSet();
        idsp=PluginSettings.instance().getDataSetProcessor(series.getClass());
        if (ds.getValues() instanceof Number[]) {
          doaDataSet=(Number[])ds.getValues();
          Number[] numbers=new BigNumber[doaDataSet.length];
          for (int j=0; j < doaDataSet.length; j++) {
            numbers[j]=NumberUtil.asBigNumber(doaDataSet[j],divisor);
          }
          ds.setValues(numbers);
        }
 else         if (ds.getValues() instanceof NumberDataPointEntry[]) {
          NumberDataPointEntry[] ndpe=(NumberDataPointEntry[])ds.getValues();
          for (int j=0; j < ndpe.length; j++) {
            Number[] nums=ndpe[j].getNumberData();
            if (nums == null || nums.length == 0) {
              continue;
            }
            Number[] newNums=new BigNumber[nums.length];
            for (int k=0; k < nums.length; k++) {
              newNums[k]=NumberUtil.asBigNumber(nums[k],divisor);
            }
            ndpe[j].setNumberData(newNums);
          }
        }
      }
    }
 else     if (absMax.compareTo(NumberUtil.DOUBLE_MAX) <= 0) {
      for (      Series series : seriesArray) {
        DataSet ds=series.getDataSet();
        ((DataSetImpl)ds).setIsBigNumber(false);
        idsp=PluginSettings.instance().getDataSetProcessor(series.getClass());
        if (ds.getValues() instanceof Number[]) {
          doaDataSet=(Number[])ds.getValues();
          Number[] newDoaDataSet=new Double[doaDataSet.length];
          for (int j=0; j < doaDataSet.length; j++) {
            newDoaDataSet[j]=NumberUtil.asDouble(doaDataSet[j]);
          }
          ds.setValues(newDoaDataSet);
        }
 else         if (ds.getValues() instanceof NumberDataPointEntry[]) {
          NumberDataPointEntry[] ndpe=(NumberDataPointEntry[])ds.getValues();
          for (int j=0; j < ndpe.length; j++) {
            Number[] nums=ndpe[j].getNumberData();
            if (nums == null || nums.length == 0) {
              continue;
            }
            Number[] newNums=new Number[nums.length];
            for (int k=0; k < nums.length; k++) {
              newNums[k]=NumberUtil.asDouble(nums[k]);
            }
            ndpe[j].setNumberData(newNums);
          }
        }
      }
    }
 else {
      BigDecimal divisor=bnMax.divide(NumberUtil.DEFAULT_DIVISOR,NumberUtil.DEFAULT_MATHCONTEXT);
      for (      Series series : seriesArray) {
        DataSet ds=series.getDataSet();
        idsp=PluginSettings.instance().getDataSetProcessor(series.getClass());
        if (ds.getValues() instanceof Number[]) {
          doaDataSet=(Number[])ds.getValues();
          Number[] numbers=new BigNumber[doaDataSet.length];
          for (int j=0; j < doaDataSet.length; j++) {
            numbers[j]=NumberUtil.asBigNumber(doaDataSet[j],divisor);
          }
          ds.setValues(numbers);
        }
 else         if (ds.getValues() instanceof NumberDataPointEntry[]) {
          NumberDataPointEntry[] ndpe=(NumberDataPointEntry[])ds.getValues();
          for (int j=0; j < ndpe.length; j++) {
            Number[] nums=ndpe[j].getNumberData();
            if (nums == null || nums.length == 0) {
              continue;
            }
            Number[] newNums=new BigNumber[nums.length];
            for (int k=0; k < nums.length; k++) {
              newNums[k]=NumberUtil.asBigNumber(nums[k],divisor);
            }
            ndpe[j].setNumberData(newNums);
          }
        }
      }
    }
  }
}