Program: 143627
Project: 143627
Buggy source:
protected static BorderAndPadding applyBaseComponentProperties(BaseComponent component,Form form,TextualStyle styleObj,Insets defaultPadding,Insets defaultBorder,IServiceProvider sp){
  Pair<IStyleSheet,IStyleRule> styleInfo=ComponentFactory.getStyleForBasicComponent(sp,component,form);
  Insets insetsBorder=null;
  Border designBorder=null;
  if (component.getBorderType() != null) {
    insetsBorder=ComponentFactoryHelper.createBorderCSSProperties(component.getBorderType(),styleObj);
    designBorder=ComponentFactoryHelper.createBorder(component.getBorderType());
  }
  Insets insetsMargin=null;
  if (component instanceof ISupportTextSetup) {
    insetsMargin=((ISupportTextSetup)component).getMargin();
  }
  if (styleInfo != null) {
    IStyleSheet ss=styleInfo.getLeft();
    IStyleRule s=styleInfo.getRight();
    if (ss != null && s != null) {
      List<String> attributeNames=s.getAttributeNames();
      for (      String s_attr : attributeNames) {
        if (s_attr.toLowerCase().contains("String_Node_Str"))         continue;
        if (s_attr.toLowerCase().contains("String_Node_Str") && component.getBorderType() != null)         continue;
        String val=s.getValue(s_attr);
        if (s_attr.equals("String_Node_Str")) {
          String tmp=val;
          if (tmp.endsWith("String_Node_Str")) {
            int size=Utils.getAsInteger(tmp.substring(0,tmp.length() - 2));
            if (size == 9) {
              size=11;
            }
 else {
              size=(int)(size * (4 / (double)3));
            }
            styleObj.setProperty(s_attr,size + "String_Node_Str");
          }
 else {
            int size=0;
            if (tmp.endsWith("String_Node_Str")) {
              size=Utils.getAsInteger(tmp.substring(0,tmp.length() - 2));
            }
 else {
              size=Utils.getAsInteger(tmp);
            }
            if (size == 9) {
              size=7;
            }
 else {
              size=(int)(size * (3 / (double)4));
            }
            styleObj.setProperty(s_attr,size + "String_Node_Str");
          }
        }
 else {
          if (val.toString() != null)           styleObj.setProperty(s_attr,s.getValues(s_attr),false);
        }
      }
      if (component.getBorderType() == null) {
        if (ss.hasBorder(s)) {
          Border b=ss.getBorder(s);
          if (b != null) {
            try {
              insetsBorder=b.getBorderInsets(null);
            }
 catch (            Exception e) {
              Debug.error("String_Node_Str" + b + "String_Node_Str",e);
            }
            TextualStyle borderStyle=new TextualStyle();
            ComponentFactoryHelper.createBorderCSSProperties(ComponentFactoryHelper.createBorderString(b),borderStyle);
            Enumeration<Object> cssAttributes=borderStyle.keys();
            while (cssAttributes.hasMoreElements()) {
              String att=(String)cssAttributes.nextElement();
              styleObj.setProperty(att,borderStyle.getProperty(att),false);
            }
          }
        }
      }
      if (insetsMargin == null) {
        if (ss.hasMargin(s)) {
          insetsMargin=ss.getMargin(s);
        }
      }
    }
  }
  if (component.getFontType() != null) {
    Pair<String,String>[] props=PersistHelper.createFontCSSProperties(component.getFontType());
    if (props != null) {
      for (      Pair<String,String> element : props) {
        if (element == null)         continue;
        styleObj.setProperty(element.getLeft(),element.getRight());
      }
    }
  }
  if (component.getForeground() != null) {
    styleObj.setProperty("String_Node_Str",PersistHelper.createColorString(component.getForeground()));
  }
  if (component.getTransparent()) {
    styleObj.setProperty("String_Node_Str",IStyleSheet.COLOR_TRANSPARENT);
  }
 else   if (component.getBackground() != null) {
    styleObj.setProperty("String_Node_Str",PersistHelper.createColorString(component.getBackground()));
  }
  if (insetsBorder == null)   insetsBorder=defaultBorder;
  if (insetsMargin == null && defaultPadding != null)   insetsMargin=defaultPadding;
  BorderAndPadding bp=new BorderAndPadding(insetsBorder,insetsMargin);
  styleObj.setProperty("String_Node_Str",(designBorder instanceof EmptyBorder) ? createInsetsText(bp.getSum()) : createInsetsText(bp.getPadding()));
  return bp;
}

