Program: 69795
Project: 69795
Buggy source:
/** 
 * Layouts one row of components. This is done based on the layout's orientation, minor alignment and major alignment.
 * @param parent the parent figure
 * @since 2.0
 */
protected void layoutRow(IFigure parent){
  int majorAdjustment=0;
  int minorAdjustment=0;
  int correctMajorAlignment=majorAlignment;
  int correctMinorAlignment=minorAlignment;
  majorAdjustment=data.area.width - data.rowWidth + getMinorSpacing();
  if (majorAdjustment < 0) {
    if (parent instanceof ReportRootFigure || !parent.isMirrored()) {
      majorAdjustment=0;
    }
  }
 else {
switch (correctMajorAlignment) {
case ALIGN_LEFTTOP:
      majorAdjustment=0;
    break;
case ALIGN_CENTER:
  majorAdjustment/=2;
break;
case ALIGN_RIGHTBOTTOM:
break;
}
}
boolean needVerticalAlign=minorAlignment == ALIGN_CENTER || minorAlignment == ALIGN_RIGHTBOTTOM;
for (int j=data.rowPos; j < data.rowCount; j++) {
if (fill) {
data.bounds[j].height=data.rowHeight;
}
 else {
minorAdjustment=data.rowHeight - data.bounds[j].height;
switch (correctMinorAlignment) {
case ALIGN_LEFTTOP:
minorAdjustment=0;
break;
case ALIGN_CENTER:
minorAdjustment/=2;
break;
case ALIGN_RIGHTBOTTOM:
break;
}
if (minorAdjustment < 0) {
minorAdjustment=0;
}
data.bounds[j].y+=minorAdjustment;
}
data.bounds[j].x+=majorAdjustment;
Rectangle parentArea=parent.getClientArea().getCopy();
if (data.rowY < parentArea.y + parentArea.height && data.rowY + data.rowHeight > parentArea.y + parentArea.height) {
Rectangle rect=data.bounds[j].getCopy();
rect.translate(parentArea.x,parentArea.y);
int distanceHeight=rect.y + rect.height - parentArea.y - parentArea.height;
if (distanceHeight > 0) {
int topDistnceHeight=rect.y - data.rowY - parentArea.y;
if (topDistnceHeight > 0) {
if (distanceHeight > topDistnceHeight) {
data.bounds[j].y=data.bounds[j].y - topDistnceHeight;
}
 else {
if (correctMinorAlignment == ALIGN_CENTER) {
data.bounds[j].y=data.bounds[j].y - minorAdjustment + (topDistnceHeight - distanceHeight) / 2;
}
 else {
data.bounds[j].y=(data.bounds[j].y - minorAdjustment + topDistnceHeight - distanceHeight);
}
}
}
}
 else {
if (correctMinorAlignment == ALIGN_CENTER) {
data.bounds[j].y=data.bounds[j].y - minorAdjustment + (parentArea.height - data.rowY - data.bounds[j].height) / 2;
}
}
}
if (!needVerticalAlign) {
setBoundsOfChild(parent,data.row[j],data.bounds[j].getCopy().crop(data.margin[j]));
}
}
data.rowPos=data.rowCount;
data.rowY+=getMajorSpacing() + data.rowHeight;
postLayoutRow(data);
initRow();
}

Fixed version (ground truth):
/** 
 * Layouts one row of components. This is done based on the layout's orientation, minor alignment and major alignment.
 * @param parent the parent figure
 * @since 2.0
 */
protected void layoutRow(IFigure parent){
  int majorAdjustment=0;
  int minorAdjustment=0;
  int correctMajorAlignment=majorAlignment;
  majorAdjustment=data.area.width - data.rowWidth + getMinorSpacing();
  if (majorAdjustment < 0) {
    if (parent instanceof ReportRootFigure || !parent.isMirrored()) {
      majorAdjustment=0;
    }
  }
 else {
switch (correctMajorAlignment) {
case ALIGN_LEFTTOP:
      majorAdjustment=0;
    break;
case ALIGN_CENTER:
  majorAdjustment/=2;
break;
case ALIGN_RIGHTBOTTOM:
break;
}
}
boolean needVerticalAlign=minorAlignment == ALIGN_CENTER || minorAlignment == ALIGN_RIGHTBOTTOM;
for (int j=data.rowPos; j < data.rowCount; j++) {
int correctMinorAlignment=getChildVerticalAlign(data.row[j]);
if (fill) {
data.bounds[j].height=data.rowHeight;
}
 else {
minorAdjustment=data.rowHeight - data.bounds[j].height;
switch (correctMinorAlignment) {
case ALIGN_LEFTTOP:
minorAdjustment=0;
break;
case ALIGN_CENTER:
minorAdjustment/=2;
break;
case ALIGN_RIGHTBOTTOM:
break;
}
if (minorAdjustment < 0) {
minorAdjustment=0;
}
data.bounds[j].y+=minorAdjustment;
}
data.bounds[j].x+=majorAdjustment;
Rectangle parentArea=parent.getClientArea().getCopy();
if (data.rowY < parentArea.y + parentArea.height && data.rowY + data.rowHeight > parentArea.y + parentArea.height) {
Rectangle rect=data.bounds[j].getCopy();
rect.translate(parentArea.x,parentArea.y);
int distanceHeight=rect.y + rect.height - parentArea.y - parentArea.height;
if (distanceHeight > 0) {
int topDistnceHeight=rect.y - data.rowY - parentArea.y;
if (topDistnceHeight > 0) {
if (distanceHeight > topDistnceHeight) {
data.bounds[j].y=data.bounds[j].y - topDistnceHeight;
}
 else {
if (correctMinorAlignment == ALIGN_CENTER) {
data.bounds[j].y=data.bounds[j].y - minorAdjustment + (topDistnceHeight - distanceHeight) / 2;
}
 else {
data.bounds[j].y=(data.bounds[j].y - minorAdjustment + topDistnceHeight - distanceHeight);
}
}
}
}
 else {
if (correctMinorAlignment == ALIGN_CENTER) {
data.bounds[j].y=data.bounds[j].y - minorAdjustment + (parentArea.height - data.rowY - data.bounds[j].height) / 2;
}
}
}
if (!needVerticalAlign) {
setBoundsOfChild(parent,data.row[j],data.bounds[j].getCopy().crop(data.margin[j]));
}
}
data.rowPos=data.rowCount;
data.rowY+=getMajorSpacing() + data.rowHeight;
postLayoutRow(data);
initRow();
}