Program: 177877
Project: 177877
Buggy source:
public void init(){
  int padding=deviceUtils.getDIP(8);
  int radius=deviceUtils.getDIP(4);
  int textPadding=deviceUtils.getDIP(4);
  int bottom=colors.getColor(bottomColor);
  int top=colors.getColor(topColor);
  int strokeTop=colors.getColor(strokeTopColor);
  int strokeBottom=colors.getColor(strokeBottomColor);
  int bgColor=Color.BLACK;
  if (!StringUtils.isEmpty(backgroundColor)) {
    bgColor=colors.getColor(backgroundColor);
  }
  GradientDrawable base=makeGradient(bgColor,bgColor);
  base.setCornerRadius(radius + deviceUtils.getDIP(2));
  GradientDrawable stroke=makeGradient(strokeBottom,strokeTop);
  stroke.setCornerRadius(radius + deviceUtils.getDIP(1));
  GradientDrawable background=makeGradient(bottom,top);
  background.setCornerRadius(radius);
  LayerDrawable layers=new LayerDrawable(new Drawable[]{base,stroke,background});
  layers.setLayerInset(1,1,1,1,1);
  layers.setLayerInset(2,2,2,2,2);
  int pWidth=LinearLayout.LayoutParams.WRAP_CONTENT;
  int pHeight=LinearLayout.LayoutParams.WRAP_CONTENT;
  if (width == null) {
    pWidth=LinearLayout.LayoutParams.FILL_PARENT;
  }
 else   if (width > 0) {
    pWidth=deviceUtils.getDIP(width);
  }
  if (height == null) {
    pHeight=LinearLayout.LayoutParams.FILL_PARENT;
  }
 else   if (height > 0) {
    pHeight=deviceUtils.getDIP(height);
  }
  LayoutParams fill=makeLayoutParams(pWidth,pHeight);
  fill.setMargins(padding,padding,padding,padding);
  setOrientation(LinearLayout.HORIZONTAL);
  setLayoutParams(fill);
  setBackgroundDrawable(layers);
  setPadding(padding,padding,padding,padding);
  setClickable(true);
  TEXT_ALIGN align=TEXT_ALIGN.LEFT;
  if (!StringUtils.isEmpty(textAlign)) {
    textAlign=textAlign.trim().toUpperCase();
    try {
      align=TEXT_ALIGN.valueOf(textAlign);
    }
 catch (    Exception ignore) {
      ignore.printStackTrace();
    }
  }
switch (align) {
case LEFT:
    setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
  break;
case CENTER:
setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER);
break;
case RIGHT:
setGravity(Gravity.CENTER_VERTICAL | Gravity.RIGHT);
break;
}
LayoutParams imageLayout=makeLayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
LayoutParams textLayout=makeLayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
textView=makeTextView();
textView.setTextColor(Color.WHITE);
if (bold) {
if (italic) {
textView.setTypeface(Typeface.DEFAULT_BOLD,Typeface.BOLD_ITALIC);
}
 else {
textView.setTypeface(Typeface.DEFAULT_BOLD);
}
}
 else if (italic) {
textView.setTypeface(Typeface.DEFAULT,Typeface.ITALIC);
}
setTextSize(textSize);
textView.setText(text);
textView.setLayoutParams(textLayout);
if (!StringUtils.isEmpty(imageName)) {
imageView=makeImageView();
imageView.setImageDrawable(drawables.getDrawable(imageName));
imageView.setLayoutParams(imageLayout);
addView(imageView);
textView.setPadding(textPadding,0,0,0);
}
 else {
textView.setPadding(0,0,0,0);
}
addView(textView);
}

Fixed version (ground truth):
public void init(){
  int dipPadding=deviceUtils.getDIP(padding);
  int radius=deviceUtils.getDIP(4);
  int textPadding=deviceUtils.getDIP(4);
  int bottom=colors.getColor(bottomColor);
  int top=colors.getColor(topColor);
  int strokeTop=colors.getColor(strokeTopColor);
  int strokeBottom=colors.getColor(strokeBottomColor);
  int bgColor=Color.BLACK;
  if (!StringUtils.isEmpty(backgroundColor)) {
    bgColor=colors.getColor(backgroundColor);
  }
  GradientDrawable base=makeGradient(bgColor,bgColor);
  base.setCornerRadius(radius + deviceUtils.getDIP(2));
  GradientDrawable stroke=makeGradient(strokeBottom,strokeTop);
  stroke.setCornerRadius(radius + deviceUtils.getDIP(1));
  GradientDrawable background=makeGradient(bottom,top);
  background.setCornerRadius(radius);
  LayerDrawable layers=new LayerDrawable(new Drawable[]{base,stroke,background});
  layers.setLayerInset(1,1,1,1,1);
  layers.setLayerInset(2,2,2,2,2);
  int pWidth=LinearLayout.LayoutParams.WRAP_CONTENT;
  int pHeight=LinearLayout.LayoutParams.WRAP_CONTENT;
  if (width == null) {
    pWidth=LinearLayout.LayoutParams.FILL_PARENT;
  }
 else   if (width > 0) {
    pWidth=deviceUtils.getDIP(width);
  }
  if (height == null) {
    pHeight=LinearLayout.LayoutParams.FILL_PARENT;
  }
 else   if (height > 0) {
    pHeight=deviceUtils.getDIP(height);
  }
  LayoutParams fill=makeLayoutParams(pWidth,pHeight);
  fill.setMargins(dipPadding,dipPadding,dipPadding,dipPadding);
  setOrientation(LinearLayout.HORIZONTAL);
  setLayoutParams(fill);
  setBackgroundDrawable(layers);
  setPadding(dipPadding,dipPadding,dipPadding,dipPadding);
  setClickable(true);
  TEXT_ALIGN align=TEXT_ALIGN.LEFT;
  if (!StringUtils.isEmpty(textAlign)) {
    textAlign=textAlign.trim().toUpperCase();
    try {
      align=TEXT_ALIGN.valueOf(textAlign);
    }
 catch (    Exception ignore) {
      ignore.printStackTrace();
    }
  }
switch (align) {
case LEFT:
    setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
  break;
case CENTER:
setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER);
break;
case RIGHT:
setGravity(Gravity.CENTER_VERTICAL | Gravity.RIGHT);
break;
}
LayoutParams imageLayout=makeLayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
LayoutParams textLayout=makeLayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
textView=makeTextView();
textView.setTextColor(Color.WHITE);
if (bold) {
if (italic) {
textView.setTypeface(Typeface.DEFAULT_BOLD,Typeface.BOLD_ITALIC);
}
 else {
textView.setTypeface(Typeface.DEFAULT_BOLD);
}
}
 else if (italic) {
textView.setTypeface(Typeface.DEFAULT,Typeface.ITALIC);
}
setTextSize(textSize);
textView.setText(text);
textView.setLayoutParams(textLayout);
if (!StringUtils.isEmpty(imageName)) {
imageView=makeImageView();
imageView.setImageDrawable(drawables.getDrawable(imageName));
imageView.setLayoutParams(imageLayout);
addView(imageView);
textView.setPadding(textPadding,0,0,0);
}
 else {
textView.setPadding(0,0,0,0);
}
addView(textView);
}