Program: 65812
Project: 65812
Buggy source:
public void renderSeries(IPrimitiveRenderer ipr,Plot p,ISeriesRenderingHints isrh) throws ChartException {
  final ChartWithAxes cwa=(ChartWithAxes)getModel();
  if (cwa.getDimension() != ChartDimension.TWO_DIMENSIONAL_LITERAL) {
    throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",new Object[]{cwa.getDimension().getName()},Messages.getResourceBundle(getRunTimeContext().getULocale()));
  }
  if (isTransposed()) {
    throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",Messages.getResourceBundle(getRunTimeContext().getULocale()));
  }
  final SeriesRenderingHints srh=(SeriesRenderingHints)isrh;
  try {
    validateDataSetCount(isrh);
  }
 catch (  ChartException vex) {
    throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,vex);
  }
  final AbstractScriptHandler<?> sh=getRunTimeContext().getScriptHandler();
  logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str",new Object[]{getClass().getName(),Integer.valueOf(iSeriesIndex + 1),Integer.valueOf(iSeriesCount)},getRunTimeContext().getULocale()));
  final StockSeries ss=(StockSeries)getSeries();
  if (!ss.isVisible()) {
    restoreClipping(ipr);
    return;
  }
  final double dSeriesThickness=srh.getSeriesThickness();
  final DataPointHints[] dpha=srh.getDataPoints();
  final LineAttributes lia=ss.getLineAttributes();
  final double dUnitSpacing=(!cwa.isSetUnitSpacing()) ? 50 : cwa.getUnitSpacing();
  double dX=0, dY=0, dWidth=0, dHeight=0, dSpacing=0;
  double dLow, dHigh, dOpen, dClose;
  Location lo, loStart=null, loEnd=null, loUpper=goFactory.createLocation(0,0), loLower=goFactory.createLocation(0,0);
  Location[] loaFrontFace=null;
  LineRenderEvent lre;
  final SeriesDefinition sd=getSeriesDefinition();
  final EList<Fill> elPalette=sd.getSeriesPalette().getEntries();
  if (elPalette.isEmpty()) {
    throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",new Object[]{ss},Messages.getResourceBundle(getRunTimeContext().getULocale()));
  }
  final boolean bPaletteByCategory=isPaletteByCategory();
  int iThisSeriesIndex=-1;
  Fill fPaletteEntry=null;
  if (!bPaletteByCategory) {
    iThisSeriesIndex=sd.getRunTimeSeries().indexOf(ss);
    if (iThisSeriesIndex < 0) {
      throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",new Object[]{ss,sd},Messages.getResourceBundle(getRunTimeContext().getULocale()));
    }
    fPaletteEntry=FillUtil.getPaletteFill(elPalette,iThisSeriesIndex);
  }
  renderClipping(ipr,getPlotBounds());
  StackedSeriesLookup ssl=null;
  StackGroup sg=null;
  ssl=srh.getStackedSeriesLookup();
  sg=ssl.getStackGroup(ss);
  int iSharedUnitIndex=(sg == null) ? 0 : sg.getSharedIndex();
  int iSharedUnitCount=(sg == null) ? 1 : sg.getSharedCount();
  if (iSharedUnitCount == 1) {
    iSharedUnitIndex=0;
  }
  double[] faX=new double[dpha.length];
  double[] faY=new double[dpha.length];
  final AutoScale scale=getInternalOrthogonalAxis().getScale();
  for (int i=0; i < dpha.length; i++) {
    StockEntry se=(StockEntry)dpha[i].getOrthogonalValue();
    if (!isValidEntry(se)) {
      continue;
    }
    correctEntry(se);
    if (checkEntryInRange(se,scale.getMinimum(),scale.getMaximum()) > 0) {
      dpha[i].markOutside();
    }
    if (bPaletteByCategory) {
      fPaletteEntry=FillUtil.getPaletteFill(elPalette,i);
    }
 else {
      fPaletteEntry=FillUtil.getPaletteFill(elPalette,iThisSeriesIndex);
    }
    updateTranslucency(fPaletteEntry,ss);
    lo=dpha[i].getLocation();
    dX=lo.getX();
    dY=lo.getY();
    try {
      dLow=srh.getLocationOnOrthogonal(new Double(se.getLow()));
      dHigh=srh.getLocationOnOrthogonal(new Double(se.getHigh()));
      dOpen=srh.getLocationOnOrthogonal(new Double(se.getOpen()));
      dClose=srh.getLocationOnOrthogonal(new Double(se.getClose()));
    }
 catch (    Exception ex) {
      logger.log(ex);
      continue;
    }
    ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_ELEMENT,dpha[i],fPaletteEntry);
    ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_DATA_POINT,dpha[i],fPaletteEntry,getRunTimeContext().getScriptContext());
    getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_ELEMENT,dpha[i]);
    getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_DATA_POINT,dpha[i]);
    dSpacing=(dpha[i].getSize() * dUnitSpacing) / 200;
    if (loStart == null) {
      loStart=goFactory.createLocation(0,0);
      loEnd=goFactory.createLocation(0,0);
      loaFrontFace=new Location[4];
      for (int j=0; j < 4; j++) {
        loaFrontFace[j]=goFactory.createLocation(0,0);
      }
    }
    dWidth=dpha[i].getSize();
    dWidth-=2 * dSpacing;
    dWidth/=iSharedUnitCount;
    if (cwa.getBaseAxes()[0].isCategoryAxis()) {
      dX+=dSpacing + dWidth / 2 + iSharedUnitIndex * dWidth;
    }
    lre=((EventObjectCache)ipr).getEventObject(WrappedStructureSource.createSeriesDataPoint(ss,dpha[i]),LineRenderEvent.class);
    if (ss.isShowAsBarStick()) {
      int stickLength=ss.getStickLength();
      Location loStart2=goFactory.createLocation(0,0), loEnd2=goFactory.createLocation(0,0);
      loStart.set(dX - stickLength,dOpen);
      loEnd.set(dX + stickLength,dClose);
      loStart2.set(dX,dOpen);
      loEnd2.set(dX,dClose);
      loUpper.set(dX,dHigh > dLow ? dHigh : dLow);
      loLower.set(dX,dHigh < dLow ? dHigh : dLow);
      lre.setLineAttributes(lia);
      lre.setStart(loUpper);
      lre.setEnd(loLower);
      ipr.drawLine(lre);
      lre.setStart(loStart);
      lre.setEnd(loStart2);
      ipr.drawLine(lre);
      lre.setStart(loEnd);
      lre.setEnd(loEnd2);
      ipr.drawLine(lre);
    }
 else {
{
        loStart.set(dX,dLow);
        loEnd.set(dX,dHigh);
        loaFrontFace[0].set(dX - dWidth / 2,dOpen);
        loaFrontFace[1].set(dX - dWidth / 2,dClose);
        loaFrontFace[2].set(dX + dWidth / 2,dClose);
        loaFrontFace[3].set(dX + dWidth / 2,dOpen);
        loUpper.set(dX,dOpen > dClose ? dOpen : dClose);
        loLower.set(dX,dOpen < dClose ? dOpen : dClose);
      }
      lre.setLineAttributes(lia);
      lre.setStart(loStart);
      lre.setEnd(loUpper);
      ipr.drawLine(lre);
      lre.setStart(loLower);
      lre.setEnd(loEnd);
      ipr.drawLine(lre);
      renderPlane(ipr,WrappedStructureSource.createSeriesDataPoint(ss,dpha[i]),loaFrontFace,convertFill(fPaletteEntry,se.getClose() > se.getOpen()),lia,cwa.getDimension(),dSeriesThickness,true);
    }
    if (cwa.isTransposed()) {
      faX[i]=((loUpper.getX() + loLower.getX()) / 2);
      faY[i]=loUpper.getY();
    }
 else {
      faX[i]=loLower.getX();
      faY[i]=((loUpper.getY() + loLower.getY()) / 2);
    }
    if (isInteractivityEnabled()) {
      final EList<Trigger> elTriggers=ss.getTriggers();
      if (!elTriggers.isEmpty()) {
        final StructureSource iSource=WrappedStructureSource.createSeriesDataPoint(ss,dpha[i]);
        final InteractionEvent iev=((EventObjectCache)ipr).getEventObject(iSource,InteractionEvent.class);
        iev.setCursor(ss.getCursor());
        Trigger tg;
        for (int t=0; t < elTriggers.size(); t++) {
          tg=goFactory.copyOf(elTriggers.get(t));
          processTrigger(tg,iSource);
          iev.addTrigger(tg);
        }
        final PolygonRenderEvent pre=((EventObjectCache)ipr).getEventObject(StructureSource.createSeries(ss),PolygonRenderEvent.class);
        pre.setPoints(loaFrontFace);
        iev.setHotSpot(pre);
        ipr.enableInteraction(iev);
      }
    }
    ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_ELEMENT,dpha[i],fPaletteEntry);
    ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_DATA_POINT,dpha[i],fPaletteEntry,getRunTimeContext().getScriptContext());
    getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_ELEMENT,dpha[i]);
    getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_DATA_POINT,dpha[i]);
    renderDataPointLabel(srh.getLabelAttributes(getSeries()),dpha[i],srh.getLabelPosition(getSeries()),loaFrontFace,p,sh,dX,dY,dWidth,dHeight,dHigh,dLow,dOpen,dClose);
  }
  if (getSeries().getCurveFitting() != null) {
    Location[] larray=new Location[faX.length];
    for (int i=0; i < larray.length; i++) {
      larray[i]=goFactory.createLocation(faX[i],faY[i]);
    }
    larray=filterNull(larray);
    renderFittingCurve(ipr,larray,getSeries().getCurveFitting(),false,true);
  }
  restoreClipping(ipr);
}

