Program: 143726
Project: 143726
Buggy source:
public Border getBorder(AttributeSet a){
  Border b=null;
  Object borderStyle=null;
  Object borderColor=null;
  float top=getLength(null);
  float right=getLength(null);
  float bottom=getLength(null);
  float left=getLength(null);
  Object unexpandedBorder=a.getAttribute(CSS.Attribute.BORDER);
  if (unexpandedBorder != null) {
    StringTokenizer st=new StringTokenizer(unexpandedBorder.toString());
    while (st.hasMoreTokens()) {
      String tok=st.nextToken();
      if (tok.matches("String_Node_Str")) {
        top=right=bottom=left=getLength(tok);
      }
 else       if (Arrays.asList(BORDER_STYLES).contains(tok)) {
        borderStyle=tok;
      }
 else       if (tok.equals(BORDER_COLOR_TRANSPARENT)) {
        borderColor=BORDER_COLOR_TRANSPARENT;
      }
 else {
        Color c=PersistHelper.createColor(tok);
        if (c != null)         borderColor=tok;
      }
    }
  }
  if (a.isDefined(CSS.Attribute.BORDER_STYLE))   borderStyle=a.getAttribute(CSS.Attribute.BORDER_STYLE);
  if (a.isDefined(CSS.Attribute.BORDER_COLOR))   borderColor=a.getAttribute(CSS.Attribute.BORDER_COLOR);
  if (a.isDefined(CSS.Attribute.BORDER_TOP_WIDTH))   top=getLength(a.getAttribute(CSS.Attribute.BORDER_TOP_WIDTH));
  if (a.isDefined(CSS.Attribute.BORDER_RIGHT_WIDTH))   right=getLength(a.getAttribute(CSS.Attribute.BORDER_RIGHT_WIDTH));
  if (a.isDefined(CSS.Attribute.BORDER_BOTTOM_WIDTH))   bottom=getLength(a.getAttribute(CSS.Attribute.BORDER_BOTTOM_WIDTH));
  if (a.isDefined(CSS.Attribute.BORDER_LEFT_WIDTH))   left=getLength(a.getAttribute(CSS.Attribute.BORDER_LEFT_WIDTH));
  if (borderStyle != null) {
    Color[] colors=getBorderColor(borderColor);
    String bstyle=borderStyle.toString();
    if (bstyle.equals(BORDER_STYLE_INSET) || bstyle.equals(BORDER_STYLE_OUTSET)) {
      int style=BevelBorder.LOWERED;
      if (bstyle.equals(BORDER_STYLE_OUTSET))       style=BevelBorder.RAISED;
      if (colors != null && colors.length > 0) {
        if (colors.length == 1) {
          b=BorderFactory.createBevelBorder(style,colors[0].brighter().brighter(),colors[0].darker().darker());
        }
        if (colors.length == 2) {
          b=BorderFactory.createBevelBorder(style,colors[0],colors[1]);
        }
 else         if (colors.length > 3) {
          b=BorderFactory.createBevelBorder(style,colors[0],colors[1],colors[2],colors[3]);
        }
      }
 else {
        b=BorderFactory.createBevelBorder(style);
      }
    }
 else     if (bstyle.equals(BORDER_STYLE_NONE)) {
      b=BorderFactory.createEmptyBorder();
    }
 else     if (bstyle.equals(BORDER_STYLE_GROOVE)) {
      b=BorderFactory.createEtchedBorder();
    }
 else     if (bstyle.equals(BORDER_STYLE_SOLID) || bstyle.equals(BORDER_STYLE_DOTTED) || bstyle.equals(BORDER_STYLE_DASHED)) {
      colors=expandColors(colors);
      if (bstyle.equals(BORDER_STYLE_SOLID)) {
        if (borderColor != null && BORDER_COLOR_TRANSPARENT.equals(borderColor.toString())) {
          top=makeSizeSave(top);
          right=makeSizeSave(right);
          bottom=makeSizeSave(bottom);
          left=makeSizeSave(left);
          b=BorderFactory.createEmptyBorder((int)top,(int)left,(int)bottom,(int)right);
        }
 else         if (colors != null) {
          if (top == -1f && right == -1f && bottom == -1f && left == -1f) {
            b=BorderFactory.createLineBorder(colors[0]);
          }
 else           if (top == 0f && right == 0f && bottom == 0f && left == 0f) {
            b=BorderFactory.createEmptyBorder();
          }
 else {
            top=makeSizeSave(top);
            right=makeSizeSave(right);
            bottom=makeSizeSave(bottom);
            left=makeSizeSave(left);
            b=new SpecialMatteBorder(top,left,bottom,right,colors[0],colors[3],colors[2],colors[1]);
          }
        }
      }
 else       if (bstyle.equals(BORDER_STYLE_DASHED)) {
        if (top <= 0 && left <= 0 && bottom <= 0 && right <= 0) {
          top=left=bottom=right=1;
        }
        b=new SpecialMatteBorder(top,left,bottom,right,colors[0],colors[3],colors[2],colors[1]);
        ((SpecialMatteBorder)b).setDashPattern(new float[]{3,3});
      }
 else       if (bstyle.equals(BORDER_STYLE_DOTTED)) {
        if (top <= 0 && left <= 0 && bottom <= 0 && right <= 0) {
          top=left=bottom=right=1;
        }
        b=new SpecialMatteBorder(top,left,bottom,right,colors[0],colors[3],colors[2],colors[1]);
        ((SpecialMatteBorder)b).setDashPattern(new float[]{1,1});
      }
    }
  }
  return b;
}

