Program: 143724
Project: 143724
Buggy source:
/** 
 * @param height
 * @param border
 * @param margin
 * @param fontSize
 * @param properties
 * @return
 */
public Insets getPaddingAndBorder(int height,Border border,Insets margin,int fontSize,Properties properties,boolean isButton,int valign){
  Insets insets=null;
  Insets borderMargin=margin;
  if (border != null) {
    if (border instanceof CompoundBorder) {
      Insets marginInside=((CompoundBorder)border).getInsideBorder().getBorderInsets(null);
      borderMargin=TemplateGenerator.sumInsets(borderMargin,marginInside);
      insets=((CompoundBorder)border).getOutsideBorder().getBorderInsets(null);
    }
 else {
      try {
        insets=border.getBorderInsets(null);
      }
 catch (      Exception ex) {
        insets=defaultBorder;
        Debug.error(ex);
      }
    }
  }
 else {
    insets=defaultBorder;
  }
  Insets padding=borderMargin;
  if (padding == null)   padding=defaultPadding;
  if (properties != null) {
    Insets borderAndPadding=TemplateGenerator.sumInsets(insets,padding);
    int innerHeight=height;
    if (borderAndPadding != null)     innerHeight-=borderAndPadding.top + borderAndPadding.bottom;
    int bottomPaddingExtra=0;
    if (isButton && valign != ISupportTextSetup.CENTER) {
      bottomPaddingExtra=innerHeight;
    }
    if (padding == null) {
      properties.put("String_Node_Str","String_Node_Str");
      properties.put("String_Node_Str","String_Node_Str");
      properties.put("String_Node_Str","String_Node_Str");
      properties.put("String_Node_Str",bottomPaddingExtra + "String_Node_Str");
    }
 else {
      properties.put("String_Node_Str",padding.top + "String_Node_Str");
      properties.put("String_Node_Str",padding.right + "String_Node_Str");
      properties.put("String_Node_Str",padding.left + "String_Node_Str");
      properties.put("String_Node_Str",(bottomPaddingExtra + padding.bottom) + "String_Node_Str");
    }
  }
  if (insets == null)   insets=padding;
 else {
    insets=TemplateGenerator.sumInsets(insets,padding);
  }
  return insets;
}

Fixed version (ground truth):
/** 
 * @param height
 * @param border
 * @param margin
 * @param fontSize
 * @param properties
 * @return
 */
public Insets getPaddingAndBorder(int height,Border border,Insets margin,int fontSize,Properties properties,boolean isButton,int valign){
  Insets insets=null;
  Insets borderMargin=margin;
  if (border != null) {
    if (border instanceof CompoundBorder) {
      Insets marginInside=((CompoundBorder)border).getInsideBorder().getBorderInsets(null);
      borderMargin=TemplateGenerator.sumInsets(borderMargin,marginInside);
      Border ob=((CompoundBorder)border).getOutsideBorder();
      if (ob instanceof ISupportCustomBorderInsets) {
        insets=((ISupportCustomBorderInsets)ob).getCustomBorderInsets();
      }
 else {
        insets=ob.getBorderInsets(null);
      }
    }
 else     if (border instanceof ISupportCustomBorderInsets) {
      insets=((ISupportCustomBorderInsets)border).getCustomBorderInsets();
    }
 else {
      try {
        insets=border.getBorderInsets(null);
      }
 catch (      Exception ex) {
        insets=defaultBorder;
        Debug.error(ex);
      }
    }
  }
 else {
    insets=defaultBorder;
  }
  Insets padding=borderMargin;
  if (padding == null)   padding=defaultPadding;
  if (properties != null) {
    Insets borderAndPadding=TemplateGenerator.sumInsets(insets,padding);
    int innerHeight=height;
    if (borderAndPadding != null)     innerHeight-=borderAndPadding.top + borderAndPadding.bottom;
    int bottomPaddingExtra=0;
    if (isButton && valign != ISupportTextSetup.CENTER) {
      bottomPaddingExtra=innerHeight;
    }
    if (padding == null) {
      properties.put("String_Node_Str","String_Node_Str");
      properties.put("String_Node_Str","String_Node_Str");
      properties.put("String_Node_Str","String_Node_Str");
      properties.put("String_Node_Str",bottomPaddingExtra + "String_Node_Str");
    }
 else {
      properties.put("String_Node_Str",padding.top + "String_Node_Str");
      properties.put("String_Node_Str",padding.right + "String_Node_Str");
      properties.put("String_Node_Str",padding.left + "String_Node_Str");
      properties.put("String_Node_Str",(bottomPaddingExtra + padding.bottom) + "String_Node_Str");
    }
  }
  if (insets == null)   insets=padding;
 else {
    insets=TemplateGenerator.sumInsets(insets,padding);
  }
  return insets;
}