Program: 66122
Project: 66122
Buggy source:
/** 
 * @param loC center coordinates of pie slice.
 * @param loOffset pie slice officeset for multiple dimension.
 * @param sz the width and height of pie slice.
 * @param fi the fill properties.
 * @param iPieceType
 * @throws ChartException
 */
private final void render(Location loC,Location loOffset,Size sz,Fill fi,int iPieceType) throws ChartException {
  boolean hasInnerRadius=ps.isSetInnerRadius() && ps.getInnerRadius() > 0d && Math.min(sz.getHeight(),sz.getWidth()) > ps.getInnerRadius();
  loC.translate(loOffset.getX() / 2d,loOffset.getY() / 2d);
  if (isExploded && dExplosion != 0) {
    double dMidAngleInRadians=Math.toRadians(getStartAngle() + getSliceLength() / 2d);
    double dSineThetaMid=(Math.sin(dMidAngleInRadians));
    double dCosThetaMid=(Math.cos(dMidAngleInRadians));
    double xDelta=(dExplosion * dCosThetaMid);
    double yDelta=(dExplosion * dSineThetaMid);
    if (ratio < 1) {
      yDelta=yDelta * ratio;
    }
 else {
      xDelta=xDelta / ratio;
    }
    loC.translate(xDelta,-yDelta);
  }
  Location loCTop=goFactory.createLocation(loC.getX() - loOffset.getX(),loC.getY() - loOffset.getY());
  double dAngleInRadians=Math.toRadians(getStartAngle());
  double dSineThetaStart=Math.sin(dAngleInRadians);
  double dCosThetaStart=Math.cos(dAngleInRadians);
  dAngleInRadians=Math.toRadians(getStartAngle() + getSliceLength());
  double dSineThetaEnd=Math.sin(dAngleInRadians);
  double dCosThetaEnd=Math.cos(dAngleInRadians);
  double xE=(sz.getWidth() * dCosThetaEnd);
  double yE=(sz.getHeight() * dSineThetaEnd);
  double xS=(sz.getWidth() * dCosThetaStart);
  double yS=(sz.getHeight() * dSineThetaStart);
  double xInnerE=0d;
  double yInnerE=0d;
  double xInnerS=0d;
  double yInnerS=0d;
  if (hasInnerRadius) {
    double innerRadius=ps.getInnerRadius();
    if (innerRadius < 1d) {
      xInnerE=innerRadius * sz.getWidth() * dCosThetaEnd;
      yInnerE=innerRadius * sz.getHeight() * dSineThetaEnd;
      xInnerS=innerRadius * sz.getWidth() * dCosThetaStart;
      yInnerS=innerRadius * sz.getHeight() * dSineThetaStart;
    }
 else {
      double radio=sz.getHeight() / sz.getWidth();
      xInnerE=innerRadius * dCosThetaEnd;
      yInnerE=innerRadius * radio * dSineThetaEnd;
      xInnerS=innerRadius * dCosThetaStart;
      yInnerS=innerRadius * radio * dSineThetaStart;
    }
  }
  ArcRenderEvent are=null;
  if (iPieceType == LOWER) {
    are=new ArcRenderEvent(WrappedStructureSource.createSeriesDataPoint(ps,dataPointHints));
  }
 else {
    are=((EventObjectCache)idr).getEventObject(WrappedStructureSource.createSeriesDataPoint(ps,getDataPointHints()),ArcRenderEvent.class);
  }
  are.setBackground(fi);
  liaEdges.setColor(getSliceOutline(fi));
  are.setOutline(liaEdges);
  are.setTopLeft(goFactory.createLocation(loCTop.getX() - sz.getWidth(),loCTop.getY() - sz.getHeight() + (iPieceType == LOWER ? dThickness : 0)));
  are.setWidth(sz.getWidth() * 2);
  are.setHeight(sz.getHeight() * 2);
  if (hasInnerRadius) {
    are.setOuterRadius(sz.getWidth());
    are.setInnerRadius(ps.getInnerRadius());
  }
  are.setStartAngle(startAngle);
  are.setAngleExtent(sliceLength);
  are.setStyle(ArcRenderEvent.SECTOR);
  idr.fillArc(are);
  if (iPieceType == LOWER) {
    if (!hasInnerRadius) {
      double[] daXPoints={loC.getX(),loCTop.getX(),loCTop.getX() + xE,loC.getX() + xE};
      double[] daYPoints={loC.getY(),loCTop.getY(),loCTop.getY() - yE,loC.getY() - yE};
      deferFlatPlane(deferredPlanes,getStartAngle() + getSliceLength(),false,daXPoints,daYPoints,fi,dataPointHints);
      daXPoints=new double[]{loC.getX(),loC.getX() + xS,loCTop.getX() + xS,loCTop.getX()};
      daYPoints=new double[]{loC.getY(),loC.getY() - yS,loCTop.getY() - yS,loCTop.getY()};
      deferFlatPlane(deferredPlanes,getStartAngle(),true,daXPoints,daYPoints,fi,dataPointHints);
      daXPoints=new double[]{loC.getX() + xS,loCTop.getX() + xS,loCTop.getX() + xE,loC.getX() + xE};
      daYPoints=new double[]{loC.getY() - yS,loCTop.getY() - yS,loCTop.getY() - yE,loC.getY() - yE};
    }
 else {
      double[] daXPoints={loC.getX() + xInnerE,loCTop.getX() + xInnerE,loCTop.getX() + xE,loC.getX() + xE};
      double[] daYPoints={loC.getY() - yInnerE,loCTop.getY() - yInnerE,loCTop.getY() - yE,loC.getY() - yE};
      deferFlatPlane(deferredPlanes,getStartAngle() + getSliceLength(),false,daXPoints,daYPoints,fi,dataPointHints);
      daXPoints=new double[]{loC.getX() + xInnerS,loC.getX() + xS,loCTop.getX() + xS,loCTop.getX() + xInnerS};
      daYPoints=new double[]{loC.getY() - yInnerS,loC.getY() - yS,loCTop.getY() - yS,loCTop.getY() - yInnerS};
      deferFlatPlane(deferredPlanes,getStartAngle(),true,daXPoints,daYPoints,fi,dataPointHints);
      daXPoints=new double[]{loC.getX() + xS,loCTop.getX() + xS,loCTop.getX() + xE,loC.getX() + xE};
      daYPoints=new double[]{loC.getY() - yS,loCTop.getY() - yS,loCTop.getY() - yE,loC.getY() - yE};
    }
    if (hasInnerRadius) {
      if (ps.getInnerRadius() < 1d) {
        Size innerSize=SizeImpl.create(ps.getInnerRadius() * sz.getWidth(),ps.getInnerRadius() * sz.getHeight());
        renderCurvedSurface(loC,loCTop,innerSize,xInnerE,yInnerE,xInnerS,yInnerS,fi,true);
      }
 else {
        double radio=sz.getHeight() / sz.getWidth();
        Size innerSize=SizeImpl.create(ps.getInnerRadius(),ps.getInnerRadius() * radio);
        renderCurvedSurface(loC,loCTop,innerSize,xInnerE,yInnerE,xInnerS,yInnerS,fi,true);
      }
    }
    renderCurvedSurface(loC,loCTop,sz,xE,yE,xS,yS,fi,false);
  }
 else   if (iPieceType == UPPER) {
    if (ps.getSliceOutline() != null) {
      idr.drawArc(are);
    }
    if (pie.isInteractivityEnabled() && !bMinSlice) {
      final EList<Trigger> elTriggers=ps.getTriggers();
      if (!elTriggers.isEmpty()) {
        final StructureSource iSource=WrappedStructureSource.createSeriesDataPoint(ps,dataPointHints);
        final InteractionEvent iev=((EventObjectCache)idr).getEventObject(iSource,InteractionEvent.class);
        iev.setCursor(ps.getCursor());
        Trigger tg;
        for (int t=0; t < elTriggers.size(); t++) {
          tg=goFactory.copyOf(elTriggers.get(t));
          pie.processTrigger(tg,iSource);
          iev.addTrigger(tg);
        }
        iev.setHotSpot(are);
        idr.enableInteraction(iev);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * @param loC center coordinates of pie slice.
 * @param loOffset pie slice officeset for multiple dimension.
 * @param sz the width and height of pie slice.
 * @param fi the fill properties.
 * @param iPieceType
 * @throws ChartException
 */
private final void render(Location loC,Location loOffset,Size sz,Fill fi,int iPieceType) throws ChartException {
  boolean hasInnerRadius=ps.isSetInnerRadius() && ps.getInnerRadius() > 0d;
  if (!(ps.isSetInnerRadiusPercent() && ps.isInnerRadiusPercent())) {
    hasInnerRadius=hasInnerRadius && Math.min(sz.getHeight(),sz.getWidth()) > ps.getInnerRadius();
  }
  loC.translate(loOffset.getX() / 2d,loOffset.getY() / 2d);
  if (isExploded && dExplosion != 0) {
    double dMidAngleInRadians=Math.toRadians(getStartAngle() + getSliceLength() / 2d);
    double dSineThetaMid=(Math.sin(dMidAngleInRadians));
    double dCosThetaMid=(Math.cos(dMidAngleInRadians));
    double xDelta=(dExplosion * dCosThetaMid);
    double yDelta=(dExplosion * dSineThetaMid);
    if (ratio < 1) {
      yDelta=yDelta * ratio;
    }
 else {
      xDelta=xDelta / ratio;
    }
    loC.translate(xDelta,-yDelta);
  }
  Location loCTop=goFactory.createLocation(loC.getX() - loOffset.getX(),loC.getY() - loOffset.getY());
  double dAngleInRadians=Math.toRadians(getStartAngle());
  double dSineThetaStart=Math.sin(dAngleInRadians);
  double dCosThetaStart=Math.cos(dAngleInRadians);
  dAngleInRadians=Math.toRadians(getStartAngle() + getSliceLength());
  double dSineThetaEnd=Math.sin(dAngleInRadians);
  double dCosThetaEnd=Math.cos(dAngleInRadians);
  double xE=(sz.getWidth() * dCosThetaEnd);
  double yE=(sz.getHeight() * dSineThetaEnd);
  double xS=(sz.getWidth() * dCosThetaStart);
  double yS=(sz.getHeight() * dSineThetaStart);
  double xInnerE=0d;
  double yInnerE=0d;
  double xInnerS=0d;
  double yInnerS=0d;
  if (hasInnerRadius) {
    double innerRadius=ps.getInnerRadius();
    if (ps.isInnerRadiusPercent()) {
      innerRadius*=0.01d;
      xInnerE=innerRadius * sz.getWidth() * dCosThetaEnd;
      yInnerE=innerRadius * sz.getHeight() * dSineThetaEnd;
      xInnerS=innerRadius * sz.getWidth() * dCosThetaStart;
      yInnerS=innerRadius * sz.getHeight() * dSineThetaStart;
    }
 else {
      double radio=sz.getHeight() / sz.getWidth();
      xInnerE=innerRadius * dCosThetaEnd;
      yInnerE=innerRadius * radio * dSineThetaEnd;
      xInnerS=innerRadius * dCosThetaStart;
      yInnerS=innerRadius * radio * dSineThetaStart;
    }
  }
  ArcRenderEvent are=null;
  if (iPieceType == LOWER) {
    are=new ArcRenderEvent(WrappedStructureSource.createSeriesDataPoint(ps,dataPointHints));
  }
 else {
    are=((EventObjectCache)idr).getEventObject(WrappedStructureSource.createSeriesDataPoint(ps,getDataPointHints()),ArcRenderEvent.class);
  }
  are.setBackground(fi);
  liaEdges.setColor(getSliceOutline(fi));
  are.setOutline(liaEdges);
  are.setTopLeft(goFactory.createLocation(loCTop.getX() - sz.getWidth(),loCTop.getY() - sz.getHeight() + (iPieceType == LOWER ? dThickness : 0)));
  are.setWidth(sz.getWidth() * 2);
  are.setHeight(sz.getHeight() * 2);
  if (hasInnerRadius) {
    are.setOuterRadius(sz.getWidth());
    if (ps.isInnerRadiusPercent()) {
      are.setInnerRadius(sz.getWidth() * ps.getInnerRadius() * 0.01d);
    }
 else {
      are.setInnerRadius(ps.getInnerRadius());
    }
  }
  are.setStartAngle(startAngle);
  are.setAngleExtent(sliceLength);
  are.setStyle(ArcRenderEvent.SECTOR);
  idr.fillArc(are);
  if (iPieceType == LOWER) {
    if (!hasInnerRadius) {
      double[] daXPoints={loC.getX(),loCTop.getX(),loCTop.getX() + xE,loC.getX() + xE};
      double[] daYPoints={loC.getY(),loCTop.getY(),loCTop.getY() - yE,loC.getY() - yE};
      deferFlatPlane(deferredPlanes,getStartAngle() + getSliceLength(),false,daXPoints,daYPoints,fi,dataPointHints);
      daXPoints=new double[]{loC.getX(),loC.getX() + xS,loCTop.getX() + xS,loCTop.getX()};
      daYPoints=new double[]{loC.getY(),loC.getY() - yS,loCTop.getY() - yS,loCTop.getY()};
      deferFlatPlane(deferredPlanes,getStartAngle(),true,daXPoints,daYPoints,fi,dataPointHints);
      daXPoints=new double[]{loC.getX() + xS,loCTop.getX() + xS,loCTop.getX() + xE,loC.getX() + xE};
      daYPoints=new double[]{loC.getY() - yS,loCTop.getY() - yS,loCTop.getY() - yE,loC.getY() - yE};
    }
 else {
      double[] daXPoints={loC.getX() + xInnerE,loCTop.getX() + xInnerE,loCTop.getX() + xE,loC.getX() + xE};
      double[] daYPoints={loC.getY() - yInnerE,loCTop.getY() - yInnerE,loCTop.getY() - yE,loC.getY() - yE};
      deferFlatPlane(deferredPlanes,getStartAngle() + getSliceLength(),false,daXPoints,daYPoints,fi,dataPointHints);
      daXPoints=new double[]{loC.getX() + xInnerS,loC.getX() + xS,loCTop.getX() + xS,loCTop.getX() + xInnerS};
      daYPoints=new double[]{loC.getY() - yInnerS,loC.getY() - yS,loCTop.getY() - yS,loCTop.getY() - yInnerS};
      deferFlatPlane(deferredPlanes,getStartAngle(),true,daXPoints,daYPoints,fi,dataPointHints);
      daXPoints=new double[]{loC.getX() + xS,loCTop.getX() + xS,loCTop.getX() + xE,loC.getX() + xE};
      daYPoints=new double[]{loC.getY() - yS,loCTop.getY() - yS,loCTop.getY() - yE,loC.getY() - yE};
    }
    if (hasInnerRadius) {
      if (ps.isInnerRadiusPercent()) {
        double innerRadius=ps.getInnerRadius() * 0.01d;
        Size innerSize=SizeImpl.create(innerRadius * sz.getWidth(),innerRadius * sz.getHeight());
        renderCurvedSurface(loC,loCTop,innerSize,xInnerE,yInnerE,xInnerS,yInnerS,fi,true);
      }
 else {
        double radio=sz.getHeight() / sz.getWidth();
        Size innerSize=SizeImpl.create(ps.getInnerRadius(),ps.getInnerRadius() * radio);
        renderCurvedSurface(loC,loCTop,innerSize,xInnerE,yInnerE,xInnerS,yInnerS,fi,true);
      }
    }
    renderCurvedSurface(loC,loCTop,sz,xE,yE,xS,yS,fi,false);
  }
 else   if (iPieceType == UPPER) {
    if (ps.getSliceOutline() != null) {
      idr.drawArc(are);
    }
    if (pie.isInteractivityEnabled() && !bMinSlice) {
      final EList<Trigger> elTriggers=ps.getTriggers();
      if (!elTriggers.isEmpty()) {
        final StructureSource iSource=WrappedStructureSource.createSeriesDataPoint(ps,dataPointHints);
        final InteractionEvent iev=((EventObjectCache)idr).getEventObject(iSource,InteractionEvent.class);
        iev.setCursor(ps.getCursor());
        Trigger tg;
        for (int t=0; t < elTriggers.size(); t++) {
          tg=goFactory.copyOf(elTriggers.get(t));
          pie.processTrigger(tg,iSource);
          iev.addTrigger(tg);
        }
        iev.setHotSpot(are);
        idr.enableInteraction(iev);
      }
    }
  }
}