Fixed version (ground truth):
public Border getBorder(AttributeSet a){
  Border b=null;
  Object borderStyle=null;
  Object borderColor=null;
  float top=getLength(null);
  float right=getLength(null);
  float bottom=getLength(null);
  float left=getLength(null);
  Object unexpandedBorder=a.getAttribute(CSS.Attribute.BORDER);
  if (unexpandedBorder != null) {
    StringTokenizer st=new StringTokenizer(unexpandedBorder.toString());
    while (st.hasMoreTokens()) {
      String tok=st.nextToken();
      if (tok.matches("String_Node_Str")) {
        top=right=bottom=left=getLength(tok);
      }
 else       if (Arrays.asList(BORDER_STYLES).contains(tok)) {
        borderStyle=tok;
      }
 else       if (tok.equals(BORDER_COLOR_TRANSPARENT)) {
        borderColor=BORDER_COLOR_TRANSPARENT;
      }
 else {
        Color c=PersistHelper.createColor(tok);
        if (c != null)         borderColor=tok;
      }
    }
  }
  if (a.isDefined(CSS.Attribute.BORDER_STYLE))   borderStyle=a.getAttribute(CSS.Attribute.BORDER_STYLE);
  if (a.isDefined(CSS.Attribute.BORDER_COLOR))   borderColor=a.getAttribute(CSS.Attribute.BORDER_COLOR);
  if (a.isDefined(CSS.Attribute.BORDER_TOP_WIDTH))   top=getLength(a.getAttribute(CSS.Attribute.BORDER_TOP_WIDTH));
  if (a.isDefined(CSS.Attribute.BORDER_RIGHT_WIDTH))   right=getLength(a.getAttribute(CSS.Attribute.BORDER_RIGHT_WIDTH));
  if (a.isDefined(CSS.Attribute.BORDER_BOTTOM_WIDTH))   bottom=getLength(a.getAttribute(CSS.Attribute.BORDER_BOTTOM_WIDTH));
  if (a.isDefined(CSS.Attribute.BORDER_LEFT_WIDTH))   left=getLength(a.getAttribute(CSS.Attribute.BORDER_LEFT_WIDTH));
  if (borderStyle != null) {
    Color[] colors=getBorderColor(borderColor);
    String bstyle=borderStyle.toString();
    if (bstyle.equals(BORDER_STYLE_INSET) || bstyle.equals(BORDER_STYLE_OUTSET)) {
      int style=BevelBorder.LOWERED;
      if (bstyle.equals(BORDER_STYLE_OUTSET))       style=BevelBorder.RAISED;
      top=makeSizeSave(top);
      right=makeSizeSave(right);
      bottom=makeSizeSave(bottom);
      left=makeSizeSave(left);
      Insets customBorderInsets=new Insets((int)top,(int)left,(int)bottom,(int)right);
      if (colors != null && colors.length > 0) {
        if (colors.length == 1) {
          b=new CustomBevelBorder(style,colors[0].brighter().brighter(),colors[0].darker().darker(),customBorderInsets);
        }
        if (colors.length == 2) {
          b=new CustomBevelBorder(style,colors[0],colors[1],customBorderInsets);
        }
 else         if (colors.length > 3) {
          b=new CustomBevelBorder(style,colors[0],colors[1],colors[2],colors[3],customBorderInsets);
        }
      }
 else {
        b=new CustomBevelBorder(style,customBorderInsets);
      }
    }
 else     if (bstyle.equals(BORDER_STYLE_NONE)) {
      b=BorderFactory.createEmptyBorder();
    }
 else     if (bstyle.equals(BORDER_STYLE_DOUBLE)) {
      top=makeSizeSave(top);
      right=makeSizeSave(right);
      bottom=makeSizeSave(bottom);
      left=makeSizeSave(left);
      b=BorderFactory.createEmptyBorder((int)top,(int)left,(int)bottom,(int)right);
    }
 else     if (bstyle.equals(BORDER_STYLE_GROOVE) || bstyle.equals(BORDER_STYLE_RIDGE)) {
      int style=EtchedBorder.LOWERED;
      if (bstyle.equals(BORDER_STYLE_RIDGE))       style=EtchedBorder.RAISED;
      top=makeSizeSave(top);
      right=makeSizeSave(right);
      bottom=makeSizeSave(bottom);
      left=makeSizeSave(left);
      Insets customBorderInsets=new Insets((int)top,(int)left,(int)bottom,(int)right);
      if (colors != null && colors.length > 0) {
        if (colors.length == 1) {
          b=new CustomEtchedBorder(style,colors[0].brighter().brighter(),colors[0].darker().darker(),customBorderInsets);
        }
        if (colors.length == 2) {
          b=new CustomEtchedBorder(style,colors[0],colors[1],customBorderInsets);
        }
      }
 else {
        b=new CustomEtchedBorder(style,customBorderInsets);
      }
    }
 else     if (bstyle.equals(BORDER_STYLE_SOLID) || bstyle.equals(BORDER_STYLE_DOTTED) || bstyle.equals(BORDER_STYLE_DASHED)) {
      colors=expandColors(colors);
      if (bstyle.equals(BORDER_STYLE_SOLID)) {
        if (borderColor != null && BORDER_COLOR_TRANSPARENT.equals(borderColor.toString())) {
          top=makeSizeSave(top);
          right=makeSizeSave(right);
          bottom=makeSizeSave(bottom);
          left=makeSizeSave(left);
          b=BorderFactory.createEmptyBorder((int)top,(int)left,(int)bottom,(int)right);
        }
 else         if (colors != null) {
          if (top == -1f && right == -1f && bottom == -1f && left == -1f) {
            b=BorderFactory.createLineBorder(colors[0]);
          }
 else           if (top == 0f && right == 0f && bottom == 0f && left == 0f) {
            b=BorderFactory.createEmptyBorder();
          }
 else {
            top=makeSizeSave(top);
            right=makeSizeSave(right);
            bottom=makeSizeSave(bottom);
            left=makeSizeSave(left);
            b=new SpecialMatteBorder(top,left,bottom,right,colors[0],colors[3],colors[2],colors[1]);
          }
        }
      }
 else       if (bstyle.equals(BORDER_STYLE_DASHED)) {
        if (top <= 0 && left <= 0 && bottom <= 0 && right <= 0) {
          top=left=bottom=right=1;
        }
        b=new SpecialMatteBorder(top,left,bottom,right,colors[0],colors[3],colors[2],colors[1]);
        ((SpecialMatteBorder)b).setDashPattern(new float[]{3,3});
      }
 else       if (bstyle.equals(BORDER_STYLE_DOTTED)) {
        if (top <= 0 && left <= 0 && bottom <= 0 && right <= 0) {
          top=left=bottom=right=1;
        }
        b=new SpecialMatteBorder(top,left,bottom,right,colors[0],colors[3],colors[2],colors[1]);
        ((SpecialMatteBorder)b).setDashPattern(new float[]{1,1});
      }
    }
  }
  return b;
}