Program: 77298
Project: 77298
Buggy source:
public int[] resolve(int specifiedWidth,int maxWidth){
  assert(specifiedWidth <= maxWidth);
  int columnNumber=table.getColumnCount();
  int[] columns=new int[columnNumber];
  int columnWithWidth=0;
  int colSum=0;
  for (int j=0; j < table.getColumnCount(); j++) {
    IColumn column=(IColumn)table.getColumn(j);
    int columnWidth=getDimensionValue(column.getWidth(),tableWidth);
    if (columnWidth > 0) {
      columns[j]=columnWidth;
      colSum+=columnWidth;
      columnWithWidth++;
    }
 else {
      columns[j]=-1;
    }
  }
  if (columnWithWidth == columnNumber) {
    if (colSum <= maxWidth) {
      return columns;
    }
 else {
      int delta=(colSum - maxWidth) / columnNumber;
      assert(delta >= 0);
      for (int i=0; i < columnNumber; i++) {
        columns[i]-=delta;
      }
      return columns;
    }
  }
 else {
    if (specifiedWidth == 0) {
      if (colSum < maxWidth) {
        int colNumber=columnNumber - columnWithWidth;
        int aw=(maxWidth - colSum) / colNumber;
        distributeWidth(columns,colNumber,aw);
      }
 else {
        distributeWidth(columns,columnNumber,maxWidth / columnNumber);
      }
    }
 else {
      if (colSum < specifiedWidth) {
        int colNumber=columnNumber - columnWithWidth;
        int aw=(specifiedWidth - colSum) / colNumber;
        distributeWidth(columns,colNumber,aw);
      }
 else {
        if (colSum < maxWidth) {
          int colNumber=columnNumber - columnWithWidth;
          int aw=(maxWidth - colSum) / colNumber;
          distributeWidth(columns,colNumber,aw);
        }
 else {
          distributeWidth(columns,columnNumber,specifiedWidth / columnNumber);
        }
      }
    }
  }
  return columns;
}

Fixed version (ground truth):
public int[] resolve(int specifiedWidth,int maxWidth){
  assert(specifiedWidth <= maxWidth);
  int columnNumber=table.getColumnCount();
  int[] columns=new int[columnNumber];
  int columnWithWidth=0;
  int colSum=0;
  for (int j=0; j < table.getColumnCount(); j++) {
    IColumn column=(IColumn)table.getColumn(j);
    int columnWidth=getDimensionValue(column.getWidth(),tableWidth);
    if (columnWidth > 0) {
      columns[j]=columnWidth;
      colSum+=columnWidth;
      columnWithWidth++;
    }
 else {
      columns[j]=-1;
    }
  }
  if (columnWithWidth == columnNumber) {
    if (colSum <= maxWidth) {
      return columns;
    }
 else {
      float delta=colSum - maxWidth;
      for (int i=0; i < columnNumber; i++) {
        columns[i]-=(int)(delta * columns[i] / colSum);
      }
      return columns;
    }
  }
 else {
    if (specifiedWidth == 0) {
      if (colSum < maxWidth) {
        distributeLeftWidth(columns,(maxWidth - colSum) / (columnNumber - columnWithWidth));
      }
 else {
        redistributeWidth(columns,colSum - maxWidth + (columnNumber - columnWithWidth) * maxWidth / columnNumber,maxWidth,colSum);
      }
    }
 else {
      if (colSum < specifiedWidth) {
        distributeLeftWidth(columns,(specifiedWidth - colSum) / columnNumber - columnWithWidth);
      }
 else {
        if (colSum < maxWidth) {
          distributeLeftWidth(columns,(maxWidth - colSum) / (columnNumber - columnWithWidth));
        }
 else {
          redistributeWidth(columns,colSum - specifiedWidth + (columnNumber - columnWithWidth) * specifiedWidth / columnNumber,specifiedWidth,colSum);
        }
      }
    }
  }
  return columns;
}