Program: 143413
Project: 143413
Buggy source:
private FormElement createBodyPortalFormElement(BodyPortal listViewPortal,FlattenedSolution fs,final boolean isInDesigner){
  Form form=listViewPortal.getForm();
  Part bodyPart=null;
  for (  Part prt : Utils.iterate(form.getParts())) {
    if (prt.getPartType() == Part.BODY) {
      bodyPart=prt;
      break;
    }
  }
  if (bodyPart != null) {
    try {
      String name="String_Node_Str" + form.getName();
      int startPos=form.getPartStartYPos(bodyPart.getID());
      int endPos=bodyPart.getHeight();
      int bodyheight=endPos - startPos;
      JSONObject portal=new JSONObject();
      portal.put("String_Node_Str",name);
      portal.put("String_Node_Str",!listViewPortal.isTableview());
      portal.put("String_Node_Str",!listViewPortal.isTableview() ? bodyheight : getRowHeight(form));
      portal.put("String_Node_Str",form.getScrollbars());
      if (listViewPortal.isTableview()) {
        int headerHeight=30;
        if (form.hasPart(Part.HEADER)) {
          headerHeight=0;
        }
        portal.put("String_Node_Str",headerHeight);
        portal.put("String_Node_Str",form.getOnSortCmdMethodID() != -1);
      }
      JSONObject location=new JSONObject();
      location.put("String_Node_Str",0);
      location.put("String_Node_Str",isInDesigner ? startPos : 0);
      portal.put("String_Node_Str",location);
      JSONObject size=new JSONObject();
      size.put("String_Node_Str",form.getWidth());
      size.put("String_Node_Str",bodyheight);
      portal.put("String_Node_Str",size);
      portal.put("String_Node_Str",listViewPortal.getVisible());
      portal.put("String_Node_Str",listViewPortal.getEnabled());
      portal.put("String_Node_Str",new JSONArray());
      JSONObject relatedFoundset=new JSONObject();
      relatedFoundset.put("String_Node_Str","String_Node_Str");
      portal.put("String_Node_Str",relatedFoundset);
      PropertyPath propertyPath=new PropertyPath();
      propertyPath.setShouldAddElementName();
      FormElement portalFormElement=new FormElement("String_Node_Str",portal,form,name,fs,propertyPath,isInDesigner);
      PropertyDescription pd=portalFormElement.getWebComponentSpec().getProperties().get("String_Node_Str");
      if (pd != null)       pd=((CustomJSONArrayType<?,?>)pd.getType()).getCustomJSONTypeDefinition();
      if (pd == null) {
        Debug.error(new RuntimeException("String_Node_Str"));
        return null;
      }
      ComponentPropertyType type=((ComponentPropertyType)pd.getType());
      Map<String,Object> portalFormElementProperties=new HashMap<>(portalFormElement.getRawPropertyValues());
      portalFormElementProperties.put("String_Node_Str",IAnchorConstants.ALL);
      portalFormElementProperties.put("String_Node_Str",startPos);
      portalFormElementProperties.put("String_Node_Str",bodyPart.getHeight());
      Iterator<IPersist> it=form.getAllObjects(PositionComparator.XY_PERSIST_COMPARATOR);
      List<Object> children=new ArrayList<>();
      List<String> headersText=new ArrayList<>();
      propertyPath.add(portalFormElement.getName());
      propertyPath.add("String_Node_Str");
      int minBodyPortalTabSeq=-2;
      while (it.hasNext()) {
        IPersist persist=it.next();
        if (persist instanceof IFormElement) {
          Point loc=((IFormElement)persist).getLocation();
          if (startPos <= loc.y && endPos > loc.y) {
            if (listViewPortal.isTableview() && persist instanceof GraphicalComponent && ((GraphicalComponent)persist).getLabelFor() != null)             continue;
            propertyPath.add(children.size());
            FormElement fe=getFormElement((IFormElement)persist,fs,propertyPath,isInDesigner);
            if (listViewPortal.isTableview()) {
              String elementName=fe.getName();
              boolean hasLabelFor=false;
              Iterator<GraphicalComponent> graphicalComponents=form.getGraphicalComponents();
              while (graphicalComponents.hasNext()) {
                GraphicalComponent gc=graphicalComponents.next();
                if (gc.getLabelFor() != null && Utils.equalObjects(elementName,gc.getLabelFor()) && startPos <= gc.getLocation().y && endPos > gc.getLocation().y) {
                  headersText.add(gc.getText());
                  hasLabelFor=true;
                  break;
                }
              }
              if (!hasLabelFor) {
                if (fe.getPropertyValue("String_Node_Str") != null) {
                  headersText.add(fe.getPropertyValue("String_Node_Str").toString());
                }
 else {
                  headersText.add(null);
                }
              }
              Map<String,Object> feRawProperties=new HashMap<>(fe.getRawPropertyValues());
              feRawProperties.put("String_Node_Str",Integer.valueOf(children.size()));
              fe.updatePropertyValuesDontUse(feRawProperties);
            }
            children.add(type.getFormElementValue(null,pd,propertyPath,fe,fs));
            propertyPath.backOneLevel();
            Collection<PropertyDescription> tabSequenceProperties=fe.getWebComponentSpec().getProperties(NGTabSeqPropertyType.NG_INSTANCE);
            for (            PropertyDescription tabSeqProperty : tabSequenceProperties) {
              String tabSeqPropertyName=tabSeqProperty.getName();
              Integer tabSeqVal=(Integer)fe.getPropertyValue(tabSeqPropertyName);
              if (tabSeqVal == null)               tabSeqVal=Integer.valueOf(0);
              if (minBodyPortalTabSeq < 0 || minBodyPortalTabSeq > tabSeqVal.intValue())               minBodyPortalTabSeq=tabSeqVal.intValue();
            }
          }
        }
      }
      propertyPath.backOneLevel();
      propertyPath.backOneLevel();
      portalFormElementProperties.put("String_Node_Str",children.toArray());
      if (listViewPortal.isTableview()) {
        portalFormElementProperties.put("String_Node_Str",headersText.toArray());
      }
      portalFormElementProperties.put("String_Node_Str",Integer.valueOf(minBodyPortalTabSeq));
      portalFormElement.updatePropertyValuesDontUse(portalFormElementProperties);
      return portalFormElement;
    }
 catch (    JSONException ex) {
      Debug.error("String_Node_Str",ex);
    }
  }
  return null;
}

