Program: 25816
Project: 25816
Buggy source:
/** 
 * <p> Draw the data </p> <p> チャートでデータを書く </p> <p> 将数据绘制在图表上 </p>
 * @param canvas
 */
protected void drawData(Canvas canvas){
  if (null != data) {
    float sum=0;
    for (int i=0; i < data.size(); i++) {
      sum=sum + data.get(i).getValue();
    }
    Paint mPaintDonut=new Paint();
    mPaintDonut.setStyle(Style.STROKE);
    mPaintDonut.setAntiAlias(true);
    mPaintDonut.setStrokeWidth(donutWidth);
    Paint mPaintBorder=new Paint();
    mPaintBorder.setStyle(Style.STROKE);
    mPaintBorder.setColor(longitudeColor);
    mPaintBorder.setAntiAlias(true);
    float offset=-90;
    for (int j=0; j < data.size(); j++) {
      TitleValueColorEntity e=data.get(j);
      mPaintDonut.setColor(e.getColor());
      RectF oval=new RectF(position.x - longitudeLength + borderWidth / 2 + donutWidth / 2,position.y - longitudeLength + borderWidth / 2 + donutWidth / 2,position.x + longitudeLength - borderWidth / 2 - donutWidth / 2,position.y + longitudeLength - borderWidth / 2 - donutWidth / 2);
      float sweep=e.getValue() * 360f / sum;
      canvas.drawArc(oval,offset,sweep,false,mPaintDonut);
      offset=offset + sweep;
    }
    Paint mPaintFont=new Paint();
    mPaintFont.setColor(Color.LTGRAY);
    mPaintFont.setTextSize(titleFontSize);
    Paint mPaintRect=new Paint();
    mPaintRect.setStyle(Style.FILL);
    mPaintRect.setAntiAlias(true);
    mPaintRect.setStrokeWidth(titleFontSize);
    float startX=position.x - (longitudeLength - donutWidth - 2 * borderWidth) / 1.4f;
    float startY=position.y - data.size() * titleFontSize / 2;
    for (int k=0; k < data.size(); k++) {
      TitleValueColorEntity e=data.get(k);
      float value=e.getValue();
      float percentage=(int)(value / sum * 10000) / 100f;
      String title=e.getTitle();
      mPaintRect.setColor(e.getColor());
      canvas.drawRect(startX + 1,startY + k * titleFontSize + 1,startX + titleFontSize - 1,startY + k * titleFontSize + titleFontSize - 1,mPaintRect);
      canvas.drawText(String.valueOf(percentage) + "String_Node_Str",startX + titleFontSize + 2,startY + k * titleFontSize + titleFontSize - 2,mPaintFont);
      canvas.drawText(title,startX + titleFontSize + 4+ mPaintFont.measureText(String.valueOf(percentage) + "String_Node_Str"),startY + k * titleFontSize + titleFontSize - 2,mPaintFont);
    }
  }
}

Fixed version (ground truth):
/** 
 * <p> Draw the data </p> <p> チャートでデータを書く </p> <p> 将数据绘制在图表上 </p>
 * @param canvas
 */
protected void drawData(Canvas canvas){
  if (null != data) {
    float sum=0;
    for (int i=0; i < data.size(); i++) {
      sum=sum + data.get(i).getValue();
    }
    Paint mPaintDonut=new Paint();
    mPaintDonut.setStyle(Style.STROKE);
    mPaintDonut.setAntiAlias(true);
    mPaintDonut.setStrokeWidth(donutWidth);
    Paint mPaintBorder=new Paint();
    mPaintBorder.setStyle(Style.STROKE);
    mPaintBorder.setColor(longitudeColor);
    mPaintBorder.setAntiAlias(true);
    float offset=-90;
    for (int j=0; j < data.size(); j++) {
      TitleValueColorEntity e=data.get(j);
      mPaintDonut.setColor(e.getColor());
      RectF oval=new RectF(position.x - longitudeLength + borderWidth / 2 + donutWidth / 2,position.y - longitudeLength + borderWidth / 2 + donutWidth / 2,position.x + longitudeLength - borderWidth / 2 - donutWidth / 2,position.y + longitudeLength - borderWidth / 2 - donutWidth / 2);
      float sweep=e.getValue() * 360f / sum;
      canvas.drawArc(oval,offset,sweep + 1,false,mPaintDonut);
      offset=offset + sweep;
    }
    Paint mPaintFont=new Paint();
    mPaintFont.setColor(Color.LTGRAY);
    mPaintFont.setTextSize(titleFontSize);
    Paint mPaintRect=new Paint();
    mPaintRect.setStyle(Style.FILL);
    mPaintRect.setAntiAlias(true);
    mPaintRect.setStrokeWidth(titleFontSize);
    float startX=position.x - (longitudeLength - donutWidth - 2 * borderWidth) / 1.4f;
    float startY=position.y - data.size() * titleFontSize / 2;
    for (int k=0; k < data.size(); k++) {
      TitleValueColorEntity e=data.get(k);
      float value=e.getValue();
      float percentage=(int)(value / sum * 10000) / 100f;
      String title=e.getTitle();
      mPaintRect.setColor(e.getColor());
      canvas.drawRect(startX + 1,startY + k * titleFontSize + 1,startX + titleFontSize - 1,startY + k * titleFontSize + titleFontSize - 1,mPaintRect);
      canvas.drawText(String.valueOf(percentage) + "String_Node_Str",startX + titleFontSize + 2,startY + k * titleFontSize + titleFontSize - 2,mPaintFont);
      canvas.drawText(title,startX + titleFontSize + 4+ mPaintFont.measureText(String.valueOf(percentage) + "String_Node_Str"),startY + k * titleFontSize + titleFontSize - 2,mPaintFont);
    }
  }
}