Program: 77245
Project: 77245
Buggy source:
/** 
 * Creates a ODA InputParameterAttributes with the given ROM report parameter.
 * @param paramDefn the ROM report parameter.
 * @param dataSetDesign
 * @return the created <code>InputParameterAttributes</code>.
 */
private InputParameterAttributes updateInputElementAttrs(InputParameterAttributes inputParamAttrs,ScalarParameterHandle paramDefn,DataSetDesign dataSetDesign){
  if (inputParamAttrs == null)   inputParamAttrs=DesignFactory.eINSTANCE.createInputParameterAttributes();
  InputElementAttributes inputAttrs=inputParamAttrs.getElementAttributes();
  if (inputAttrs == null)   inputAttrs=DesignFactory.eINSTANCE.createInputElementAttributes();
  inputAttrs.setDefaultScalarValue(paramDefn.getDefaultValue());
  inputAttrs.setOptional(paramDefn.allowBlank());
  inputAttrs.setMasksValue(paramDefn.isConcealValue());
  ScalarValueChoices staticChoices=null;
  Iterator selectionList=paramDefn.choiceIterator();
  while (selectionList.hasNext()) {
    if (staticChoices == null)     staticChoices=DesignFactory.eINSTANCE.createScalarValueChoices();
    SelectionChoiceHandle choice=(SelectionChoiceHandle)selectionList.next();
    ScalarValueDefinition valueDefn=DesignFactory.eINSTANCE.createScalarValueDefinition();
    valueDefn.setValue(choice.getValue());
    valueDefn.setDisplayName(choice.getLabel());
    staticChoices.getScalarValues().add(valueDefn);
  }
  inputAttrs.setStaticValueChoices(staticChoices);
  DataSetHandle setHandle=paramDefn.getDataSet();
  String valueExpr=paramDefn.getValueExpr();
  String labelExpr=paramDefn.getLabelExpr();
  if (setHandle instanceof OdaDataSetHandle && (valueExpr != null || labelExpr != null)) {
    DynamicValuesQuery valueQuery=DesignFactory.eINSTANCE.createDynamicValuesQuery();
    DataSetDesign targetDataSetDesign=dataSetDesign;
    if (!setHandle.getName().equals(dataSetDesign.getName()))     targetDataSetDesign=new ModelOdaAdapter().createDataSetDesign((OdaDataSetHandle)setHandle);
    valueQuery.setDataSetDesign(targetDataSetDesign);
    valueQuery.setDisplayNameColumn(labelExpr);
    valueQuery.setValueColumn(valueExpr);
    valueQuery.setEnabled(true);
    inputAttrs.setDynamicValueChoices(valueQuery);
  }
  InputElementUIHints uiHints=DesignFactory.eINSTANCE.createInputElementUIHints();
  uiHints.setPromptStyle(newPromptStyle(paramDefn.getControlType(),paramDefn.isMustMatch()));
  inputAttrs.setUiHints(uiHints);
  if (paramDefn.getContainer() instanceof ParameterGroupHandle) {
    ParameterGroupHandle groupHandle=(ParameterGroupHandle)paramDefn.getContainer();
    InputParameterUIHints paramUiHints=DesignFactory.eINSTANCE.createInputParameterUIHints();
    paramUiHints.setGroupPromptDisplayName(groupHandle.getDisplayName());
    inputParamAttrs.setUiHints(paramUiHints);
  }
  inputParamAttrs.setElementAttributes(inputAttrs);
  return inputParamAttrs;
}

Fixed version (ground truth):
/** 
 * Creates a ODA InputParameterAttributes with the given ROM report parameter.
 * @param paramDefn the ROM report parameter.
 * @param dataSetDesign
 * @return the created <code>InputParameterAttributes</code>.
 */
private InputParameterAttributes updateInputElementAttrs(InputParameterAttributes inputParamAttrs,ScalarParameterHandle paramDefn,DataSetDesign dataSetDesign){
  if (inputParamAttrs == null)   inputParamAttrs=DesignFactory.eINSTANCE.createInputParameterAttributes();
  InputElementAttributes inputAttrs=inputParamAttrs.getElementAttributes();
  if (inputAttrs == null)   inputAttrs=DesignFactory.eINSTANCE.createInputElementAttributes();
  inputAttrs.setDefaultScalarValue(paramDefn.getDefaultValue());
  inputAttrs.setOptional(paramDefn.allowBlank());
  inputAttrs.setMasksValue(paramDefn.isConcealValue());
  ScalarValueChoices staticChoices=null;
  Iterator selectionList=paramDefn.choiceIterator();
  while (selectionList.hasNext()) {
    if (staticChoices == null)     staticChoices=DesignFactory.eINSTANCE.createScalarValueChoices();
    SelectionChoiceHandle choice=(SelectionChoiceHandle)selectionList.next();
    ScalarValueDefinition valueDefn=DesignFactory.eINSTANCE.createScalarValueDefinition();
    valueDefn.setValue(choice.getValue());
    valueDefn.setDisplayName(choice.getLabel());
    staticChoices.getScalarValues().add(valueDefn);
  }
  inputAttrs.setStaticValueChoices(staticChoices);
  DataSetHandle setHandle=paramDefn.getDataSet();
  String valueExpr=paramDefn.getValueExpr();
  String labelExpr=paramDefn.getLabelExpr();
  if (setHandle instanceof OdaDataSetHandle && (valueExpr != null || labelExpr != null)) {
    DynamicValuesQuery valueQuery=DesignFactory.eINSTANCE.createDynamicValuesQuery();
    if (dataSetDesign != null) {
      DataSetDesign targetDataSetDesign=(DataSetDesign)EcoreUtil.copy(dataSetDesign);
      if (!setHandle.getName().equals(dataSetDesign.getName()))       targetDataSetDesign=new ModelOdaAdapter().createDataSetDesign((OdaDataSetHandle)setHandle);
      valueQuery.setDataSetDesign(targetDataSetDesign);
    }
 else {
      DataSetDesign targetDataSetDesign=new ModelOdaAdapter().createDataSetDesign((OdaDataSetHandle)setHandle);
      valueQuery.setDataSetDesign(targetDataSetDesign);
    }
    valueQuery.setDisplayNameColumn(labelExpr);
    valueQuery.setValueColumn(valueExpr);
    valueQuery.setEnabled(true);
    inputAttrs.setDynamicValueChoices(valueQuery);
  }
  InputElementUIHints uiHints=DesignFactory.eINSTANCE.createInputElementUIHints();
  uiHints.setPromptStyle(newPromptStyle(paramDefn.getControlType(),paramDefn.isMustMatch()));
  inputAttrs.setUiHints(uiHints);
  if (paramDefn.getContainer() instanceof ParameterGroupHandle) {
    ParameterGroupHandle groupHandle=(ParameterGroupHandle)paramDefn.getContainer();
    InputParameterUIHints paramUiHints=DesignFactory.eINSTANCE.createInputParameterUIHints();
    paramUiHints.setGroupPromptDisplayName(groupHandle.getDisplayName());
    inputParamAttrs.setUiHints(paramUiHints);
  }
  inputParamAttrs.setElementAttributes(inputAttrs);
  return inputParamAttrs;
}