nus-yam/ex-repair huggingface dataset:
Program: 65110
Project: 65110
Buggy source:
/** 
 * @param dataSourceDesign
 * @param dataSetDesign
 * @return
 */
public static DataSourceAndDataSet newInstance(IBaseDataSourceDesign dataSourceDesign,IBaseDataSetDesign dataSetDesign,Collection paramterHints,String cacheScopeID){
  DataSourceAndDataSet dataSourceAndSet=new DataSourceAndDataSet();
  dataSourceAndSet.dataSourceDesign=dataSourceDesign;
  dataSourceAndSet.dataSetDesign=dataSetDesign;
  dataSourceAndSet.paramterHints=paramterHints;
  dataSourceAndSet.cacheScopeID=cacheScopeID;
  return dataSourceAndSet;
}

Fixed version (ground truth):
/** 
 * @param dataSourceDesign
 * @param dataSetDesign
 * @return
 */
public static DataSourceAndDataSet newInstance(IBaseDataSourceDesign dataSourceDesign,IBaseDataSetDesign dataSetDesign,Collection paramterHints,String cacheScopeID,boolean enableSamplePreview){
  DataSourceAndDataSet dataSourceAndSet=new DataSourceAndDataSet();
  dataSourceAndSet.dataSourceDesign=dataSourceDesign;
  dataSourceAndSet.dataSetDesign=dataSetDesign;
  dataSourceAndSet.paramterHints=paramterHints;
  dataSourceAndSet.cacheScopeID=cacheScopeID;
  dataSourceAndSet.enableSamplePreview=enableSamplePreview;
  return dataSourceAndSet;
}
Program: 65111
Project: 65111
Buggy source:
protected boolean fromCache() throws DataException {
  if (queryDefn.getQueryExecutionHints().enablePushDown()) {
    if (querySpec != null && querySpec.getResultSetSpecification() != null && !querySpec.getResultSetSpecification().isEmpty()) {
      if (appContext.get(DataEngine.QUERY_EXECUTION_SESSION_ID) == null) {
        dataEngine.getSession().getDataSetCacheManager().clearCache(dataEngine.getDataSourceDesign(this.dataSet.getDesign().getDataSourceName()),this.dataSet.getDesign());
      }
    }
  }
  return super.fromCache();
}

Fixed version (ground truth):
protected boolean fromCache() throws DataException {
  if (queryDefn.getQueryExecutionHints().enablePushDown()) {
    if (querySpec != null && querySpec.getResultSetSpecification() != null && !querySpec.getResultSetSpecification().isEmpty()) {
      if (!CacheIDFetcher.getInstance().enableSampleDataPreivew(appContext)) {
        dataEngine.getSession().getDataSetCacheManager().clearCache(dataEngine.getDataSourceDesign(this.dataSet.getDesign().getDataSourceName()),this.dataSet.getDesign());
      }
    }
  }
  return super.fromCache();
}
Program: 65112
Project: 65112
Buggy source:
private List<IBinding> getRequestColumnMap(){
  IQueryOptimizeHints hints=null;
  if (resultSetPopulator.getEventHandler().getAppContext() != null) {
    hints=(IQueryOptimizeHints)resultSetPopulator.getEventHandler().getAppContext().get(IQueryOptimizeHints.QUERY_OPTIMIZE_HINT);
  }
  if (hints != null) {
    return null;
  }
 else {
    return (this.resultSetPopulator.getQuery().getQueryDefinition() != null && ((IQueryDefinition)this.resultSetPopulator.getQuery().getQueryDefinition()).needAutoBinding()) ? null : resultSetPopulator.getEventHandler().getAllColumnBindings();
  }
}

Fixed version (ground truth):
private List<IBinding> getRequestColumnMap(){
  try {
    if (DataSetStore.isDataMartStore(this.resultSetPopulator.getEventHandler().getAppContext(),this.resultSetPopulator.getSession())) {
      return null;
    }
  }
 catch (  DataException e) {
  }
  return (this.resultSetPopulator.getQuery().getQueryDefinition() != null && ((IQueryDefinition)this.resultSetPopulator.getQuery().getQueryDefinition()).needAutoBinding()) ? null : resultSetPopulator.getEventHandler().getAllColumnBindings();
}
Program: 65113
Project: 65113
Buggy source:
private List<IBinding> getRequestColumnMap(){
  IQueryOptimizeHints hints=null;
  if (handler.getAppContext() != null) {
    hints=(IQueryOptimizeHints)handler.getAppContext().get(IQueryOptimizeHints.QUERY_OPTIMIZE_HINT);
  }
  if (hints != null) {
    return null;
  }
 else {
    return (this.query instanceof IQueryDefinition) && ((IQueryDefinition)this.query).needAutoBinding() ? null : this.handler.getAllColumnBindings();
  }
}

Fixed version (ground truth):
private List<IBinding> getRequestColumnMap(){
  try {
    if (DataSetStore.isDataMartStore(handler.getAppContext(),this.session)) {
      return null;
    }
  }
 catch (  DataException e) {
  }
  return (this.query instanceof IQueryDefinition) && ((IQueryDefinition)this.query).needAutoBinding() ? null : this.handler.getAllColumnBindings();
}
Program: 65114
Project: 65114
Buggy source:
public boolean canLeave(){
  if (this.modelChanged && this.getContainer() != null && this.getContainer() instanceof DataSetEditor) {
    this.modelChanged=false;
    ((DataSetEditor)getContainer()).updateDataSetDesign(this);
  }
  return true;
}

Fixed version (ground truth):
public boolean canLeave(){
  if (this.modelChanged && this.getContainer() != null && this.getContainer() instanceof DataSetEditor) {
    this.modelChanged=false;
    ((DataSetEditor)getContainer()).updateDataSetDesign(this);
    try {
      DataSetUIUtil.updateColumnCache((DataSetHandle)getContainer().getModel());
    }
 catch (    SemanticException e) {
      e.printStackTrace();
    }
  }
  return true;
}
Program: 65115
Project: 65115
Buggy source:
protected QueryDefinition constructQuery(DataSetHandle dataset,DataRequestSession session) throws BirtException {
  QueryDefinition query=super.constructQuery(dataset,session);
  PropertyHandle propertyHandle=dataset.getPropertyHandle(DataSetHandle.PARAMETERS_PROP);
  int paramsSize=propertyHandle.getListValue().size();
  Iterator paramIter=propertyHandle.iterator();
  for (int n=1; n <= paramsSize; n++) {
    DataSetParameterHandle paramDefn=(DataSetParameterHandle)paramIter.next();
    if (!paramDefn.isOutput())     continue;
    String bindingName=paramDefn.getName();
    IBinding binding=new Binding(bindingName);
    binding.setExpression(new ScriptExpression(PREFIX_OUTPUTPARAMETER + "String_Node_Str" + paramDefn.getName()+ "String_Node_Str"));
    binding.setDataType(DataAdapterUtil.adaptModelDataType(paramDefn.getDataType()));
    query.addBinding(binding);
  }
  return query;
}

