Program: 51858
Project: 51858
Buggy source:
public void layout(){
  if (this instanceof XulContainer == false) {
    return;
  }
  setVisible(isVisible());
  if (this.container != null) {
    this.container.clear();
  }
  Object w=getManagedObject();
  double totalFlex=0.0;
  for (  XulComponent comp : this.getChildNodes()) {
    if (comp.getManagedObject() == null) {
      continue;
    }
    if (comp.getFlex() > 0 && comp.isVisible()) {
      flexLayout=true;
      totalFlex+=comp.getFlex();
    }
  }
  List<XulComponent> nodes=this.getChildNodes();
  XulContainer thisContainer=(XulContainer)this;
  Align alignment=(StringUtils.isEmpty(thisContainer.getAlign()) == false) ? Align.valueOf(thisContainer.getAlign().toUpperCase()) : null;
  if (!flexLayout && StringUtils.isEmpty(thisContainer.getAlign()) == false) {
    SimplePanel fillerPanel=new SimplePanel();
switch (alignment) {
case END:
      container.add(fillerPanel);
    if (this.getOrientation() == Orient.VERTICAL) {
      ((VerticalPanel)container).setCellHeight(fillerPanel,"String_Node_Str");
    }
 else {
      ((HorizontalPanel)container).setCellWidth(fillerPanel,"String_Node_Str");
    }
  break;
case CENTER:
container.add(fillerPanel);
if (this.getOrientation() == Orient.VERTICAL) {
((VerticalPanel)container).setCellHeight(fillerPanel,"String_Node_Str");
}
 else {
((HorizontalPanel)container).setCellWidth(fillerPanel,"String_Node_Str");
}
break;
}
}
for (int i=0; i < children.size(); i++) {
XulComponent comp=nodes.get(i);
Object wrappedWidget=comp.getManagedObject();
if (wrappedWidget == null || !(wrappedWidget instanceof Widget)) {
continue;
}
Widget component=(Widget)wrappedWidget;
component.getElement().setId(comp.getId());
if (component != null) {
container.add(component);
}
if (flexLayout && component != null) {
int componentFlex=comp.getFlex();
if (componentFlex > 0) {
String percentage=Math.round((componentFlex / totalFlex) * 100) + "String_Node_Str";
if (this.getOrientation() == Orient.VERTICAL) {
((VerticalPanel)container).setCellHeight(component,percentage);
((VerticalPanel)container).setCellWidth(component,"String_Node_Str");
if (comp.getFlex() > 0) {
component.getElement().getStyle().setProperty("String_Node_Str","String_Node_Str");
}
}
 else {
((HorizontalPanel)container).setCellWidth(component,percentage);
((HorizontalPanel)container).setCellHeight(component,"String_Node_Str");
if (comp.getFlex() > 0) {
component.setWidth("String_Node_Str");
}
}
}
}
Style style=component.getElement().getStyle();
if (this.getOrientation() == Orient.VERTICAL) {
if (comp.getWidth() > 0) {
style.setProperty("String_Node_Str",comp.getWidth() + "String_Node_Str");
}
 else {
style.setProperty("String_Node_Str","String_Node_Str");
}
if (comp.getHeight() > 0) {
style.setProperty("String_Node_Str",comp.getHeight() + "String_Node_Str");
}
 else {
style.setProperty("String_Node_Str","String_Node_Str");
}
}
 else {
if (comp.getHeight() > 0) {
style.setProperty("String_Node_Str",comp.getHeight() + "String_Node_Str");
}
 else {
style.setProperty("String_Node_Str","String_Node_Str");
}
if (comp.getWidth() > 0) {
style.setProperty("String_Node_Str",comp.getWidth() + "String_Node_Str");
}
 else {
style.setProperty("String_Node_Str","String_Node_Str");
}
}
if (i + 1 == children.size() && !flexLayout) {
}
}
if (!flexLayout && StringUtils.isEmpty(thisContainer.getAlign()) == false) {
SimplePanel fillerPanel=new SimplePanel();
switch (alignment) {
case START:
container.add(fillerPanel);
if (this.getOrientation() == Orient.VERTICAL) {
((VerticalPanel)container).setCellHeight(fillerPanel,"String_Node_Str");
}
 else {
((HorizontalPanel)container).setCellWidth(fillerPanel,"String_Node_Str");
}
break;
case CENTER:
container.add(fillerPanel);
if (this.getOrientation() == Orient.VERTICAL) {
((VerticalPanel)container).setCellHeight(fillerPanel,"String_Node_Str");
}
 else {
((HorizontalPanel)container).setCellWidth(fillerPanel,"String_Node_Str");
}
break;
case END:
break;
}
}
initialized=true;
}

