Program: 26314
Project: 26314
Buggy source:
protected void drawDataSet(Canvas c,IPieDataSet dataSet){
  float angle=0;
  float rotationAngle=mChart.getRotationAngle();
  float phaseX=mAnimator.getPhaseX();
  float phaseY=mAnimator.getPhaseY();
  final RectF circleBox=mChart.getCircleBox();
  final int entryCount=dataSet.getEntryCount();
  final float[] drawAngles=mChart.getDrawAngles();
  float sliceSpace=dataSet.getSliceSpace();
  final PointF center=mChart.getCenterCircleBox();
  final float radius=mChart.getRadius();
  final float userInnerRadius=mChart.isDrawHoleEnabled() && !mChart.isDrawSlicesUnderHoleEnabled() ? radius * (mChart.getHoleRadius() / 100.f) : 0.f;
  int visibleAngleCount=0;
  for (int j=0; j < entryCount; j++) {
    if ((Math.abs(dataSet.getEntryForIndex(j).getVal()) > 0.000001)) {
      visibleAngleCount++;
    }
  }
  for (int j=0; j < entryCount; j++) {
    float sliceAngle=drawAngles[j];
    float innerRadius=userInnerRadius;
    Entry e=dataSet.getEntryForIndex(j);
    if ((Math.abs(e.getVal()) > 0.000001)) {
      if (!mChart.needsHighlight(e.getXIndex(),mChart.getData().getIndexOfDataSet(dataSet))) {
        mRenderPaint.setColor(dataSet.getColor(j));
        final float sliceSpaceOuterAngle=visibleAngleCount == 1 ? 0.f : sliceSpace / (Utils.FDEG2RAD * radius);
        final float startAngleOuter=rotationAngle + (angle + sliceSpaceOuterAngle / 2.f) * phaseY;
        float sweepAngleOuter=(sliceAngle - sliceSpaceOuterAngle) * phaseY;
        if (sweepAngleOuter < 0.f) {
          sweepAngleOuter=0.f;
        }
        mPathBuffer.reset();
        float arcStartPointX=0.f, arcStartPointY=0.f;
        if (sweepAngleOuter % 360f == 0.f) {
          mPathBuffer.addCircle(center.x,center.y,radius,Path.Direction.CW);
        }
 else {
          arcStartPointX=center.x + radius * (float)Math.cos(startAngleOuter * Utils.FDEG2RAD);
          arcStartPointY=center.y + radius * (float)Math.sin(startAngleOuter * Utils.FDEG2RAD);
          mPathBuffer.moveTo(arcStartPointX,arcStartPointY);
          mPathBuffer.arcTo(circleBox,startAngleOuter,sweepAngleOuter);
        }
        if (sliceSpace > 0.f) {
          innerRadius=Math.max(innerRadius,calculateMinimumRadiusForSpacedSlice(center,radius,sliceAngle * phaseY,arcStartPointX,arcStartPointY,startAngleOuter,sweepAngleOuter));
        }
        mInnerRectBuffer.set(center.x - innerRadius,center.y - innerRadius,center.x + innerRadius,center.y + innerRadius);
        if (innerRadius > 0.0) {
          final float sliceSpaceInnerAngle=visibleAngleCount == 1 ? 0.f : sliceSpace / (Utils.FDEG2RAD * innerRadius);
          final float startAngleInner=rotationAngle + (angle + sliceSpaceInnerAngle / 2.f) * phaseY;
          float sweepAngleInner=(sliceAngle - sliceSpaceInnerAngle) * phaseY;
          if (sweepAngleInner < 0.f) {
            sweepAngleInner=0.f;
          }
          final float endAngleInner=startAngleInner + sweepAngleInner;
          if (sweepAngleOuter % 360f == 0.f) {
            mPathBuffer.addCircle(center.x,center.y,innerRadius,Path.Direction.CCW);
          }
 else {
            mPathBuffer.lineTo(center.x + innerRadius * (float)Math.cos(endAngleInner * Utils.FDEG2RAD),center.y + innerRadius * (float)Math.sin(endAngleInner * Utils.FDEG2RAD));
            mPathBuffer.arcTo(mInnerRectBuffer,endAngleInner,-sweepAngleInner);
          }
        }
 else {
          if (sweepAngleOuter % 360f != 0.f) {
            mPathBuffer.lineTo(center.x,center.y);
          }
        }
        mPathBuffer.close();
        mBitmapCanvas.drawPath(mPathBuffer,mRenderPaint);
      }
    }
    angle+=sliceAngle * phaseX;
  }
}