Fixed version (ground truth):
protected QueryDefinition constructQuery(DataSetHandle dataset,DataRequestSession session) throws BirtException {
  QueryDefinition query=super.constructQuery(dataset,session);
  query.getBindings().clear();
  PropertyHandle propertyHandle=dataset.getPropertyHandle(DataSetHandle.PARAMETERS_PROP);
  int paramsSize=propertyHandle.getListValue().size();
  Iterator paramIter=propertyHandle.iterator();
  for (int n=1; n <= paramsSize; n++) {
    DataSetParameterHandle paramDefn=(DataSetParameterHandle)paramIter.next();
    if (!paramDefn.isOutput())     continue;
    String bindingName=paramDefn.getName();
    IBinding binding=new Binding(bindingName);
    binding.setExpression(new ScriptExpression(PREFIX_OUTPUTPARAMETER + "String_Node_Str" + paramDefn.getName()+ "String_Node_Str"));
    binding.setDataType(DataAdapterUtil.adaptModelDataType(paramDefn.getDataType()));
    query.addBinding(binding);
  }
  return query;
}
Program: 65116
Project: 65116
Buggy source:
/** 
 * @param appContext
 * @param dsource
 * @param dset
 * @param moduleHandle
 * @throws BirtException
 */
void preDefineDataSet(DataSessionContext appContext,IBaseDataSourceDesign dsource,IBaseDataSetDesign dset,IDataQueryDefinition query,IDataQueryDefinition[] registedQueries) throws BirtException ;

Fixed version (ground truth):
/** 
 * @param dsource
 * @param dset
 * @param query
 * @param registedQueries
 * @param dContext
 * @param session
 * @throws BirtException
 */
void preDefineDataSet(IBaseDataSourceDesign dsource,IBaseDataSetDesign dset,IDataQueryDefinition query,IDataQueryDefinition[] registedQueries,DataSessionContext dContext,String tempDir) throws BirtException ;
Program: 65119
Project: 65119
Buggy source:
/** 
 * Makes one pass over the odiResult and calculates values for all aggregate expressions. odiResult must be open, and cursor placed at first row. Upon return, odiResult is rewinded to first row. Before calling this method, a Javascript "row" object must be set up in the passed-in JS context and bound to the passed in odiResult.
 */
private void calculate() throws DataException {
  List validAggregations=new ArrayList();
  boolean[] populateAggrValue=new boolean[this.currentAggrCount];
  int count=1;
  for (int i=0; i < this.currentAggrCount; i++) {
    validAggregations.add(Integer.valueOf(i));
    if (this.getAggrInfo(i).getAggregation().getNumberOfPasses() > 1)     populateAggrValue[i]=false;
 else     populateAggrValue[i]=true;
    accumulatorManagers[i]=new AccumulatorManager(this.getAggrInfo(i).getAggregation());
  }
  while (validAggregations.size() > 0) {
    int[] validAggregationArray=new int[validAggregations.size()];
    for (int i=0; i < validAggregations.size(); i++) {
      validAggregationArray[i]=((Integer)validAggregations.get(i)).intValue();
    }
    assert(this.getCurrentResult() == null || this.getCurrentResultIndex() == 0);
    if (this.getCurrentResult() == null) {
      return;
    }
    pass(populateAggrValue,validAggregationArray);
    this.first(0);
    count++;
    prepareNextIteration(validAggregations,populateAggrValue,count);
  }
}

Fixed version (ground truth):
/** 
 * Makes one pass over the odiResult and calculates values for all aggregate expressions. odiResult must be open, and cursor placed at first row. Upon return, odiResult is rewinded to first row. Before calling this method, a Javascript "row" object must be set up in the passed-in JS context and bound to the passed in odiResult.
 */
private void calculate() throws DataException {
  List validAggregations=new ArrayList();
  boolean[] populateAggrValue=new boolean[this.currentAggrCount];
  int count=1;
  for (int i=0; i < this.currentAggrCount; i++) {
    validAggregations.add(Integer.valueOf(i));
    if (this.getAggrInfo(i).getAggregation().getNumberOfPasses() > 1)     populateAggrValue[i]=false;
 else     populateAggrValue[i]=true;
    accumulatorManagers[i]=new AccumulatorManager(this.getAggrInfo(i).getAggregation());
  }
  while (validAggregations.size() > 0) {
    int[] validAggregationArray=new int[validAggregations.size()];
    for (int i=0; i < validAggregations.size(); i++) {
      validAggregationArray[i]=((Integer)validAggregations.get(i)).intValue();
    }
    assert(this.getCurrentResult() == null || this.getCurrentResultIndex() == 0);
    if (this.getCurrentResult() == null) {
      for (int i=0; i < accumulatorManagers.length; i++) {
        Accumulator a=accumulatorManagers[i].getCurrentAccumulator();
        a.finish();
        currentRoundAggrValue[i].add(a.getValue());
      }
      return;
    }
    pass(populateAggrValue,validAggregationArray);
    this.first(0);
    count++;
    prepareNextIteration(validAggregations,populateAggrValue,count);
  }
}
Program: 65120
Project: 65120
Buggy source:
public boolean canLeave(){
  if (isValid()) {
    saveOutputColumns();
    if (this.modelChanged) {
      ((DataSetEditor)this.getContainer()).updateDataSetDesign(this);
      this.modelChanged=false;
    }
    this.pageActivated=false;
    return super.canLeave();
  }
 else   return false;
}

Fixed version (ground truth):
public boolean canLeave(){
  if (isValid()) {
    saveOutputColumns();
    if (this.modelChanged) {
      ((DataSetEditor)this.getContainer()).updateDataSetDesign(this);
      updateColumnCache();
      this.modelChanged=false;
    }
    this.pageActivated=false;
    return super.canLeave();
  }
 else   return false;
}
Program: 65122
Project: 65122
Buggy source:
/** 
 * Returns the index of specified expression on GroupDefinition.
 * @param expr specified expression.
 * @param groupDefinitions list of <code>GroupDefinition</code>
 * @return
 * @throws ChartException
 */
