Program: 76272
Project: 76272
Buggy source:
public void visitScalarParameter(ScalarParameterHandle handle){
  assert(handle.getName() != null);
  ScalarParameterDefn scalarParameter=new ScalarParameterDefn();
  scalarParameter.setHandle(handle);
  scalarParameter.setParameterType(IParameterDefnBase.SCALAR_PARAMETER);
  scalarParameter.setName(handle.getName());
  List properties=handle.getUserProperties();
  for (int i=0; i < properties.size(); i++) {
    UserPropertyDefn p=(UserPropertyDefn)properties.get(i);
    scalarParameter.addUserProperty(p.getName(),handle.getProperty(p.getName()));
  }
  String align=handle.getAlignment();
  if (DesignChoiceConstants.SCALAR_PARAM_ALIGN_CENTER.equals(align))   scalarParameter.setAlignment(IScalarParameterDefn.CENTER);
 else   if (DesignChoiceConstants.SCALAR_PARAM_ALIGN_LEFT.equals(align))   scalarParameter.setAlignment(IScalarParameterDefn.LEFT);
 else   if (DesignChoiceConstants.SCALAR_PARAM_ALIGN_RIGHT.equals(align))   scalarParameter.setAlignment(IScalarParameterDefn.RIGHT);
 else   scalarParameter.setAlignment(IScalarParameterDefn.AUTO);
  scalarParameter.setAllowBlank(handle.allowBlank());
  scalarParameter.setAllowNull(handle.allowNull());
  scalarParameter.setIsRequired(handle.isRequired());
  String controlType=handle.getControlType();
  if (DesignChoiceConstants.PARAM_CONTROL_CHECK_BOX.equals(controlType))   scalarParameter.setControlType(IScalarParameterDefn.CHECK_BOX);
 else   if (DesignChoiceConstants.PARAM_CONTROL_LIST_BOX.equals(controlType))   scalarParameter.setControlType(IScalarParameterDefn.LIST_BOX);
 else   if (DesignChoiceConstants.PARAM_CONTROL_RADIO_BUTTON.equals(controlType))   scalarParameter.setControlType(IScalarParameterDefn.RADIO_BUTTON);
 else   scalarParameter.setControlType(IScalarParameterDefn.TEXT_BOX);
  scalarParameter.setDefaultValue(handle.getDefaultValue());
  scalarParameter.setDisplayName(handle.getDisplayName());
  scalarParameter.setDisplayNameKey(handle.getDisplayNameKey());
  scalarParameter.setFormat(handle.getPattern());
  scalarParameter.setHelpText(handle.getHelpText());
  scalarParameter.setHelpTextKey(handle.getHelpTextKey());
  scalarParameter.setPromptText(handle.getPromptText());
  scalarParameter.setPromptTextKey(handle.getPromptTextID());
  scalarParameter.setIsHidden(handle.isHidden());
  scalarParameter.setName(handle.getName());
  String valueType=handle.getDataType();
  if (DesignChoiceConstants.PARAM_TYPE_BOOLEAN.equals(valueType))   scalarParameter.setDataType(IScalarParameterDefn.TYPE_BOOLEAN);
 else   if (DesignChoiceConstants.PARAM_TYPE_DATETIME.equals(valueType))   scalarParameter.setDataType(IScalarParameterDefn.TYPE_DATE_TIME);
 else   if (DesignChoiceConstants.PARAM_TYPE_DECIMAL.equals(valueType))   scalarParameter.setDataType(IScalarParameterDefn.TYPE_DECIMAL);
 else   if (DesignChoiceConstants.PARAM_TYPE_FLOAT.equals(valueType))   scalarParameter.setDataType(IScalarParameterDefn.TYPE_FLOAT);
 else   if (DesignChoiceConstants.PARAM_TYPE_STRING.equals(valueType))   scalarParameter.setDataType(IScalarParameterDefn.TYPE_STRING);
 else   if (DesignChoiceConstants.PARAM_TYPE_INTEGER.equals(valueType))   scalarParameter.setDataType(IScalarParameterDefn.TYPE_INTEGER);
 else   scalarParameter.setDataType(IScalarParameterDefn.TYPE_ANY);
  ArrayList values=new ArrayList();
  Iterator selectionIter=handle.choiceIterator();
  while (selectionIter.hasNext()) {
    SelectionChoiceHandle selection=(SelectionChoiceHandle)selectionIter.next();
    ParameterSelectionChoice selectionChoice=new ParameterSelectionChoice(this.handle);
    selectionChoice.setLabel(selection.getLabelKey(),selection.getLabel());
    selectionChoice.setValue(selection.getValue(),scalarParameter.getDataType());
    values.add(selectionChoice);
  }
  scalarParameter.setSelectionList(values);
  scalarParameter.setAllowNewValues(!handle.isMustMatch());
  scalarParameter.setFixedOrder(handle.isFixedOrder());
  String paramType=handle.getValueType();
  if (IScalarParameterDefn.SELECTION_LIST_TYPE_STATIC.equals(paramType) && scalarParameter.getSelectionList() != null && scalarParameter.getSelectionList().size() > 0) {
    scalarParameter.setSelectionListType(IScalarParameterDefn.SELECTION_LIST_STATIC);
  }
 else   if (IScalarParameterDefn.SELECTION_LIST_TYPE_DYNAMIC.equals(paramType)) {
    scalarParameter.setSelectionListType(IScalarParameterDefn.SELECTION_LIST_DYNAMIC);
  }
 else {
    scalarParameter.setSelectionListType(IScalarParameterDefn.SELECTION_LIST_NONE);
  }
  scalarParameter.setValueConcealed(handle.isConcealValue());
  currentElement=scalarParameter;
}

