Program: 121733
Project: 121733
Buggy source:
@Override public void layout(IFigure container){
  Rectangle clientArea=container.getClientArea();
  IFigure tableContainer=getTableContainer(container);
  int containerWidth=tableContainer.getBounds().width;
  initColumnPercentage(clientArea.width,containerWidth);
  int columnNum=columns.size();
  int toltalWidth=0;
  Dimension prefSizes[]=new Dimension[columnNum];
  int titleHeight=0;
  for (int i=0; i < columnNum; i++) {
    TableColumn column=columns.get(i);
    prefSizes[i]=column.getPreferredSize();
    titleHeight=Math.max(titleHeight,prefSizes[i].height);
  }
  int X=clientArea.x;
  int Y=clientArea.y;
  int previousSashOccupied=0;
  for (int i=0; i < columns.size(); i++) {
    TableColumn currentColumn=columns.get(i);
    ColumnSash sash=null;
    if (i < columns.size() - 1) {
      sash=separators.get(i);
    }
    Double percent=keyAndPercentage.get(currentColumn.getColumnKey());
    int width=(int)Math.round(clientArea.width * percent);
    if (sash != null) {
      int halfSashWidth=sash.getSashWidth() / 2;
      toltalWidth+=width;
      Rectangle newBounds=new Rectangle(X,Y,width - halfSashWidth - previousSashOccupied,titleHeight);
      currentColumn.setBounds(newBounds);
      keyAndLength.put(currentColumn.getColumnKey(),width);
      X+=newBounds.width;
      newBounds=new Rectangle(X,Y,sash.getSashWidth(),titleHeight);
      sash.setBounds(newBounds);
      X+=newBounds.width;
      previousSashOccupied=halfSashWidth;
    }
 else {
      Rectangle newBounds=new Rectangle(X,Y,width - previousSashOccupied,titleHeight);
      currentColumn.setBounds(newBounds);
      keyAndLength.put(currentColumn.getColumnKey(),width);
      toltalWidth+=width;
    }
  }
  if (toltalWidth != 0) {
    int diff=clientArea.width - toltalWidth;
    if (diff < 0) {
      diff=0;
    }
    int avg=diff / columnNum;
    int remainder=diff % columnNum;
    if (avg != 0) {
      for (int i=0; i < columnNum; i++) {
        TableColumn tableColumn=columns.get(i);
        Rectangle copy=tableColumn.getBounds().getCopy();
        if (i > 0) {
          copy.x+=avg * i;
        }
        copy.width+=avg;
        tableColumn.setBounds(copy);
        keyAndLength.put(tableColumn.getColumnKey(),keyAndLength.get(tableColumn.getColumnKey()) + avg);
        if (i < separators.size()) {
          ColumnSash separator=separators.get(i);
          copy=separator.getBounds().getCopy();
          copy.x+=avg * (i + 1);
          separator.setBounds(copy);
        }
      }
    }
    if (remainder != 0) {
      TableColumn lastChild=columns.get(columns.size() - 1);
      final Rectangle bounds=lastChild.getBounds();
      bounds.width=bounds.width + remainder;
      lastChild.setBounds(bounds);
      keyAndLength.put(lastChild.getColumnKey(),keyAndLength.get(lastChild.getColumnKey()) + remainder);
    }
  }
  Dimension itemContainerSize=tableItemContainer.getPreferredSize();
  Rectangle newBounds=new Rectangle(clientArea.x,clientArea.y + titleHeight,clientArea.width,itemContainerSize.height);
  tableItemContainer.setBounds(newBounds);
}

Fixed version (ground truth):
@Override public void layout(IFigure container){
  Rectangle clientArea=container.getClientArea();
  IFigure tableContainer=getTableContainer(container);
  int containerWidth=tableContainer.getBounds().width;
  int clientWidth=clientArea.width;
  if (ajustToDefaultWidth) {
    clientWidth=containerWidth;
  }
  initColumnPercentage(clientWidth,containerWidth);
  int columnNum=columns.size();
  int toltalWidth=0;
  Dimension prefSizes[]=new Dimension[columnNum];
  int titleHeight=0;
  for (int i=0; i < columnNum; i++) {
    TableColumn column=columns.get(i);
    prefSizes[i]=column.getPreferredSize();
    titleHeight=Math.max(titleHeight,prefSizes[i].height);
  }
  int X=clientArea.x;
  int Y=clientArea.y;
  int previousSashOccupied=0;
  for (int i=0; i < columns.size(); i++) {
    TableColumn currentColumn=columns.get(i);
    ColumnSash sash=null;
    if (i < columns.size() - 1) {
      sash=separators.get(i);
    }
    Double percent=keyAndPercentage.get(currentColumn.getColumnKey());
    int width=(int)Math.round(clientWidth * percent);
    if (sash != null) {
      int halfSashWidth=sash.getSashWidth() / 2;
      toltalWidth+=width;
      Rectangle newBounds=new Rectangle(X,Y,width - halfSashWidth - previousSashOccupied,titleHeight);
      currentColumn.setBounds(newBounds);
      keyAndLength.put(currentColumn.getColumnKey(),width);
      X+=newBounds.width;
      newBounds=new Rectangle(X,Y,sash.getSashWidth(),titleHeight);
      sash.setBounds(newBounds);
      X+=newBounds.width;
      previousSashOccupied=halfSashWidth;
    }
 else {
      Rectangle newBounds=new Rectangle(X,Y,width - previousSashOccupied,titleHeight);
      currentColumn.setBounds(newBounds);
      keyAndLength.put(currentColumn.getColumnKey(),width);
      toltalWidth+=width;
    }
  }
  if (toltalWidth != 0) {
    int diff=clientWidth - toltalWidth;
    if (diff < 0) {
      diff=0;
    }
    int avg=diff / columnNum;
    int remainder=diff % columnNum;
    if (avg != 0) {
      for (int i=0; i < columnNum; i++) {
        TableColumn tableColumn=columns.get(i);
        Rectangle copy=tableColumn.getBounds().getCopy();
        if (i > 0) {
          copy.x+=avg * i;
        }
        copy.width+=avg;
        tableColumn.setBounds(copy);
        keyAndLength.put(tableColumn.getColumnKey(),keyAndLength.get(tableColumn.getColumnKey()) + avg);
        if (i < separators.size()) {
          ColumnSash separator=separators.get(i);
          copy=separator.getBounds().getCopy();
          copy.x+=avg * (i + 1);
          separator.setBounds(copy);
        }
      }
    }
    if (remainder != 0) {
      TableColumn lastChild=columns.get(columns.size() - 1);
      final Rectangle bounds=lastChild.getBounds();
      bounds.width=bounds.width + remainder;
      lastChild.setBounds(bounds);
      keyAndLength.put(lastChild.getColumnKey(),keyAndLength.get(lastChild.getColumnKey()) + remainder);
    }
  }
  Dimension itemContainerSize=tableItemContainer.getPreferredSize();
  Rectangle newBounds=new Rectangle(clientArea.x,clientArea.y + titleHeight,clientWidth,itemContainerSize.height);
  tableItemContainer.setBounds(newBounds);
}