Program: 73460
Project: 73460
Buggy source:
final double computeAxisLabelThickness(IDisplayServer xs,Label la,int iOrientation) throws ChartException {
  if (!la.isSetVisible()) {
    throw new ChartException(ChartEnginePlugin.ID,ChartException.GENERATION,"String_Node_Str",new Object[]{la.getCaption().getValue()},Messages.getResourceBundle(rtc.getULocale()));
  }
  if (!la.isVisible() && !bLabelWithinAxes) {
    return 0;
  }
  String sText;
  AxisTickCoordinates da=getTickCordinates();
  if (iOrientation == VERTICAL) {
    double dW, dMaxW=0, dMaxW2=0;
    if (isCategoryScale()) {
      final DataSetIterator dsi=getData();
      final int iDateTimeUnit=(getType() == IConstants.DATE_TIME) ? CDateTime.computeUnit(dsi) : IConstants.UNDEFINED;
      dsi.reset();
      int i=0;
      while (dsi.hasNext()) {
        la.getCaption().setValue(formatCategoryValue(getType(),dsi.next(),iDateTimeUnit));
        dW=computeWidth(xs,la);
        if (isAxisLabelStaggered() && baTickLabelStaggered[i]) {
          dMaxW2=Math.max(dW,dMaxW2);
        }
 else         if (dW > dMaxW) {
          dMaxW=dW;
        }
        i++;
      }
    }
 else     if ((getType() & LINEAR) == LINEAR) {
      final NumberDataElement nde=NumberDataElementImpl.create(0);
      double dAxisValue=asDouble(getMinimum()).doubleValue();
      double dAxisStep=asDouble(getStep()).doubleValue();
      DecimalFormat df=null;
      if (fs == null) {
        df=computeDecimalFormat(dAxisValue,dAxisStep);
      }
      for (int i=0; i < da.size(); i++) {
        nde.setValue(dAxisValue);
        try {
          sText=ValueFormatter.format(nde,fs,rtc.getULocale(),df);
        }
 catch (        ChartException dfex) {
          logger.log(dfex);
          sText=IConstants.NULL_STRING;
        }
        la.getCaption().setValue(sText);
        dW=computeWidth(xs,la);
        if (isAxisLabelStaggered() && baTickLabelStaggered[i]) {
          dMaxW2=Math.max(dW,dMaxW2);
        }
 else         if (dW > dMaxW) {
          dMaxW=dW;
        }
        dAxisValue+=dAxisStep;
      }
    }
 else     if ((getType() & LOGARITHMIC) == LOGARITHMIC) {
      final NumberDataElement nde=NumberDataElementImpl.create(0);
      double dAxisValue=asDouble(getMinimum()).doubleValue();
      double dAxisStep=asDouble(getStep()).doubleValue();
      DecimalFormat df=null;
      for (int i=0; i < da.size(); i++) {
        if (fs == null) {
          df=computeDecimalFormat(dAxisValue,dAxisStep);
        }
        nde.setValue(dAxisValue);
        try {
          sText=ValueFormatter.format(nde,fs,rtc.getULocale(),df);
        }
 catch (        ChartException dfex) {
          logger.log(dfex);
          sText=IConstants.NULL_STRING;
        }
        la.getCaption().setValue(sText);
        dW=computeWidth(xs,la);
        if (isAxisLabelStaggered() && baTickLabelStaggered[i]) {
          dMaxW2=Math.max(dW,dMaxW2);
        }
 else         if (dW > dMaxW) {
          dMaxW=dW;
        }
        dAxisValue*=dAxisStep;
      }
    }
 else     if ((getType() & DATE_TIME) == DATE_TIME) {
      CDateTime cdtAxisValue=asDateTime(getMinimum());
      int iStep=asInteger(getStep());
      int iUnit=asInteger(getUnit());
      IDateFormatWrapper sdf=null;
      if (fs == null) {
        sdf=DateFormatWrapperFactory.getPreferredDateFormat(iUnit,rtc.getULocale());
      }
      for (int i=0; i < da.size(); i++) {
        try {
          sText=ValueFormatter.format(cdtAxisValue,fs,rtc.getULocale(),sdf);
        }
 catch (        ChartException dfex) {
          logger.log(dfex);
          sText=IConstants.NULL_STRING;
        }
        la.getCaption().setValue(sText);
        dW=computeWidth(xs,la);
        if (isAxisLabelStaggered() && baTickLabelStaggered[i]) {
          dMaxW2=Math.max(dW,dMaxW2);
        }
 else         if (dW > dMaxW) {
          dMaxW=dW;
        }
        cdtAxisValue=cdtAxisValue.forward(iUnit,iStep);
      }
    }
    return dMaxW + dMaxW2;
  }
 else   if (iOrientation == HORIZONTAL) {
    double dH, dMaxH=0, dMaxH2=0;
    if (isCategoryScale()) {
      final DataSetIterator dsi=getData();
      final int iDateTimeUnit=(getType() == IConstants.DATE_TIME) ? CDateTime.computeUnit(dsi) : IConstants.UNDEFINED;
      dsi.reset();
      int i=0;
      while (dsi.hasNext()) {
        la.getCaption().setValue(formatCategoryValue(getType(),dsi.next(),iDateTimeUnit));
        dH=computeHeight(xs,la);
        if (isAxisLabelStaggered() && baTickLabelStaggered[i]) {
          dMaxH2=Math.max(dH,dMaxH2);
        }
 else         if (dH > dMaxH) {
          dMaxH=dH;
        }
        i++;
      }
    }
 else     if ((getType() & LINEAR) == LINEAR) {
      final NumberDataElement nde=NumberDataElementImpl.create(0);
      double dAxisValue=asDouble(getMinimum()).doubleValue();
      final double dAxisStep=asDouble(getStep()).doubleValue();
      DecimalFormat df=null;
      if (fs == null) {
        df=computeDecimalFormat(dAxisValue,dAxisStep);
      }
      for (int i=0; i < da.size(); i++) {
        nde.setValue(dAxisValue);
        try {
          sText=ValueFormatter.format(nde,fs,rtc.getULocale(),df);
        }
 catch (        ChartException dfex) {
          logger.log(dfex);
          sText=IConstants.NULL_STRING;
        }
        la.getCaption().setValue(sText);
        dH=computeHeight(xs,la);
        if (isAxisLabelStaggered() && baTickLabelStaggered[i]) {
          dMaxH2=Math.max(dH,dMaxH2);
        }
 else         if (dH > dMaxH) {
          dMaxH=dH;
        }
        dAxisValue+=dAxisStep;
      }
    }
 else     if ((getType() & LOGARITHMIC) == LOGARITHMIC) {
      final NumberDataElement nde=NumberDataElementImpl.create(0);
      double dAxisValue=asDouble(getMinimum()).doubleValue();
      final double dAxisStep=asDouble(getStep()).doubleValue();
      DecimalFormat df=null;
      for (int i=0; i < da.size(); i++) {
        if (fs == null) {
          df=computeDecimalFormat(dAxisValue,dAxisStep);
        }
        nde.setValue(dAxisValue);
        try {
          sText=ValueFormatter.format(nde,fs,rtc.getULocale(),df);
        }
 catch (        ChartException dfex) {
          logger.log(dfex);
          sText=IConstants.NULL_STRING;
        }
        la.getCaption().setValue(sText);
        dH=computeHeight(xs,la);
        if (isAxisLabelStaggered() && baTickLabelStaggered[i]) {
          dMaxH2=Math.max(dH,dMaxH2);
        }
 else         if (dH > dMaxH) {
          dMaxH=dH;
        }
        dAxisValue*=dAxisStep;
      }
    }
 else     if ((getType() & DATE_TIME) == DATE_TIME) {
      CDateTime cdtAxisValue=asDateTime(getMinimum());
      final int iStep=asInteger(getStep());
      final int iUnit=asInteger(getUnit());
      IDateFormatWrapper sdf=null;
      if (fs == null) {
        sdf=DateFormatWrapperFactory.getPreferredDateFormat(iUnit,rtc.getULocale());
      }
      for (int i=0; i < da.size(); i++) {
        try {
          sText=ValueFormatter.format(cdtAxisValue,fs,rtc.getULocale(),sdf);
        }
 catch (        ChartException dfex) {
          logger.log(dfex);
          sText=IConstants.NULL_STRING;
        }
        la.getCaption().setValue(sText);
        dH=computeHeight(xs,la);
        if (isAxisLabelStaggered() && baTickLabelStaggered[i]) {
          dMaxH2=Math.max(dH,dMaxH2);
        }
 else         if (dH > dMaxH) {
          dMaxH=dH;
        }
        cdtAxisValue.forward(iUnit,iStep);
      }
    }
    return dMaxH + dMaxH2;
  }
  return 0;
}

