Program: 69327
Project: 69327
Buggy source:
/** 
 * @param dBlockY
 * @param aax
 * @param axPH
 * @param scY
 * @param iXLabelLocation
 * @param iYLabelLocation
 * @param iXTitleLocation
 * @param laYAxisLabels
 * @param dXAxisLabelsThickness
 * @param dDecorationThickness
 * @param dXAxisTitleThickness
 * @param dHTotal
 * @param dY
 * @param bTicksAbove
 * @param bTicksBelow
 * @param dAppliedXAxisPlotSpacing
 * @param bForwardScale
 * @return
 * @throws ChartException
 */
private double adjustVerticalWithMinOrigin(double dBlockY,AllAxes aax,final OneAxis axPH,final AutoScale scY,final int iXLabelLocation,final int iYLabelLocation,final int iXTitleLocation,final Label laYAxisLabels,double dXAxisLabelsThickness,double[] dDecorationThickness,double dXAxisTitleThickness,double dHTotal,double dY,final boolean bTicksAbove,final boolean bTicksBelow,final double dAppliedXAxisPlotSpacing,final boolean bForwardScale) throws ChartException {
  double dY1;
  double dY2;
  dY-=dAppliedXAxisPlotSpacing;
  dHTotal-=dAppliedXAxisPlotSpacing;
  dY1=dY;
  dY2=dY;
  double dTickSize=getTickSize();
  if (bTicksAbove && dTickSize <= dHTotal) {
    dY1-=dTickSize;
    dHTotal-=dTickSize;
  }
 else {
    dTickSize=0;
  }
  double dH1=0;
  double dH2=0;
  if (iXLabelLocation == ABOVE) {
    dH1=Math.max(dXAxisLabelsThickness,dDecorationThickness[0]);
    dH2=Math.max(bTicksBelow ? getTickSize() : 0,dAppliedXAxisPlotSpacing);
  }
 else   if (iXLabelLocation == BELOW) {
    dH1=dDecorationThickness[0];
    dH2+=Math.max((bTicksBelow ? getTickSize() : 0) + dXAxisLabelsThickness,dAppliedXAxisPlotSpacing);
  }
  if (dH1 + dH2 <= dHTotal) {
    dY1-=dH1;
    dY2+=dH2;
    dHTotal-=(dH1 + dH2);
  }
 else {
    axPH.setShowLabels(false);
  }
  if (iXTitleLocation == ABOVE) {
    dY1-=dXAxisTitleThickness;
  }
 else   if (iXTitleLocation == BELOW) {
    dY2+=dXAxisTitleThickness;
  }
  if (dY1 < dBlockY) {
    final double dDelta=(dBlockY - dY1);
    dY1=dBlockY;
    dY+=dDelta;
    dY2+=dDelta;
  }
  double dDeltaY1=dY - dY1;
  double dDeltaY2=dY2 - dY;
  double dXAxisThickness=0;
  if (iXLabelLocation == ABOVE) {
    dXAxisThickness=dY2 - dY1;
  }
 else   if (iXLabelLocation == BELOW) {
    dY2=(dY + dAppliedXAxisPlotSpacing);
    dXAxisThickness=dY2 - dY1;
  }
  if ((bForwardScale && dXAxisThickness > scY.getStartShift()) || (!bForwardScale && dXAxisThickness > scY.getEndShift())) {
    double dStart=scY.getStart(), dEnd=dY2 - scY.getEndShift();
    if (bForwardScale) {
      dStart=dY2 - scY.getStartShift();
      dEnd=scY.getEnd();
    }
    scY.resetShifts();
    scY.setEndPoints(dStart,dEnd);
    scY.computeTicks(ids,laYAxisLabels,iYLabelLocation,VERTICAL,dStart,dEnd,true,aax);
    if (!scY.isStepFixed()) {
      final Object[] oaMinMax=scY.getMinMax();
      while (!scY.checkFit(ids,laYAxisLabels,iYLabelLocation)) {
        if (!scY.zoomOut()) {
          break;
        }
        scY.updateAxisMinMax(oaMinMax[0],oaMinMax[1]);
        int tickCount=scY.computeTicks(ids,laYAxisLabels,iYLabelLocation,VERTICAL,dStart,dEnd,true,aax);
        if (scY.getUnit() != null && asInteger(scY.getUnit()) == Calendar.YEAR && tickCount <= 3 || isSharedScale()) {
          break;
        }
      }
    }
  }
  dY-=insCA.getTop();
  dY1=dY - dDeltaY1;
  dY2=dY + dDeltaY2;
  axPH.setTitleCoordinate((iXTitleLocation == ABOVE) ? dY1 - 1 : dY2 + 1 - dXAxisTitleThickness);
  return dY;
}