Fixed version (ground truth):
public void layout(){
  if (this instanceof XulContainer == false) {
    return;
  }
  setVisible(isVisible());
  if (this.container != null) {
    this.container.clear();
  }
  Object w=getManagedObject();
  double totalFlex=0.0;
  for (  XulComponent comp : this.getChildNodes()) {
    if (comp.getManagedObject() == null) {
      continue;
    }
    if (comp.getFlex() > 0 && comp.isVisible()) {
      flexLayout=true;
      totalFlex+=comp.getFlex();
    }
  }
  List<XulComponent> nodes=this.getChildNodes();
  XulContainer thisContainer=(XulContainer)this;
  Align alignment=(StringUtils.isEmpty(thisContainer.getAlign()) == false) ? Align.valueOf(thisContainer.getAlign().toUpperCase()) : null;
  if (!flexLayout && StringUtils.isEmpty(thisContainer.getAlign()) == false) {
    SimplePanel fillerPanel=new SimplePanel();
switch (alignment) {
case END:
      container.add(fillerPanel);
    if (this.getOrientation() == Orient.VERTICAL) {
      ((VerticalPanel)container).setCellHeight(fillerPanel,"String_Node_Str");
    }
 else {
      ((HorizontalPanel)container).setCellWidth(fillerPanel,"String_Node_Str");
    }
  break;
case CENTER:
container.add(fillerPanel);
if (this.getOrientation() == Orient.VERTICAL) {
((VerticalPanel)container).setCellHeight(fillerPanel,"String_Node_Str");
}
 else {
((HorizontalPanel)container).setCellWidth(fillerPanel,"String_Node_Str");
}
break;
}
}
for (int i=0; i < children.size(); i++) {
XulComponent comp=nodes.get(i);
Object wrappedWidget=comp.getManagedObject();
if (wrappedWidget == null || !(wrappedWidget instanceof Widget)) {
continue;
}
Widget component=(Widget)wrappedWidget;
component.getElement().setId(comp.getId());
if (component != null) {
container.add(component);
}
if (flexLayout && component != null) {
int componentFlex=comp.getFlex();
if (componentFlex > 0) {
String percentage=Math.round((componentFlex / totalFlex) * 100) + "String_Node_Str";
if (this.getOrientation() == Orient.VERTICAL) {
((VerticalPanel)container).setCellHeight(component,percentage);
((VerticalPanel)container).setCellWidth(component,"String_Node_Str");
if (comp.getFlex() > 0) {
component.getElement().getStyle().setProperty("String_Node_Str","String_Node_Str");
}
}
 else {
((HorizontalPanel)container).setCellWidth(component,percentage);
((HorizontalPanel)container).setCellHeight(component,"String_Node_Str");
if (comp.getFlex() > 0) {
component.setWidth("String_Node_Str");
}
}
}
}
Style style=component.getElement().getStyle();
if (this.getOrientation() == Orient.VERTICAL) {
if (comp.getWidth() > 0) {
style.setProperty("String_Node_Str",comp.getWidth() + "String_Node_Str");
}
 else {
style.setProperty("String_Node_Str","String_Node_Str");
}
if (comp.getHeight() > 0) {
style.setProperty("String_Node_Str",comp.getHeight() + "String_Node_Str");
}
 else {
style.setProperty("String_Node_Str","String_Node_Str");
}
}
 else {
if (comp.getHeight() > 0) {
style.setProperty("String_Node_Str",comp.getHeight() + "String_Node_Str");
}
 else {
style.setProperty("String_Node_Str","String_Node_Str");
}
if (comp.getWidth() > 0) {
style.setProperty("String_Node_Str",comp.getWidth() + "String_Node_Str");
}
 else {
style.setProperty("String_Node_Str","String_Node_Str");
}
}
if (i + 1 == children.size() && !flexLayout) {
}
}
if (!flexLayout && container != null) {
SimplePanel fillerPanel=new SimplePanel();
if (alignment == null) {
alignment=Align.START;
}
switch (alignment) {
case START:
container.add(fillerPanel);
if (this.getOrientation() == Orient.VERTICAL) {
((VerticalPanel)container).setCellHeight(fillerPanel,"String_Node_Str");
}
 else {
((HorizontalPanel)container).setCellWidth(fillerPanel,"String_Node_Str");
}
break;
case CENTER:
container.add(fillerPanel);
if (this.getOrientation() == Orient.VERTICAL) {
((VerticalPanel)container).setCellHeight(fillerPanel,"String_Node_Str");
}
 else {
((HorizontalPanel)container).setCellWidth(fillerPanel,"String_Node_Str");
}
break;
case END:
break;
}
}
initialized=true;
}