Program: 78448
Project: 78448
Buggy source:
/** 
 * @see org.eclipse.draw2d.LayoutManager#layout(IFigure)
 */
public void layout(IFigure parent){
  data=new WorkingData();
  Rectangle relativeArea=parent.getClientArea();
  data.area=relativeArea;
  Iterator iterator=parent.getChildren().iterator();
  int dx;
  int wHint=parent.getClientArea().width;
  int hHint=-1;
  initVariables(parent);
  initRow();
  int i=0;
  int display=ReportItemConstraint.NONE;
  int lastDisplay=ReportItemConstraint.NONE;
  while (iterator.hasNext()) {
    IFigure f=(IFigure)iterator.next();
    Insets fmargin=getFigureMargin(f);
    if (getDisplay(f) == ReportItemConstraint.BLOCK) {
      wHint=parent.getClientArea().width;
    }
 else {
      wHint=-1;
    }
    if (wHint != -1) {
      wHint=Math.max(0,wHint - fmargin.getWidth());
    }
    Dimension pref=getChildSize(f,wHint,hHint);
    if (f instanceof LabelFigure && (pref.width + fmargin.getWidth()) > parent.getClientArea().width) {
      pref=getChildSize(f,Math.max(0,parent.getClientArea().width - fmargin.getWidth()),hHint);
    }
    Rectangle r=new Rectangle(0,0,pref.width + fmargin.getWidth(),pref.height + fmargin.getHeight());
    display=getDisplay(f);
    if (data.rowCount > data.rowPos) {
      if ((data.rowWidth + r.width > data.maxWidth) || display == ReportItemConstraint.BLOCK || lastDisplay == ReportItemConstraint.BLOCK)       layoutRow(parent);
    }
    lastDisplay=display;
    r.x=data.rowX;
    r.y=data.rowY;
    dx=r.width + getMinorSpacing();
    data.rowX+=dx;
    data.rowWidth+=dx;
    data.rowHeight=Math.max(data.rowHeight,r.height);
    data.row[data.rowCount]=f;
    data.margin[data.rowCount]=fmargin;
    data.bounds[data.rowCount]=r;
    data.rowCount++;
    i++;
  }
  if (data.rowCount > data.rowPos) {
    layoutRow(parent);
  }
  layoutVertical(parent);
  data=null;
}

Fixed version (ground truth):
/** 
 * @see org.eclipse.draw2d.LayoutManager#layout(IFigure)
 */
public void layout(IFigure parent){
  data=new WorkingData();
  Rectangle relativeArea=parent.getClientArea();
  data.area=relativeArea;
  Iterator iterator=parent.getChildren().iterator();
  int dx;
  int wHint=parent.getClientArea().width;
  int hHint=-1;
  initVariables(parent);
  initRow();
  int i=0;
  int display=ReportItemConstraint.NONE;
  int lastDisplay=ReportItemConstraint.NONE;
  while (iterator.hasNext()) {
    IFigure f=(IFigure)iterator.next();
    Insets fmargin=getFigureMargin(f);
    if (getDisplay(f) == ReportItemConstraint.BLOCK || f instanceof ImageFigure) {
      wHint=parent.getClientArea().width;
    }
 else {
      wHint=-1;
    }
    if (wHint != -1) {
      wHint=Math.max(0,wHint - fmargin.getWidth());
    }
    Dimension pref=getChildSize(f,wHint,hHint);
    if (f instanceof LabelFigure && (pref.width + fmargin.getWidth()) > parent.getClientArea().width) {
      pref=getChildSize(f,Math.max(0,parent.getClientArea().width - fmargin.getWidth()),hHint);
    }
    Rectangle r=new Rectangle(0,0,pref.width + fmargin.getWidth(),pref.height + fmargin.getHeight());
    display=getDisplay(f);
    if (data.rowCount > data.rowPos) {
      if ((data.rowWidth + r.width > data.maxWidth) || display == ReportItemConstraint.BLOCK || lastDisplay == ReportItemConstraint.BLOCK)       layoutRow(parent);
    }
    lastDisplay=display;
    r.x=data.rowX;
    r.y=data.rowY;
    dx=r.width + getMinorSpacing();
    data.rowX+=dx;
    data.rowWidth+=dx;
    data.rowHeight=Math.max(data.rowHeight,r.height);
    data.row[data.rowCount]=f;
    data.margin[data.rowCount]=fmargin;
    data.bounds[data.rowCount]=r;
    data.rowCount++;
    i++;
  }
  if (data.rowCount > data.rowPos) {
    layoutRow(parent);
  }
  layoutVertical(parent);
  data=null;
}