Program: 118716
Project: 118716
Buggy source:
/** 
 * DOC ycbai Comment method "loadParametersFromForm". <p> Get element parameters of <code>element</code> from <code>form</code>.
 * @param node optional, used if there is a component setting up the properties
 * @param element
 * @param category
 * @param form
 * @return parameters list
 */
public static List<ElementParameter> getParametersFromForm(IElement element,EComponentCategory category,ComponentProperties compProperties,String parentPropertiesPath,Form form,Widget parentWidget,AtomicInteger lastRowNum){
  List<ElementParameter> elementParameters=new ArrayList<>();
  List<String> parameterNames=new ArrayList<>();
  EComponentCategory compCategory=category;
  if (compCategory == null) {
    compCategory=EComponentCategory.BASIC;
  }
  AtomicInteger lastRN=lastRowNum;
  if (lastRN == null) {
    lastRN=new AtomicInteger();
  }
  if (form == null) {
    return elementParameters;
  }
  ComponentProperties componentProperties=compProperties;
  if (componentProperties == null) {
    componentProperties=(ComponentProperties)form.getProperties();
  }
  if (element instanceof INode) {
    INode node=(INode)element;
    if (node.getComponentProperties() == null) {
      node.setComponentProperties(componentProperties);
    }
  }
  componentProperties.setValueEvaluator(null);
  List<Widget> formWidgets=form.getWidgets();
  for (  Widget widget : formWidgets) {
    NamedThing widgetProperty=widget.getContent();
    String propertiesPath=getPropertiesPath(parentPropertiesPath,null);
    if (widgetProperty instanceof Form) {
      Form subForm=(Form)widgetProperty;
      ComponentProperties subProperties=(ComponentProperties)subForm.getProperties();
      if (!isSameComponentProperties(componentProperties,widgetProperty)) {
        propertiesPath=getPropertiesPath(parentPropertiesPath,subProperties.getName());
      }
      elementParameters.addAll(getParametersFromForm(element,compCategory,subProperties,propertiesPath,subForm,widget,lastRN));
      continue;
    }
    GenericElementParameter param=new GenericElementParameter(element,componentProperties,form,widget,getComponentService());
    String parameterName=propertiesPath.concat(param.getName());
    param.setName(parameterName);
    param.setCategory(compCategory);
    param.setShow(parentWidget == null ? widget.isVisible() : parentWidget.isVisible() && widget.isVisible());
    int rowNum=0;
    if (widget.getOrder() != 1) {
      rowNum=lastRN.get();
    }
 else {
      rowNum=widget.getRow();
      if (parentWidget != null) {
        rowNum+=parentWidget.getRow();
      }
      rowNum=rowNum + lastRN.get();
    }
    param.setNumRow(rowNum);
    lastRN.set(rowNum);
    EParameterFieldType fieldType=getFieldType(widget,widgetProperty);
    param.setFieldType(fieldType != null ? fieldType : EParameterFieldType.TEXT);
    if (widgetProperty instanceof PresentationItem) {
      param.setValue(widgetProperty.getDisplayName());
    }
 else {
      Property property=(Property)widgetProperty;
      param.setRequired(property.isRequired());
      param.setValue(getParameterValue(property));
      param.setSupportContext(isSupportContext(property));
      param.setContext(EConnectionType.FLOW_MAIN.getName());
      List<?> values=property.getPossibleValues();
      if (values != null) {
        param.setPossibleValues(values);
        List<String> possVals=new ArrayList<>();
        List<String> possValsDisplay=new ArrayList<>();
        for (        Object obj : values) {
          if (obj instanceof NamedThing) {
            NamedThing nal=(NamedThing)obj;
            possVals.add(nal.getName());
            possValsDisplay.add(nal.getDisplayName());
          }
 else {
            possVals.add(String.valueOf(obj));
            possValsDisplay.add(String.valueOf(obj));
          }
        }
        param.setListItemsDisplayName(possValsDisplay.toArray(new String[0]));
        param.setListItemsDisplayCodeName(possValsDisplay.toArray(new String[0]));
        param.setListItemsValue(possVals.toArray(new String[0]));
      }
    }
    param.setReadOnly(false);
    param.setSerialized(true);
    if (EParameterFieldType.SCHEMA_TYPE.equals(param.getFieldType())) {
      String propertyName=componentProperties.getName();
    }
    if (!parameterNames.contains(parameterName)) {
      elementParameters.add(param);
      parameterNames.add(parameterName);
    }
  }
  return elementParameters;
}

