Program: 77809
Project: 77809
Buggy source:
void adaptBaseDataSet(DataSetHandle modelDataSet,BaseDataSetDesign dteDataSet) throws BirtException {
  if ((!(modelDataSet instanceof JointDataSetHandle)) && modelDataSet.getDataSource() == null)   throw new EngineException("String_Node_Str");
  if (!(modelDataSet instanceof JointDataSetHandle)) {
    dteDataSet.setDataSource(modelDataSet.getDataSource().getQualifiedName());
    dteDataSet.setBeforeOpenScript(modelDataSet.getBeforeOpen());
    dteDataSet.setAfterOpenScript(modelDataSet.getAfterOpen());
    dteDataSet.setOnFetchScript(modelDataSet.getOnFetch());
    dteDataSet.setBeforeCloseScript(modelDataSet.getBeforeClose());
    dteDataSet.setAfterCloseScript(modelDataSet.getAfterClose());
    HashMap paramBindingCandidates=new HashMap();
    Iterator elmtIter=modelDataSet.parametersIterator();
    if (elmtIter != null) {
      while (elmtIter.hasNext()) {
        DataSetParameterHandle modelParam=(DataSetParameterHandle)elmtIter.next();
        dteDataSet.addParameter(newParam(modelParam));
        if (modelParam.isInput()) {
          String defaultValueExpr=modelParam.getDefaultValue();
          if (defaultValueExpr != null)           paramBindingCandidates.put(modelParam.getName(),defaultValueExpr);
        }
      }
    }
    elmtIter=modelDataSet.paramBindingsIterator();
    if (elmtIter != null) {
      while (elmtIter.hasNext()) {
        ParamBindingHandle modelParamBinding=(ParamBindingHandle)elmtIter.next();
        paramBindingCandidates.put(modelParamBinding.getParamName(),modelParamBinding.getExpression());
      }
    }
    if (paramBindingCandidates.size() > 0) {
      elmtIter=paramBindingCandidates.keySet().iterator();
      while (elmtIter.hasNext()) {
        Object paramName=elmtIter.next();
        assert(paramName != null && paramName instanceof String);
        String expression=(String)paramBindingCandidates.get(paramName);
        dteDataSet.addInputParamBinding(newInputParamBinding((String)paramName,expression));
      }
    }
    dteDataSet.setCacheRowCount(modelDataSet.getCachedRowCount());
  }
  Iterator elmtIter=modelDataSet.computedColumnsIterator();
  if (elmtIter != null) {
    while (elmtIter.hasNext()) {
      ComputedColumnHandle modelCmptdColumn=(ComputedColumnHandle)elmtIter.next();
      IComputedColumn dteCmptdColumn=newComputedColumn(modelCmptdColumn);
      dteDataSet.addComputedColumn(dteCmptdColumn);
    }
  }
  elmtIter=modelDataSet.filtersIterator();
  if (elmtIter != null) {
    while (elmtIter.hasNext()) {
      FilterConditionHandle modelFilter=(FilterConditionHandle)elmtIter.next();
      IFilterDefinition dteFilter=newFilter(modelFilter);
      dteDataSet.addFilter(dteFilter);
    }
  }
  elmtIter=modelDataSet.resultSetIterator();
  if (elmtIter != null) {
    while (elmtIter.hasNext()) {
      ResultSetColumnHandle modelColumn=(ResultSetColumnHandle)elmtIter.next();
      dteDataSet.addResultSetHint(newColumnDefn(modelColumn));
    }
  }
  elmtIter=modelDataSet.columnHintsIterator();
  if (elmtIter != null) {
    List columnDefns=dteDataSet.getResultSetHints();
    while (elmtIter.hasNext()) {
      ColumnHintHandle modelColumnHint=(ColumnHintHandle)elmtIter.next();
      ColumnDefinition existDefn=findColumnDefn(columnDefns,modelColumnHint.getColumnName());
      if (existDefn != null)       updateColumnDefn(existDefn,modelColumnHint);
 else       dteDataSet.addResultSetHint(newColumnDefn(modelColumnHint));
    }
  }
}