Fixed version (ground truth):
private FormElement createBodyPortalFormElement(BodyPortal listViewPortal,FlattenedSolution fs,final boolean isInDesigner){
  Form form=listViewPortal.getForm();
  Part bodyPart=null;
  for (  Part prt : Utils.iterate(form.getParts())) {
    if (prt.getPartType() == Part.BODY) {
      bodyPart=prt;
      break;
    }
  }
  if (bodyPart != null) {
    try {
      String name="String_Node_Str" + form.getName();
      int startPos=form.getPartStartYPos(bodyPart.getID());
      int endPos=bodyPart.getHeight();
      int bodyheight=endPos - startPos;
      JSONObject portal=new JSONObject();
      portal.put("String_Node_Str",name);
      portal.put("String_Node_Str",!listViewPortal.isTableview());
      portal.put("String_Node_Str",!listViewPortal.isTableview() ? bodyheight : getRowHeight(form));
      portal.put("String_Node_Str",form.getScrollbars());
      if (listViewPortal.isTableview()) {
        int headerHeight=30;
        if (form.hasPart(Part.HEADER)) {
          headerHeight=0;
        }
        portal.put("String_Node_Str",headerHeight);
        portal.put("String_Node_Str",form.getOnSortCmdMethodID() != -1);
      }
      JSONObject location=new JSONObject();
      location.put("String_Node_Str",0);
      location.put("String_Node_Str",isInDesigner ? startPos : 0);
      portal.put("String_Node_Str",location);
      JSONObject size=new JSONObject();
      size.put("String_Node_Str",form.getWidth());
      size.put("String_Node_Str",bodyheight);
      portal.put("String_Node_Str",size);
      portal.put("String_Node_Str",listViewPortal.getVisible());
      portal.put("String_Node_Str",listViewPortal.getEnabled());
      portal.put("String_Node_Str",new JSONArray());
      JSONObject relatedFoundset=new JSONObject();
      relatedFoundset.put("String_Node_Str","String_Node_Str");
      portal.put("String_Node_Str",relatedFoundset);
      PropertyPath propertyPath=new PropertyPath();
      propertyPath.setShouldAddElementName();
      FormElement portalFormElement=new FormElement("String_Node_Str",portal,form,name,fs,propertyPath,isInDesigner);
      PropertyDescription pd=portalFormElement.getWebComponentSpec().getProperties().get("String_Node_Str");
      if (pd != null)       pd=((CustomJSONArrayType<?,?>)pd.getType()).getCustomJSONTypeDefinition();
      if (pd == null) {
        Debug.error(new RuntimeException("String_Node_Str"));
        return null;
      }
      ComponentPropertyType type=((ComponentPropertyType)pd.getType());
      Map<String,Object> portalFormElementProperties=new HashMap<>(portalFormElement.getRawPropertyValues());
      portalFormElementProperties.put("String_Node_Str",IAnchorConstants.ALL);
      portalFormElementProperties.put("String_Node_Str",startPos);
      portalFormElementProperties.put("String_Node_Str",bodyPart.getHeight());
      portalFormElementProperties.put("String_Node_Str",true);
      Iterator<IPersist> it=form.getAllObjects(PositionComparator.XY_PERSIST_COMPARATOR);
      List<Object> children=new ArrayList<>();
      List<String> headersText=new ArrayList<>();
      propertyPath.add(portalFormElement.getName());
      propertyPath.add("String_Node_Str");
      int minBodyPortalTabSeq=-2;
      while (it.hasNext()) {
        IPersist persist=it.next();
        if (persist instanceof IFormElement) {
          Point loc=((IFormElement)persist).getLocation();
          if (startPos <= loc.y && endPos > loc.y) {
            if (listViewPortal.isTableview() && persist instanceof GraphicalComponent && ((GraphicalComponent)persist).getLabelFor() != null)             continue;
            propertyPath.add(children.size());
            FormElement fe=getFormElement((IFormElement)persist,fs,propertyPath,isInDesigner);
            if (listViewPortal.isTableview()) {
              String elementName=fe.getName();
              boolean hasLabelFor=false;
              Iterator<GraphicalComponent> graphicalComponents=form.getGraphicalComponents();
              while (graphicalComponents.hasNext()) {
                GraphicalComponent gc=graphicalComponents.next();
                if (gc.getLabelFor() != null && Utils.equalObjects(elementName,gc.getLabelFor()) && startPos <= gc.getLocation().y && endPos > gc.getLocation().y) {
                  headersText.add(gc.getText());
                  hasLabelFor=true;
                  break;
                }
              }
              if (!hasLabelFor) {
                if (fe.getPropertyValue("String_Node_Str") != null) {
                  headersText.add(fe.getPropertyValue("String_Node_Str").toString());
                }
 else {
                  headersText.add(null);
                }
              }
              Map<String,Object> feRawProperties=new HashMap<>(fe.getRawPropertyValues());
              feRawProperties.put("String_Node_Str",Integer.valueOf(children.size()));
              fe.updatePropertyValuesDontUse(feRawProperties);
            }
            children.add(type.getFormElementValue(null,pd,propertyPath,fe,fs));
            propertyPath.backOneLevel();
            Collection<PropertyDescription> tabSequenceProperties=fe.getWebComponentSpec().getProperties(NGTabSeqPropertyType.NG_INSTANCE);
            for (            PropertyDescription tabSeqProperty : tabSequenceProperties) {
              String tabSeqPropertyName=tabSeqProperty.getName();
              Integer tabSeqVal=(Integer)fe.getPropertyValue(tabSeqPropertyName);
              if (tabSeqVal == null)               tabSeqVal=Integer.valueOf(0);
              if (minBodyPortalTabSeq < 0 || minBodyPortalTabSeq > tabSeqVal.intValue())               minBodyPortalTabSeq=tabSeqVal.intValue();
            }
          }
        }
      }
      propertyPath.backOneLevel();
      propertyPath.backOneLevel();
      portalFormElementProperties.put("String_Node_Str",children.toArray());
      if (listViewPortal.isTableview()) {
        portalFormElementProperties.put("String_Node_Str",headersText.toArray());
      }
      portalFormElementProperties.put("String_Node_Str",Integer.valueOf(minBodyPortalTabSeq));
      portalFormElement.updatePropertyValuesDontUse(portalFormElementProperties);
      return portalFormElement;
    }
 catch (    JSONException ex) {
      Debug.error("String_Node_Str",ex);
    }
  }
  return null;
}