Fixed version (ground truth):
/** 
 * @param dBlockY
 * @param aax
 * @param axPH
 * @param scY
 * @param iXLabelLocation
 * @param iYLabelLocation
 * @param iXTitleLocation
 * @param laYAxisLabels
 * @param dXAxisLabelsThickness
 * @param dDecorationThickness
 * @param dXAxisTitleThickness
 * @param dHTotal
 * @param dY
 * @param bTicksAbove
 * @param bTicksBelow
 * @param dAppliedXAxisPlotSpacing
 * @param bForwardScale
 * @return
 * @throws ChartException
 */
private double adjustVerticalWithMinOrigin(double dBlockY,AllAxes aax,final OneAxis axPH,final AutoScale scY,final int iXLabelLocation,final int iYLabelLocation,final int iXTitleLocation,final Label laYAxisLabels,double dXAxisLabelsThickness,double[] dDecorationThickness,double dXAxisTitleThickness,double dHTotal,double dY,final boolean bTicksAbove,final boolean bTicksBelow,final double dAppliedXAxisPlotSpacing,final boolean bForwardScale) throws ChartException {
  double dY1;
  double dY2;
  dY-=dAppliedXAxisPlotSpacing;
  dHTotal-=dAppliedXAxisPlotSpacing;
  dY1=dY;
  dY2=dY;
  double dTickSize=getTickSize();
  if (bTicksAbove && dTickSize <= dHTotal) {
    dY1-=dTickSize;
    dHTotal-=dTickSize;
  }
 else {
    dTickSize=0;
  }
  double dH1=0;
  double dH2=0;
  if (iXLabelLocation == ABOVE) {
    dH1=Math.max(dXAxisLabelsThickness,dDecorationThickness[0]);
    dH2=Math.max(bTicksBelow ? getTickSize() : 0,dAppliedXAxisPlotSpacing);
  }
 else   if (iXLabelLocation == BELOW) {
    dH1=dDecorationThickness[0];
    dH2+=Math.max((bTicksBelow ? getTickSize() : 0) + dXAxisLabelsThickness,dAppliedXAxisPlotSpacing);
  }
  if (dH1 + dH2 <= dHTotal) {
    dY1-=dH1;
    dY2+=dH2;
  }
 else {
    axPH.setShowLabels(false);
  }
  if (iXTitleLocation == ABOVE) {
    dY1-=dXAxisTitleThickness;
  }
 else   if (iXTitleLocation == BELOW) {
    dY2+=dXAxisTitleThickness;
  }
  if (dY1 < dBlockY) {
    final double dDelta=(dBlockY - dY1);
    dY1=dBlockY;
    dY+=dDelta;
    dY2+=dDelta;
  }
  double dDeltaY1=dY - dY1;
  double dDeltaY2=dY2 - dY;
  double dXAxisThickness=0;
  if (iXLabelLocation == ABOVE) {
    dXAxisThickness=dY2 - dY1;
  }
 else   if (iXLabelLocation == BELOW) {
    dY2=(dY + dAppliedXAxisPlotSpacing);
    dXAxisThickness=dY2 - dY1;
  }
  if ((bForwardScale && dXAxisThickness > scY.getStartShift()) || (!bForwardScale && dXAxisThickness > scY.getEndShift())) {
    double dStart=scY.getStart(), dEnd=dY2 - scY.getEndShift();
    if (bForwardScale) {
      dStart=dY2 - scY.getStartShift();
      dEnd=scY.getEnd();
    }
    scY.resetShifts();
    scY.setEndPoints(dStart,dEnd);
    scY.computeTicks(ids,laYAxisLabels,iYLabelLocation,VERTICAL,dStart,dEnd,true,aax);
    if (!scY.isStepFixed()) {
      final Object[] oaMinMax=scY.getMinMax();
      while (!scY.checkFit(ids,laYAxisLabels,iYLabelLocation)) {
        if (!scY.zoomOut()) {
          break;
        }
        scY.updateAxisMinMax(oaMinMax[0],oaMinMax[1]);
        int tickCount=scY.computeTicks(ids,laYAxisLabels,iYLabelLocation,VERTICAL,dStart,dEnd,true,aax);
        if (scY.getUnit() != null && asInteger(scY.getUnit()) == Calendar.YEAR && tickCount <= 3 || isSharedScale()) {
          break;
        }
      }
    }
  }
  dY-=insCA.getTop();
  dY1=dY - dDeltaY1;
  dY2=dY + dDeltaY2;
  axPH.setTitleCoordinate((iXTitleLocation == ABOVE) ? dY1 - 1 : dY2 + 1 - dXAxisTitleThickness);
  return dY;
}