Program: 76608
Project: 76608
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) {
  }
  double[] 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=((scBase.getType() & NUMERICAL) == IConstants.NUMERICAL && !oaxBase.isCategoryScale()) ? getLocation(scBase,0) : scBase.getStart();
  if (scBase.getType() == TEXT || oaxBase.isCategoryScale()) {
    iUnitCount--;
  }
  double dX=0, dY=0, dLength=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();
      fsBase=dpc.getFormatSpecifier();
      if (fsBase == null) {
        fsBase=sdBase.getFormatSpecifier();
      }
      fsOrthogonal=dpc.getFormatSpecifier();
      if (fsOrthogonal == null && seOrthogonal.eContainer() instanceof SeriesDefinition) {
        fsOrthogonal=((SeriesDefinition)seOrthogonal.eContainer()).getFormatSpecifier();
      }
      fsSeries=dpc.getFormatSpecifier();
      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[0] + dUnitSize * i;
          try {
            dX=getLocation(scOrthogonal,oDataOrthogonal);
          }
 catch (          IllegalArgumentException nvex) {
            dX=Double.NaN;
          }
catch (          ChartException dfex) {
            dX=dOrthogonalZero;
          }
        }
 else {
          dX=daTickCoordinates[0] + 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);
      dLength=(i < iTickCount - 1) ? daTickCoordinates[i + 1] - daTickCoordinates[i] : 0;
      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) {
  }
  double[] 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=((scBase.getType() & NUMERICAL) == IConstants.NUMERICAL && !oaxBase.isCategoryScale()) ? getLocation(scBase,0) : scBase.getStart();
  if (scBase.getType() == TEXT || oaxBase.isCategoryScale()) {
    iUnitCount--;
  }
  double dX=0, dY=0, dLength=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[0] + dUnitSize * i;
          try {
            dX=getLocation(scOrthogonal,oDataOrthogonal);
          }
 catch (          IllegalArgumentException nvex) {
            dX=Double.NaN;
          }
catch (          ChartException dfex) {
            dX=dOrthogonalZero;
          }
        }
 else {
          dX=daTickCoordinates[0] + 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);
      dLength=(i < iTickCount - 1) ? daTickCoordinates[i + 1] - daTickCoordinates[i] : 0;
      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);
}