Fixed version (ground truth):
final double computeAxisLabelThickness(IDisplayServer xs,Label la,int iOrientation) throws ChartException {
  if (!la.isSetVisible()) {
    throw new ChartException(ChartEnginePlugin.ID,ChartException.GENERATION,"String_Node_Str",new Object[]{la.getCaption().getValue()},Messages.getResourceBundle(rtc.getULocale()));
  }
  if (!la.isVisible()) {
    return 0;
  }
  String sText;
  AxisTickCoordinates da=getTickCordinates();
  if (iOrientation == VERTICAL) {
    double dW, dMaxW=0, dMaxW2=0;
    if (isCategoryScale()) {
      final DataSetIterator dsi=getData();
      final int iDateTimeUnit=(getType() == IConstants.DATE_TIME) ? CDateTime.computeUnit(dsi) : IConstants.UNDEFINED;
      dsi.reset();
      int i=0;
      while (dsi.hasNext()) {
        la.getCaption().setValue(formatCategoryValue(getType(),dsi.next(),iDateTimeUnit));
        dW=computeWidth(xs,la);
        if (isAxisLabelStaggered() && baTickLabelStaggered[i]) {
          dMaxW2=Math.max(dW,dMaxW2);
        }
 else         if (dW > dMaxW) {
          dMaxW=dW;
        }
        i++;
      }
    }
 else     if ((getType() & LINEAR) == LINEAR) {
      final NumberDataElement nde=NumberDataElementImpl.create(0);
      double dAxisValue=asDouble(getMinimum()).doubleValue();
      double dAxisStep=asDouble(getStep()).doubleValue();
      DecimalFormat df=null;
      if (fs == null) {
        df=computeDecimalFormat(dAxisValue,dAxisStep);
      }
      for (int i=0; i < da.size(); i++) {
        nde.setValue(dAxisValue);
        try {
          sText=ValueFormatter.format(nde,fs,rtc.getULocale(),df);
        }
 catch (        ChartException dfex) {
          logger.log(dfex);
          sText=IConstants.NULL_STRING;
        }
        la.getCaption().setValue(sText);
        dW=computeWidth(xs,la);
        if (isAxisLabelStaggered() && baTickLabelStaggered[i]) {
          dMaxW2=Math.max(dW,dMaxW2);
        }
 else         if (dW > dMaxW) {
          dMaxW=dW;
        }
        dAxisValue+=dAxisStep;
      }
    }
 else     if ((getType() & LOGARITHMIC) == LOGARITHMIC) {
      final NumberDataElement nde=NumberDataElementImpl.create(0);
      double dAxisValue=asDouble(getMinimum()).doubleValue();
      double dAxisStep=asDouble(getStep()).doubleValue();
      DecimalFormat df=null;
      for (int i=0; i < da.size(); i++) {
        if (fs == null) {
          df=computeDecimalFormat(dAxisValue,dAxisStep);
        }
        nde.setValue(dAxisValue);
        try {
          sText=ValueFormatter.format(nde,fs,rtc.getULocale(),df);
        }
 catch (        ChartException dfex) {
          logger.log(dfex);
          sText=IConstants.NULL_STRING;
        }
        la.getCaption().setValue(sText);
        dW=computeWidth(xs,la);
        if (isAxisLabelStaggered() && baTickLabelStaggered[i]) {
          dMaxW2=Math.max(dW,dMaxW2);
        }
 else         if (dW > dMaxW) {
          dMaxW=dW;
        }
        dAxisValue*=dAxisStep;
      }
    }
 else     if ((getType() & DATE_TIME) == DATE_TIME) {
      CDateTime cdtAxisValue=asDateTime(getMinimum());
      int iStep=asInteger(getStep());
      int iUnit=asInteger(getUnit());
      IDateFormatWrapper sdf=null;
      if (fs == null) {
        sdf=DateFormatWrapperFactory.getPreferredDateFormat(iUnit,rtc.getULocale());
      }
      for (int i=0; i < da.size(); i++) {
        try {
          sText=ValueFormatter.format(cdtAxisValue,fs,rtc.getULocale(),sdf);
        }
 catch (        ChartException dfex) {
          logger.log(dfex);
          sText=IConstants.NULL_STRING;
        }
        la.getCaption().setValue(sText);
        dW=computeWidth(xs,la);
        if (isAxisLabelStaggered() && baTickLabelStaggered[i]) {
          dMaxW2=Math.max(dW,dMaxW2);
        }
 else         if (dW > dMaxW) {
          dMaxW=dW;
        }
        cdtAxisValue=cdtAxisValue.forward(iUnit,iStep);
      }
    }
    return dMaxW + dMaxW2;
  }
 else   if (iOrientation == HORIZONTAL) {
    double dH, dMaxH=0, dMaxH2=0;
    if (isCategoryScale()) {
      final DataSetIterator dsi=getData();
      final int iDateTimeUnit=(getType() == IConstants.DATE_TIME) ? CDateTime.computeUnit(dsi) : IConstants.UNDEFINED;
      dsi.reset();
      int i=0;
      while (dsi.hasNext()) {
        la.getCaption().setValue(formatCategoryValue(getType(),dsi.next(),iDateTimeUnit));
        dH=computeHeight(xs,la);
        if (isAxisLabelStaggered() && baTickLabelStaggered[i]) {
          dMaxH2=Math.max(dH,dMaxH2);
        }
 else         if (dH > dMaxH) {
          dMaxH=dH;
        }
        i++;
      }
    }
 else     if ((getType() & LINEAR) == LINEAR) {
      final NumberDataElement nde=NumberDataElementImpl.create(0);
      double dAxisValue=asDouble(getMinimum()).doubleValue();
      final double dAxisStep=asDouble(getStep()).doubleValue();
      DecimalFormat df=null;
      if (fs == null) {
        df=computeDecimalFormat(dAxisValue,dAxisStep);
      }
      for (int i=0; i < da.size(); i++) {
        nde.setValue(dAxisValue);
        try {
          sText=ValueFormatter.format(nde,fs,rtc.getULocale(),df);
        }
 catch (        ChartException dfex) {
          logger.log(dfex);
          sText=IConstants.NULL_STRING;
        }
        la.getCaption().setValue(sText);
        dH=computeHeight(xs,la);
        if (isAxisLabelStaggered() && baTickLabelStaggered[i]) {
          dMaxH2=Math.max(dH,dMaxH2);
        }
 else         if (dH > dMaxH) {
          dMaxH=dH;
        }
        dAxisValue+=dAxisStep;
      }
    }
 else     if ((getType() & LOGARITHMIC) == LOGARITHMIC) {
      final NumberDataElement nde=NumberDataElementImpl.create(0);
      double dAxisValue=asDouble(getMinimum()).doubleValue();
      final double dAxisStep=asDouble(getStep()).doubleValue();
      DecimalFormat df=null;
      for (int i=0; i < da.size(); i++) {
        if (fs == null) {
          df=computeDecimalFormat(dAxisValue,dAxisStep);
        }
        nde.setValue(dAxisValue);
        try {
          sText=ValueFormatter.format(nde,fs,rtc.getULocale(),df);
        }
 catch (        ChartException dfex) {
          logger.log(dfex);
          sText=IConstants.NULL_STRING;
        }
        la.getCaption().setValue(sText);
        dH=computeHeight(xs,la);
        if (isAxisLabelStaggered() && baTickLabelStaggered[i]) {
          dMaxH2=Math.max(dH,dMaxH2);
        }
 else         if (dH > dMaxH) {
          dMaxH=dH;
        }
        dAxisValue*=dAxisStep;
      }
    }
 else     if ((getType() & DATE_TIME) == DATE_TIME) {
      CDateTime cdtAxisValue=asDateTime(getMinimum());
      final int iStep=asInteger(getStep());
      final int iUnit=asInteger(getUnit());
      IDateFormatWrapper sdf=null;
      if (fs == null) {
        sdf=DateFormatWrapperFactory.getPreferredDateFormat(iUnit,rtc.getULocale());
      }
      for (int i=0; i < da.size(); i++) {
        try {
          sText=ValueFormatter.format(cdtAxisValue,fs,rtc.getULocale(),sdf);
        }
 catch (        ChartException dfex) {
          logger.log(dfex);
          sText=IConstants.NULL_STRING;
        }
        la.getCaption().setValue(sText);
        dH=computeHeight(xs,la);
        if (isAxisLabelStaggered() && baTickLabelStaggered[i]) {
          dMaxH2=Math.max(dH,dMaxH2);
        }
 else         if (dH > dMaxH) {
          dMaxH=dH;
        }
        cdtAxisValue.forward(iUnit,iStep);
      }
    }
    return dMaxH + dMaxH2;
  }
  return 0;
}