Program: 76794
Project: 76794
Buggy source:
/** 
 * Draws a container's border, and its background color/image if there is any.
 * @param container			the containerArea whose border and background need to be drawed
 */
protected void drawContainer(IContainerArea container){
  IStyle style=container.getStyle();
  if (null == style) {
    return;
  }
  ContainerPosition curPos;
  if (!containerStack.isEmpty())   curPos=(ContainerPosition)containerStack.peek();
 else   curPos=new ContainerPosition(0,0);
  if (container.getContent() != null) {
    int layoutX=curPos.x + container.getX();
    int layoutY=curPos.y + container.getY();
    float startX=layoutPointX2PDF(layoutX);
    float startY=layoutPointY2PDF(layoutY);
    float width=pdfMeasure(container.getWidth());
    float height=pdfMeasure(container.getHeight());
    Color bc=PropertyUtil.getColor(style.getProperty(StyleConstants.STYLE_BACKGROUND_COLOR));
    drawBackgroundColor(bc,startX,startY,width,height);
    drawBackgroundImage(style,startX,startY,width,height);
    int borderTopWidth=PropertyUtil.getDimensionValue(style.getProperty(StyleConstants.STYLE_BORDER_TOP_WIDTH));
    if (borderTopWidth > 0) {
      Color borderTopColor=PropertyUtil.getColor(style.getProperty(StyleConstants.STYLE_BORDER_TOP_COLOR));
      drawBorder(new BorderInfo(layoutX,layoutY + borderTopWidth / 2,layoutX + container.getWidth(),layoutY + borderTopWidth / 2,borderTopWidth,borderTopColor,style.getProperty(IStyle.STYLE_BORDER_TOP_STYLE),BorderInfo.TOP_BORDER));
    }
    int borderLeftWidth=PropertyUtil.getDimensionValue(style.getProperty(StyleConstants.STYLE_BORDER_LEFT_WIDTH));
    if (borderLeftWidth > 0) {
      Color borderLeftColor=PropertyUtil.getColor(style.getProperty(StyleConstants.STYLE_BORDER_LEFT_COLOR));
      drawBorder(new BorderInfo(layoutX + borderLeftWidth / 2,layoutY,layoutX + borderLeftWidth / 2,layoutY + container.getHeight(),borderLeftWidth,borderLeftColor,style.getProperty(IStyle.STYLE_BORDER_LEFT_STYLE),BorderInfo.LEFT_BORDER));
    }
    int borderBottomWidth=PropertyUtil.getDimensionValue(style.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_WIDTH));
    if (borderBottomWidth > 0) {
      Color borderBottomColor=PropertyUtil.getColor(style.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_COLOR));
      drawBorder(new BorderInfo(layoutX,layoutY + container.getHeight() - borderBottomWidth / 2,layoutX + container.getWidth(),layoutY + container.getHeight() - borderBottomWidth / 2,borderBottomWidth,borderBottomColor,style.getProperty(IStyle.STYLE_BORDER_BOTTOM_STYLE),BorderInfo.BOTTOM_BORDER));
    }
    int borderRightWidth=PropertyUtil.getDimensionValue(style.getProperty(StyleConstants.STYLE_BORDER_RIGHT_WIDTH));
    if (borderRightWidth > 0) {
      Color borderRightColor=PropertyUtil.getColor(style.getProperty(StyleConstants.STYLE_BORDER_RIGHT_COLOR));
      drawBorder(new BorderInfo(layoutX + container.getWidth() - borderRightWidth / 2,layoutY,layoutX + container.getWidth() - borderRightWidth / 2,layoutY + container.getHeight(),borderRightWidth,borderRightColor,style.getProperty(IStyle.STYLE_BORDER_RIGHT_STYLE),BorderInfo.RIGHT_BORDER));
    }
    makeBookmark(container,curPos);
    handleHyperlinkAction(container,curPos);
  }
}