Fixed version (ground truth):
protected void drawDataSet(Canvas c,IPieDataSet dataSet){
  float angle=0;
  float rotationAngle=mChart.getRotationAngle();
  float phaseX=mAnimator.getPhaseX();
  float phaseY=mAnimator.getPhaseY();
  final RectF circleBox=mChart.getCircleBox();
  final int entryCount=dataSet.getEntryCount();
  final float[] drawAngles=mChart.getDrawAngles();
  float sliceSpace=dataSet.getSliceSpace();
  final PointF center=mChart.getCenterCircleBox();
  final float radius=mChart.getRadius();
  final boolean drawInnerArc=mChart.isDrawHoleEnabled() && !mChart.isDrawSlicesUnderHoleEnabled();
  final float userInnerRadius=drawInnerArc ? radius * (mChart.getHoleRadius() / 100.f) : 0.f;
  int visibleAngleCount=0;
  for (int j=0; j < entryCount; j++) {
    if ((Math.abs(dataSet.getEntryForIndex(j).getVal()) > 0.000001)) {
      visibleAngleCount++;
    }
  }
  for (int j=0; j < entryCount; j++) {
    float sliceAngle=drawAngles[j];
    float innerRadius=userInnerRadius;
    Entry e=dataSet.getEntryForIndex(j);
    if ((Math.abs(e.getVal()) > 0.000001)) {
      if (!mChart.needsHighlight(e.getXIndex(),mChart.getData().getIndexOfDataSet(dataSet))) {
        mRenderPaint.setColor(dataSet.getColor(j));
        final float sliceSpaceAngleOuter=visibleAngleCount == 1 ? 0.f : sliceSpace / (Utils.FDEG2RAD * radius);
        final float startAngleOuter=rotationAngle + (angle + sliceSpaceAngleOuter / 2.f) * phaseY;
        float sweepAngleOuter=(sliceAngle - sliceSpaceAngleOuter) * phaseY;
        if (sweepAngleOuter < 0.f) {
          sweepAngleOuter=0.f;
        }
        mPathBuffer.reset();
        float arcStartPointX=0.f, arcStartPointY=0.f;
        if (sweepAngleOuter % 360f == 0.f) {
          mPathBuffer.addCircle(center.x,center.y,radius,Path.Direction.CW);
        }
 else {
          arcStartPointX=center.x + radius * (float)Math.cos(startAngleOuter * Utils.FDEG2RAD);
          arcStartPointY=center.y + radius * (float)Math.sin(startAngleOuter * Utils.FDEG2RAD);
          mPathBuffer.moveTo(arcStartPointX,arcStartPointY);
          mPathBuffer.arcTo(circleBox,startAngleOuter,sweepAngleOuter);
        }
        mInnerRectBuffer.set(center.x - innerRadius,center.y - innerRadius,center.x + innerRadius,center.y + innerRadius);
        if (drawInnerArc && (innerRadius > 0.f || sliceSpace > 0.f)) {
          if (sliceSpace > 0.f) {
            float minSpacedRadius=calculateMinimumRadiusForSpacedSlice(center,radius,sliceAngle * phaseY,arcStartPointX,arcStartPointY,startAngleOuter,sweepAngleOuter);
            if (minSpacedRadius < 0.f)             minSpacedRadius=-minSpacedRadius;
            innerRadius=Math.max(innerRadius,minSpacedRadius);
          }
          final float sliceSpaceAngleInner=visibleAngleCount == 1 || innerRadius == 0.f ? 0.f : sliceSpace / (Utils.FDEG2RAD * innerRadius);
          final float startAngleInner=rotationAngle + (angle + sliceSpaceAngleInner / 2.f) * phaseY;
          float sweepAngleInner=(sliceAngle - sliceSpaceAngleInner) * phaseY;
          if (sweepAngleInner < 0.f) {
            sweepAngleInner=0.f;
          }
          final float endAngleInner=startAngleInner + sweepAngleInner;
          if (sweepAngleOuter % 360f == 0.f) {
            mPathBuffer.addCircle(center.x,center.y,innerRadius,Path.Direction.CCW);
          }
 else {
            mPathBuffer.lineTo(center.x + innerRadius * (float)Math.cos(endAngleInner * Utils.FDEG2RAD),center.y + innerRadius * (float)Math.sin(endAngleInner * Utils.FDEG2RAD));
            mPathBuffer.arcTo(mInnerRectBuffer,endAngleInner,-sweepAngleInner);
          }
        }
 else {
          if (sweepAngleOuter % 360f != 0.f) {
            if (sliceSpace > 0.f) {
              float angleMiddle=startAngleOuter + sweepAngleOuter / 2.f;
              float sliceSpaceOffset=calculateMinimumRadiusForSpacedSlice(center,radius,sliceAngle * phaseY,arcStartPointX,arcStartPointY,startAngleOuter,sweepAngleOuter);
              float arcEndPointX=center.x + sliceSpaceOffset * (float)Math.cos(angleMiddle * Utils.FDEG2RAD);
              float arcEndPointY=center.y + sliceSpaceOffset * (float)Math.sin(angleMiddle * Utils.FDEG2RAD);
              mPathBuffer.lineTo(arcEndPointX,arcEndPointY);
            }
 else {
              mPathBuffer.lineTo(center.x,center.y);
            }
          }
        }
        mPathBuffer.close();
        mBitmapCanvas.drawPath(mPathBuffer,mRenderPaint);
      }
    }
    angle+=sliceAngle * phaseX;
  }
}