Program: 143755
Project: 143755
Buggy source:
private Map placeElements(Iterator e1,IApplication app,Form form,IScriptExecuter listner,Map emptyDataRenderers,int XCorrection,int YCorrection,boolean printing,ControllerUndoManager undoManager,TabSequence<Component> tabSequence) throws Exception {
  final boolean useAJAX=Utils.getAsBoolean(app.getRuntimeProperties().get("String_Node_Str"));
  IDataProviderLookup dataProviderLookup=app.getFlattenedSolution().getDataproviderLookup(app.getFoundSetManager(),form);
  Map listTocomplete=new HashMap();
  Map labelForComponents=new HashMap();
  String orientation=OrientationApplier.getHTMLContainerOrientation(app.getLocale(),app.getSolution().getTextOrientation());
  boolean leftToRight=!"String_Node_Str".equalsIgnoreCase(orientation);
  boolean isAnchoringEnabled=Utils.getAsBoolean(app.getRuntimeProperties().get("String_Node_Str"));
  while (e1.hasNext()) {
    Point l=null;
    IPersist obj=(IPersist)e1.next();
    if (obj instanceof IFormElement) {
      l=((IFormElement)obj).getLocation();
      if (l == null)       continue;
      if (printing && obj instanceof ISupportPrinting) {
        if (!((ISupportPrinting)obj).getPrintable())         continue;
      }
      Iterator it=emptyDataRenderers.values().iterator();
      while (it.hasNext()) {
        WebDataRenderer panel=(WebDataRenderer)it.next();
        int start=panel.getLocation().y;
        if (l.y >= start && l.y < start + panel.getSize().height) {
          org.apache.wicket.Component comp=(org.apache.wicket.Component)ComponentFactory.createComponent(app,form,obj,dataProviderLookup,listner,printing);
          if (comp != null) {
            if (obj instanceof Field) {
              String name=((Field)obj).getName();
              if (name != null && !"String_Node_Str".equals(name)) {
                labelForComponents.put(name,comp);
              }
            }
 else             if (obj instanceof GraphicalComponent && (comp instanceof WebBaseLabel || comp instanceof WebBaseSubmitLink)) {
              String labelFor=((GraphicalComponent)obj).getLabelFor();
              if (labelFor != null && !"String_Node_Str".equals(labelFor)) {
                labelForComponents.put(comp,labelFor);
              }
            }
            if ((obj instanceof ISupportTabSeq) && (tabSequence != null)) {
              tabSequence.add(panel,(ISupportTabSeq)obj,comp);
            }
            org.apache.wicket.Component newComp=comp;
            if (newComp instanceof IDisplay) {
              panel.addDisplayComponent(obj,(IDisplay)newComp);
            }
 else             if (newComp instanceof WebImageBeanHolder) {
              WebImageBeanHolder wiBeanHolder=(WebImageBeanHolder)newComp;
              Object bean=wiBeanHolder.getDelegate();
              if (bean instanceof IServoyAwareBean) {
                IServoyAwareBean ourBean=(IServoyAwareBean)bean;
                panel.addDisplayComponent(obj,ourBean);
              }
            }
            ((IComponent)comp).setLocation(new Point((l.x) + XCorrection,(l.y - start) + YCorrection));
            if (form.getOnRecordEditStartMethodID() > 0 && comp instanceof IFieldComponent) {
              if (useAJAX && comp instanceof IDisplayData && ((IDisplayData)comp).getDataProviderID() != null && !((IDisplayData)comp).getDataProviderID().startsWith(ScriptVariable.GLOBAL_DOT_PREFIX)) {
                StartEditOnFocusGainedEventBehavior.addNewBehaviour(comp);
              }
            }
            if (isAnchoringEnabled && (((obj instanceof Field) && TemplateGenerator.needsWrapperDivForAnchoring((Field)obj)) || (obj instanceof Bean))) {
              MarkupContainer compWrapper=new WrapperContainer(ComponentFactory.getWebID(null,obj) + "String_Node_Str",comp);
              Dimension s=((IFormElement)obj).getSize();
              int anchors=0;
              if (obj instanceof ISupportAnchors)               anchors=((ISupportAnchors)obj).getAnchors();
              int offsetWidth=s.width;
              int offsetHeight=s.height;
              if (comp instanceof ISupportWebBounds) {
                Rectangle b=((ISupportWebBounds)comp).getWebBounds();
                offsetWidth=b.width;
                offsetHeight=b.height;
              }
              final String styleToReturn=computeWrapperDivStyle(l.y,l.x,offsetWidth,offsetHeight,s.width,s.height,anchors,start,start + panel.getSize().height,panel.getSize().width,leftToRight);
              compWrapper.add(new StyleAppendingModifier(new AbstractReadOnlyModel<String>(){
                @Override public String getObject(){
                  return styleToReturn;
                }
              }
));
              compWrapper.add(StyleAttributeModifierModel.INSTANCE);
              comp.add(new StyleAppendingModifier(new AbstractReadOnlyModel<String>(){
                @Override public String getObject(){
                  return "String_Node_Str";
                }
              }
));
              compWrapper.add(comp);
              panel.add(compWrapper);
            }
 else {
              panel.add(comp);
            }
          }
        }
      }
    }
  }
  Iterator it=labelForComponents.entrySet().iterator();
  while (it.hasNext()) {
    Map.Entry entry=(Entry)it.next();
    Object key=entry.getKey();
    if (key instanceof WebBaseLabel || key instanceof WebBaseSubmitLink) {
      IFieldComponent component=(IFieldComponent)labelForComponents.get(entry.getValue());
      if (component != null) {
        if (key instanceof WebBaseLabel) {
          ((WebBaseLabel)entry.getKey()).setLabelFor(component);
        }
 else {
          ((WebBaseSubmitLink)entry.getKey()).setLabelFor(component);
        }
        (component).addLabelFor((ILabel)entry.getKey());
        component.setComponentVisible(component.isVisible());
        component.setComponentEnabled(component.isEnabled());
      }
    }
  }
  it=emptyDataRenderers.values().iterator();
  while (it.hasNext()) {
    WebDataRenderer panel=(WebDataRenderer)it.next();
    panel.createDataAdapter(app,dataProviderLookup,listner,undoManager);
  }
  return listTocomplete;
}

