Program: 75307
Project: 75307
Buggy source:
public final ISeriesRenderingHints getSeriesRenderingHints(SeriesDefinition sdOrthogonal,Series seOrthogonal) throws ChartException, IllegalArgumentException {
  if (seOrthogonal == null || seOrthogonal.getClass() == SeriesImpl.class) {
    return null;
  }
  OneAxis oaxOrthogonal=findOrthogonalAxis(seOrthogonal);
  if (oaxOrthogonal == null) {
    throw new ChartException(ChartEnginePlugin.ID,ChartException.NOT_FOUND,"String_Node_Str",new Object[]{seOrthogonal},Messages.getResourceBundle(rtc.getULocale()));
  }
  final OneAxis oaxBase=aax.getPrimaryBase();
  final SeriesDefinition sdBase=(SeriesDefinition)oaxBase.getModelAxis().getSeriesDefinitions().get(0);
  final AutoScale scBase=oaxBase.getScale();
  final AutoScale scOrthogonal=oaxOrthogonal.getScale();
  final int iTickCount=scBase.getTickCount();
  int iUnitCount=iTickCount;
  final int iDirection=scBase.getDirection();
  final double dUnitSize=(iDirection == BACKWARD || (iDirection == AUTO && aax.areAxesSwapped())) ? -scBase.getUnitSize() : scBase.getUnitSize();
  if (scBase.getType() == IConstants.DATE_TIME) {
  }
  AxisTickCoordinates daTickCoordinates=scBase.getTickCordinates();
  Object oDataBase=null;
  DataSetIterator dsiDataBase=scBase.getData();
  Object oDataOrthogonal;
  DataSetIterator dsiDataOrthogonal=getTypedDataSet(seOrthogonal,oaxOrthogonal.getScale().getType());
  double dOrthogonalZero=0;
  if ((scOrthogonal.getType() & NUMERICAL) == NUMERICAL) {
    dOrthogonalZero=getLocation(scOrthogonal,0);
  }
 else {
    dOrthogonalZero=scOrthogonal.getStart();
  }
  double dBaseZero=0;
  if ((scBase.getType() & NUMERICAL) == IConstants.NUMERICAL && !oaxBase.isCategoryScale()) {
    dBaseZero=getLocation(scBase,0);
  }
 else   if (oaxBase.isTickBwtweenCategories()) {
    dBaseZero=scBase.getStart();
  }
 else {
    dBaseZero=scBase.getStart() + scBase.getStartShift();
  }
  if (scBase.getType() == TEXT || oaxBase.isCategoryScale()) {
    iUnitCount--;
    if (oaxBase.isTickBwtweenCategories()) {
      iUnitCount--;
    }
  }
  double dX=0, dY=0;
  Location lo;
  final int iBaseCount=dsiDataBase.size();
  final int iOrthogonalCount=dsiDataOrthogonal.size();
  DataPointHints[] dpa=null;
  if (iBaseCount != iOrthogonalCount) {
    logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str",new Object[]{new Integer(iBaseCount),new Integer(iOrthogonalCount)},rtc.getULocale()));
  }
 else {
    dpa=new DataPointHints[iBaseCount];
    final boolean bScatter=(oaxBase.getScale().getType() != IConstants.TEXT && !oaxBase.isCategoryScale());
    final DataPoint dp=seOrthogonal.getDataPoint();
    final EList el=dp.getComponents();
    DataPointComponent dpc;
    DataPointComponentType dpct;
    FormatSpecifier fsBase=null, fsOrthogonal=null, fsSeries=null, fsPercentile=null;
    for (int i=0; i < el.size(); i++) {
      dpc=(DataPointComponent)el.get(i);
      dpct=dpc.getType();
      if (DataPointComponentType.BASE_VALUE_LITERAL.equals(dpct)) {
        fsBase=dpc.getFormatSpecifier();
        if (fsBase == null) {
          fsBase=sdBase.getFormatSpecifier();
        }
      }
      if (DataPointComponentType.ORTHOGONAL_VALUE_LITERAL.equals(dpct)) {
        fsOrthogonal=dpc.getFormatSpecifier();
        if (fsOrthogonal == null && seOrthogonal.eContainer() instanceof SeriesDefinition) {
          fsOrthogonal=((SeriesDefinition)seOrthogonal.eContainer()).getFormatSpecifier();
        }
      }
      if (DataPointComponentType.SERIES_VALUE_LITERAL.equals(dpct)) {
        fsSeries=dpc.getFormatSpecifier();
      }
      if (DataPointComponentType.PERCENTILE_ORTHOGONAL_VALUE_LITERAL.equals(dpct)) {
        fsPercentile=dpc.getFormatSpecifier();
      }
    }
    dsiDataBase.reset();
    dsiDataOrthogonal.reset();
    UserDataSetHints udsh=new UserDataSetHints(seOrthogonal.getDataSets());
    udsh.reset();
    double total=0;
    boolean isZeroValue=true;
    for (int i=0; i < iOrthogonalCount; i++) {
      Object v=dsiDataOrthogonal.next();
      if (v instanceof Number) {
        if (((Number)v).doubleValue() != 0.0) {
          isZeroValue=false;
        }
        total+=((Number)v).doubleValue();
      }
 else       if (v instanceof NumberDataElement) {
        if (((NumberDataElement)v).getValue() != 0.0) {
          isZeroValue=false;
        }
        total+=((NumberDataElement)v).getValue();
      }
    }
    dsiDataOrthogonal.reset();
    for (int i=0; i < iBaseCount; i++) {
      oDataBase=dsiDataBase.next();
      oDataOrthogonal=dsiDataOrthogonal.next();
      if (!bScatter) {
        if (aax.areAxesSwapped()) {
          dY=daTickCoordinates.getStart() + dUnitSize * i;
          if (!oaxBase.isTickBwtweenCategories()) {
            dY+=dUnitSize / 2;
          }
          try {
            dX=getLocation(scOrthogonal,oDataOrthogonal);
          }
 catch (          IllegalArgumentException nvex) {
            dX=Double.NaN;
          }
catch (          ChartException dfex) {
            dX=dOrthogonalZero;
          }
        }
 else {
          dX=daTickCoordinates.getStart() + dUnitSize * i;
          if (!oaxBase.isTickBwtweenCategories()) {
            dX+=dUnitSize / 2;
          }
          try {
            dY=getLocation(scOrthogonal,oDataOrthogonal);
          }
 catch (          IllegalArgumentException nvex) {
            dY=Double.NaN;
          }
catch (          ChartException dfex) {
            dY=dOrthogonalZero;
          }
        }
      }
 else {
        try {
          dX=getLocation(scBase,oDataBase);
        }
 catch (        IllegalArgumentException nvex) {
          dX=dBaseZero;
        }
catch (        ChartException dfex) {
          dX=dBaseZero;
        }
        try {
          dY=getLocation(scOrthogonal,oDataOrthogonal);
        }
 catch (        IllegalArgumentException nvex) {
          dX=Double.NaN;
        }
catch (        ChartException dfex) {
          dY=dOrthogonalZero;
        }
        if (aax.areAxesSwapped()) {
          final double dTemp=dX;
          dX=dY;
          dY=dTemp;
        }
      }
      lo=LocationImpl.create(dX,dY);
      double dLength=0;
      for (int j=0; j < iTickCount - 1; j++) {
        if (aax.areAxesSwapped()) {
          if ((dY <= daTickCoordinates.getCoordinate(j) && dY >= daTickCoordinates.getCoordinate(j + 1)) || (dY <= daTickCoordinates.getCoordinate(j + 1) && dY >= daTickCoordinates.getCoordinate(j))) {
            dLength=daTickCoordinates.getCoordinate(j + 1) - daTickCoordinates.getCoordinate(j);
            break;
          }
        }
 else {
          if ((dX <= daTickCoordinates.getCoordinate(j + 1) && dX >= daTickCoordinates.getCoordinate(j)) || (dX <= daTickCoordinates.getCoordinate(j) && dX >= daTickCoordinates.getCoordinate(j + 1))) {
            dLength=daTickCoordinates.getCoordinate(j + 1) - daTickCoordinates.getCoordinate(j);
            break;
          }
        }
      }
      Object percentileValue=null;
      if (total != 0) {
        if (oDataOrthogonal instanceof Number) {
          percentileValue=new Double(((Number)oDataOrthogonal).doubleValue() / total);
        }
 else         if (oDataOrthogonal instanceof NumberDataElement) {
          percentileValue=new Double(((NumberDataElement)oDataOrthogonal).getValue() / total);
        }
      }
 else       if (isZeroValue == true) {
        percentileValue=new Double(1.0 / iOrthogonalCount);
      }
      dpa[i]=new DataPointHints(oDataBase,oDataOrthogonal,seOrthogonal.getSeriesIdentifier(),percentileValue,seOrthogonal.getDataPoint(),fsBase,fsOrthogonal,fsSeries,fsPercentile,i,lo,dLength,rtc);
      udsh.next(dpa[i]);
    }
  }
  return new SeriesRenderingHints(this,oaxBase.getAxisCoordinate(),scOrthogonal.getStart(),dOrthogonalZero,dSeriesThickness,daTickCoordinates,dpa,scBase,scOrthogonal,ssl,dsiDataBase,dsiDataOrthogonal);
}

