Program: 92621
Project: 92621
Buggy source:
private void initialise(AttributeSet attrs){
  if (this.isInEditMode())   return;
  LayoutInflater inflator=(LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View v=inflator.inflate(R.layout.badge,null,false);
  container=(LinearLayout)v.findViewById(R.id.container);
  view_icon=v.findViewById(R.id.view_icon);
  TypedArray a=getContext().obtainStyledAttributes(attrs,R.styleable.DroidiconBadge);
  try {
    icon_size=a.getDimension(R.styleable.DroidiconBadge_db_size,DEFAULT_ICON_SIZE);
  }
  finally {
    a.recycle();
  }
  bgColor=getColor();
  iconColor=R.color.white;
  icon=getIcon();
  icon_size=Utils.convertPixelsToDp((int)icon_size,context);
  icon_padding=a.getDimension(R.styleable.DroidiconBadge_db_icon_padding,(int)(icon_size * PADDING_PERCENTAGE));
  float scale=getResources().getDisplayMetrics().density;
  int padding=4;
  int paddingPX=(int)((padding * scale) + 0.5);
  int imageSizeWidthPX=(int)((icon_size * scale) + 0.5);
  int imageSizeHeightPX=(int)((icon_size * scale) + 0.5);
  container.setLayoutParams(new LinearLayout.LayoutParams(imageSizeWidthPX,imageSizeHeightPX));
  container.setBackgroundResource(R.drawable.badge);
  GradientDrawable bgShape=(GradientDrawable)container.getBackground();
  bgShape.setColor(getResources().getColor(bgColor));
  iconicFontDrawable=new IconicFontDrawable(this.context);
  iconicFontDrawable.setIcon(icon);
  iconicFontDrawable.setIconColor(getResources().getColor(iconColor));
  iconicFontDrawable.setIconPadding((int)icon_padding);
  if (SDK_INT < JELLY_BEAN) {
    view_icon.setBackgroundDrawable(iconicFontDrawable);
  }
 else {
    view_icon.setBackground(iconicFontDrawable);
  }
  this.addView(v);
}

Fixed version (ground truth):
private void initialise(AttributeSet attrs){
  if (this.isInEditMode())   return;
  LayoutInflater inflator=(LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View v=inflator.inflate(R.layout.badge,null,false);
  container=(LinearLayout)v.findViewById(R.id.container);
  view_icon=v.findViewById(R.id.view_icon);
  TypedArray a=getContext().obtainStyledAttributes(attrs,R.styleable.DroidiconBadge);
  try {
    icon_size=a.getDimension(R.styleable.DroidiconBadge_db_size,DEFAULT_ICON_SIZE);
    icon_size=Utils.convertPixelsToDp((int)icon_size,context);
    icon_padding=a.getDimension(R.styleable.DroidiconBadge_db_icon_padding,(int)(icon_size * PADDING_PERCENTAGE));
  }
  finally {
    a.recycle();
  }
  bgColor=getColor();
  iconColor=R.color.white;
  icon=getIcon();
  float scale=getResources().getDisplayMetrics().density;
  int padding=4;
  int paddingPX=(int)((padding * scale) + 0.5);
  int imageSizeWidthPX=(int)((icon_size * scale) + 0.5);
  int imageSizeHeightPX=(int)((icon_size * scale) + 0.5);
  container.setLayoutParams(new LinearLayout.LayoutParams(imageSizeWidthPX,imageSizeHeightPX));
  container.setBackgroundResource(R.drawable.badge);
  GradientDrawable bgShape=(GradientDrawable)container.getBackground();
  bgShape.setColor(getResources().getColor(bgColor));
  iconicFontDrawable=new IconicFontDrawable(this.context);
  iconicFontDrawable.setIcon(icon);
  iconicFontDrawable.setIconColor(getResources().getColor(iconColor));
  iconicFontDrawable.setIconPadding((int)icon_padding);
  if (SDK_INT < JELLY_BEAN) {
    view_icon.setBackgroundDrawable(iconicFontDrawable);
  }
 else {
    view_icon.setBackground(iconicFontDrawable);
  }
  this.addView(v);
}