Fixed version (ground truth):
private Map placeElements(Iterator e1,IApplication app,Form form,IScriptExecuter listner,Map emptyDataRenderers,int XCorrection,int YCorrection,boolean printing,ControllerUndoManager undoManager,TabSequence<Component> tabSequence) throws Exception {
  final boolean useAJAX=Utils.getAsBoolean(app.getRuntimeProperties().get("String_Node_Str"));
  IDataProviderLookup dataProviderLookup=app.getFlattenedSolution().getDataproviderLookup(app.getFoundSetManager(),form);
  Map listTocomplete=new HashMap();
  Map labelForComponents=new HashMap();
  String orientation=OrientationApplier.getHTMLContainerOrientation(app.getLocale(),app.getSolution().getTextOrientation());
  boolean leftToRight=!"String_Node_Str".equalsIgnoreCase(orientation);
  boolean isAnchoringEnabled=Utils.getAsBoolean(app.getRuntimeProperties().get("String_Node_Str"));
  while (e1.hasNext()) {
    Point l=null;
    IPersist obj=(IPersist)e1.next();
    if (obj instanceof IFormElement) {
      l=((IFormElement)obj).getLocation();
      if (l == null)       continue;
      if (printing && obj instanceof ISupportPrinting) {
        if (!((ISupportPrinting)obj).getPrintable())         continue;
      }
      Iterator it=emptyDataRenderers.values().iterator();
      while (it.hasNext()) {
        WebDataRenderer panel=(WebDataRenderer)it.next();
        int start=panel.getLocation().y;
        if (l.y >= start && l.y < start + panel.getSize().height) {
          org.apache.wicket.Component comp=(org.apache.wicket.Component)ComponentFactory.createComponent(app,form,obj,dataProviderLookup,listner,printing);
          if (comp != null) {
            if (comp.getId().equals("String_Node_Str")) {
              System.out.println();
            }
            if (obj instanceof Field) {
              String name=((Field)obj).getName();
              if (name != null && !"String_Node_Str".equals(name)) {
                labelForComponents.put(name,comp);
              }
            }
 else             if (obj instanceof GraphicalComponent && (comp instanceof WebBaseLabel || comp instanceof WebBaseSubmitLink)) {
              String labelFor=((GraphicalComponent)obj).getLabelFor();
              if (labelFor != null && !"String_Node_Str".equals(labelFor)) {
                labelForComponents.put(comp,labelFor);
              }
            }
            if ((obj instanceof ISupportTabSeq) && (tabSequence != null)) {
              tabSequence.add(panel,(ISupportTabSeq)obj,comp);
            }
            org.apache.wicket.Component newComp=comp;
            if (newComp instanceof IDisplay) {
              panel.addDisplayComponent(obj,(IDisplay)newComp);
            }
 else             if (newComp instanceof WebImageBeanHolder) {
              WebImageBeanHolder wiBeanHolder=(WebImageBeanHolder)newComp;
              Object bean=wiBeanHolder.getDelegate();
              if (bean instanceof IServoyAwareBean) {
                IServoyAwareBean ourBean=(IServoyAwareBean)bean;
                panel.addDisplayComponent(obj,ourBean);
              }
            }
            ((IComponent)comp).setLocation(new Point((l.x) + XCorrection,(l.y - start) + YCorrection));
            if (form.getOnRecordEditStartMethodID() > 0 && comp instanceof IFieldComponent) {
              if (useAJAX && comp instanceof IDisplayData && ((IDisplayData)comp).getDataProviderID() != null && !((IDisplayData)comp).getDataProviderID().startsWith(ScriptVariable.GLOBAL_DOT_PREFIX)) {
                StartEditOnFocusGainedEventBehavior.addNewBehaviour(comp);
              }
            }
            if (isAnchoringEnabled && (((obj instanceof Field) && TemplateGenerator.needsWrapperDivForAnchoring((Field)obj)) || (obj instanceof Bean))) {
              MarkupContainer compWrapper=new WrapperContainer(ComponentFactory.getWebID(null,obj) + "String_Node_Str",comp);
              Dimension s=((IFormElement)obj).getSize();
              int anchors=0;
              if (obj instanceof ISupportAnchors)               anchors=((ISupportAnchors)obj).getAnchors();
              int offsetWidth=s.width;
              int offsetHeight=s.height;
              if (comp instanceof ISupportWebBounds) {
                Rectangle b=((ISupportWebBounds)comp).getWebBounds();
                offsetWidth=b.width;
                offsetHeight=b.height;
              }
              final String styleToReturn=computeWrapperDivStyle(l.y,l.x,offsetWidth,offsetHeight,s.width,s.height,anchors,start,start + panel.getSize().height,panel.getSize().width,leftToRight);
              compWrapper.add(new StyleAppendingModifier(new AbstractReadOnlyModel<String>(){
                @Override public String getObject(){
                  return styleToReturn;
                }
              }
));
              compWrapper.add(StyleAttributeModifierModel.INSTANCE);
              comp.add(new StyleAppendingModifier(new AbstractReadOnlyModel<String>(){
                @Override public String getObject(){
                  return "String_Node_Str";
                }
              }
));
              compWrapper.add(comp);
              panel.add(compWrapper);
            }
 else {
              panel.add(comp);
            }
          }
        }
      }
    }
  }
  Iterator it=labelForComponents.entrySet().iterator();
  while (it.hasNext()) {
    Map.Entry entry=(Entry)it.next();
    Object key=entry.getKey();
    if (key instanceof WebBaseLabel || key instanceof WebBaseSubmitLink) {
      IFieldComponent component=(IFieldComponent)labelForComponents.get(entry.getValue());
      if (component != null) {
        if (key instanceof WebBaseLabel) {
          ((WebBaseLabel)entry.getKey()).setLabelFor(component);
        }
 else {
          ((WebBaseSubmitLink)entry.getKey()).setLabelFor(component);
        }
        (component).addLabelFor((ILabel)entry.getKey());
        component.setComponentVisible(component.isVisible());
        component.setComponentEnabled(component.isEnabled());
      }
    }
  }
  it=emptyDataRenderers.values().iterator();
  while (it.hasNext()) {
    WebDataRenderer panel=(WebDataRenderer)it.next();
    panel.createDataAdapter(app,dataProviderLookup,listner,undoManager);
  }
  return listTocomplete;
}