Program: 68979
Project: 68979
Buggy source:
/** 
 * This method returns appropriate renders for the given chart model. It uses extension points to identify a renderer corresponding to a custom series.
 * @param cm
 * @param rtc
 * @param oComputations
 * @return renderers
 * @throws ChartException
 */
public static final BaseRenderer[] instances(Chart cm,RunTimeContext rtc,PlotComputation oComputations) throws ChartException {
  final PluginSettings ps=PluginSettings.instance();
  BaseRenderer[] brna=null;
  final boolean bPaletteByCategory=(cm.getLegend().getItemType().getValue() == LegendItemType.CATEGORIES);
  if (cm instanceof ChartWithAxes) {
    final ChartWithAxes cwa=(ChartWithAxes)cm;
    final Axis[] axa=cwa.getPrimaryBaseAxes();
    Axis axPrimaryBase=axa[0];
    Series se;
    AxesRenderer ar=null;
    List<AxesRenderer> al=new ArrayList<AxesRenderer>();
    List<Series> alRunTimeSeries;
    EList<SeriesDefinition> elBase, elOrthogonal;
    SeriesDefinition sd=null;
    elBase=axPrimaryBase.getSeriesDefinitions();
    if (elBase.isEmpty()) {
      return createEmptyInstance(cm,rtc,oComputations);
    }
 else {
      final SeriesDefinition sdBase=elBase.get(0);
      alRunTimeSeries=sdBase.getRunTimeSeries();
      if (alRunTimeSeries.isEmpty()) {
        return createEmptyInstance(cm,rtc,oComputations);
      }
      se=alRunTimeSeries.get(0);
      ar=(se.getClass() == SeriesImpl.class) ? new EmptyWithAxes() : (AxesRenderer)ps.getRenderer(se.getClass());
      ar.set(cm,oComputations,se,axPrimaryBase,sdBase);
      ar.set(rtc);
      al.add(ar);
      final Axis[] axaOrthogonal=cwa.getOrthogonalAxes(axPrimaryBase,true);
      for (int i=0; i < axaOrthogonal.length; i++) {
        elOrthogonal=axaOrthogonal[i].getSeriesDefinitions();
        for (int j=0; j < elOrthogonal.size(); j++) {
          sd=elOrthogonal.get(j);
          alRunTimeSeries=sd.getRunTimeSeries();
          for (int k=0; k < alRunTimeSeries.size(); k++) {
            se=alRunTimeSeries.get(k);
            ar=(se.getClass() == SeriesImpl.class) ? new EmptyWithAxes() : (AxesRenderer)ps.getRenderer(se.getClass());
            ar.set(cm,oComputations,se,axaOrthogonal[i],bPaletteByCategory ? sdBase : sd);
            al.add(ar);
          }
        }
      }
      Collections.sort(al,zOrderComparator);
      brna=new BaseRenderer[al.size()];
      for (int i=0; i < brna.length; i++) {
        ar=al.get(i);
        ar.iSeriesIndex=i;
        ar.iSeriesCount=brna.length;
        brna[i]=ar;
      }
    }
  }
 else   if (cm instanceof ChartWithoutAxes) {
    final ChartWithoutAxes cwoa=(ChartWithoutAxes)cm;
    EList<SeriesDefinition> elBase=cwoa.getSeriesDefinitions();
    EList<SeriesDefinition> elOrthogonal;
    SeriesDefinition sd, sdBase;
    List<Series> alRuntimeSeries;
    final Series[] sea=cwoa.getRunTimeSeries();
    Series se;
    final int iSeriesCount=sea.length;
    brna=new BaseRenderer[iSeriesCount];
    int iSI=0;
    for (int i=0; i < elBase.size(); i++) {
      sdBase=elBase.get(i);
      alRuntimeSeries=sdBase.getRunTimeSeries();
      if (ChartUtil.isDataEmpty(rtc)) {
        brna=new BaseRenderer[1];
        brna[0]=new EmptyWithoutAxes();
        brna[0].set(cm,oComputations,sdBase.getSeries().get(0),sdBase);
        brna[0].set(rtc);
        brna[0].iSeriesIndex=0;
        brna[0].iSeriesCount=1;
        return brna;
      }
      if (alRuntimeSeries.size() != 1) {
        throw new ChartException(ChartEnginePlugin.ID,ChartException.PLUGIN,"String_Node_Str",new Object[]{Integer.valueOf(alRuntimeSeries.size())},Messages.getResourceBundle(rtc.getULocale()));
      }
      se=alRuntimeSeries.get(0);
      brna[iSI]=(se.getClass() == SeriesImpl.class) ? new EmptyWithoutAxes() : ps.getRenderer(se.getClass());
      brna[iSI].set(cm,oComputations,se,sdBase);
      brna[iSI].set(rtc);
      brna[iSI].iSeriesIndex=iSI++;
      elOrthogonal=elBase.get(i).getSeriesDefinitions();
      for (int j=0; j < elOrthogonal.size(); j++) {
        sd=elOrthogonal.get(j);
        alRuntimeSeries=sd.getRunTimeSeries();
        for (int k=0; k < alRuntimeSeries.size(); k++) {
          se=alRuntimeSeries.get(k);
          brna[iSI]=(se.getClass() == SeriesImpl.class) ? new EmptyWithoutAxes() : ps.getRenderer(se.getClass());
          brna[iSI].set(cm,oComputations,se,bPaletteByCategory ? sdBase : sd);
          brna[iSI].iSeriesIndex=iSI++;
        }
      }
    }
    for (int k=0; k < iSI; k++) {
      brna[k].iSeriesCount=iSI;
    }
  }
  return brna;
}