private int getGroupIndex(String expr,List<IGroupDefinition> groupDefinitions) throws ChartException {
  if (expr == null) {
    return -1;
  }
  exprCodec.decode(expr);
  Set<String> bindingNameSet=exprCodec.getRowBindingNameSet();
  boolean isJavaScript=ExpressionCodec.JAVASCRIPT.equals(exprCodec.getType());
  for (int i=0; i < groupDefinitions.size(); i++) {
    IGroupDefinition gd=groupDefinitions.get(i);
    String exprGroupKey=gd.getKeyExpression();
    if (isJavaScript) {
      if (expr.indexOf(exprGroupKey) >= 0) {
        return i;
      }
    }
    if (!bindingNameSet.isEmpty()) {
      Set<String> grpBindings=exprCodec.getRowBindingNameSet(exprGroupKey);
      for (      String grpBinding : grpBindings) {
        if (bindingNameSet.contains(grpBinding)) {
          return i;
        }
      }
    }
  }
  return -1;
}

Fixed version (ground truth):
/** 
 * Returns the index of specified expression on GroupDefinition.
 * @param expr specified expression.
 * @param groupDefinitions list of <code>GroupDefinition</code>
 * @param isCategory
 * @return
 * @throws ChartException
 */
private int getGroupIndex(String expr,List<IGroupDefinition> groupDefinitions,boolean isCategory) throws ChartException {
  if (expr == null) {
    return -1;
  }
  exprCodec.decode(expr);
  Set<String> bindingNameSet=exprCodec.getRowBindingNameSet();
  boolean isJavaScript=ExpressionCodec.JAVASCRIPT.equals(exprCodec.getType());
  if (isCategory) {
    for (int i=groupDefinitions.size() - 1; i >= 0; i--) {
      IGroupDefinition gd=groupDefinitions.get(i);
      String exprGroupKey=gd.getKeyExpression();
      if (isJavaScript) {
        if (expr.indexOf(exprGroupKey) >= 0) {
          return i;
        }
      }
      if (!bindingNameSet.isEmpty()) {
        Set<String> grpBindings=exprCodec.getRowBindingNameSet(exprGroupKey);
        for (        String grpBinding : grpBindings) {
          if (bindingNameSet.contains(grpBinding)) {
            return i;
          }
        }
      }
    }
  }
 else {
    for (int i=0; i < groupDefinitions.size(); i++) {
      IGroupDefinition gd=groupDefinitions.get(i);
      String exprGroupKey=gd.getKeyExpression();
      if (isJavaScript) {
        if (expr.indexOf(exprGroupKey) >= 0) {
          return i;
        }
      }
      if (!bindingNameSet.isEmpty()) {
        Set<String> grpBindings=exprCodec.getRowBindingNameSet(exprGroupKey);
        for (        String grpBinding : grpBindings) {
          if (bindingNameSet.contains(grpBinding)) {
            return i;
          }
        }
      }
    }
  }
  return -1;
}
Program: 65124
Project: 65124
Buggy source:
protected QueryDefinition constructQuery(DataSetHandle dataset) throws DataException {
  QueryDefinition query=super.constructQuery(dataset);
  PropertyHandle propertyHandle=dataset.getPropertyHandle(DataSetHandle.PARAMETERS_PROP);
  int paramsSize=propertyHandle.getListValue().size();
  Iterator paramIter=propertyHandle.iterator();
  for (int n=1; n <= paramsSize; n++) {
    DataSetParameterHandle paramDefn=(DataSetParameterHandle)paramIter.next();
    if (!paramDefn.isOutput())     continue;
    String bindingName=paramDefn.getName();
    IBinding binding=new Binding(bindingName);
    binding.setExpression(new ScriptExpression(PREFIX_OUTPUTPARAMETER + "String_Node_Str" + paramDefn.getName()+ "String_Node_Str"));
    binding.setDataType(DataAdapterUtil.adaptModelDataType(paramDefn.getDataType()));
    query.addBinding(binding);
  }
  return query;
}

Fixed version (ground truth):
protected QueryDefinition constructQuery(DataSetHandle dataset,DataRequestSession session) throws BirtException {
  QueryDefinition query=super.constructQuery(dataset,session);
  PropertyHandle propertyHandle=dataset.getPropertyHandle(DataSetHandle.PARAMETERS_PROP);
  int paramsSize=propertyHandle.getListValue().size();
  Iterator paramIter=propertyHandle.iterator();
  for (int n=1; n <= paramsSize; n++) {
    DataSetParameterHandle paramDefn=(DataSetParameterHandle)paramIter.next();
    if (!paramDefn.isOutput())     continue;
    String bindingName=paramDefn.getName();
    IBinding binding=new Binding(bindingName);
    binding.setExpression(new ScriptExpression(PREFIX_OUTPUTPARAMETER + "String_Node_Str" + paramDefn.getName()+ "String_Node_Str"));
    binding.setDataType(DataAdapterUtil.adaptModelDataType(paramDefn.getDataType()));
    query.addBinding(binding);
  }
  return query;
}
Program: 65125
Project: 65125
Buggy source:
/** 
 * Transforms dimension value to points.
 * @param handle
 * @param dpi to convert px unit
 * @return the dimension value with measure of points
 * @since 2.3
 */
public static double convertToPoints(org.eclipse.birt.report.model.api.DimensionHandle handle,int dpi){
  double retValue=0.0;
  if (handle.getMeasure() > 0 && handle.getUnits().trim().length() > 0) {
    if (handle.getUnits() == DesignChoiceConstants.UNITS_PT) {
      retValue=handle.getMeasure();
    }
 else     if (handle.getUnits() == DesignChoiceConstants.UNITS_PX) {
      retValue=(handle.getMeasure() * 72d) / dpi;
    }
 else {
      retValue=DimensionUtil.convertTo(handle.getMeasure(),handle.getUnits(),DesignChoiceConstants.UNITS_PT).getMeasure();
    }
  }
  return retValue;
}

Fixed version (ground truth):
/** 
 * Transforms dimension value to points.
 * @param handle
 * @param dpi to convert px unit
 * @return the dimension value with measure of points
 * @since 2.3
 */