Fixed version (ground truth):
protected static BorderAndPadding applyBaseComponentProperties(BaseComponent component,Form form,TextualStyle styleObj,Insets defaultPadding,Insets defaultBorder,IServiceProvider sp){
  Pair<IStyleSheet,IStyleRule> styleInfo=ComponentFactory.getStyleForBasicComponent(sp,component,form);
  Insets insetsBorder=null;
  Border designBorder=null;
  if (component.getBorderType() != null) {
    insetsBorder=ComponentFactoryHelper.createBorderCSSProperties(component.getBorderType(),styleObj);
    designBorder=ComponentFactoryHelper.createBorder(component.getBorderType());
  }
  Insets insetsMargin=null;
  if (component instanceof ISupportTextSetup) {
    insetsMargin=((ISupportTextSetup)component).getMargin();
  }
  if (styleInfo != null) {
    IStyleSheet ss=styleInfo.getLeft();
    IStyleRule s=styleInfo.getRight();
    if (ss != null && s != null) {
      List<String> attributeNames=s.getAttributeNames();
      for (      String s_attr : attributeNames) {
        if (s_attr.toLowerCase().contains("String_Node_Str"))         continue;
        if (s_attr.toLowerCase().contains("String_Node_Str") && component.getBorderType() != null)         continue;
        String val=s.getValue(s_attr);
        if (s_attr.equals("String_Node_Str")) {
          String tmp=val;
          if (tmp.endsWith("String_Node_Str")) {
            int size=Utils.getAsInteger(tmp.substring(0,tmp.length() - 2));
            if (size == 9) {
              size=11;
            }
 else {
              size=(int)(size * (4 / (double)3));
            }
            styleObj.setProperty(s_attr,size + "String_Node_Str");
          }
 else {
            int size=0;
            if (tmp.endsWith("String_Node_Str")) {
              size=Utils.getAsInteger(tmp.substring(0,tmp.length() - 2));
            }
 else {
              size=Utils.getAsInteger(tmp);
            }
            if (size == 9) {
              size=7;
            }
 else {
              size=(int)(size * (3 / (double)4));
            }
            styleObj.setProperty(s_attr,size + "String_Node_Str");
          }
        }
 else {
          if (val.toString() != null)           styleObj.setProperty(s_attr,s.getValues(s_attr),false);
        }
      }
      if (component.getBorderType() == null) {
        if (ss.hasBorder(s)) {
          Border b=ss.getBorder(s);
          if (b != null) {
            try {
              insetsBorder=ComponentFactoryHelper.getBorderInsetsForNoComponent(b);
            }
 catch (            Exception e) {
              Debug.error("String_Node_Str" + b + "String_Node_Str",e);
            }
            TextualStyle borderStyle=new TextualStyle();
            ComponentFactoryHelper.createBorderCSSProperties(ComponentFactoryHelper.createBorderString(b),borderStyle);
            Enumeration<Object> cssAttributes=borderStyle.keys();
            while (cssAttributes.hasMoreElements()) {
              String att=(String)cssAttributes.nextElement();
              styleObj.setProperty(att,borderStyle.getProperty(att),false);
            }
          }
        }
      }
      if (insetsMargin == null) {
        if (ss.hasMargin(s)) {
          insetsMargin=ss.getMargin(s);
        }
      }
    }
  }
  if (component.getFontType() != null) {
    Pair<String,String>[] props=PersistHelper.createFontCSSProperties(component.getFontType());
    if (props != null) {
      for (      Pair<String,String> element : props) {
        if (element == null)         continue;
        styleObj.setProperty(element.getLeft(),element.getRight());
      }
    }
  }
  if (component.getForeground() != null) {
    styleObj.setProperty("String_Node_Str",PersistHelper.createColorString(component.getForeground()));
  }
  if (component.getTransparent()) {
    styleObj.setProperty("String_Node_Str",IStyleSheet.COLOR_TRANSPARENT);
  }
 else   if (component.getBackground() != null) {
    styleObj.setProperty("String_Node_Str",PersistHelper.createColorString(component.getBackground()));
  }
  if (insetsBorder == null)   insetsBorder=defaultBorder;
  if (insetsMargin == null && defaultPadding != null)   insetsMargin=defaultPadding;
  BorderAndPadding bp=new BorderAndPadding(insetsBorder,insetsMargin);
  styleObj.setProperty("String_Node_Str",(designBorder instanceof EmptyBorder) ? createInsetsText(bp.getSum()) : createInsetsText(bp.getPadding()));
  return bp;
}