Fixed version (ground truth):
public void renderSeries(IPrimitiveRenderer ipr,Plot p,ISeriesRenderingHints isrh) throws ChartException {
  final ChartWithAxes cwa=(ChartWithAxes)getModel();
  if (cwa.getDimension() != ChartDimension.TWO_DIMENSIONAL_LITERAL) {
    throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",new Object[]{cwa.getDimension().getName()},Messages.getResourceBundle(getRunTimeContext().getULocale()));
  }
  if (isTransposed()) {
    throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",Messages.getResourceBundle(getRunTimeContext().getULocale()));
  }
  final SeriesRenderingHints srh=(SeriesRenderingHints)isrh;
  try {
    validateDataSetCount(isrh);
  }
 catch (  ChartException vex) {
    throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,vex);
  }
  final AbstractScriptHandler<?> sh=getRunTimeContext().getScriptHandler();
  logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str",new Object[]{getClass().getName(),Integer.valueOf(iSeriesIndex + 1),Integer.valueOf(iSeriesCount)},getRunTimeContext().getULocale()));
  final StockSeries ss=(StockSeries)getSeries();
  if (!ss.isVisible()) {
    restoreClipping(ipr);
    return;
  }
  final double dSeriesThickness=srh.getSeriesThickness();
  final DataPointHints[] dpha=srh.getDataPoints();
  final LineAttributes lia=ss.getLineAttributes();
  final double dUnitSpacing=(!cwa.isSetUnitSpacing()) ? 50 : cwa.getUnitSpacing();
  double dX=0, dY=0, dWidth=0, dHeight=0, dSpacing=0;
  double dLow, dHigh, dOpen, dClose;
  Location lo, loStart=null, loEnd=null, loUpper=goFactory.createLocation(0,0), loLower=goFactory.createLocation(0,0);
  Location[] loaFrontFace=null;
  LineRenderEvent lre;
  final SeriesDefinition sd=getSeriesDefinition();
  final EList<Fill> elPalette=sd.getSeriesPalette().getEntries();
  if (elPalette.isEmpty()) {
    throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",new Object[]{ss},Messages.getResourceBundle(getRunTimeContext().getULocale()));
  }
  final boolean bPaletteByCategory=isPaletteByCategory();
  int iThisSeriesIndex=-1;
  Fill fPaletteEntry=null;
  if (!bPaletteByCategory) {
    iThisSeriesIndex=sd.getRunTimeSeries().indexOf(ss);
    if (iThisSeriesIndex < 0) {
      throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",new Object[]{ss,sd},Messages.getResourceBundle(getRunTimeContext().getULocale()));
    }
    fPaletteEntry=FillUtil.getPaletteFill(elPalette,iThisSeriesIndex);
  }
  renderClipping(ipr,getPlotBounds());
  StackedSeriesLookup ssl=null;
  StackGroup sg=null;
  ssl=srh.getStackedSeriesLookup();
  sg=ssl.getStackGroup(ss);
  int iSharedUnitIndex=(sg == null) ? 0 : sg.getSharedIndex();
  int iSharedUnitCount=(sg == null) ? 1 : sg.getSharedCount();
  if (iSharedUnitCount == 1) {
    iSharedUnitIndex=0;
  }
  double[] faX=new double[dpha.length];
  double[] faY=new double[dpha.length];
  final AutoScale scale=getInternalOrthogonalAxis().getScale();
  for (int i=0; i < dpha.length; i++) {
    StockEntry se=(StockEntry)dpha[i].getOrthogonalValue();
    if (!isValidEntry(se)) {
      continue;
    }
    correctEntry(se);
    if (checkEntryInRange(se,scale.getMinimum(),scale.getMaximum()) > 0) {
      dpha[i].markOutside();
    }
    if (bPaletteByCategory) {
      fPaletteEntry=FillUtil.getPaletteFill(elPalette,i);
    }
 else {
      fPaletteEntry=FillUtil.getPaletteFill(elPalette,iThisSeriesIndex);
    }
    updateTranslucency(fPaletteEntry,ss);
    lo=dpha[i].getLocation();
    dX=lo.getX();
    dY=lo.getY();
    try {
      dLow=srh.getLocationOnOrthogonal(new Double(se.getLow()));
      dHigh=srh.getLocationOnOrthogonal(new Double(se.getHigh()));
      dOpen=srh.getLocationOnOrthogonal(new Double(se.getOpen()));
      dClose=srh.getLocationOnOrthogonal(new Double(se.getClose()));
    }
 catch (    Exception ex) {
      logger.log(ex);
      continue;
    }
    ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_ELEMENT,dpha[i],fPaletteEntry);
    ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_DATA_POINT,dpha[i],fPaletteEntry,getRunTimeContext().getScriptContext());
    getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_ELEMENT,dpha[i]);
    getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_DATA_POINT,dpha[i]);
    dSpacing=(dpha[i].getSize() * dUnitSpacing) / 200;
    if (loStart == null) {
      loStart=goFactory.createLocation(0,0);
      loEnd=goFactory.createLocation(0,0);
      loaFrontFace=new Location[4];
      for (int j=0; j < 4; j++) {
        loaFrontFace[j]=goFactory.createLocation(0,0);
      }
    }
    dWidth=dpha[i].getSize();
    dWidth-=2 * dSpacing;
    dWidth/=iSharedUnitCount;
    if (cwa.getBaseAxes()[0].isCategoryAxis()) {
      dX+=dSpacing + dWidth / 2 + iSharedUnitIndex * dWidth;
    }
    lre=((EventObjectCache)ipr).getEventObject(WrappedStructureSource.createSeriesDataPoint(ss,dpha[i]),LineRenderEvent.class);
    if (ss.isShowAsBarStick()) {
      int stickLength=ss.getStickLength();
      int hotspotHalfWidth=Math.min(stickLength,MIN_HOTSPOT_WIDTH / 2);
      double hotspotHigh=Math.max(dHigh,dLow);
      double hotspotLow=Math.min(dHigh,dLow);
      loaFrontFace[0].set(dX - hotspotHalfWidth,hotspotHigh);
      loaFrontFace[1].set(dX - hotspotHalfWidth,hotspotLow);
      loaFrontFace[2].set(dX + hotspotHalfWidth,hotspotLow);
      loaFrontFace[3].set(dX + hotspotHalfWidth,hotspotHigh);
      Location loStart2=goFactory.createLocation(0,0), loEnd2=goFactory.createLocation(0,0);
      loStart.set(dX - stickLength,dOpen);
      loEnd.set(dX + stickLength,dClose);
      loStart2.set(dX,dOpen);
      loEnd2.set(dX,dClose);
      loUpper.set(dX,dHigh > dLow ? dHigh : dLow);
      loLower.set(dX,dHigh < dLow ? dHigh : dLow);
      lre.setLineAttributes(lia);
      lre.setStart(loUpper);
      lre.setEnd(loLower);
      ipr.drawLine(lre);
      lre.setStart(loStart);
      lre.setEnd(loStart2);
      ipr.drawLine(lre);
      lre.setStart(loEnd);
      lre.setEnd(loEnd2);
      ipr.drawLine(lre);
    }
 else {
{
        loStart.set(dX,dLow);
        loEnd.set(dX,dHigh);
        loaFrontFace[0].set(dX - dWidth / 2,dOpen);
        loaFrontFace[1].set(dX - dWidth / 2,dClose);
        loaFrontFace[2].set(dX + dWidth / 2,dClose);
        loaFrontFace[3].set(dX + dWidth / 2,dOpen);
        loUpper.set(dX,dOpen > dClose ? dOpen : dClose);
        loLower.set(dX,dOpen < dClose ? dOpen : dClose);
      }
      lre.setLineAttributes(lia);
      lre.setStart(loStart);
      lre.setEnd(loUpper);
      ipr.drawLine(lre);
      lre.setStart(loLower);
      lre.setEnd(loEnd);
      ipr.drawLine(lre);
      renderPlane(ipr,WrappedStructureSource.createSeriesDataPoint(ss,dpha[i]),loaFrontFace,convertFill(fPaletteEntry,se.getClose() > se.getOpen()),lia,cwa.getDimension(),dSeriesThickness,true);
    }
    if (cwa.isTransposed()) {
      faX[i]=((loUpper.getX() + loLower.getX()) / 2);
      faY[i]=loUpper.getY();
    }
 else {
      faX[i]=loLower.getX();
      faY[i]=((loUpper.getY() + loLower.getY()) / 2);
    }
    if (isInteractivityEnabled()) {
      final EList<Trigger> elTriggers=ss.getTriggers();
      if (!elTriggers.isEmpty()) {
        final StructureSource iSource=WrappedStructureSource.createSeriesDataPoint(ss,dpha[i]);
        final InteractionEvent iev=((EventObjectCache)ipr).getEventObject(iSource,InteractionEvent.class);
        iev.setCursor(ss.getCursor());
        Trigger tg;
        for (int t=0; t < elTriggers.size(); t++) {
          tg=goFactory.copyOf(elTriggers.get(t));
          processTrigger(tg,iSource);
          iev.addTrigger(tg);
        }
        final PolygonRenderEvent pre=((EventObjectCache)ipr).getEventObject(StructureSource.createSeries(ss),PolygonRenderEvent.class);
        pre.setPoints(loaFrontFace);
        iev.setHotSpot(pre);
        ipr.enableInteraction(iev);
      }
    }
    ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_ELEMENT,dpha[i],fPaletteEntry);
    ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_DATA_POINT,dpha[i],fPaletteEntry,getRunTimeContext().getScriptContext());
    getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_ELEMENT,dpha[i]);
    getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_DATA_POINT,dpha[i]);
    renderDataPointLabel(srh.getLabelAttributes(getSeries()),dpha[i],srh.getLabelPosition(getSeries()),loaFrontFace,p,sh,dX,dY,dWidth,dHeight,dHigh,dLow,dOpen,dClose);
  }
  if (getSeries().getCurveFitting() != null) {
    Location[] larray=new Location[faX.length];
    for (int i=0; i < larray.length; i++) {
      larray[i]=goFactory.createLocation(faX[i],faY[i]);
    }
    larray=filterNull(larray);
    renderFittingCurve(ipr,larray,getSeries().getCurveFitting(),false,true);
  }
  restoreClipping(ipr);
}