public static double convertToPoints(org.eclipse.birt.report.model.api.DimensionHandle handle,int dpi){
  double retValue=0.0;
  if (handle.getMeasure() > 0 && handle.getUnits().trim().length() > 0) {
    if (DesignChoiceConstants.UNITS_PT.equalsIgnoreCase(handle.getUnits())) {
      retValue=handle.getMeasure();
    }
 else     if (DesignChoiceConstants.UNITS_PX.equalsIgnoreCase(handle.getUnits())) {
      retValue=(handle.getMeasure() * 72d) / dpi;
    }
 else {
      retValue=DimensionUtil.convertTo(handle.getMeasure(),handle.getUnits(),DesignChoiceConstants.UNITS_PT).getMeasure();
    }
  }
  return retValue;
}
Program: 65126
Project: 65126
Buggy source:
public boolean canLeave(){
  return validateAllComputedColumns();
}

Fixed version (ground truth):
public boolean canLeave(){
  if (validateAllComputedColumns()) {
    updateColumnCache();
    return true;
  }
  return false;
}
Program: 65127
Project: 65127
Buggy source:
protected void updateComputedColumn(Object structureOrHandle){
  if (structureOrHandle instanceof ComputedColumn) {
    try {
      computedColumns.addItem((ComputedColumn)structureOrHandle);
      viewer.getViewer().refresh();
    }
 catch (    SemanticException e) {
      ExceptionHandler.handle(e);
    }
  }
 else {
    viewer.getViewer().update(structureOrHandle,null);
  }
  if (validateAllComputedColumns())   getContainer().setMessage(Messages.getString("String_Node_Str"),IMessageProvider.NONE);
  updateColumnCache();
}

Fixed version (ground truth):
protected void updateComputedColumn(Object structureOrHandle){
  if (structureOrHandle instanceof ComputedColumn) {
    try {
      computedColumns.addItem((ComputedColumn)structureOrHandle);
      viewer.getViewer().refresh();
    }
 catch (    SemanticException e) {
      ExceptionHandler.handle(e);
    }
  }
 else {
    viewer.getViewer().update(structureOrHandle,null);
  }
  if (validateAllComputedColumns())   getContainer().setMessage(Messages.getString("String_Node_Str"),IMessageProvider.NONE);
}
Program: 65128
Project: 65128
Buggy source:
public static boolean isKeepCubeHierarchyAndNotCubeTopLevelOnCategory(Chart model,CubeHandle cubeHandle,ReportItemHandle itemHandle){
  boolean isKeepCubeHierarchy=isKeepCubeHierarchyOnCategory(model);
  if (!isKeepCubeHierarchy) {
    return false;
  }
  if (cubeHandle == null) {
    return false;
  }
  SeriesDefinition sd=ChartUtil.getBaseSeriesDefinitions(model).get(0);
  Query query=ChartUtil.getDataQuery(sd,0);
  return !isCubeTopLevel(query,itemHandle);
}

Fixed version (ground truth):
public static boolean isKeepCubeHierarchyAndNotCubeTopLevelOnCategory(Chart model,CubeHandle cubeHandle,ReportItemHandle itemHandle){
  if (model == null) {
    return false;
  }
  boolean isKeepCubeHierarchy=isKeepCubeHierarchyOnCategory(model);
  if (!isKeepCubeHierarchy) {
    return false;
  }
  if (cubeHandle == null) {
    return false;
  }
  SeriesDefinition sd=ChartUtil.getBaseSeriesDefinitions(model).get(0);
  Query query=ChartUtil.getDataQuery(sd,0);
  return !isCubeTopLevel(query,itemHandle);
}
Program: 65129
Project: 65129
Buggy source:
public static boolean isKeepCubeHierarchyAndNotCubeTopLevelOnSeries(Chart model,CubeHandle cubeHandle,ReportItemHandle itemHandle){
  boolean isKeepCubeHierarchy=isKeepCubeHierarchyOnSeries(model);
  if (!isKeepCubeHierarchy) {
    return false;
  }
  if (cubeHandle == null) {
    return false;
  }
  Query query=ChartUtil.getAllOrthogonalSeriesDefinitions(model).get(0).getQuery();
  return !isCubeTopLevel(query,itemHandle);
}

Fixed version (ground truth):
public static boolean isKeepCubeHierarchyAndNotCubeTopLevelOnSeries(Chart model,CubeHandle cubeHandle,ReportItemHandle itemHandle){
  if (model == null) {
    return false;
  }
  boolean isKeepCubeHierarchy=isKeepCubeHierarchyOnSeries(model);
  if (!isKeepCubeHierarchy) {
    return false;
  }
  if (cubeHandle == null) {
    return false;
  }
  Query query=ChartUtil.getAllOrthogonalSeriesDefinitions(model).get(0).getQuery();
  return !isCubeTopLevel(query,itemHandle);
}
Program: 65130
Project: 65130
Buggy source:
private static Date getDate(int year,int month,int day,int hours,int minutes,int seconds){
  Date newDate=new Date();
  Calendar calendar=getCalendar(newDate);
  calendar.set(year,month,day,hours,minutes,seconds);
  return calendar.getTime();
}

Fixed version (ground truth):
private static Date getDate(int year,int month,int day,int hours,int minutes,int seconds){
  Date newDate=new Date();
  Calendar calendar=getCalendar(newDate);
  calendar.set(year,month,day,hours,minutes,seconds);
  calendar.set(Calendar.MILLISECOND,0);
  return calendar.getTime();
}
Program: 65132
Project: 65132
Buggy source:
public BaseTopBottomAccumulator(){
  if (DataEngineThreadLocal.getInstance().getPathManager() != null) {
    tempDir=DataEngineThreadLocal.getInstance().getPathManager().getTempFileName("String_Node_Str",this.hashCode(),null) + File.separator;
  }
 else {
    tempDir=System.getProperty("String_Node_Str") + "String_Node_Str" + this.hashCode()+ File.separator;
  }
  targetValue=new BasicCachedArray(tempDir,0);
}

