Program: 76902
Project: 76902
Buggy source:
/** 
 * Updates values of <code>DataSetHandle</code> with the given <code>sourceDesign</code>.
 * @param setDesign the ODA data source design
 * @param setHandle the Model handle
 * @param isSourceChanged <code>true</code> if the data set of the given design has been changed. Otherwise <code>false</code>.
 * @throws SemanticException if any of <code>sourceDesign</code> property values is not valid.
 */
public void updateDataSetHandle(DataSetDesign setDesign,OdaDataSetHandle setHandle,boolean isSourceChanged) throws SemanticException {
  if (setDesign == null || setHandle == null)   return;
  DesignUtil.validateObject(setDesign);
  CommandStack stack=setHandle.getModuleHandle().getCommandStack();
  stack.startTrans(null);
  try {
    setHandle.getElement().setProperty(OdaDataSourceHandle.EXTENSION_ID_PROP,setDesign.getOdaExtensionDataSetId());
    setHandle.setName(setDesign.getName());
    setHandle.setDisplayName(setDesign.getDisplayName());
    Properties props=setDesign.getPublicProperties();
    if (props != null) {
      EList propList=props.getProperties();
      for (int i=0; i < propList.size(); i++) {
        Property prop=(Property)propList.get(i);
        setHandle.setProperty(prop.getName(),prop.getValue());
      }
    }
    props=setDesign.getPrivateProperties();
    if (props != null) {
      EList propList=props.getProperties();
      for (int i=0; i < propList.size(); i++) {
        Property prop=(Property)propList.get(i);
        setHandle.setPrivateDriverProperty(prop.getName(),prop.getValue());
      }
    }
    DesignValues designerValues=null;
    try {
      designerValues=SerializerImpl.instance().read(setHandle.getDesignerValues());
    }
 catch (    IOException e) {
    }
    ResultSets cachedResultSets=designerValues == null ? null : designerValues.getResultSets();
    ResultSetDefinition cachedResultDefn=null;
    if (cachedResultSets != null && !cachedResultSets.getResultSetDefinitions().isEmpty())     cachedResultDefn=(ResultSetDefinition)cachedResultSets.getResultSetDefinitions().get(0);
    updateROMResultSets(setHandle,new ResultSetsAdapter().newROMResultSets(setDesign,setHandle,cachedResultDefn));
    setHandle.setResultSetName(setDesign.getPrimaryResultSetName());
    setHandle.setQueryText(setDesign.getQueryText());
    List userDefinedList=new DataSetParameterAdapter().getUserDefinedParameter(designerValues,setDesign,setHandle);
    updateROMDataSetParams(setDesign,setHandle,designerValues == null ? null : designerValues.getDataSetParameters(),userDefinedList);
    DataSourceDesign sourceDesign=setDesign.getDataSourceDesign();
    if (sourceDesign != null) {
      OdaDataSourceHandle sourceHandle=(OdaDataSourceHandle)setHandle.getDataSource();
      if (isSourceChanged && sourceHandle != null && !sourceHandle.getModuleHandle().isReadOnly()) {
        setHandle.setDataSource(sourceDesign.getName());
        updateDataSourceHandle(sourceDesign,sourceHandle);
      }
      if (!isSourceChanged && sourceHandle != null && !sourceHandle.getModuleHandle().isReadOnly() && !(new EcoreUtil.EqualityHelper().equals(createDataSourceDesign(sourceHandle),sourceDesign))) {
        updateDataSourceHandle(sourceDesign,sourceHandle);
      }
    }
 else     setHandle.setDataSource(null);
    updateDesignerValue(setDesign,setHandle,designerValues,userDefinedList);
  }
 catch (  SemanticException e) {
    stack.rollback();
    throw e;
  }
  stack.commit();
}

Fixed version (ground truth):
/** 
 * Updates values of <code>DataSetHandle</code> with the given <code>sourceDesign</code>.
 * @param setDesign the ODA data source design
 * @param setHandle the Model handle
 * @param isSourceChanged <code>true</code> if the data set of the given design has been changed. Otherwise <code>false</code>.
 * @throws SemanticException if any of <code>sourceDesign</code> property values is not valid.
 */
public void updateDataSetHandle(DataSetDesign setDesign,OdaDataSetHandle setHandle,boolean isSourceChanged) throws SemanticException {
  if (setDesign == null || setHandle == null)   return;
  DesignUtil.validateObject(setDesign);
  CommandStack stack=setHandle.getModuleHandle().getCommandStack();
  stack.startTrans(null);
  try {
    setHandle.getElement().setProperty(OdaDataSourceHandle.EXTENSION_ID_PROP,setDesign.getOdaExtensionDataSetId());
    setHandle.setName(setDesign.getName());
    setHandle.setDisplayName(setDesign.getDisplayName());
    Properties props=setDesign.getPublicProperties();
    if (props != null) {
      EList propList=props.getProperties();
      for (int i=0; i < propList.size(); i++) {
        Property prop=(Property)propList.get(i);
        setHandle.setProperty(prop.getName(),prop.getValue());
      }
    }
    props=setDesign.getPrivateProperties();
    if (props != null) {
      EList propList=props.getProperties();
      for (int i=0; i < propList.size(); i++) {
        Property prop=(Property)propList.get(i);
        setHandle.setPrivateDriverProperty(prop.getName(),prop.getValue());
      }
    }
    DesignValues designerValues=null;
    try {
      designerValues=SerializerImpl.instance().read(setHandle.getDesignerValues());
    }
 catch (    IOException e) {
    }
    ResultSets cachedResultSets=designerValues == null ? null : designerValues.getResultSets();
    ResultSetDefinition cachedResultDefn=null;
    if (cachedResultSets != null && !cachedResultSets.getResultSetDefinitions().isEmpty())     cachedResultDefn=(ResultSetDefinition)cachedResultSets.getResultSetDefinitions().get(0);
    updateROMResultSets(setHandle,new ResultSetsAdapter().newROMResultSets(setDesign,setHandle,cachedResultDefn));
    setHandle.setResultSetName(setDesign.getPrimaryResultSetName());
    setHandle.setQueryText(setDesign.getQueryText());
    List userDefinedList=new DataSetParameterAdapter().getUserDefinedParameter(designerValues,setDesign,setHandle);
    updateROMDataSetParams(setDesign,setHandle,designerValues == null ? null : designerValues.getDataSetParameters(),userDefinedList);
    DataSourceDesign sourceDesign=setDesign.getDataSourceDesign();
    if (sourceDesign != null) {
      OdaDataSourceHandle sourceHandle=(OdaDataSourceHandle)setHandle.getDataSource();
      if (isSourceChanged && sourceHandle != null && !sourceHandle.getModuleHandle().isReadOnly()) {
        setHandle.setDataSource(sourceDesign.getName());
        updateDataSourceHandle(sourceDesign,sourceHandle);
      }
      if (!isSourceChanged && sourceHandle != null && !sourceHandle.getModuleHandle().isReadOnly() && !(this.isEqualDataSourceDesign(createDataSourceDesign(sourceHandle),sourceDesign))) {
        updateDataSourceHandle(sourceDesign,sourceHandle);
      }
    }
 else     setHandle.setDataSource(null);
    updateDesignerValue(setDesign,setHandle,designerValues,userDefinedList);
  }
 catch (  SemanticException e) {
    stack.rollback();
    throw e;
  }
  stack.commit();
}