Program: 85865
Project: 85865
Buggy source:
/** 
 * Draws the pie section labels in the simple form.
 * @param g2  the graphics device.
 * @param keys  the section keys.
 * @param totalValue  the total value for all sections in the pie.
 * @param plotArea  the plot area.
 * @param pieArea  the area containing the pie.
 * @param state  the plot state.
 * @since 1.0.7
 */
protected void drawSimpleLabels(Graphics2D g2,List keys,double totalValue,Rectangle2D plotArea,Rectangle2D pieArea,PiePlotState state){
  Composite originalComposite=g2.getComposite();
  g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,1.0f));
  Rectangle2D labelsArea=this.simpleLabelOffset.createInsetRectangle(pieArea);
  double runningTotal=0.0;
  Iterator iterator=keys.iterator();
  while (iterator.hasNext()) {
    Comparable key=(Comparable)iterator.next();
    boolean include;
    double v=0.0;
    Number n=getDataset().getValue(key);
    if (n == null) {
      include=!getIgnoreNullValues();
    }
 else {
      v=n.doubleValue();
      include=getIgnoreZeroValues() ? v > 0.0 : v >= 0.0;
    }
    if (include) {
      runningTotal=runningTotal + v;
      double mid=getStartAngle() + (getDirection().getFactor() * ((runningTotal - v / 2.0) * 360) / totalValue);
      Arc2D arc=new Arc2D.Double(labelsArea,getStartAngle(),mid - getStartAngle(),Arc2D.OPEN);
      int x=(int)arc.getEndPoint().getX();
      int y=(int)arc.getEndPoint().getY();
      PieSectionLabelGenerator myLabelGenerator=getLabelGenerator();
      if (myLabelGenerator == null) {
        continue;
      }
      String label=myLabelGenerator.generateSectionLabel(this.dataset,key);
      if (label == null) {
        continue;
      }
      g2.setFont(this.labelFont);
      FontMetrics fm=g2.getFontMetrics();
      Rectangle2D bounds=TextUtilities.getTextBounds(label,g2,fm);
      Rectangle2D out=this.labelPadding.createOutsetRectangle(bounds);
      Shape bg=ShapeUtilities.createTranslatedShape(out,x - bounds.getCenterX(),y - bounds.getCenterY());
      if (this.labelShadowPaint != null && this.shadowGenerator == null) {
        Shape shadow=ShapeUtilities.createTranslatedShape(bg,this.shadowXOffset,this.shadowYOffset);
        g2.setPaint(this.labelShadowPaint);
        g2.fill(shadow);
      }
      if (this.labelBackgroundPaint != null) {
        g2.setPaint(this.labelBackgroundPaint);
        g2.fill(bg);
      }
      if (this.labelOutlinePaint != null && this.labelOutlineStroke != null) {
        g2.setPaint(this.labelOutlinePaint);
        g2.setStroke(this.labelOutlineStroke);
        g2.draw(bg);
      }
      g2.setPaint(this.labelPaint);
      g2.setFont(this.labelFont);
      TextUtilities.drawAlignedString(label,g2,x,y,TextAnchor.CENTER);
    }
  }
  g2.setComposite(originalComposite);
}

Fixed version (ground truth):
/** 
 * Draws the pie section labels in the simple form.
 * @param g2  the graphics device.
 * @param keys  the section keys.
 * @param totalValue  the total value for all sections in the pie.
 * @param plotArea  the plot area.
 * @param pieArea  the area containing the pie.
 * @param state  the plot state.
 * @since 1.0.7
 */
protected void drawSimpleLabels(Graphics2D g2,List<Comparable> keys,double totalValue,Rectangle2D plotArea,Rectangle2D pieArea,PiePlotState state){
  Composite originalComposite=g2.getComposite();
  g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,1.0f));
  Rectangle2D labelsArea=this.simpleLabelOffset.createInsetRectangle(pieArea);
  double runningTotal=0.0;
  for (  Comparable key : keys) {
    boolean include;
    double v=0.0;
    Number n=getDataset().getValue(key);
    if (n == null) {
      include=!getIgnoreNullValues();
    }
 else {
      v=n.doubleValue();
      include=getIgnoreZeroValues() ? v > 0.0 : v >= 0.0;
    }
    if (include) {
      runningTotal=runningTotal + v;
      double mid=getStartAngle() + (getDirection().getFactor() * ((runningTotal - v / 2.0) * 360) / totalValue);
      Arc2D arc=new Arc2D.Double(labelsArea,getStartAngle(),mid - getStartAngle(),Arc2D.OPEN);
      int x=(int)arc.getEndPoint().getX();
      int y=(int)arc.getEndPoint().getY();
      PieSectionLabelGenerator myLabelGenerator=getLabelGenerator();
      if (myLabelGenerator == null) {
        continue;
      }
      String label=myLabelGenerator.generateSectionLabel(this.dataset,key);
      if (label == null) {
        continue;
      }
      g2.setFont(this.labelFont);
      FontMetrics fm=g2.getFontMetrics();
      Rectangle2D bounds=TextUtilities.getTextBounds(label,g2,fm);
      Rectangle2D out=this.labelPadding.createOutsetRectangle(bounds);
      Shape bg=ShapeUtilities.createTranslatedShape(out,x - bounds.getCenterX(),y - bounds.getCenterY());
      if (this.labelShadowPaint != null && this.shadowGenerator == null) {
        Shape shadow=ShapeUtilities.createTranslatedShape(bg,this.shadowXOffset,this.shadowYOffset);
        g2.setPaint(this.labelShadowPaint);
        g2.fill(shadow);
      }
      if (this.labelBackgroundPaint != null) {
        g2.setPaint(this.labelBackgroundPaint);
        g2.fill(bg);
      }
      if (this.labelOutlinePaint != null && this.labelOutlineStroke != null) {
        g2.setPaint(this.labelOutlinePaint);
        g2.setStroke(this.labelOutlineStroke);
        g2.draw(bg);
      }
      g2.setPaint(this.labelPaint);
      g2.setFont(this.labelFont);
      TextUtilities.drawAlignedString(label,g2,x,y,TextAnchor.CENTER);
    }
  }
  g2.setComposite(originalComposite);
}