Fixed version (ground truth):
/** 
 * Draws a container's border, and its background color/image if there is any.
 * @param container			the containerArea whose border and background need to be drawed
 */
protected void drawContainer(IContainerArea container){
  IStyle style=container.getStyle();
  if (null == style) {
    return;
  }
  ContainerPosition curPos;
  if (!containerStack.isEmpty())   curPos=(ContainerPosition)containerStack.peek();
 else   curPos=new ContainerPosition(0,0);
  if (container.getContent() != null) {
    int layoutX=curPos.x + container.getX();
    int layoutY=curPos.y + container.getY();
    float startX=layoutPointX2PDF(layoutX);
    float startY=layoutPointY2PDF(layoutY);
    float width=pdfMeasure(container.getWidth());
    float height=pdfMeasure(container.getHeight());
    Color bc=PropertyUtil.getColor(style.getProperty(StyleConstants.STYLE_BACKGROUND_COLOR));
    drawBackgroundColor(bc,startX,startY,width,height);
    drawBackgroundImage(style,startX,startY,width,height);
    int borderTopWidth=PropertyUtil.getDimensionValue(style.getProperty(StyleConstants.STYLE_BORDER_TOP_WIDTH));
    int borderLeftWidth=PropertyUtil.getDimensionValue(style.getProperty(StyleConstants.STYLE_BORDER_LEFT_WIDTH));
    int borderBottomWidth=PropertyUtil.getDimensionValue(style.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_WIDTH));
    int borderRightWidth=PropertyUtil.getDimensionValue(style.getProperty(StyleConstants.STYLE_BORDER_RIGHT_WIDTH));
    if (borderTopWidth > 0 || borderLeftWidth > 0 || borderBottomWidth > 0 || borderRightWidth > 0) {
      Color borderTopColor=PropertyUtil.getColor(style.getProperty(StyleConstants.STYLE_BORDER_TOP_COLOR));
      Color borderRightColor=PropertyUtil.getColor(style.getProperty(StyleConstants.STYLE_BORDER_RIGHT_COLOR));
      Color borderBottomColor=PropertyUtil.getColor(style.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_COLOR));
      Color borderLeftColor=PropertyUtil.getColor(style.getProperty(StyleConstants.STYLE_BORDER_LEFT_COLOR));
      BorderInfo[] borders=new BorderInfo[4];
      borders[BorderInfo.TOP_BORDER]=new BorderInfo(layoutX,layoutY + borderTopWidth / 2,layoutX + container.getWidth(),layoutY + borderTopWidth / 2,borderTopWidth,borderTopColor,style.getProperty(StyleConstants.STYLE_BORDER_TOP_STYLE),BorderInfo.TOP_BORDER);
      borders[BorderInfo.RIGHT_BORDER]=new BorderInfo(layoutX + container.getWidth() - borderRightWidth / 2,layoutY,layoutX + container.getWidth() - borderRightWidth / 2,layoutY + container.getHeight(),borderRightWidth,borderRightColor,style.getProperty(StyleConstants.STYLE_BORDER_RIGHT_STYLE),BorderInfo.RIGHT_BORDER);
      borders[BorderInfo.BOTTOM_BORDER]=new BorderInfo(layoutX,layoutY + container.getHeight() - borderBottomWidth / 2,layoutX + container.getWidth(),layoutY + container.getHeight() - borderBottomWidth / 2,borderBottomWidth,borderBottomColor,style.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_STYLE),BorderInfo.BOTTOM_BORDER);
      borders[BorderInfo.LEFT_BORDER]=new BorderInfo(layoutX + borderLeftWidth / 2,layoutY,layoutX + borderLeftWidth / 2,layoutY + container.getHeight(),borderLeftWidth,borderLeftColor,style.getProperty(StyleConstants.STYLE_BORDER_LEFT_STYLE),BorderInfo.LEFT_BORDER);
      drawBorder(borders);
    }
    makeBookmark(container,curPos);
    handleHyperlinkAction(container,curPos);
  }
}