Program: 68532
Project: 68532
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()));
  }
  try {
    validateDataSetCount(isrh);
  }
 catch (  ChartException vex) {
    throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,vex);
  }
  SeriesRenderingHints srh=(SeriesRenderingHints)isrh;
  DifferenceSeries ds=(DifferenceSeries)getSeries();
  if (!ds.isVisible()) {
    return;
  }
  logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str",new Object[]{getClass().getName(),Integer.valueOf(iSeriesIndex + 1),Integer.valueOf(iSeriesCount)},getRunTimeContext().getULocale()));
  final AbstractScriptHandler<?> sh=getRunTimeContext().getScriptHandler();
  final DataPointHints[] dpha=isrh.getDataPoints();
  validateNullDatapoint(dpha);
  double fX, fY, fUnit, fPos, fNeg;
  double[] faX=new double[dpha.length];
  double[][] faY=new double[2][dpha.length];
  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[]{ds},Messages.getResourceBundle(getRunTimeContext().getULocale()));
  }
  final boolean isTransposed=isTransposed();
  final boolean bPaletteByCategory=isPaletteByCategory();
  if (bPaletteByCategory && ds.eContainer() instanceof SeriesDefinition) {
    sd=(SeriesDefinition)ds.eContainer();
  }
  int iThisSeriesIndex=sd.getRunTimeSeries().indexOf(ds);
  if (iThisSeriesIndex < 0) {
    throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",new Object[]{ds,sd},Messages.getResourceBundle(getRunTimeContext().getULocale()));
  }
  Marker posMarker=null;
  if (ds.getMarkers().size() > 0) {
    posMarker=ds.getMarkers().get(iThisSeriesIndex % ds.getMarkers().size());
  }
  Marker negMarker=null;
  if (ds.getNegativeMarkers().size() > 0) {
    negMarker=ds.getNegativeMarkers().get(iThisSeriesIndex % ds.getNegativeMarkers().size());
  }
  Fill fPaletteEntry=null;
  if (!bPaletteByCategory) {
    fPaletteEntry=FillUtil.getPaletteFill(elPalette,iThisSeriesIndex);
  }
 else   if (iSeriesIndex > 0) {
    fPaletteEntry=FillUtil.getPaletteFill(elPalette,iSeriesIndex - 1);
  }
  updateTranslucency(fPaletteEntry,ds);
  LineAttributes liaPos=ds.getLineAttributes();
  LineAttributes liaNeg=ds.getNegativeLineAttributes();
  if (((LineSeries)getSeries()).isPaletteLineColor()) {
    final Fill[] fills=DifferenceRenderer.createDifferenceFillFromPalette(fPaletteEntry,true);
    liaPos.setColor(FillUtil.getColor(fills[0]));
    liaNeg.setColor(FillUtil.getColor(fills[1]));
  }
  for (int i=0; i < dpha.length; i++) {
    DifferenceEntry de=(DifferenceEntry)dpha[i].getOrthogonalValue();
    faX[i]=Double.NaN;
    faY[0][i]=Double.NaN;
    faY[1][i]=Double.NaN;
    if (!DifferenceRenderer.isValidDifferenceEntry(de)) {
      continue;
    }
    Location lo=dpha[i].getLocation();
    fPos=srh.getLocationOnOrthogonal(new Double(de.getPositiveValue()));
    fNeg=srh.getLocationOnOrthogonal(new Double(de.getNegativeValue()));
    if (isTransposed) {
      fUnit=dpha[i].getSize();
      fY=(lo.getY() + fUnit / 2.0);
      faX[i]=fY;
      faY[0][i]=fPos;
      faY[1][i]=fNeg;
    }
 else {
      fUnit=dpha[i].getSize();
      fX=(lo.getX() + fUnit / 2.0);
      faX[i]=fX;
      faY[0][i]=fPos;
      faY[1][i]=fNeg;
    }
  }
  if (isTransposed) {
    handleOutsideDataPoints(ipr,srh,faY[0],faX,false);
    handleOutsideDataPoints(ipr,srh,faY[1],faX,false);
  }
 else {
    handleOutsideDataPoints(ipr,srh,faX,faY[0],false);
    handleOutsideDataPoints(ipr,srh,faX,faY[1],false);
  }
  if (ds.isCurve()) {
    DifferenceRenderer.renderDifferenceCurve(this,ipr,dpha,isTransposed ? goFactory.createLocations(faY[0],faX) : goFactory.createLocations(faX,faY[0]),isTransposed ? goFactory.createLocations(faY[1],faX) : goFactory.createLocations(faX,faY[1]),liaPos,liaNeg,fPaletteEntry);
  }
 else {
    DifferenceRenderer.renderDifferencePolygon(this,ipr,dpha,isTransposed ? goFactory.createLocations(faY[0],faX) : goFactory.createLocations(faX,faY[0]),isTransposed ? goFactory.createLocations(faY[1],faX) : goFactory.createLocations(faX,faY[1]),liaPos,liaNeg,fPaletteEntry);
  }
  if (negMarker != null || posMarker != null) {
    for (int i=0; i < dpha.length; i++) {
      DifferenceEntry de=(DifferenceEntry)dpha[i].getOrthogonalValue();
      if (!DifferenceRenderer.isValidDifferenceEntry(de) || dpha[i].isOutside()) {
        continue;
      }
      if (bPaletteByCategory) {
        fPaletteEntry=FillUtil.getPaletteFill(elPalette,i);
      }
 else {
        fPaletteEntry=FillUtil.getPaletteFill(elPalette,iThisSeriesIndex);
      }
      updateTranslucency(fPaletteEntry,ds);
      ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_DATA_POINT,dpha[i],fPaletteEntry,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_DATA_POINT,dpha[i]);
      if (negMarker != null) {
        Fill negFill=FillUtil.convertFill(fPaletteEntry,-1,null);
        renderMarker(ds,ipr,negMarker,isTransposed ? goFactory.createLocation(faY[1][i],faX[i]) : goFactory.createLocation(faX[i],faY[1][i]),liaNeg,negFill,dpha[i],null,true,true);
      }
      if (posMarker != null) {
        Fill posFill=FillUtil.convertFill(fPaletteEntry,1,null);
        renderMarker(ds,ipr,posMarker,isTransposed ? goFactory.createLocation(faY[0][i],faX[i]) : goFactory.createLocation(faX[i],faY[0][i]),liaPos,posFill,dpha[i],null,true,true);
      }
      ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_DATA_POINT,dpha[i],fPaletteEntry,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_DATA_POINT,dpha[i]);
    }
  }
  Label laDataPoint=srh.getLabelAttributes(ds);
  if (laDataPoint.isVisible()) {
    Position posDataPoint=srh.getLabelPosition(ds);
    Location loDataPoint=goFactory.createLocation(0,0);
    final double dSize=(posMarker == null) ? 0 : posMarker.getSize();
    for (int i=0; i < dpha.length; i++) {
      DifferenceEntry de=(DifferenceEntry)dpha[i].getOrthogonalValue();
      if (!DifferenceRenderer.isValidDifferenceEntry(de) || dpha[i].isOutside()) {
        continue;
      }
      laDataPoint.getCaption().setValue(dpha[i].getDisplayValue());
      ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_DATA_POINT_LABEL,dpha[i],laDataPoint,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_DATA_POINT_LABEL,laDataPoint);
      if (laDataPoint.isVisible()) {
        fX=faX[i];
        fY=faY[1][i];
        if (isTransposed) {
          fX=faY[1][i];
          fY=faX[i];
        }
switch (posDataPoint.getValue()) {
case Position.ABOVE:
          loDataPoint.set(fX,fY - dSize - p.getVerticalSpacing());
        break;
case Position.BELOW:
      loDataPoint.set(fX,fY + dSize + p.getVerticalSpacing());
    break;
case Position.LEFT:
  loDataPoint.set(fX - dSize - p.getHorizontalSpacing(),fY);
break;
case Position.RIGHT:
loDataPoint.set(fX + dSize + p.getHorizontalSpacing(),fY);
break;
default :
throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",new Object[]{posDataPoint.getName()},Messages.getResourceBundle(getRunTimeContext().getULocale()));
}
renderLabel(WrappedStructureSource.createSeriesDataPoint(ds,dpha[i]),TextRenderEvent.RENDER_TEXT_AT_LOCATION,laDataPoint,posDataPoint,loDataPoint,null);
}
ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_DATA_POINT_LABEL,dpha[i],laDataPoint,getRunTimeContext().getScriptContext());
getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_DATA_POINT_LABEL,laDataPoint);
}
}
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()));
  }
  try {
    validateDataSetCount(isrh);
  }
 catch (  ChartException vex) {
    throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,vex);
  }
  SeriesRenderingHints srh=(SeriesRenderingHints)isrh;
  DifferenceSeries ds=(DifferenceSeries)getSeries();
  if (!ds.isVisible()) {
    restoreClipping(ipr);
    return;
  }
  logger.log(ILogger.INFORMATION,Messages.getString("String_Node_Str",new Object[]{getClass().getName(),Integer.valueOf(iSeriesIndex + 1),Integer.valueOf(iSeriesCount)},getRunTimeContext().getULocale()));
  final AbstractScriptHandler<?> sh=getRunTimeContext().getScriptHandler();
  final DataPointHints[] dpha=isrh.getDataPoints();
  validateNullDatapoint(dpha);
  double fX, fY, fUnit, fPos, fNeg;
  double[] faX=new double[dpha.length];
  double[][] faY=new double[2][dpha.length];
  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[]{ds},Messages.getResourceBundle(getRunTimeContext().getULocale()));
  }
  final boolean isTransposed=isTransposed();
  final boolean bPaletteByCategory=isPaletteByCategory();
  if (bPaletteByCategory && ds.eContainer() instanceof SeriesDefinition) {
    sd=(SeriesDefinition)ds.eContainer();
  }
  int iThisSeriesIndex=sd.getRunTimeSeries().indexOf(ds);
  if (iThisSeriesIndex < 0) {
    throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",new Object[]{ds,sd},Messages.getResourceBundle(getRunTimeContext().getULocale()));
  }
  Marker posMarker=null;
  if (ds.getMarkers().size() > 0) {
    posMarker=ds.getMarkers().get(iThisSeriesIndex % ds.getMarkers().size());
  }
  Marker negMarker=null;
  if (ds.getNegativeMarkers().size() > 0) {
    negMarker=ds.getNegativeMarkers().get(iThisSeriesIndex % ds.getNegativeMarkers().size());
  }
  Fill fPaletteEntry=null;
  if (!bPaletteByCategory) {
    fPaletteEntry=FillUtil.getPaletteFill(elPalette,iThisSeriesIndex);
  }
 else   if (iSeriesIndex > 0) {
    fPaletteEntry=FillUtil.getPaletteFill(elPalette,iSeriesIndex - 1);
  }
  updateTranslucency(fPaletteEntry,ds);
  LineAttributes liaPos=ds.getLineAttributes();
  LineAttributes liaNeg=ds.getNegativeLineAttributes();
  if (((LineSeries)getSeries()).isPaletteLineColor()) {
    final Fill[] fills=DifferenceRenderer.createDifferenceFillFromPalette(fPaletteEntry,true);
    liaPos.setColor(FillUtil.getColor(fills[0]));
    liaNeg.setColor(FillUtil.getColor(fills[1]));
  }
  for (int i=0; i < dpha.length; i++) {
    DifferenceEntry de=(DifferenceEntry)dpha[i].getOrthogonalValue();
    faX[i]=Double.NaN;
    faY[0][i]=Double.NaN;
    faY[1][i]=Double.NaN;
    if (!DifferenceRenderer.isValidDifferenceEntry(de)) {
      continue;
    }
    Location lo=dpha[i].getLocation();
    fPos=srh.getLocationOnOrthogonal(new Double(de.getPositiveValue()));
    fNeg=srh.getLocationOnOrthogonal(new Double(de.getNegativeValue()));
    if (isTransposed) {
      fUnit=dpha[i].getSize();
      fY=(lo.getY() + fUnit / 2.0);
      faX[i]=fY;
      faY[0][i]=fPos;
      faY[1][i]=fNeg;
    }
 else {
      fUnit=dpha[i].getSize();
      fX=(lo.getX() + fUnit / 2.0);
      faX[i]=fX;
      faY[0][i]=fPos;
      faY[1][i]=fNeg;
    }
  }
  if (isTransposed) {
    handleOutsideDataPoints(ipr,srh,faY[0],faX,false);
    handleOutsideDataPoints(ipr,srh,faY[1],faX,false);
  }
 else {
    handleOutsideDataPoints(ipr,srh,faX,faY[0],false);
    handleOutsideDataPoints(ipr,srh,faX,faY[1],false);
  }
  if (ds.isCurve()) {
    DifferenceRenderer.renderDifferenceCurve(this,ipr,dpha,isTransposed ? goFactory.createLocations(faY[0],faX) : goFactory.createLocations(faX,faY[0]),isTransposed ? goFactory.createLocations(faY[1],faX) : goFactory.createLocations(faX,faY[1]),liaPos,liaNeg,fPaletteEntry);
  }
 else {
    DifferenceRenderer.renderDifferencePolygon(this,ipr,dpha,isTransposed ? goFactory.createLocations(faY[0],faX) : goFactory.createLocations(faX,faY[0]),isTransposed ? goFactory.createLocations(faY[1],faX) : goFactory.createLocations(faX,faY[1]),liaPos,liaNeg,fPaletteEntry);
  }
  if (negMarker != null || posMarker != null) {
    for (int i=0; i < dpha.length; i++) {
      DifferenceEntry de=(DifferenceEntry)dpha[i].getOrthogonalValue();
      if (!DifferenceRenderer.isValidDifferenceEntry(de) || dpha[i].isOutside()) {
        continue;
      }
      if (bPaletteByCategory) {
        fPaletteEntry=FillUtil.getPaletteFill(elPalette,i);
      }
 else {
        fPaletteEntry=FillUtil.getPaletteFill(elPalette,iThisSeriesIndex);
      }
      updateTranslucency(fPaletteEntry,ds);
      ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_DATA_POINT,dpha[i],fPaletteEntry,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_DATA_POINT,dpha[i]);
      if (negMarker != null) {
        Fill negFill=FillUtil.convertFill(fPaletteEntry,-1,null);
        renderMarker(ds,ipr,negMarker,isTransposed ? goFactory.createLocation(faY[1][i],faX[i]) : goFactory.createLocation(faX[i],faY[1][i]),liaNeg,negFill,dpha[i],null,true,true);
      }
      if (posMarker != null) {
        Fill posFill=FillUtil.convertFill(fPaletteEntry,1,null);
        renderMarker(ds,ipr,posMarker,isTransposed ? goFactory.createLocation(faY[0][i],faX[i]) : goFactory.createLocation(faX[i],faY[0][i]),liaPos,posFill,dpha[i],null,true,true);
      }
      ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_DATA_POINT,dpha[i],fPaletteEntry,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_DATA_POINT,dpha[i]);
    }
  }
  Label laDataPoint=srh.getLabelAttributes(ds);
  if (laDataPoint.isVisible()) {
    Position posDataPoint=srh.getLabelPosition(ds);
    Location loDataPoint=goFactory.createLocation(0,0);
    final double dSize=(posMarker == null) ? 0 : posMarker.getSize();
    for (int i=0; i < dpha.length; i++) {
      DifferenceEntry de=(DifferenceEntry)dpha[i].getOrthogonalValue();
      if (!DifferenceRenderer.isValidDifferenceEntry(de) || dpha[i].isOutside()) {
        continue;
      }
      laDataPoint.getCaption().setValue(dpha[i].getDisplayValue());
      ScriptHandler.callFunction(sh,ScriptHandler.BEFORE_DRAW_DATA_POINT_LABEL,dpha[i],laDataPoint,getRunTimeContext().getScriptContext());
      getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.BEFORE_DRAW_DATA_POINT_LABEL,laDataPoint);
      if (laDataPoint.isVisible()) {
        fX=faX[i];
        fY=faY[1][i];
        if (isTransposed) {
          fX=faY[1][i];
          fY=faX[i];
        }
switch (posDataPoint.getValue()) {
case Position.ABOVE:
          loDataPoint.set(fX,fY - dSize - p.getVerticalSpacing());
        break;
case Position.BELOW:
      loDataPoint.set(fX,fY + dSize + p.getVerticalSpacing());
    break;
case Position.LEFT:
  loDataPoint.set(fX - dSize - p.getHorizontalSpacing(),fY);
break;
case Position.RIGHT:
loDataPoint.set(fX + dSize + p.getHorizontalSpacing(),fY);
break;
default :
throw new ChartException(ChartEngineExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",new Object[]{posDataPoint.getName()},Messages.getResourceBundle(getRunTimeContext().getULocale()));
}
renderLabel(WrappedStructureSource.createSeriesDataPoint(ds,dpha[i]),TextRenderEvent.RENDER_TEXT_AT_LOCATION,laDataPoint,posDataPoint,loDataPoint,null);
}
ScriptHandler.callFunction(sh,ScriptHandler.AFTER_DRAW_DATA_POINT_LABEL,dpha[i],laDataPoint,getRunTimeContext().getScriptContext());
getRunTimeContext().notifyStructureChange(IStructureDefinitionListener.AFTER_DRAW_DATA_POINT_LABEL,laDataPoint);
}
}
restoreClipping(ipr);
}