Program: 167273
Project: 167273
Buggy source:
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  mTextPaint.setColor(mTextColor);
  mTextPaint.setTextSize(mTextSize);
  mMainLinePaint.setColor(mLineColor);
  mSecondaryLinePaint.setColor(mLineColor);
  mTerciaryLinePaint.setColor(mLineColor);
  mMarkerPaint.setColor(mMarkerColor);
  canvas.drawColor(mBackgroundColor);
  int width=getMeasuredWidth();
  int height=getMeasuredHeight();
  int paddingTop=getPaddingTop();
  int paddingBottom=getPaddingBottom();
  int paddingLeft=getPaddingLeft();
  int paddingRight=getPaddingRight();
  int unitHeight=(height - paddingTop - paddingBottom) / 12;
  float pixDeg=(width - paddingLeft - paddingRight) / mRangeDegrees;
  int minDegrees=Math.round(mDegrees - mRangeDegrees / 2), maxDegrees=Math.round(mDegrees + mRangeDegrees / 2);
  for (int i=-180; i < 540; i+=15) {
    if ((i >= minDegrees) && (i <= maxDegrees)) {
      canvas.drawLine(paddingLeft + pixDeg * (i - minDegrees),height - paddingBottom,paddingLeft + pixDeg * (i - minDegrees),10 * unitHeight + paddingTop,mTerciaryLinePaint);
      if (i % 45 == 0) {
        canvas.drawLine(paddingLeft + pixDeg * (i - minDegrees),height - paddingBottom,paddingLeft + pixDeg * (i - minDegrees),8 * unitHeight + paddingTop,mSecondaryLinePaint);
      }
      if (i % 90 == 0) {
        canvas.drawLine(paddingLeft + pixDeg * (i - minDegrees),height - paddingBottom,paddingLeft + pixDeg * (i - minDegrees),6 * unitHeight + paddingTop,mMainLinePaint);
        String coord="String_Node_Str";
switch (i) {
case -90:
case 270:
          coord=getResources().getString(R.string.compass_west);
        break;
case 0:
case 360:
      coord=getResources().getString(R.string.compass_north);
    break;
case 90:
case 450:
  coord=getResources().getString(R.string.compass_east);
break;
case -180:
case 180:
coord=getResources().getString(R.string.compass_south);
break;
}
canvas.drawText(coord,paddingLeft + pixDeg * (i - minDegrees),5 * unitHeight + paddingTop,mTextPaint);
}
}
}
if (mShowMarker) {
pathMarker.moveTo(width / 2,3 * unitHeight + paddingTop);
pathMarker.lineTo((width / 2) + 20 + paddingLeft,paddingTop);
pathMarker.lineTo((width / 2) - 20 + paddingLeft,paddingTop);
pathMarker.close();
canvas.drawPath(pathMarker,mMarkerPaint);
}
}

Fixed version (ground truth):
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  mTextPaint.setColor(mTextColor);
  mTextPaint.setTextSize(mTextSize);
  mMainLinePaint.setColor(mLineColor);
  mSecondaryLinePaint.setColor(mLineColor);
  mTerciaryLinePaint.setColor(mLineColor);
  mMarkerPaint.setColor(mMarkerColor);
  canvas.drawColor(mBackgroundColor);
  int width=getMeasuredWidth();
  int height=getMeasuredHeight();
  int paddingTop=getPaddingTop();
  int paddingBottom=getPaddingBottom();
  int paddingLeft=getPaddingLeft();
  int paddingRight=getPaddingRight();
  int unitHeight=(height - paddingTop - paddingBottom) / 12;
  float pixDeg=(width - paddingLeft - paddingRight) / mRangeDegrees;
  int minDegrees=Math.round(mDegrees - mRangeDegrees / 2), maxDegrees=Math.round(mDegrees + mRangeDegrees / 2);
  for (int i=-180; i < 540; i+=15) {
    if ((i >= minDegrees) && (i <= maxDegrees)) {
      canvas.drawLine(paddingLeft + pixDeg * (i - minDegrees),height - paddingBottom,paddingLeft + pixDeg * (i - minDegrees),10 * unitHeight + paddingTop,mTerciaryLinePaint);
      if (i % 45 == 0) {
        canvas.drawLine(paddingLeft + pixDeg * (i - minDegrees),height - paddingBottom,paddingLeft + pixDeg * (i - minDegrees),8 * unitHeight + paddingTop,mSecondaryLinePaint);
      }
      if (i % 90 == 0) {
        canvas.drawLine(paddingLeft + pixDeg * (i - minDegrees),height - paddingBottom,paddingLeft + pixDeg * (i - minDegrees),6 * unitHeight + paddingTop,mMainLinePaint);
        String coord="String_Node_Str";
switch (i) {
case -90:
case 270:
          coord=getResources().getString(R.string.compass_west);
        break;
case 0:
case 360:
      coord=getResources().getString(R.string.compass_north);
    break;
case 90:
case 450:
  coord=getResources().getString(R.string.compass_east);
break;
case -180:
case 180:
coord=getResources().getString(R.string.compass_south);
break;
}
canvas.drawText(coord,paddingLeft + pixDeg * (i - minDegrees),5 * unitHeight + paddingTop,mTextPaint);
}
}
}
if (mShowMarker) {
pathMarker.moveTo(width / 2,3 * unitHeight + paddingTop);
pathMarker.lineTo((width / 2) + 20,paddingTop);
pathMarker.lineTo((width / 2) - 20,paddingTop);
pathMarker.close();
canvas.drawPath(pathMarker,mMarkerPaint);
}
}