Program: 73826
Project: 73826
Buggy source:
/** 
 * Draws the borders of a container.
 * @param borders the border info
 */
private void drawBorder(BorderInfo[] borders){
  ArrayList dbl=null;
  ArrayList solid=null;
  ArrayList dashed=null;
  ArrayList dotted=null;
  for (int i=0; i < borders.length; i++) {
    if (IStyle.DOUBLE_VALUE.equals(borders[i].borderStyle)) {
      if (null == dbl) {
        dbl=new ArrayList();
      }
      dbl.add(borders[i]);
    }
 else     if (IStyle.DASHED_VALUE.equals(borders[i].borderStyle)) {
      if (null == dashed) {
        dashed=new ArrayList();
      }
      dashed.add(borders[i]);
    }
 else     if (IStyle.DOTTED_VALUE.equals(borders[i].borderStyle)) {
      if (null == dotted) {
        dotted=new ArrayList();
      }
      dotted.add(borders[i]);
    }
 else {
      if (null == solid) {
        solid=new ArrayList();
      }
      solid.add(borders[i]);
    }
  }
  if (null != dotted) {
    for (Iterator it=dotted.iterator(); it.hasNext(); ) {
      BorderInfo bi=(BorderInfo)it.next();
      pageGraphic.drawLine(bi.startX,bi.startY,bi.endX,bi.endY,bi.borderWidth,bi.borderColor,"String_Node_Str");
    }
  }
  if (null != dashed) {
    for (Iterator it=dashed.iterator(); it.hasNext(); ) {
      BorderInfo bi=(BorderInfo)it.next();
      pageGraphic.drawLine(bi.startX,bi.startY,bi.endX,bi.endY,bi.borderWidth,bi.borderColor,"String_Node_Str");
    }
  }
  if (null != solid) {
    for (Iterator it=solid.iterator(); it.hasNext(); ) {
      BorderInfo bi=(BorderInfo)it.next();
      pageGraphic.drawLine(bi.startX,bi.startY,bi.endX,bi.endY,bi.borderWidth,bi.borderColor,"String_Node_Str");
    }
  }
  if (null != dbl) {
    for (Iterator it=dbl.iterator(); it.hasNext(); ) {
      BorderInfo bi=(BorderInfo)it.next();
      int borderWidth=bi.borderWidth;
      int outerBorderWidth=borderWidth / 4;
      int innerBorderWidth=borderWidth / 4;
      int startX=bi.startX;
      int startY=bi.startY;
      int endX=bi.endX;
      int endY=bi.endY;
      Color borderColor=bi.borderColor;
switch (bi.borderType) {
case BorderInfo.TOP_BORDER:
        pageGraphic.drawLine(startX - borderWidth / 2 + outerBorderWidth / 2,startY - borderWidth / 2 + outerBorderWidth / 2,endX + borderWidth / 2 - outerBorderWidth / 2,endY - borderWidth / 2 + outerBorderWidth / 2,outerBorderWidth,borderColor,"String_Node_Str");
      pageGraphic.drawLine(startX - borderWidth / 2 + outerBorderWidth / 2,startY + borderWidth / 2 - innerBorderWidth / 2,endX + borderWidth / 2 - outerBorderWidth / 2,endY + borderWidth / 2 - innerBorderWidth / 2,innerBorderWidth,borderColor,"String_Node_Str");
    break;
case BorderInfo.RIGHT_BORDER:
  pageGraphic.drawLine(startX + borderWidth / 2 - outerBorderWidth / 2,startY - borderWidth / 2 + outerBorderWidth / 2,endX + borderWidth / 2 - outerBorderWidth / 2,endY + borderWidth / 2 - outerBorderWidth / 2,outerBorderWidth,borderColor,"String_Node_Str");
pageGraphic.drawLine(startX - borderWidth / 2 + innerBorderWidth / 2,startY - borderWidth / 2 + outerBorderWidth / 2,endX - borderWidth / 2 + innerBorderWidth / 2,endY + borderWidth / 2 - outerBorderWidth / 2,innerBorderWidth,borderColor,"String_Node_Str");
break;
case BorderInfo.BOTTOM_BORDER:
pageGraphic.drawLine(startX - borderWidth / 2 + outerBorderWidth / 2,startY + borderWidth / 2 - outerBorderWidth / 2,endX + borderWidth / 2 - outerBorderWidth / 2,endY + borderWidth / 2 - outerBorderWidth / 2,outerBorderWidth,borderColor,"String_Node_Str");
pageGraphic.drawLine(startX - borderWidth / 2 + outerBorderWidth / 2,startY - borderWidth / 2 + innerBorderWidth / 2,endX + borderWidth / 2 - outerBorderWidth / 2,endY - borderWidth / 2 + innerBorderWidth / 2,innerBorderWidth,borderColor,"String_Node_Str");
break;
case BorderInfo.LEFT_BORDER:
pageGraphic.drawLine(startX - borderWidth / 2 + outerBorderWidth / 2,startY - borderWidth / 2 + outerBorderWidth / 2,endX - borderWidth / 2 + outerBorderWidth / 2,endY + borderWidth / 2 - outerBorderWidth / 2,outerBorderWidth,borderColor,"String_Node_Str");
pageGraphic.drawLine(startX + borderWidth / 2 - innerBorderWidth / 2,startY - borderWidth / 2 + outerBorderWidth / 2,endX + borderWidth / 2 - innerBorderWidth / 2,endY + borderWidth / 2 - outerBorderWidth / 2,innerBorderWidth,borderColor,"String_Node_Str");
break;
}
}
}
}