Fixed version (ground truth):
void adaptBaseDataSet(DataSetHandle modelDataSet,BaseDataSetDesign dteDataSet) throws BirtException {
  if ((!(modelDataSet instanceof JointDataSetHandle)) && modelDataSet.getDataSource() == null)   throw new EngineException("String_Node_Str");
  if (!(modelDataSet instanceof JointDataSetHandle)) {
    dteDataSet.setDataSource(modelDataSet.getDataSource().getQualifiedName());
    dteDataSet.setBeforeOpenScript(modelDataSet.getBeforeOpen());
    dteDataSet.setAfterOpenScript(modelDataSet.getAfterOpen());
    dteDataSet.setOnFetchScript(modelDataSet.getOnFetch());
    dteDataSet.setBeforeCloseScript(modelDataSet.getBeforeClose());
    dteDataSet.setAfterCloseScript(modelDataSet.getAfterClose());
    HashMap paramBindingCandidates=new HashMap();
    Iterator elmtIter=modelDataSet.parametersIterator();
    if (elmtIter != null) {
      while (elmtIter.hasNext()) {
        DataSetParameterHandle modelParam=(DataSetParameterHandle)elmtIter.next();
        dteDataSet.addParameter(newParam(modelParam));
        if (modelParam.isInput()) {
          String defaultValueExpr=modelParam.getDefaultValue();
          if (defaultValueExpr != null)           paramBindingCandidates.put(modelParam.getName(),defaultValueExpr);
        }
      }
    }
    elmtIter=modelDataSet.paramBindingsIterator();
    if (elmtIter != null) {
      while (elmtIter.hasNext()) {
        ParamBindingHandle modelParamBinding=(ParamBindingHandle)elmtIter.next();
        paramBindingCandidates.put(modelParamBinding.getParamName(),modelParamBinding.getExpression());
      }
    }
    if (paramBindingCandidates.size() > 0) {
      elmtIter=paramBindingCandidates.keySet().iterator();
      while (elmtIter.hasNext()) {
        Object paramName=elmtIter.next();
        assert(paramName != null && paramName instanceof String);
        String expression=(String)paramBindingCandidates.get(paramName);
        dteDataSet.addInputParamBinding(newInputParamBinding((String)paramName,expression));
      }
    }
    dteDataSet.setCacheRowCount(modelDataSet.getCachedRowCount());
  }
  Iterator elmtIter=modelDataSet.computedColumnsIterator();
  if (elmtIter != null) {
    while (elmtIter.hasNext()) {
      ComputedColumnHandle modelCmptdColumn=(ComputedColumnHandle)elmtIter.next();
      IComputedColumn dteCmptdColumn=newComputedColumn(modelCmptdColumn);
      dteDataSet.addComputedColumn(dteCmptdColumn);
    }
  }
  elmtIter=modelDataSet.filtersIterator();
  if (elmtIter != null) {
    while (elmtIter.hasNext()) {
      FilterConditionHandle modelFilter=(FilterConditionHandle)elmtIter.next();
      IFilterDefinition dteFilter=newFilter(modelFilter);
      dteDataSet.addFilter(dteFilter);
    }
  }
  elmtIter=modelDataSet.resultSetHintsIterator();
  if (elmtIter != null) {
    while (elmtIter.hasNext()) {
      ResultSetColumnHandle modelColumn=(ResultSetColumnHandle)elmtIter.next();
      dteDataSet.addResultSetHint(newColumnDefn(modelColumn));
    }
  }
  elmtIter=modelDataSet.columnHintsIterator();
  if (elmtIter != null) {
    List columnDefns=dteDataSet.getResultSetHints();
    while (elmtIter.hasNext()) {
      ColumnHintHandle modelColumnHint=(ColumnHintHandle)elmtIter.next();
      ColumnDefinition existDefn=findColumnDefn(columnDefns,modelColumnHint.getColumnName());
      if (existDefn != null)       updateColumnDefn(existDefn,modelColumnHint);
 else       dteDataSet.addResultSetHint(newColumnDefn(modelColumnHint));
    }
  }
}