Fixed version (ground truth):
public BaseTopBottomAccumulator(){
  if (DataEngineThreadLocal.getInstance().getPathManager() != null) {
    tempDir=DataEngineThreadLocal.getInstance().getPathManager().getTempFileName("String_Node_Str",this.hashCode(),null) + File.separator;
  }
 else {
    tempDir=System.getProperty("String_Node_Str") + "String_Node_Str" + this.hashCode()+ File.separator;
  }
  targetValue=new BasicCachedArray(tempDir,0);
  DataEngineThreadLocal.getInstance().getCloseListener().add(this);
}
Program: 65133
Project: 65133
Buggy source:
private String getDataText(Object element){
  if (element != null) {
    if (expectedColumnDataType == DataType.SQL_DATE_TYPE && element instanceof Date) {
      formatter.applyPattern("String_Node_Str");
      return formatter.format((Date)element);
    }
 else     if (expectedColumnDataType == DataType.SQL_TIME_TYPE && element instanceof Date) {
      formatter.applyPattern("String_Node_Str");
      return formatter.format((Date)element);
    }
 else     if (expectedColumnDataType == DataType.DATE_TYPE && element instanceof Date) {
      formatter.applyPattern("String_Node_Str");
      return formatter.format((Date)element);
    }
 else {
      try {
        return DataTypeUtil.toString(element);
      }
 catch (      BirtException e) {
        return String.valueOf(element);
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private String getDataText(Object element){
  if (element != null) {
    if (expectedColumnDataType == DataType.SQL_DATE_TYPE && element instanceof Date) {
      formatter.applyPattern("String_Node_Str");
      return formatter.format((Date)element);
    }
 else     if (expectedColumnDataType == DataType.SQL_TIME_TYPE && element instanceof Date) {
      formatter.applyPattern("String_Node_Str");
      return formatter.format((Date)element);
    }
 else     if (expectedColumnDataType == DataType.DATE_TYPE && element instanceof Date) {
      formatter.applyPattern("String_Node_Str");
      return formatter.format((Date)element);
    }
 else     if (element instanceof Number) {
      try {
        return DataTypeUtil.toLocaleNeutralString(element);
      }
 catch (      BirtException e) {
        return String.valueOf(element);
      }
    }
 else {
      try {
        return DataTypeUtil.toString(element);
      }
 catch (      BirtException e) {
        return String.valueOf(element);
      }
    }
  }
  return null;
}
Program: 65134
Project: 65134
Buggy source:
protected void updateComputedColumn(Object structureOrHandle){
  if (structureOrHandle instanceof ComputedColumn) {
    try {
      computedColumns.addItem((ComputedColumn)structureOrHandle);
      viewer.getViewer().refresh();
    }
 catch (    SemanticException e) {
      ExceptionHandler.handle(e);
    }
  }
 else {
    viewer.getViewer().update(structureOrHandle,null);
  }
  if (validateAllComputedColumns())   getContainer().setMessage(Messages.getString("String_Node_Str"),IMessageProvider.NONE);
}

Fixed version (ground truth):
protected void updateComputedColumn(Object structureOrHandle){
  if (structureOrHandle instanceof ComputedColumn) {
    try {
      computedColumns.addItem((ComputedColumn)structureOrHandle);
      viewer.getViewer().refresh();
    }
 catch (    SemanticException e) {
      ExceptionHandler.handle(e);
    }
  }
 else {
    viewer.getViewer().update(structureOrHandle,null);
  }
  if (validateAllComputedColumns())   getContainer().setMessage(Messages.getString("String_Node_Str"),IMessageProvider.NONE);
  updateColumnCache();
}
Program: 65135
Project: 65135
Buggy source:
/** 
 * Set the resultset metadata in dataset design
 * @param dataSetDesign
 * @param md
 * @throws OdaException
 */
private static void setResultSetMetaData(DataSetDesign dataSetDesign,IResultSetMetaData md) throws OdaException {
  ResultSetColumns columns=DesignSessionUtil.toResultSetColumnsDesign(md);
  if (columns != null) {
    ResultSetDefinition resultSetDefn=DesignFactory.eINSTANCE.createResultSetDefinition();
    resultSetDefn.setResultSetColumns(columns);
    dataSetDesign.setPrimaryResultSet(resultSetDefn);
    dataSetDesign.getResultSets().setDerivedMetaData(true);
  }
 else {
    dataSetDesign.setResultSets(null);
  }
}

Fixed version (ground truth):
/** 
 * Set the resultset metadata in dataset design
 * @param dataSetDesign
 * @param md
 * @throws OdaException
 */
private static void setResultSetMetaData(DataSetDesign dataSetDesign,IResultSetMetaData md) throws OdaException {
  if (md == null || dataSetDesign == null)   return;
  ResultSetColumns columns=DesignSessionUtil.toResultSetColumnsDesign(md);
  if (columns != null) {
    ResultSetDefinition resultSetDefn=DesignFactory.eINSTANCE.createResultSetDefinition();
    resultSetDefn.setResultSetColumns(columns);
    dataSetDesign.setPrimaryResultSet(resultSetDefn);
    dataSetDesign.getResultSets().setDerivedMetaData(true);
  }
 else {
    dataSetDesign.setResultSets(null);
  }
}
Program: 65136
Project: 65136
Buggy source:
/** 
 * init save environment
 */
private void initSave(boolean finish) throws DataException {
  if (inited == true)   return;
  inited=true;
  try {
    IOUtil.writeInt(this.rowExprsDos,rowCount);
    Map map=new HashMap();
    Iterator it=exprNameSet.iterator();
    while (it.hasNext()) {
      Object value=it.next();
      map.put(value,value);
    }
    int rowBytes=this.version >= VersionManager.VERSION_2_2_1_3 ? this.initSave(map) : this.saveExprValue(map);
    IOUtil.writeInt(this.rowExprsDos,rowBytes);
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e);
  }
}

Fixed version (ground truth):
/** 
 * init save environment
 */
private void initSave(boolean finish) throws DataException {
  if (inited == true)   return;
  inited=true;
  try {
    IOUtil.writeInt(this.rowExprsDos,rowCount);
    Map map=new HashMap();
    Iterator it=exprNameSet.iterator();
    while (it.hasNext()) {
      Object value=it.next();
      map.put(value,value);
    }
    int rowBytes=this.version >= VersionManager.VERSION_2_2_1_3 ? this.initSave(map) : this.saveExprValue(map);
    IOUtil.writeInt(this.rowExprsDos,rowBytes);
    this.rowExprsDos.flush();
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.RD_SAVE_ERROR,e);
  }
}
Program: 65138
Project: 65138
Buggy source:
public BaseTopBottomAccumulator(){
  this.tempDir=TempDir.getInstance().getPath();
  targetValue=new BasicCachedArray(tempDir,0);
}

Fixed version (ground truth):
public BaseTopBottomAccumulator(){
  if (DataEngineThreadLocal.getInstance().getPathManager() != null) {
    tempDir=DataEngineThreadLocal.getInstance().getPathManager().getTempFileName("String_Node_Str",this.hashCode(),null) + File.separator;
  }
 else {
    tempDir=System.getProperty("String_Node_Str") + "String_Node_Str" + this.hashCode()+ File.separator;
  }
  targetValue=new BasicCachedArray(tempDir,0);
}
Program: 65139
Project: 65139
Buggy source:
@Override public void stop(BundleContext context) throws Exception {
  TempDir.release();
  super.stop(context);
}

Fixed version (ground truth):
@Override public void stop(BundleContext context) throws Exception {
  super.stop(context);
}
Program: 65140
Project: 65140
Buggy source:
@Override public void start(BundleContext context) throws Exception {
  super.start(context);
  String tempDir=System.getProperty("String_Node_Str") + "String_Node_Str" + this.getBundle().hashCode()+ File.separator;
  TempDir.createInstance(tempDir);
}

Fixed version (ground truth):
@Override public void start(BundleContext context) throws Exception {
  super.start(context);
}
Program: 65141
Project: 65141
Buggy source:
/** 
 * @param subqueryLocator
 * @param sourceResultIterator
 * @return
 * @throws BirtException 
 */
private org.eclipse.birt.data.engine.api.IResultIterator getSubQueryIterator(SubqueryLocator subqueryLocator,org.eclipse.birt.data.engine.api.IResultIterator sourceResultIterator) throws BirtException {
  org.eclipse.birt.data.engine.api.IResultIterator resultIterator=sourceResultIterator;
  if (subqueryLocator.getParentQuery() != null && subqueryLocator.getParentQuery() instanceof SubqueryLocator) {
    resultIterator=getSubQueryIterator((SubqueryLocator)subqueryLocator.getParentQuery(),sourceResultIterator);
  }
  resultIterator.moveTo(subqueryLocator.getRowId());
  return resultIterator.getSecondaryIterator(subqueryLocator.getName(),queryScope);
}

Fixed version (ground truth):
/** 
 * @param subqueryLocator
 * @param sourceResultIterator
 * @return
 * @throws BirtException 
 */
private org.eclipse.birt.data.engine.api.IResultIterator getSubQueryIterator(SubqueryLocator subqueryLocator,org.eclipse.birt.data.engine.api.IResultIterator sourceResultIterator) throws BirtException {
  org.eclipse.birt.data.engine.api.IResultIterator resultIterator=sourceResultIterator;
  if (subqueryLocator.getParentQuery() != null && subqueryLocator.getParentQuery() instanceof SubqueryLocator) {
    resultIterator=getSubQueryIterator((SubqueryLocator)subqueryLocator.getParentQuery(),sourceResultIterator);
  }
  if (subqueryLocator.getRowId() <= -1 && resultIterator.isEmpty()) {
    return resultIterator.getSecondaryIterator(subqueryLocator.getName(),queryScope);
  }
 else   resultIterator.moveTo(subqueryLocator.getRowId());
  return resultIterator.getSecondaryIterator(subqueryLocator.getName(),queryScope);
}
Program: 65142
Project: 65142
Buggy source:
/** 
 * @return
 * @throws IOException
 */
private long getOffset() throws IOException {
  return randomAccessFile.getFilePointer();
}

Fixed version (ground truth):
/** 
 * @return
 * @throws IOException
 */
private long getOffset() throws IOException {
  return getRandomAccessFile().getFilePointer();
}
Program: 65143
Project: 65143
Buggy source:
/** 
 * @throws IOException
 */
public BaseDiskArray() throws IOException {
  this.currentCacheStartIndex=0;
  this.size=0;
  this.buffer=new Object[bufferSize];
  this.segmentOffsets=new ArrayList<Long>();
  this.segmentOffsets.add(Long.valueOf(0L));
  createRandomAccessFile();
  DataEngineThreadLocal.getInstance().getCloseListener().add(this);
}

Fixed version (ground truth):
/** 
 * @throws IOException
 */
public BaseDiskArray() throws IOException {
  this.currentCacheStartIndex=0;
  this.size=0;
  this.buffer=new Object[bufferSize];
  this.segmentOffsets=new ArrayList<Long>();
  this.segmentOffsets.add(Long.valueOf(0L));
  DataEngineThreadLocal.getInstance().getCloseListener().add(this);
}
Program: 65144
Project: 65144
Buggy source:
/** 
 * Reads up to <code>readSize</code> objects from disk.
 * @param dis
 * @param list
 * @return
 * @throws IOException
 */
private void readObjects(long offset,int readSize) throws IOException {
  this.randomAccessFile.seek(offset);
  for (int i=0; i < readSize; i++) {
    this.buffer[i]=readObject();
  }
}

Fixed version (ground truth):
/** 
 * Reads up to <code>readSize</code> objects from disk.
 * @param dis
 * @param list
 * @return
 * @throws IOException
 */
private void readObjects(long offset,int readSize) throws IOException {
  getRandomAccessFile().seek(offset);
  for (int i=0; i < readSize; i++) {
    this.buffer[i]=readObject();
  }
}
Program: 65145
Project: 65145
Buggy source:
protected void writeObject(Object object) throws IOException {
  if (object == null) {
    randomAccessFile.writeShort(NULL_VALUE);
    return;
  }
  randomAccessFile.writeShort(NORMAL_VALUE);
  if (fieldWriter == null) {
    fieldWriter=IOUtil.getRandomWriter(DataType.getDataType(object.getClass()));
    fieldReader=IOUtil.getRandomReader(DataType.getDataType(object.getClass()));
  }
  fieldWriter.write(randomAccessFile,object);
}

Fixed version (ground truth):
protected void writeObject(Object object) throws IOException {
  if (object == null) {
    getRandomAccessFile().writeShort(NULL_VALUE);
    return;
  }
  getRandomAccessFile().writeShort(NORMAL_VALUE);
  if (fieldWriter == null) {
    fieldWriter=IOUtil.getRandomWriter(DataType.getDataType(object.getClass()));
    fieldReader=IOUtil.getRandomReader(DataType.getDataType(object.getClass()));
  }
  fieldWriter.write(getRandomAccessFile(),object);
}
Program: 65146
Project: 65146
Buggy source:
protected Object readObject() throws IOException {
  short fieldCount=randomAccessFile.readShort();
  if (fieldCount == NULL_VALUE) {
    return null;
  }
  return fieldReader.read(randomAccessFile);
}

Fixed version (ground truth):
protected Object readObject() throws IOException {
  short fieldCount=getRandomAccessFile().readShort();
  if (fieldCount == NULL_VALUE) {
    return null;
  }
  return fieldReader.read(getRandomAccessFile());
}
Program: 65147
Project: 65147
Buggy source:
protected void writeObject(Object object) throws IOException {
  if (object == null) {
    randomAccessFile.writeShort(NULL_VALUE);
    return;
  }
  IStructure cachedObject=(IStructure)object;
  Object[] objects=cachedObject.getFieldValues();
  randomAccessFile.writeShort((short)objects.length);
  if (fieldWriters == null || fieldWriters.length < objects.length) {
    createReadersAndWriters(objects.length);
  }
  for (int i=0; i < objects.length; i++) {
    if (i >= fieldWriters.length) {
      fieldWriters[fieldWriters.length - 1].write(randomAccessFile,objects[i]);
    }
 else {
      fieldWriters[i].write(randomAccessFile,objects[i]);
    }
  }
}

Fixed version (ground truth):
protected void writeObject(Object object) throws IOException {
  if (object == null) {
    getRandomAccessFile().writeShort(NULL_VALUE);
    return;
  }
  IStructure cachedObject=(IStructure)object;
  Object[] objects=cachedObject.getFieldValues();
  getRandomAccessFile().writeShort((short)objects.length);
  if (fieldWriters == null || fieldWriters.length < objects.length) {
    createReadersAndWriters(objects.length);
  }
  for (int i=0; i < objects.length; i++) {
    if (i >= fieldWriters.length) {
      fieldWriters[fieldWriters.length - 1].write(getRandomAccessFile(),objects[i]);
    }
 else {
      fieldWriters[i].write(getRandomAccessFile(),objects[i]);
    }
  }
}
Program: 65148
Project: 65148
Buggy source:
protected Object readObject() throws IOException {
  short fieldCount=randomAccessFile.readShort();
  if (fieldCount == NULL_VALUE) {
    return null;
  }
  Object[] objects=new Object[fieldCount];
  for (int i=0; i < objects.length; i++) {
    if (i < fieldReaders.length && fieldReaders[i].getDataType() != fieldWriters[i].getDataType())     fieldReaders[i].setDataType(fieldWriters[i].getDataType());
    if (i >= fieldReaders.length) {
      objects[i]=fieldReaders[fieldReaders.length - 1].read(randomAccessFile);
    }
 else {
      objects[i]=fieldReaders[i].read(randomAccessFile);
    }
  }
  return creator.createInstance(objects);
}

Fixed version (ground truth):
protected Object readObject() throws IOException {
  short fieldCount=getRandomAccessFile().readShort();
  if (fieldCount == NULL_VALUE) {
    return null;
  }
  Object[] objects=new Object[fieldCount];
  for (int i=0; i < objects.length; i++) {
    if (i < fieldReaders.length && fieldReaders[i].getDataType() != fieldWriters[i].getDataType())     fieldReaders[i].setDataType(fieldWriters[i].getDataType());
    if (i >= fieldReaders.length) {
      objects[i]=fieldReaders[fieldReaders.length - 1].read(getRandomAccessFile());
    }
 else {
      objects[i]=fieldReaders[i].read(getRandomAccessFile());
    }
  }
  return creator.createInstance(objects);
}
Program: 65149
Project: 65149
Buggy source:
/** 
 * @param parent A widget which will be the parent of the new instance (cannot be null)
 * @param style The style of widget to construct
 */
public void buildUI(Composite parent){
  super.buildUI(parent);
  container.setLayout(WidgetUtil.createGridLayout(2,15));
  IDescriptorProvider provider=new TextPropertyDescriptorProvider(ImageHandle.ALT_TEXT_PROP,ReportDesignConstants.IMAGE_ITEM);
  TextSection section=new TextSection(provider.getDisplayName(),container,true);
  section.setProvider(provider);
  section.setStyle(SWT.SINGLE);
  section.setWidth(500);
  addSection(PageSectionId.ALTER_ALT_TEXT,section);
  IDescriptorProvider keyProvider=new TextPropertyDescriptorProvider(ImageHandle.ALT_TEXT_KEY_PROP,ReportDesignConstants.IMAGE_ITEM);
  TextSection keySection=new TextSection(keyProvider.getDisplayName(),container,true);
  keySection.setProvider(keyProvider);
  keySection.setStyle(SWT.SINGLE);
  keySection.setWidth(500);
  addSection(PageSectionId.ALTER_ALT_TEXT_KEY,keySection);
  createSections();
  layoutSections();
}

Fixed version (ground truth):
/** 
 * @param parent A widget which will be the parent of the new instance (cannot be null)
 * @param style The style of widget to construct
 */
public void buildUI(Composite parent){
  super.buildUI(parent);
  container.setLayout(WidgetUtil.createGridLayout(2,15));
  IDescriptorProvider provider=new TextPropertyDescriptorProvider(IImageItemModel.ALT_TEXT_PROP,ReportDesignConstants.IMAGE_ITEM);
  TextSection section=new TextSection(provider.getDisplayName(),container,true);
  section.setProvider(provider);
  section.setStyle(SWT.SINGLE);
  section.setWidth(500);
  addSection(PageSectionId.ALTER_ALT_TEXT,section);
  IDescriptorProvider keyProvider=new TextPropertyDescriptorProvider(IImageItemModel.ALT_TEXT_KEY_PROP,ReportDesignConstants.IMAGE_ITEM);
  TextSection keySection=new TextSection(keyProvider.getDisplayName(),container,true);
  keySection.setProvider(keyProvider);
  keySection.setStyle(SWT.SINGLE);
  keySection.setWidth(500);
  addSection(PageSectionId.ALTER_ALT_TEXT_KEY,keySection);
  createSections();
  layoutSections();
}
Program: 65150
Project: 65150
Buggy source:
/** 
 * @return
 */
public static int getLatestVersion(){
  return VERSION_4_2_2;
}

Fixed version (ground truth):
/** 
 * @return
 */
public static int getLatestVersion(){
  return VERSION_4_2_3;
}
Program: 65151
Project: 65151
Buggy source:
/** 
 * @param name
 * @param resultSets
 * @param writer
 * @throws IOException
 */
public static void save(String name,IAggregationResultSet[] resultSets,IDocArchiveWriter writer) throws IOException {
  if (writer == null || name == null)   return;
  RAOutputStream outputStream=writer.createRandomAccessStream(name);
  DataOutputStream dataOutputStream=new DataOutputStream(outputStream);
  if (resultSets == null) {
    dataOutputStream.writeInt(-1);
    return;
  }
  dataOutputStream.writeInt(resultSets.length);
  dataOutputStream.close();
  for (int i=0; i < resultSets.length; i++) {
    outputStream=writer.createRandomAccessStream(name + PREFIX_RESULTSET + i);
    dataOutputStream=new DataOutputStream(outputStream);
    saveOneResultSet(dataOutputStream,resultSets[i]);
    dataOutputStream.close();
  }
}

Fixed version (ground truth):
/** 
 * @param name
 * @param resultSets
 * @param writer
 * @throws IOException
 */
public static void save(String name,IAggregationResultSet[] resultSets,IDocArchiveWriter writer) throws IOException {
  if (writer == null || name == null)   return;
  RAOutputStream outputStream=writer.createRandomAccessStream(name);
  DataOutputStream dataOutputStream=new DataOutputStream(outputStream);
  if (resultSets == null) {
    dataOutputStream.writeInt(-1);
    return;
  }
  dataOutputStream.writeInt(resultSets.length);
  dataOutputStream.close();
  resultSets=sortRsBeforeSaving(resultSets);
  for (int i=0; i < resultSets.length; i++) {
    outputStream=writer.createRandomAccessStream(name + PREFIX_RESULTSET + i);
    dataOutputStream=new DataOutputStream(outputStream);
    saveOneResultSet(dataOutputStream,resultSets[i]);
    dataOutputStream.close();
  }
}
Program: 65152
Project: 65152
Buggy source:
public void stop(BundleContext context) throws Exception {
  plugin=null;
  super.stop(context);
}

Fixed version (ground truth):
public void stop(BundleContext context) throws Exception {
  plugin=null;
  ClassLoaderProvider.releaseInstance();
  super.stop(context);
}
Program: 65153
Project: 65153
Buggy source:
private URLClassLoader getPojoDataSetClassLoader() throws OdaException {
  URLParser up=new URLParser(appContext);
  URL[] urls=up.parse(pojoDataSetClassPath);
  logger.log(Level.INFO,"String_Node_Str" + Arrays.toString(urls) + "String_Node_Str");
  return new URLClassLoader(urls,Activator.class.getClassLoader());
}

Fixed version (ground truth):
private URLClassLoader getPojoDataSetClassLoader() throws OdaException {
  URLParser up=new URLParser(appContext);
  URL[] urls=up.parse(pojoDataSetClassPath);
  logger.log(Level.INFO,"String_Node_Str" + Arrays.toString(urls) + "String_Node_Str");
  URLClassLoader loader=ClassLoaderProvider.getInstance().getClassLoader(urls);
  return loader;
}
Program: 65154
Project: 65154
Buggy source:
public void close() throws OdaException {
  currentRowId=0;
  if (pojoDataSet != null) {
    pojoDataSet.close();
  }
  if (pojoClassLoader != null) {
    pojoClassLoader.close();
  }
}

Fixed version (ground truth):
public void close() throws OdaException {
  currentRowId=0;
  if (pojoDataSet != null) {
    pojoDataSet.close();
  }
}
Program: 65155
Project: 65155
Buggy source:
public static ClassMethodFieldBuffer getInstance(){
  return instance;
}

Fixed version (ground truth):
public static ClassMethodFieldBuffer getInstance(){
synchronized (ClassMethodFieldBuffer.class) {
    if (instance == null)     instance=new ClassMethodFieldBuffer();
  }
  return instance;
}
Program: 65156
Project: 65156
Buggy source:
private String enableURI(String location){
  String result=location.replace("String_Node_Str","String_Node_Str");
  if (File.separatorChar != '/') {
    result=result.replace(File.separatorChar,'/');
  }
  if (!result.endsWith("String_Node_Str") && !result.endsWith("String_Node_Str")) {
    if (result.charAt(result.length() - 1) != '/') {
      result+="String_Node_Str";
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * @param location
 * @return
 */
private String enableURI(String location){
  String result=location;
  try {
    if (File.separatorChar != '/')     location=location.replace(File.separatorChar,'/');
    if (location.startsWith("String_Node_Str")) {
      result=new File(location).toURI().toASCIIString().replace(new File("String_Node_Str").toURI().toASCIIString(),"String_Node_Str");
    }
 else     result=new File(location).toURI().toASCIIString().replace(new File("String_Node_Str").toURI().toASCIIString(),"String_Node_Str");
  }
 catch (  Exception e) {
    return location;
  }
  return result;
}
Program: 65161
Project: 65161
Buggy source:
private void resetDataSetReference(Object value,boolean clearHistory){
  try {
    startTrans("String_Node_Str");
    getReportItemHandle().setDataBindingReference(null);
    DataSetHandle dataSet=null;
    if (value != null) {
      dataSet=SessionHandleAdapter.getInstance().getReportDesignHandle().findDataSet(value.toString());
    }
    if (getReportItemHandle().getDataBindingType() == ReportItemHandle.DATABINDING_TYPE_REPORT_ITEM_REF) {
      getReportItemHandle().setDataBindingReference(null);
    }
    getReportItemHandle().setCube(null);
    getReportItemHandle().setDataSet(dataSet);
    if (clearHistory) {
      getReportItemHandle().getColumnBindings().clearValue();
      getReportItemHandle().getPropertyHandle(ReportItemHandle.PARAM_BINDINGS_PROP).clearValue();
    }
    getDependedProvider().generateAllBindingColumns();
    commit();
  }
 catch (  SemanticException e) {
    rollback();
    ExceptionHandler.handle(e);
  }
  section.load();
}

Fixed version (ground truth):
private void resetDataSetReference(Object value,boolean clearHistory){
  try {
    startTrans("String_Node_Str");
    getReportItemHandle().setDataBindingReference(null);
    DataSetHandle dataSet=null;
    if (value != null) {
      dataSet=SessionHandleAdapter.getInstance().getReportDesignHandle().findDataSet(value.toString());
    }
    if (getReportItemHandle().getDataBindingType() == ReportItemHandle.DATABINDING_TYPE_REPORT_ITEM_REF) {
      getReportItemHandle().setDataBindingReference(null);
    }
    getReportItemHandle().setCube(null);
    if (dataSet == null && value != null) {
      getReportItemHandle().setDataSet(null);
      new LinkedDataSetAdapter().setLinkedDataModel(getReportItemHandle(),value);
    }
 else {
      new LinkedDataSetAdapter().setLinkedDataModel(getReportItemHandle(),null);
      getReportItemHandle().setDataSet(dataSet);
    }
    if (clearHistory) {
      getReportItemHandle().getColumnBindings().clearValue();
      getReportItemHandle().getPropertyHandle(ReportItemHandle.PARAM_BINDINGS_PROP).clearValue();
    }
    getDependedProvider().generateAllBindingColumns();
    commit();
  }
 catch (  SemanticException e) {
    rollback();
    ExceptionHandler.handle(e);
  }
  section.load();
}