Program: 69656
Project: 69656
Buggy source:
/** 
 * Computes for non-study-layout case.
 * @throws ChartException
 * @throws IllegalArgumentException
 */
private void computeCommon() throws ChartException, IllegalArgumentException {
  ChartWithAxes cwa=getModel();
  double dX=boPlot.getLeft();
  double dY=boPlot.getTop();
  double dW=boPlot.getWidth();
  double dH=boPlot.getHeight();
  if (aax.getOverlayCount() > 0) {
    if (aax.areAxesSwapped()) {
      updateOverlayScales(aax,dX,dX + dW,dY,dH);
      dY=aax.getStart();
      dH=aax.getLength();
    }
 else {
      updateOverlayScales(aax,dY - dH,dY,dX,dW);
      dX=aax.getStart();
      dW=aax.getLength();
    }
  }
  double dStart, dEnd;
  final Axis[] axa=cwa.getPrimaryBaseAxes();
  final Axis axPrimaryBase=axa[0];
  final Axis axPrimaryOrthogonal=cwa.getPrimaryOrthogonalAxis(axPrimaryBase);
  Scale sc=axPrimaryBase.getScale();
  AutoScale scPrimaryBase=null;
  OneAxis oaxPrimaryBase=aax.getPrimaryBase();
  int iAxisType=getAxisType(axPrimaryBase);
  Object oaData=null;
  if (iAxisType == TEXT || oaxPrimaryBase.isCategoryScale()) {
    oaData=getTypedDataSet(axPrimaryBase,iAxisType,0);
  }
 else   if ((iAxisType & NUMERICAL) == NUMERICAL) {
    oaData=getMinMax(axPrimaryBase,iAxisType);
  }
 else   if ((iAxisType & DATE_TIME) == DATE_TIME) {
    oaData=getMinMax(axPrimaryBase,iAxisType);
  }
  DataSetIterator dsi=(oaData instanceof DataSetIterator) ? (DataSetIterator)oaData : new DataSetIterator(oaData,iAxisType);
  oaData=null;
  dStart=(aax.areAxesSwapped()) ? dY + dH : dX;
  dEnd=(aax.areAxesSwapped()) ? dY : dStart + dW;
  int iDirection=AUTO;
  scPrimaryBase=AutoScale.computeScale(ids,oaxPrimaryBase,dsi,iAxisType,dStart,dEnd,sc,axPrimaryBase.getFormatSpecifier(),rtc,iDirection,1,iMarginPercent);
  oaxPrimaryBase.set(scPrimaryBase);
  AutoScale scPrimaryOrthogonal=null;
  OneAxis oaxPrimaryOrthogonal=aax.getPrimaryOrthogonal();
  iAxisType=getAxisType(axPrimaryOrthogonal);
  oaData=null;
  if ((iAxisType & NUMERICAL) == NUMERICAL || (iAxisType & DATE_TIME) == DATE_TIME) {
    if (rtc.getSharedScale() != null) {
      dsi=rtc.getSharedScale().createDataSetIterator(iAxisType);
    }
 else {
      dsi=new DataSetIterator(getMinMax(axPrimaryOrthogonal,iAxisType),iAxisType);
    }
    dsi.reverse(cwa.isReverseCategory());
  }
 else {
    throw new ChartException(ChartEnginePlugin.ID,ChartException.DATA_FORMAT,"String_Node_Str",Messages.getResourceBundle(rtc.getULocale()));
  }
  dStart=(aax.areAxesSwapped()) ? dX : dY + dH;
  dEnd=(aax.areAxesSwapped()) ? dX + dW : dY;
  sc=axPrimaryOrthogonal.getScale();
  scPrimaryOrthogonal=AutoScale.computeScale(ids,oaxPrimaryOrthogonal,dsi,iAxisType,dStart,dEnd,sc,oaxPrimaryBase.getModelAxis().getOrigin(),axPrimaryOrthogonal.getFormatSpecifier(),rtc,AUTO,1,iMarginPercent);
  oaxPrimaryOrthogonal.set(scPrimaryOrthogonal);
  double dYAxisLocation=adjustHorizontal(dX,dW,aax,aax.getPrimaryOrthogonal());
  double dXAxisLocation=adjustVerticalDueToHorizontal(dY,dH,aax,aax.getPrimaryOrthogonal());
  iAxisType=getAxisType(axPrimaryOrthogonal);
  oaData=getTypedDataSet(axPrimaryOrthogonal,iAxisType,0);
  scPrimaryOrthogonal.setData(dsi);
  iAxisType=getAxisType(axPrimaryBase);
  if (iAxisType != IConstants.TEXT) {
    scPrimaryBase.setData(getTypedDataSet(axPrimaryBase,iAxisType,0));
  }
  scPrimaryBase.resetShifts();
  scPrimaryOrthogonal.resetShifts();
  updateOverlayAxes(aax);
  growBaseAxis(aax,goFactory.createBounds(dX,dY,dW,dH));
  final OneAxis axPH=aax.areAxesSwapped() ? aax.getPrimaryOrthogonal() : aax.getPrimaryBase();
  final OneAxis axPV=aax.areAxesSwapped() ? aax.getPrimaryBase() : aax.getPrimaryOrthogonal();
  axPH.setAxisCoordinate(dXAxisLocation);
  axPV.setAxisCoordinate(dYAxisLocation);
  computePlotBackground(aax.getPrimaryBase(),new OneAxis[]{aax.getPrimaryOrthogonal()});
  computePlotWithMargin(axPH,axPV);
}

