Program: 70137
Project: 70137
Buggy source:
/** 
 * Creates a new LabelFigure with a MarginBorder that is the given size and a FlowPage containing a TextFlow with the style WORD_WRAP_HARD.
 * @param borderSize the size of the MarginBorder
 */
public LabelFigure(int borderSize){
  setBorder(new MarginBorder(borderSize));
  label=new TextFlow(){
    public void postValidate(){
      if (DesignChoiceConstants.DISPLAY_BLOCK.equals(display) || DesignChoiceConstants.DISPLAY_INLINE.equals(display)) {
        List list=getFragments();
        FlowBox box;
        int left=Integer.MAX_VALUE, top=left;
        int bottom=Integer.MIN_VALUE;
        for (int i=0; i < list.size(); i++) {
          box=(FlowBox)list.get(i);
          left=Math.min(left,box.getX());
          top=Math.min(top,box.getBaseline() - box.getAscent());
          bottom=Math.max(bottom,box.getBaseline() + box.getDescent());
        }
        setBounds(new Rectangle(left,top,LabelFigure.this.getClientArea().width,Math.max(LabelFigure.this.getClientArea().height,bottom - top)));
        list=getChildren();
        for (int i=0; i < list.size(); i++) {
          ((FlowFigure)list.get(i)).postValidate();
        }
      }
 else {
        super.postValidate();
      }
    }
  }
;
  label.setLayoutManager(new ParagraphTextLayout(label,ParagraphTextLayout.WORD_WRAP_SOFT));
  flowPage=new FlowPage();
  flowPage.add(label);
  setLayoutManager(new StackLayout());
  add(flowPage);
}

Fixed version (ground truth):
/** 
 * Creates a new LabelFigure with a MarginBorder that is the given size and a FlowPage containing a TextFlow with the style WORD_WRAP_HARD.
 * @param borderSize the size of the MarginBorder
 */
public LabelFigure(int borderSize){
  setBorder(new MarginBorder(borderSize));
  label=new TextFlow(){
    public void postValidate(){
      if (DesignChoiceConstants.DISPLAY_BLOCK.equals(display) || DesignChoiceConstants.DISPLAY_INLINE.equals(display)) {
        List list=getFragments();
        FlowBox box;
        int left=Integer.MAX_VALUE, top=left;
        int bottom=Integer.MIN_VALUE;
        for (int i=0; i < list.size(); i++) {
          box=(FlowBox)list.get(i);
          left=Math.min(left,box.getX());
          top=Math.min(top,box.getBaseline() - box.getAscent());
          bottom=Math.max(bottom,box.getBaseline() + box.getDescent());
        }
        int width=LabelFigure.this.getClientArea().width;
        if (isFixLayout) {
          int maxWidth=calcMaxSegment() - getInsets().getWidth();
          width=Math.max(width,maxWidth);
        }
        setBounds(new Rectangle(left,top,width,Math.max(LabelFigure.this.getClientArea().height,bottom - top)));
        if (isFixLayout()) {
          Figure child=(Figure)getParent();
          Rectangle rect=child.getBounds();
          child.setBounds(new Rectangle(rect.x,rect.y,width,rect.height));
        }
        list=getChildren();
        for (int i=0; i < list.size(); i++) {
          ((FlowFigure)list.get(i)).postValidate();
        }
      }
 else {
        super.postValidate();
      }
    }
  }
;
  label.setLayoutManager(new ParagraphTextLayout(label,ParagraphTextLayout.WORD_WRAP_SOFT));
  flowPage=new FlowPage();
  flowPage.add(label);
  setLayoutManager(new StackLayout());
  add(flowPage);
}