Fixed version (ground truth):
/** 
 * DOC ycbai Comment method "loadParametersFromForm". <p> Get element parameters of <code>element</code> from <code>form</code>.
 * @param node optional, used if there is a component setting up the properties
 * @param element
 * @param category
 * @param form
 * @return parameters list
 */
public static List<ElementParameter> getParametersFromForm(IElement element,EComponentCategory category,ComponentProperties compProperties,String parentPropertiesPath,Form form,Widget parentWidget,AtomicInteger lastRowNum){
  List<ElementParameter> elementParameters=new ArrayList<>();
  List<String> parameterNames=new ArrayList<>();
  EComponentCategory compCategory=category;
  if (compCategory == null) {
    compCategory=EComponentCategory.BASIC;
  }
  AtomicInteger lastRN=lastRowNum;
  if (lastRN == null) {
    lastRN=new AtomicInteger();
  }
  if (form == null) {
    return elementParameters;
  }
  ComponentProperties componentProperties=compProperties;
  if (componentProperties == null) {
    componentProperties=(ComponentProperties)form.getProperties();
  }
  if (element instanceof INode) {
    INode node=(INode)element;
    if (node.getComponentProperties() == null) {
      node.setComponentProperties(componentProperties);
    }
  }
  componentProperties.setValueEvaluator(null);
  List<Widget> formWidgets=form.getWidgets();
  for (  Widget widget : formWidgets) {
    NamedThing widgetProperty=widget.getContent();
    String propertiesPath=getPropertiesPath(parentPropertiesPath,null);
    if (widgetProperty instanceof Form) {
      Form subForm=(Form)widgetProperty;
      ComponentProperties subProperties=(ComponentProperties)subForm.getProperties();
      if (!isSameComponentProperties(componentProperties,widgetProperty)) {
        propertiesPath=getPropertiesPath(parentPropertiesPath,subProperties.getName());
      }
      elementParameters.addAll(getParametersFromForm(element,compCategory,subProperties,propertiesPath,subForm,widget,lastRN));
      continue;
    }
    GenericElementParameter param=new GenericElementParameter(element,componentProperties,form,widget,getComponentService());
    String parameterName=propertiesPath.concat(param.getName());
    param.setName(parameterName);
    param.setCategory(compCategory);
    param.setShow(parentWidget == null ? widget.isVisible() : parentWidget.isVisible() && widget.isVisible());
    int rowNum=0;
    if (widget.getOrder() != 1) {
      rowNum=lastRN.get();
    }
 else {
      rowNum=widget.getRow();
      if (parentWidget != null) {
        rowNum+=parentWidget.getRow();
      }
      rowNum=rowNum + lastRN.get();
    }
    param.setNumRow(rowNum);
    lastRN.set(rowNum);
    EParameterFieldType fieldType=getFieldType(widget,widgetProperty);
    param.setFieldType(fieldType != null ? fieldType : EParameterFieldType.TEXT);
    if (widgetProperty instanceof PresentationItem) {
      param.setValue(widgetProperty.getDisplayName());
    }
 else {
      Property property=(Property)widgetProperty;
      param.setRequired(property.isRequired());
      param.setValue(getParameterValue(element,property));
      param.setSupportContext(isSupportContext(property));
      param.setContext(EConnectionType.FLOW_MAIN.getName());
      List<?> values=property.getPossibleValues();
      if (values != null) {
        param.setPossibleValues(values);
        List<String> possVals=new ArrayList<>();
        List<String> possValsDisplay=new ArrayList<>();
        for (        Object obj : values) {
          if (obj instanceof NamedThing) {
            NamedThing nal=(NamedThing)obj;
            possVals.add(nal.getName());
            possValsDisplay.add(nal.getDisplayName());
          }
 else {
            possVals.add(String.valueOf(obj));
            possValsDisplay.add(String.valueOf(obj));
          }
        }
        param.setListItemsDisplayName(possValsDisplay.toArray(new String[0]));
        param.setListItemsDisplayCodeName(possValsDisplay.toArray(new String[0]));
        param.setListItemsValue(possVals.toArray(new String[0]));
      }
    }
    param.setReadOnly(false);
    param.setSerialized(true);
    if (EParameterFieldType.SCHEMA_TYPE.equals(param.getFieldType())) {
      String propertyName=componentProperties.getName();
    }
    if (!parameterNames.contains(parameterName)) {
      elementParameters.add(param);
      parameterNames.add(parameterName);
    }
  }
  return elementParameters;
}