Fixed version (ground truth):
/** 
 * This method returns appropriate renders for the given chart model. It uses extension points to identify a renderer corresponding to a custom series.
 * @param cm
 * @param rtc
 * @param oComputations
 * @return renderers
 * @throws ChartException
 */
public static final BaseRenderer[] instances(Chart cm,RunTimeContext rtc,PlotComputation oComputations) throws ChartException {
  final PluginSettings ps=PluginSettings.instance();
  BaseRenderer[] brna=null;
  final boolean bPaletteByCategory=(cm.getLegend().getItemType().getValue() == LegendItemType.CATEGORIES);
  if (cm instanceof ChartWithAxes) {
    final ChartWithAxes cwa=(ChartWithAxes)cm;
    final Axis[] axa=cwa.getPrimaryBaseAxes();
    Axis axPrimaryBase=axa[0];
    Series se;
    AxesRenderer ar=null;
    List<AxesRenderer> al=new ArrayList<AxesRenderer>();
    List<Series> alRunTimeSeries;
    EList<SeriesDefinition> elBase, elOrthogonal;
    SeriesDefinition sd=null;
    elBase=axPrimaryBase.getSeriesDefinitions();
    if (elBase.isEmpty()) {
      return createEmptyInstance(cm,rtc,oComputations);
    }
 else {
      final SeriesDefinition sdBase=elBase.get(0);
      alRunTimeSeries=sdBase.getRunTimeSeries();
      if (alRunTimeSeries.isEmpty()) {
        return createEmptyInstance(cm,rtc,oComputations);
      }
      se=alRunTimeSeries.get(0);
      ar=(se.getClass() == SeriesImpl.class) ? new EmptyWithAxes() : (AxesRenderer)ps.getRenderer(se.getClass());
      ar.set(cm,oComputations,se,axPrimaryBase,sdBase);
      ar.set(rtc);
      al.add(ar);
      final Axis[] axaOrthogonal=cwa.getOrthogonalAxes(axPrimaryBase,true);
      for (int i=0; i < axaOrthogonal.length; i++) {
        elOrthogonal=axaOrthogonal[i].getSeriesDefinitions();
        for (int j=0; j < elOrthogonal.size(); j++) {
          sd=elOrthogonal.get(j);
          alRunTimeSeries=sd.getRunTimeSeries();
          for (int k=0; k < alRunTimeSeries.size(); k++) {
            se=alRunTimeSeries.get(k);
            ar=(se.getClass() == SeriesImpl.class) ? new EmptyWithAxes() : (AxesRenderer)ps.getRenderer(se.getClass());
            ar.set(cm,oComputations,se,axaOrthogonal[i],bPaletteByCategory ? sdBase : sd);
            al.add(ar);
          }
        }
      }
      if (cm.getDimension() == ChartDimension.TWO_DIMENSIONAL_LITERAL) {
        Collections.sort(al,zOrderComparator);
      }
      brna=new BaseRenderer[al.size()];
      for (int i=0; i < brna.length; i++) {
        ar=al.get(i);
        ar.iSeriesIndex=i;
        ar.iSeriesCount=brna.length;
        brna[i]=ar;
      }
    }
  }
 else   if (cm instanceof ChartWithoutAxes) {
    final ChartWithoutAxes cwoa=(ChartWithoutAxes)cm;
    EList<SeriesDefinition> elBase=cwoa.getSeriesDefinitions();
    EList<SeriesDefinition> elOrthogonal;
    SeriesDefinition sd, sdBase;
    List<Series> alRuntimeSeries;
    final Series[] sea=cwoa.getRunTimeSeries();
    Series se;
    final int iSeriesCount=sea.length;
    brna=new BaseRenderer[iSeriesCount];
    int iSI=0;
    for (int i=0; i < elBase.size(); i++) {
      sdBase=elBase.get(i);
      alRuntimeSeries=sdBase.getRunTimeSeries();
      if (ChartUtil.isDataEmpty(rtc)) {
        brna=new BaseRenderer[1];
        brna[0]=new EmptyWithoutAxes();
        brna[0].set(cm,oComputations,sdBase.getSeries().get(0),sdBase);
        brna[0].set(rtc);
        brna[0].iSeriesIndex=0;
        brna[0].iSeriesCount=1;
        return brna;
      }
      if (alRuntimeSeries.size() != 1) {
        throw new ChartException(ChartEnginePlugin.ID,ChartException.PLUGIN,"String_Node_Str",new Object[]{Integer.valueOf(alRuntimeSeries.size())},Messages.getResourceBundle(rtc.getULocale()));
      }
      se=alRuntimeSeries.get(0);
      brna[iSI]=(se.getClass() == SeriesImpl.class) ? new EmptyWithoutAxes() : ps.getRenderer(se.getClass());
      brna[iSI].set(cm,oComputations,se,sdBase);
      brna[iSI].set(rtc);
      brna[iSI].iSeriesIndex=iSI++;
      elOrthogonal=elBase.get(i).getSeriesDefinitions();
      for (int j=0; j < elOrthogonal.size(); j++) {
        sd=elOrthogonal.get(j);
        alRuntimeSeries=sd.getRunTimeSeries();
        for (int k=0; k < alRuntimeSeries.size(); k++) {
          se=alRuntimeSeries.get(k);
          brna[iSI]=(se.getClass() == SeriesImpl.class) ? new EmptyWithoutAxes() : ps.getRenderer(se.getClass());
          brna[iSI].set(cm,oComputations,se,bPaletteByCategory ? sdBase : sd);
          brna[iSI].iSeriesIndex=iSI++;
        }
      }
    }
    for (int k=0; k < iSI; k++) {
      brna[k].iSeriesCount=iSI;
    }
  }
  return brna;
}