Fixed version (ground truth):
public void visitScalarParameter(ScalarParameterHandle handle){
  assert(handle.getName() != null);
  ScalarParameterDefn scalarParameter=new ScalarParameterDefn();
  scalarParameter.setHandle(handle);
  scalarParameter.setParameterType(IParameterDefnBase.SCALAR_PARAMETER);
  scalarParameter.setName(handle.getName());
  List properties=handle.getUserProperties();
  for (int i=0; i < properties.size(); i++) {
    UserPropertyDefn p=(UserPropertyDefn)properties.get(i);
    scalarParameter.addUserProperty(p.getName(),handle.getProperty(p.getName()));
  }
  String align=handle.getAlignment();
  if (DesignChoiceConstants.SCALAR_PARAM_ALIGN_CENTER.equals(align))   scalarParameter.setAlignment(IScalarParameterDefn.CENTER);
 else   if (DesignChoiceConstants.SCALAR_PARAM_ALIGN_LEFT.equals(align))   scalarParameter.setAlignment(IScalarParameterDefn.LEFT);
 else   if (DesignChoiceConstants.SCALAR_PARAM_ALIGN_RIGHT.equals(align))   scalarParameter.setAlignment(IScalarParameterDefn.RIGHT);
 else   scalarParameter.setAlignment(IScalarParameterDefn.AUTO);
  scalarParameter.setAllowBlank(handle.allowBlank());
  scalarParameter.setAllowNull(handle.allowNull());
  scalarParameter.setIsRequired(handle.isRequired());
  String controlType=handle.getControlType();
  if (DesignChoiceConstants.PARAM_CONTROL_CHECK_BOX.equals(controlType))   scalarParameter.setControlType(IScalarParameterDefn.CHECK_BOX);
 else   if (DesignChoiceConstants.PARAM_CONTROL_LIST_BOX.equals(controlType))   scalarParameter.setControlType(IScalarParameterDefn.LIST_BOX);
 else   if (DesignChoiceConstants.PARAM_CONTROL_RADIO_BUTTON.equals(controlType))   scalarParameter.setControlType(IScalarParameterDefn.RADIO_BUTTON);
 else   scalarParameter.setControlType(IScalarParameterDefn.TEXT_BOX);
  scalarParameter.setDefaultValue(handle.getDefaultValue());
  scalarParameter.setDisplayName(handle.getDisplayName());
  scalarParameter.setDisplayNameKey(handle.getDisplayNameKey());
  scalarParameter.setFormat(handle.getPattern());
  scalarParameter.setHelpText(handle.getHelpText());
  scalarParameter.setHelpTextKey(handle.getHelpTextKey());
  scalarParameter.setPromptText(handle.getPromptText());
  scalarParameter.setPromptTextKey(handle.getPromptTextID());
  scalarParameter.setIsHidden(handle.isHidden());
  scalarParameter.setName(handle.getName());
  String valueType=handle.getDataType();
  if (DesignChoiceConstants.PARAM_TYPE_BOOLEAN.equals(valueType))   scalarParameter.setDataType(IScalarParameterDefn.TYPE_BOOLEAN);
 else   if (DesignChoiceConstants.PARAM_TYPE_DATETIME.equals(valueType))   scalarParameter.setDataType(IScalarParameterDefn.TYPE_DATE_TIME);
 else   if (DesignChoiceConstants.PARAM_TYPE_DECIMAL.equals(valueType))   scalarParameter.setDataType(IScalarParameterDefn.TYPE_DECIMAL);
 else   if (DesignChoiceConstants.PARAM_TYPE_FLOAT.equals(valueType))   scalarParameter.setDataType(IScalarParameterDefn.TYPE_FLOAT);
 else   if (DesignChoiceConstants.PARAM_TYPE_STRING.equals(valueType))   scalarParameter.setDataType(IScalarParameterDefn.TYPE_STRING);
 else   if (DesignChoiceConstants.PARAM_TYPE_INTEGER.equals(valueType))   scalarParameter.setDataType(IScalarParameterDefn.TYPE_INTEGER);
 else   if (DesignChoiceConstants.PARAM_TYPE_DATE.equals(valueType))   scalarParameter.setDataType(IScalarParameterDefn.TYPE_DATE);
 else   if (DesignChoiceConstants.PARAM_TYPE_TIME.equals(valueType))   scalarParameter.setDataType(IScalarParameterDefn.TYPE_TIME);
 else   scalarParameter.setDataType(IScalarParameterDefn.TYPE_ANY);
  ArrayList values=new ArrayList();
  Iterator selectionIter=handle.choiceIterator();
  while (selectionIter.hasNext()) {
    SelectionChoiceHandle selection=(SelectionChoiceHandle)selectionIter.next();
    ParameterSelectionChoice selectionChoice=new ParameterSelectionChoice(this.handle);
    selectionChoice.setLabel(selection.getLabelKey(),selection.getLabel());
    selectionChoice.setValue(selection.getValue(),scalarParameter.getDataType());
    values.add(selectionChoice);
  }
  scalarParameter.setSelectionList(values);
  scalarParameter.setAllowNewValues(!handle.isMustMatch());
  scalarParameter.setFixedOrder(handle.isFixedOrder());
  String paramType=handle.getValueType();
  if (IScalarParameterDefn.SELECTION_LIST_TYPE_STATIC.equals(paramType) && scalarParameter.getSelectionList() != null && scalarParameter.getSelectionList().size() > 0) {
    scalarParameter.setSelectionListType(IScalarParameterDefn.SELECTION_LIST_STATIC);
  }
 else   if (IScalarParameterDefn.SELECTION_LIST_TYPE_DYNAMIC.equals(paramType)) {
    scalarParameter.setSelectionListType(IScalarParameterDefn.SELECTION_LIST_DYNAMIC);
  }
 else {
    scalarParameter.setSelectionListType(IScalarParameterDefn.SELECTION_LIST_NONE);
  }
  scalarParameter.setValueConcealed(handle.isConcealValue());
  currentElement=scalarParameter;
}