Fixed version (ground truth):
/** 
 * Draws the borders of a container.
 * @param borders the border info
 */
private void drawBorder(BorderInfo[] borders){
  ArrayList dbl=null;
  ArrayList solid=null;
  ArrayList dashed=null;
  ArrayList dotted=null;
  for (int i=0; i < borders.length; i++) {
    if (IStyle.DOUBLE_VALUE.equals(borders[i].borderStyle)) {
      if (null == dbl) {
        dbl=new ArrayList();
      }
      dbl.add(borders[i]);
    }
 else     if (IStyle.DASHED_VALUE.equals(borders[i].borderStyle)) {
      if (null == dashed) {
        dashed=new ArrayList();
      }
      dashed.add(borders[i]);
    }
 else     if (IStyle.DOTTED_VALUE.equals(borders[i].borderStyle)) {
      if (null == dotted) {
        dotted=new ArrayList();
      }
      dotted.add(borders[i]);
    }
 else {
      if (null == solid) {
        solid=new ArrayList();
      }
      solid.add(borders[i]);
    }
  }
  if (null != dotted) {
    for (Iterator it=dotted.iterator(); it.hasNext(); ) {
      BorderInfo bi=(BorderInfo)it.next();
      pageGraphic.drawLine(bi.startX,bi.startY,bi.endX,bi.endY,bi.borderWidth,bi.borderColor,"String_Node_Str");
    }
  }
  if (null != dashed) {
    for (Iterator it=dashed.iterator(); it.hasNext(); ) {
      BorderInfo bi=(BorderInfo)it.next();
      pageGraphic.drawLine(bi.startX,bi.startY,bi.endX,bi.endY,bi.borderWidth,bi.borderColor,"String_Node_Str");
    }
  }
  if (null != solid) {
    for (Iterator it=solid.iterator(); it.hasNext(); ) {
      BorderInfo bi=(BorderInfo)it.next();
      pageGraphic.drawLine(bi.startX,bi.startY,bi.endX,bi.endY,bi.borderWidth,bi.borderColor,"String_Node_Str");
    }
  }
  if (null != dbl) {
    for (Iterator it=dbl.iterator(); it.hasNext(); ) {
      BorderInfo bi=(BorderInfo)it.next();
      int borderWidth=bi.borderWidth;
      int outerBorderWidth=borderWidth / 4;
      int innerBorderWidth=borderWidth / 4;
      int startX=bi.startX;
      int startY=bi.startY;
      int endX=bi.endX;
      int endY=bi.endY;
      Color borderColor=bi.borderColor;
switch (bi.borderType) {
case BorderInfo.TOP_BORDER:
        pageGraphic.drawLine(startX - borders[BorderInfo.LEFT_BORDER].borderWidth / 2 + outerBorderWidth / 2,startY - borderWidth / 2 + outerBorderWidth / 2,endX + borders[BorderInfo.RIGHT_BORDER].borderWidth / 2 - outerBorderWidth / 2,endY - borderWidth / 2 + outerBorderWidth / 2,outerBorderWidth,borderColor,"String_Node_Str");
      pageGraphic.drawLine(startX - borders[BorderInfo.LEFT_BORDER].borderWidth / 2 + outerBorderWidth / 2,startY + borderWidth / 2 - innerBorderWidth / 2,endX + borders[BorderInfo.RIGHT_BORDER].borderWidth / 2 - outerBorderWidth / 2,endY + borderWidth / 2 - innerBorderWidth / 2,innerBorderWidth,borderColor,"String_Node_Str");
    break;
case BorderInfo.RIGHT_BORDER:
  pageGraphic.drawLine(startX + borderWidth / 2 - outerBorderWidth / 2,startY - borders[BorderInfo.TOP_BORDER].borderWidth / 2 + outerBorderWidth / 2,endX + borderWidth / 2 - outerBorderWidth / 2,endY + borders[BorderInfo.BOTTOM_BORDER].borderWidth / 2 - outerBorderWidth / 2,outerBorderWidth,borderColor,"String_Node_Str");
pageGraphic.drawLine(startX - borderWidth / 2 + innerBorderWidth / 2,startY - borders[BorderInfo.TOP_BORDER].borderWidth / 2 + outerBorderWidth / 2,endX - borderWidth / 2 + innerBorderWidth / 2,endY + borders[BorderInfo.BOTTOM_BORDER].borderWidth / 2 - outerBorderWidth / 2,innerBorderWidth,borderColor,"String_Node_Str");
break;
case BorderInfo.BOTTOM_BORDER:
pageGraphic.drawLine(startX - borders[BorderInfo.LEFT_BORDER].borderWidth / 2 + outerBorderWidth / 2,startY + borderWidth / 2 - outerBorderWidth / 2,endX + borders[BorderInfo.RIGHT_BORDER].borderWidth / 2 - outerBorderWidth / 2,endY + borderWidth / 2 - outerBorderWidth / 2,outerBorderWidth,borderColor,"String_Node_Str");
pageGraphic.drawLine(startX - borders[BorderInfo.LEFT_BORDER].borderWidth / 2 + outerBorderWidth / 2,startY - borderWidth / 2 + innerBorderWidth / 2,endX + borders[BorderInfo.RIGHT_BORDER].borderWidth / 2 - outerBorderWidth / 2,endY - borderWidth / 2 + innerBorderWidth / 2,innerBorderWidth,borderColor,"String_Node_Str");
break;
case BorderInfo.LEFT_BORDER:
pageGraphic.drawLine(startX - borderWidth / 2 + outerBorderWidth / 2,startY - borders[BorderInfo.TOP_BORDER].borderWidth / 2 + outerBorderWidth / 2,endX - borderWidth / 2 + outerBorderWidth / 2,endY + borders[BorderInfo.BOTTOM_BORDER].borderWidth / 2 - outerBorderWidth / 2,outerBorderWidth,borderColor,"String_Node_Str");
pageGraphic.drawLine(startX + borderWidth / 2 - innerBorderWidth / 2,startY - borders[BorderInfo.TOP_BORDER].borderWidth / 2 + outerBorderWidth / 2,endX + borderWidth / 2 - innerBorderWidth / 2,endY + borders[BorderInfo.BOTTOM_BORDER].borderWidth / 2 - outerBorderWidth / 2,innerBorderWidth,borderColor,"String_Node_Str");
break;
}
}
}
}