Program: 85864
Project: 85864
Buggy source:
/** 
 * Draws the labels for the pie sections.
 * @param g2  the graphics device.
 * @param keys  the keys.
 * @param totalValue  the total value.
 * @param plotArea  the plot area.
 * @param linkArea  the link area.
 * @param state  the state.
 */
protected void drawLabels(Graphics2D g2,List keys,double totalValue,Rectangle2D plotArea,Rectangle2D linkArea,PiePlotState state){
  Composite originalComposite=g2.getComposite();
  g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,1.0f));
  DefaultKeyedValues leftKeys=new DefaultKeyedValues();
  DefaultKeyedValues rightKeys=new DefaultKeyedValues();
  double runningTotal=0.0;
  Iterator iterator=keys.iterator();
  while (iterator.hasNext()) {
    Comparable key=(Comparable)iterator.next();
    boolean include;
    double v=0.0;
    Number n=this.dataset.getValue(key);
    if (n == null) {
      include=!this.ignoreNullValues;
    }
 else {
      v=n.doubleValue();
      include=this.ignoreZeroValues ? v > 0.0 : v >= 0.0;
    }
    if (include) {
      runningTotal=runningTotal + v;
      double mid=this.startAngle + (this.direction.getFactor() * ((runningTotal - v / 2.0) * 360) / totalValue);
      if (Math.cos(Math.toRadians(mid)) < 0.0) {
        leftKeys.addValue(key,new Double(mid));
      }
 else {
        rightKeys.addValue(key,new Double(mid));
      }
    }
  }
  g2.setFont(getLabelFont());
  double marginX=plotArea.getX() + this.interiorGap * plotArea.getWidth();
  double gap=plotArea.getWidth() * this.labelGap;
  double ww=linkArea.getX() - gap - marginX;
  float labelWidth=(float)this.labelPadding.trimWidth(ww);
  if (this.labelGenerator != null) {
    drawLeftLabels(leftKeys,g2,plotArea,linkArea,labelWidth,state);
    drawRightLabels(rightKeys,g2,plotArea,linkArea,labelWidth,state);
  }
  g2.setComposite(originalComposite);
}

Fixed version (ground truth):
/** 
 * Draws the labels for the pie sections.
 * @param g2  the graphics device.
 * @param keys  the keys.
 * @param totalValue  the total value.
 * @param plotArea  the plot area.
 * @param linkArea  the link area.
 * @param state  the state.
 */
protected void drawLabels(Graphics2D g2,List<Comparable> keys,double totalValue,Rectangle2D plotArea,Rectangle2D linkArea,PiePlotState state){
  Composite originalComposite=g2.getComposite();
  g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,1.0f));
  DefaultKeyedValues leftKeys=new DefaultKeyedValues();
  DefaultKeyedValues rightKeys=new DefaultKeyedValues();
  double runningTotal=0.0;
  for (  Comparable key : keys) {
    boolean include;
    double v=0.0;
    Number n=this.dataset.getValue(key);
    if (n == null) {
      include=!this.ignoreNullValues;
    }
 else {
      v=n.doubleValue();
      include=this.ignoreZeroValues ? v > 0.0 : v >= 0.0;
    }
    if (include) {
      runningTotal=runningTotal + v;
      double mid=this.startAngle + (this.direction.getFactor() * ((runningTotal - v / 2.0) * 360) / totalValue);
      if (Math.cos(Math.toRadians(mid)) < 0.0) {
        leftKeys.addValue(key,new Double(mid));
      }
 else {
        rightKeys.addValue(key,new Double(mid));
      }
    }
  }
  g2.setFont(getLabelFont());
  double marginX=plotArea.getX() + this.interiorGap * plotArea.getWidth();
  double gap=plotArea.getWidth() * this.labelGap;
  double ww=linkArea.getX() - gap - marginX;
  float labelWidth=(float)this.labelPadding.trimWidth(ww);
  if (this.labelGenerator != null) {
    drawLeftLabels(leftKeys,g2,plotArea,linkArea,labelWidth,state);
    drawRightLabels(rightKeys,g2,plotArea,linkArea,labelWidth,state);
  }
  g2.setComposite(originalComposite);
}