Fixed version (ground truth):
public final ISeriesRenderingHints getSeriesRenderingHints(SeriesDefinition sdOrthogonal,Series seOrthogonal) throws ChartException, IllegalArgumentException {
  if (seOrthogonal == null || seOrthogonal.getClass() == SeriesImpl.class) {
    return null;
  }
  OneAxis oaxOrthogonal=findOrthogonalAxis(seOrthogonal);
  if (oaxOrthogonal == null) {
    throw new ChartException(ChartEnginePlugin.ID,ChartException.NOT_FOUND,"String_Node_Str",new Object[]{seOrthogonal},Messages.getResourceBundle(rtc.getULocale()));
  }
  final OneAxis oaxBase=aax.getPrimaryBase();
  final SeriesDefinition sdBase=(SeriesDefinition)oaxBase.getModelAxis().getSeriesDefinitions().get(0);
  final AutoScale scBase=oaxBase.getScale();
  final AutoScale scOrthogonal=oaxOrthogonal.getScale();
  final int iTickCount=scBase.getTickCount();
  int iUnitCount=iTickCount;
  final int iDirection=scBase.getDirection();
  final double dUnitSize=(iDirection == BACKWARD || (iDirection == AUTO && aax.areAxesSwapped())) ? -scBase.getUnitSize() : scBase.getUnitSize();
  if (scBase.getType() == IConstants.DATE_TIME) {
  }
  AxisTickCoordinates daTickCoordinates=scBase.getTickCordinates();
  Object oDataBase=null;
  DataSetIterator dsiDataBase=scBase.getData();
  Object oDataOrthogonal;
  DataSetIterator dsiDataOrthogonal=getTypedDataSet(seOrthogonal,oaxOrthogonal.getScale().getType());
  double dOrthogonalZero=0;
  if ((scOrthogonal.getType() & NUMERICAL) == NUMERICAL) {
    dOrthogonalZero=getLocation(scOrthogonal,0);
  }
 else {
    dOrthogonalZero=scOrthogonal.getStart();
  }
  double dBaseZero=0;
  if ((scBase.getType() & NUMERICAL) == IConstants.NUMERICAL && !oaxBase.isCategoryScale()) {
    dBaseZero=getLocation(scBase,0);
  }
 else   if (oaxBase.isTickBwtweenCategories()) {
    dBaseZero=scBase.getStart();
  }
 else {
    dBaseZero=scBase.getStart() + scBase.getStartShift();
  }
  if (scBase.getType() == TEXT || oaxBase.isCategoryScale()) {
    iUnitCount--;
    if (oaxBase.isTickBwtweenCategories()) {
      iUnitCount--;
    }
  }
  double dX=0, dY=0;
  Location lo;
  final int iBaseCount=dsiDataBase.size();
  final int iOrthogonalCount=dsiDataOrthogonal.size();
  DataPointHints[] dpa=null;
  if (iBaseCount != iOrthogonalCount) {
    logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str",new Object[]{new Integer(iBaseCount),new Integer(iOrthogonalCount)},rtc.getULocale()));
  }
 else {
    dpa=new DataPointHints[iBaseCount];
    final boolean bScatter=(oaxBase.getScale().getType() != IConstants.TEXT && !oaxBase.isCategoryScale());
    final DataPoint dp=seOrthogonal.getDataPoint();
    final EList el=dp.getComponents();
    DataPointComponent dpc;
    DataPointComponentType dpct;
    FormatSpecifier fsBase=null, fsOrthogonal=null, fsSeries=null, fsPercentile=null;
    for (int i=0; i < el.size(); i++) {
      dpc=(DataPointComponent)el.get(i);
      dpct=dpc.getType();
      if (DataPointComponentType.BASE_VALUE_LITERAL.equals(dpct)) {
        fsBase=dpc.getFormatSpecifier();
        if (fsBase == null) {
          fsBase=sdBase.getFormatSpecifier();
        }
      }
      if (DataPointComponentType.ORTHOGONAL_VALUE_LITERAL.equals(dpct)) {
        fsOrthogonal=dpc.getFormatSpecifier();
        if (fsOrthogonal == null && seOrthogonal.eContainer() instanceof SeriesDefinition) {
          fsOrthogonal=((SeriesDefinition)seOrthogonal.eContainer()).getFormatSpecifier();
        }
      }
      if (DataPointComponentType.SERIES_VALUE_LITERAL.equals(dpct)) {
        fsSeries=dpc.getFormatSpecifier();
      }
      if (DataPointComponentType.PERCENTILE_ORTHOGONAL_VALUE_LITERAL.equals(dpct)) {
        fsPercentile=dpc.getFormatSpecifier();
      }
    }
    dsiDataBase.reset();
    dsiDataOrthogonal.reset();
    UserDataSetHints udsh=new UserDataSetHints(seOrthogonal.getDataSets());
    udsh.reset();
    double total=0;
    boolean isZeroValue=true;
    for (int i=0; i < iOrthogonalCount; i++) {
      Object v=dsiDataOrthogonal.next();
      if (v instanceof Number) {
        if (((Number)v).doubleValue() != 0.0) {
          isZeroValue=false;
        }
        total+=((Number)v).doubleValue();
      }
 else       if (v instanceof NumberDataElement) {
        if (((NumberDataElement)v).getValue() != 0.0) {
          isZeroValue=false;
        }
        total+=((NumberDataElement)v).getValue();
      }
    }
    dsiDataOrthogonal.reset();
    for (int i=0; i < iBaseCount; i++) {
      oDataBase=dsiDataBase.next();
      oDataOrthogonal=dsiDataOrthogonal.next();
      if (!bScatter) {
        if (aax.areAxesSwapped()) {
          dY=daTickCoordinates.getStart() + dUnitSize * i;
          try {
            dX=getLocation(scOrthogonal,oDataOrthogonal);
          }
 catch (          IllegalArgumentException nvex) {
            dX=Double.NaN;
          }
catch (          ChartException dfex) {
            dX=dOrthogonalZero;
          }
        }
 else {
          dX=daTickCoordinates.getStart() + dUnitSize * i;
          try {
            dY=getLocation(scOrthogonal,oDataOrthogonal);
          }
 catch (          IllegalArgumentException nvex) {
            dY=Double.NaN;
          }
catch (          ChartException dfex) {
            dY=dOrthogonalZero;
          }
        }
      }
 else {
        try {
          dX=getLocation(scBase,oDataBase);
        }
 catch (        IllegalArgumentException nvex) {
          dX=dBaseZero;
        }
catch (        ChartException dfex) {
          dX=dBaseZero;
        }
        try {
          dY=getLocation(scOrthogonal,oDataOrthogonal);
        }
 catch (        IllegalArgumentException nvex) {
          dX=Double.NaN;
        }
catch (        ChartException dfex) {
          dY=dOrthogonalZero;
        }
        if (aax.areAxesSwapped()) {
          final double dTemp=dX;
          dX=dY;
          dY=dTemp;
        }
      }
      lo=LocationImpl.create(dX,dY);
      double dLength=0;
      if (!bScatter) {
        dLength=dUnitSize;
      }
 else {
        for (int j=0; j < iTickCount - 1; j++) {
          if (aax.areAxesSwapped()) {
            if ((dY <= daTickCoordinates.getCoordinate(j) && dY >= daTickCoordinates.getCoordinate(j + 1)) || (dY <= daTickCoordinates.getCoordinate(j + 1) && dY >= daTickCoordinates.getCoordinate(j))) {
              dLength=daTickCoordinates.getCoordinate(j + 1) - daTickCoordinates.getCoordinate(j);
              break;
            }
          }
 else {
            if ((dX <= daTickCoordinates.getCoordinate(j + 1) && dX >= daTickCoordinates.getCoordinate(j)) || (dX <= daTickCoordinates.getCoordinate(j) && dX >= daTickCoordinates.getCoordinate(j + 1))) {
              dLength=daTickCoordinates.getCoordinate(j + 1) - daTickCoordinates.getCoordinate(j);
              break;
            }
          }
        }
      }
      Object percentileValue=null;
      if (total != 0) {
        if (oDataOrthogonal instanceof Number) {
          percentileValue=new Double(((Number)oDataOrthogonal).doubleValue() / total);
        }
 else         if (oDataOrthogonal instanceof NumberDataElement) {
          percentileValue=new Double(((NumberDataElement)oDataOrthogonal).getValue() / total);
        }
      }
 else       if (isZeroValue == true) {
        percentileValue=new Double(1.0 / iOrthogonalCount);
      }
      dpa[i]=new DataPointHints(oDataBase,oDataOrthogonal,seOrthogonal.getSeriesIdentifier(),percentileValue,seOrthogonal.getDataPoint(),fsBase,fsOrthogonal,fsSeries,fsPercentile,i,lo,dLength,rtc);
      udsh.next(dpa[i]);
    }
  }
  return new SeriesRenderingHints(this,oaxBase.getAxisCoordinate(),scOrthogonal.getStart(),dOrthogonalZero,dSeriesThickness,daTickCoordinates,dpa,scBase,scOrthogonal,ssl,dsiDataBase,dsiDataOrthogonal);
}