Fixed version (ground truth):
/** 
 * Computes for non-study-layout case.
 * @throws ChartException
 * @throws IllegalArgumentException
 */
private void computeCommon() throws ChartException, IllegalArgumentException {
  ChartWithAxes cwa=getModel();
  double dX=boPlot.getLeft();
  double dY=boPlot.getTop();
  double dW=boPlot.getWidth();
  double dH=boPlot.getHeight();
  if (aax.getOverlayCount() > 0) {
    if (aax.areAxesSwapped()) {
      updateOverlayScales(aax,dX,dX + dW,dY,dH);
      dY=aax.getStart();
      dH=aax.getLength();
    }
 else {
      updateOverlayScales(aax,dY - dH,dY,dX,dW);
      dX=aax.getStart();
      dW=aax.getLength();
    }
  }
  double dStart, dEnd;
  final Axis[] axa=cwa.getPrimaryBaseAxes();
  final Axis axPrimaryBase=axa[0];
  final Axis axPrimaryOrthogonal=cwa.getPrimaryOrthogonalAxis(axPrimaryBase);
  Scale sc=axPrimaryBase.getScale();
  AutoScale scPrimaryBase=null;
  OneAxis oaxPrimaryBase=aax.getPrimaryBase();
  int iAxisType=getAxisType(axPrimaryBase);
  Object oaData=null;
  if (iAxisType == TEXT || oaxPrimaryBase.isCategoryScale()) {
    oaData=getTypedDataSet(axPrimaryBase,iAxisType,0);
  }
 else   if ((iAxisType & NUMERICAL) == NUMERICAL) {
    oaData=getMinMax(axPrimaryBase,iAxisType);
  }
 else   if ((iAxisType & DATE_TIME) == DATE_TIME) {
    oaData=getMinMax(axPrimaryBase,iAxisType);
  }
  DataSetIterator dsi=(oaData instanceof DataSetIterator) ? (DataSetIterator)oaData : new DataSetIterator(oaData,iAxisType);
  oaData=null;
  dStart=(aax.areAxesSwapped()) ? dY + dH : dX;
  dEnd=(aax.areAxesSwapped()) ? dY : dStart + dW;
  int iDirection=AUTO;
  scPrimaryBase=AutoScale.computeScale(ids,oaxPrimaryBase,dsi,iAxisType,dStart,dEnd,sc,axPrimaryBase.getFormatSpecifier(),rtc,iDirection,1,iMarginPercent);
  oaxPrimaryBase.set(scPrimaryBase);
  AutoScale scPrimaryOrthogonal=null;
  OneAxis oaxPrimaryOrthogonal=aax.getPrimaryOrthogonal();
  iAxisType=getAxisType(axPrimaryOrthogonal);
  oaData=null;
  if ((iAxisType & NUMERICAL) == NUMERICAL || (iAxisType & DATE_TIME) == DATE_TIME) {
    if (rtc.getSharedScale() != null) {
      dsi=rtc.getSharedScale().createDataSetIterator(iAxisType);
    }
 else {
      dsi=new DataSetIterator(getMinMax(axPrimaryOrthogonal,iAxisType),iAxisType);
    }
    dsi.reverse(cwa.isReverseCategory());
  }
 else {
    throw new ChartException(ChartEnginePlugin.ID,ChartException.DATA_FORMAT,"String_Node_Str",Messages.getResourceBundle(rtc.getULocale()));
  }
  dStart=(aax.areAxesSwapped()) ? dX : dY + dH;
  dEnd=(aax.areAxesSwapped()) ? dX + dW : dY;
  sc=axPrimaryOrthogonal.getScale();
  scPrimaryOrthogonal=AutoScale.computeScale(ids,oaxPrimaryOrthogonal,dsi,iAxisType,dStart,dEnd,sc,oaxPrimaryBase.getModelAxis().getOrigin(),axPrimaryOrthogonal.getFormatSpecifier(),rtc,AUTO,1,iMarginPercent);
  oaxPrimaryOrthogonal.set(scPrimaryOrthogonal);
  double dYAxisLocation=adjustHorizontal(dX,dW,aax,aax.getPrimaryOrthogonal());
  double dXAxisLocation=adjustVerticalDueToHorizontal(dY,dH,aax,aax.getPrimaryOrthogonal());
  iAxisType=getAxisType(axPrimaryOrthogonal);
  oaData=getTypedDataSet(axPrimaryOrthogonal,iAxisType,0);
  scPrimaryOrthogonal.setData(dsi);
  iAxisType=getAxisType(axPrimaryBase);
  if (iAxisType != IConstants.TEXT) {
    scPrimaryBase.setData(getTypedDataSet(axPrimaryBase,iAxisType,0));
  }
  scPrimaryBase.resetShifts();
  scPrimaryOrthogonal.resetShifts();
  updateOverlayAxes(aax);
  growBaseAxis(aax,goFactory.createBounds(dX,dY,dW,dH));
  adjustOverlayAxesDueToEndShifts();
  final OneAxis axPH=aax.areAxesSwapped() ? aax.getPrimaryOrthogonal() : aax.getPrimaryBase();
  final OneAxis axPV=aax.areAxesSwapped() ? aax.getPrimaryBase() : aax.getPrimaryOrthogonal();
  axPH.setAxisCoordinate(dXAxisLocation);
  axPV.setAxisCoordinate(dYAxisLocation);
  computePlotBackground(aax.getPrimaryBase(),new OneAxis[]{aax.getPrimaryOrthogonal()});
  computePlotWithMargin(axPH,axPV);
}