nus-yam/ex-repair huggingface dataset:
Program: 73774
Project: 73774
Buggy source:
/** 
 * evaluate conditional expression. A conditional expression can have an operator, one LHS expression, and up to two expressions on RHS, i.e., testExpr operator operand1 operand2 or testExpr between 1 20 Now only support comparison between the same data type
 * @param expr the conditional expression to be evaluated
 * @return a boolean value (as an Object)
 */
public Object evaluateCondExpr(IConditionalExpression expr) throws BirtException {
  IScriptExpression testExpr=expr.getExpression();
  if (testExpr == null)   return Boolean.FALSE;
  try {
    return ScriptEvalUtil.evalExpr(expr,scriptContext.getContext(),scriptContext.getScope(),null,0);
  }
 catch (  Exception e) {
    throw new EngineException(MessageConstants.INVALID_EXPRESSION_ERROR,expr,e);
  }
}

Fixed version (ground truth):
/** 
 * evaluate conditional expression. A conditional expression can have an operator, one LHS expression, and up to two expressions on RHS, i.e., testExpr operator operand1 operand2 or testExpr between 1 20 Now only support comparison between the same data type
 * @param expr the conditional expression to be evaluated
 * @return a boolean value (as an Object)
 */
public Object evaluateCondExpr(IConditionalExpression expr) throws BirtException {
  IScriptExpression testExpr=expr.getExpression();
  if (testExpr == null)   return Boolean.FALSE;
  try {
    return ScriptEvalUtil.evalExpr(expr,scriptContext.getContext(),scriptContext.getScope(),ScriptExpression.defaultID,0);
  }
 catch (  Exception e) {
    throw new EngineException(MessageConstants.INVALID_EXPRESSION_ERROR,expr,e);
  }
}
Program: 73776
Project: 73776
Buggy source:
/** 
 * Gets the aggregation function expression
 * @param orthoSD
 * @param strBaseAggExp
 */
public static String getAggFuncExpr(SeriesDefinition orthoSD,String strBaseAggExp){
  String strOrthoAgg=null;
  SeriesGrouping grouping=orthoSD.getGrouping();
  if (strBaseAggExp != null) {
    strOrthoAgg=grouping.getAggregateExpression();
    if (strOrthoAgg == null || "String_Node_Str".equals(strOrthoAgg)) {
      strOrthoAgg=strBaseAggExp;
    }
  }
  return strOrthoAgg;
}

Fixed version (ground truth):
/** 
 * Gets the aggregation function expression
 * @param orthoSD
 * @param strBaseAggExp
 */
public static String getAggFuncExpr(SeriesDefinition orthoSD,String strBaseAggExp){
  String strOrthoAgg=null;
  SeriesGrouping grouping=orthoSD.getGrouping();
  if (grouping.isSetEnabled() && grouping.isEnabled()) {
    strOrthoAgg=grouping.getAggregateExpression();
  }
  if (strOrthoAgg == null || "String_Node_Str".equals(strOrthoAgg)) {
    strOrthoAgg=strBaseAggExp;
  }
  return strOrthoAgg;
}
Program: 73778
Project: 73778
Buggy source:
/** 
 * Create Y grouping definition.
 * @param orthSD
 * @return
 */
private GroupDefinition createOrthogonalGroupingDefinition(SeriesDefinition orthSD){
  if (ChartReportItemUtil.isYGroupingDefined(orthSD)) {
    DataType dataType=null;
    GroupingUnitType groupUnit=null;
    double groupIntervalRange=0;
    String yGroupExpr=orthSD.getQuery().getDefinition();
    if (orthSD.getGrouping() != null && orthSD.getGrouping().isEnabled()) {
      dataType=orthSD.getGrouping().getGroupType();
      groupUnit=orthSD.getGrouping().getGroupingUnit();
      groupIntervalRange=orthSD.getGrouping().getGroupingInterval();
    }
    String name=generateUniqueBindingName(yGroupExpr);
    GroupDefinition yGroupDefinition=new GroupDefinition(name);
    yGroupDefinition.setKeyExpression(yGroupExpr);
    yGroupDefinition.setInterval(ChartReportItemUtil.convertToDtEGroupUnit(dataType,groupUnit,groupIntervalRange));
    yGroupDefinition.setIntervalRange(ChartReportItemUtil.convertToDtEIntervalRange(dataType,groupUnit,groupIntervalRange));
    if (orthSD.isSetSorting()) {
      yGroupDefinition.setSortDirection(ChartReportItemUtil.convertToDtESortDirection(orthSD.getSorting()));
    }
    return yGroupDefinition;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Create Y grouping definition.
 * @param orthSD
 * @return
 */
private GroupDefinition createOrthogonalGroupingDefinition(SeriesDefinition orthSD){
  if (ChartReportItemUtil.isYGroupingDefined(orthSD)) {
    DataType dataType=null;
    GroupingUnitType groupUnit=null;
    double groupIntervalRange=0;
    String yGroupExpr=orthSD.getQuery().getDefinition();
    if (orthSD.getGrouping() != null && orthSD.getGrouping().isSetGroupType()) {
      dataType=orthSD.getGrouping().getGroupType();
      groupUnit=orthSD.getGrouping().getGroupingUnit();
      groupIntervalRange=orthSD.getGrouping().getGroupingInterval();
    }
    String name=generateUniqueBindingName(yGroupExpr);
    GroupDefinition yGroupDefinition=new GroupDefinition(name);
    yGroupDefinition.setKeyExpression(yGroupExpr);
    yGroupDefinition.setInterval(ChartReportItemUtil.convertToDtEGroupUnit(dataType,groupUnit,groupIntervalRange));
    yGroupDefinition.setIntervalRange(ChartReportItemUtil.convertToDtEIntervalRange(dataType,groupUnit,groupIntervalRange));
    if (orthSD.isSetSorting()) {
      yGroupDefinition.setSortDirection(ChartReportItemUtil.convertToDtESortDirection(orthSD.getSorting()));
    }
    return yGroupDefinition;
  }
  return null;
}
Program: 73780
Project: 73780
Buggy source:
/** 
 * Create composite of group area.
 * @param cmpBasic
 */
protected void createGroupArea(Composite cmpBasic){
  Composite cmpGrouping=new Composite(cmpBasic,SWT.NONE);
  GridData gdCMPGrouping=new GridData(GridData.FILL_HORIZONTAL);
  gdCMPGrouping.horizontalSpan=2;
  cmpGrouping.setLayoutData(gdCMPGrouping);
  cmpGrouping.setLayout(new FillLayout());
  new SeriesGroupingComposite(cmpGrouping,SWT.NONE,getSeriesDefinitionForProcessing(),wizardContext.getModel() instanceof ChartWithoutAxes,fEnableAggregation,wizardContext,null);
}

Fixed version (ground truth):
/** 
 * Create composite of group area.
 * @param cmpBasic
 */
protected void createGroupArea(Composite cmpBasic){
  Composite cmpGrouping=new Composite(cmpBasic,SWT.NONE);
  GridData gdCMPGrouping=new GridData(GridData.FILL_HORIZONTAL);
  gdCMPGrouping.horizontalSpan=2;
  cmpGrouping.setLayoutData(gdCMPGrouping);
  cmpGrouping.setLayout(new FillLayout());
  fGroupingComposite=new SeriesGroupingComposite(cmpGrouping,SWT.NONE,getSeriesDefinitionForProcessing(),wizardContext.getModel() instanceof ChartWithoutAxes,fEnableAggregation,wizardContext,null);
}
Program: 73781
Project: 73781
Buggy source:
private boolean isSetAggregate(){
  String agg=fGrouping.getAggregateExpression();
  return (agg != null && !"String_Node_Str".equals(agg));
}

Fixed version (ground truth):
private boolean isSetAggregate(){
  return (fGrouping.isEnabled() && fGrouping.isSetEnabled());
}
Program: 73782
Project: 73782
Buggy source:
public void widgetSelected(SelectionEvent e){
  Object source=e.getSource();
  if (source == fBtnAggEnabled) {
    populateAggFuncNames();
    if (!fBtnAggEnabled.getSelection()) {
      fGrouping.setAggregateExpression(null);
    }
 else {
      fGrouping.setAggregateExpression(((String[])fCmbAggregate.getData())[fCmbAggregate.getSelectionIndex()]);
    }
    setAggregatesState();
  }
 else   if (source == fCmbAggregate) {
    String aggFunc=((String[])fCmbAggregate.getData())[fCmbAggregate.getSelectionIndex()];
    showAggregateParameters(aggFunc);
    fGrouping.setAggregateExpression(aggFunc);
  }
 else   if (isAggParametersWidget(source)) {
    setAggParameter((Text)source);
  }
 else   if (isBuilderBtnWidget(source)) {
    try {
      Text txtArg=(Text)fExprBuilderWidgetsMap.get(source);
      String sExpr=fChartContext.getUIServiceProvider().invoke(IUIServiceProvider.COMMAND_EXPRESSION_DATA_BINDINGS,txtArg.getText(),fChartContext.getExtendedItem(),fTitle);
      txtArg.setText(sExpr);
      setAggParameter(txtArg);
    }
 catch (    ChartException e1) {
      WizardBase.displayException(e1);
    }
  }
 else   if (source == fBtnOK) {
    fSeriesDefi.setGrouping(fGrouping);
    fSeriesDefi.getGrouping().eAdapters().addAll(fSeriesDefi.eAdapters());
    closeAggregateEditor(getShell());
  }
 else   if (source == fBtnCancel) {
    closeAggregateEditor(getShell());
  }
}

Fixed version (ground truth):
public void widgetSelected(SelectionEvent e){
  Object source=e.getSource();
  if (source == fBtnAggEnabled) {
    fGrouping.setEnabled(fBtnAggEnabled.getSelection());
    populateAggFuncNames();
    setAggregatesState();
  }
 else   if (source == fCmbAggregate) {
    String aggFunc=((String[])fCmbAggregate.getData())[fCmbAggregate.getSelectionIndex()];
    showAggregateParameters(aggFunc);
    fGrouping.setAggregateExpression(aggFunc);
  }
 else   if (isAggParametersWidget(source)) {
    setAggParameter((Text)source);
  }
 else   if (isBuilderBtnWidget(source)) {
    try {
      Text txtArg=(Text)fExprBuilderWidgetsMap.get(source);
      String sExpr=fChartContext.getUIServiceProvider().invoke(IUIServiceProvider.COMMAND_EXPRESSION_DATA_BINDINGS,txtArg.getText(),fChartContext.getExtendedItem(),fTitle);
      txtArg.setText(sExpr);
      setAggParameter(txtArg);
    }
 catch (    ChartException e1) {
      WizardBase.displayException(e1);
    }
  }
 else   if (source == fBtnOK) {
    fSeriesDefi.setGrouping(fGrouping);
    fSeriesDefi.getGrouping().eAdapters().addAll(fSeriesDefi.eAdapters());
    closeAggregateEditor(getShell());
  }
 else   if (source == fBtnCancel) {
    closeAggregateEditor(getShell());
  }
}
Program: 73783
Project: 73783
Buggy source:
public void setEnabled(boolean enabled){
  super.setEnabled(enabled);
  fBtnAggImage.setEnabled(enabled);
}

Fixed version (ground truth):
public void setEnabled(boolean enabled){
  super.setEnabled(enabled);
  fBtnAggImage.setEnabled(enabled);
  fBtnDropDown.setEnabled(enabled);
}
Program: 73785
Project: 73785
Buggy source:
protected void handleGroupAction(){
  SeriesDefinition sdBackup=(SeriesDefinition)EcoreUtil.copy(seriesdefinition);
  GroupSortingDialog groupDialog=createGroupSortingDialog(sdBackup);
  if (groupDialog.open() == Window.OK) {
    if (!sdBackup.eIsSet(DataPackage.eINSTANCE.getSeriesDefinition_Sorting())) {
      seriesdefinition.eUnset(DataPackage.eINSTANCE.getSeriesDefinition_Sorting());
    }
 else {
      seriesdefinition.setSorting(sdBackup.getSorting());
    }
    ChartAdapter.beginIgnoreNotifications();
    List sds=ChartUIUtil.getAllOrthogonalSeriesDefinitions(context.getModel());
    for (int i=0; i < sds.size(); i++) {
      if (i != 0) {
        SeriesDefinition sdf=(SeriesDefinition)sds.get(i);
        if (!sdBackup.eIsSet(DataPackage.eINSTANCE.getSeriesDefinition_Sorting())) {
          sdf.eUnset(DataPackage.eINSTANCE.getSeriesDefinition_Sorting());
        }
 else {
          sdf.setSorting(sdBackup.getSorting());
        }
      }
    }
    ChartAdapter.endIgnoreNotifications();
    seriesdefinition.setSortKey(sdBackup.getSortKey());
    seriesdefinition.getSortKey().eAdapters().addAll(seriesdefinition.eAdapters());
    seriesdefinition.setGrouping(sdBackup.getGrouping());
    seriesdefinition.getGrouping().eAdapters().addAll(seriesdefinition.eAdapters());
  }
}

Fixed version (ground truth):
protected void handleGroupAction(){
  SeriesDefinition sdBackup=(SeriesDefinition)EcoreUtil.copy(seriesdefinition);
  GroupSortingDialog groupDialog=createGroupSortingDialog(sdBackup);
  if (groupDialog.open() == Window.OK) {
    if (!sdBackup.eIsSet(DataPackage.eINSTANCE.getSeriesDefinition_Sorting())) {
      seriesdefinition.eUnset(DataPackage.eINSTANCE.getSeriesDefinition_Sorting());
    }
 else {
      seriesdefinition.setSorting(sdBackup.getSorting());
    }
    ChartAdapter.beginIgnoreNotifications();
    List sds=ChartUIUtil.getAllOrthogonalSeriesDefinitions(context.getModel());
    for (int i=0; i < sds.size(); i++) {
      if (i != 0) {
        SeriesDefinition sdf=(SeriesDefinition)sds.get(i);
        if (!sdBackup.eIsSet(DataPackage.eINSTANCE.getSeriesDefinition_Sorting())) {
          sdf.eUnset(DataPackage.eINSTANCE.getSeriesDefinition_Sorting());
        }
 else {
          sdf.setSorting(sdBackup.getSorting());
        }
      }
    }
    ChartAdapter.endIgnoreNotifications();
    seriesdefinition.setSortKey(sdBackup.getSortKey());
    seriesdefinition.getSortKey().eAdapters().addAll(seriesdefinition.eAdapters());
    sdBackup.getGrouping().eUnset(DataPackage.eINSTANCE.getSeriesGrouping_Enabled());
    sdBackup.getGrouping().setEnabled(false);
    seriesdefinition.setGrouping(sdBackup.getGrouping());
    seriesdefinition.getGrouping().eAdapters().addAll(seriesdefinition.eAdapters());
  }
}
Program: 73787
Project: 73787
Buggy source:
public static void addDataItem(CrosstabReportItemHandle crosstab,MeasureViewHandle measureView,String function,String rowDimension,String rowLevel,String colDimension,String colLevel) throws SemanticException {
  CrosstabModelUtil.addDataItem(crosstab,measureView,function,rowDimension,rowLevel,colDimension,colLevel,false);
}

Fixed version (ground truth):
public static void addDataItem(CrosstabReportItemHandle crosstab,AggregationCellHandle cell,MeasureViewHandle measureView,String function,String rowDimension,String rowLevel,String colDimension,String colLevel) throws SemanticException {
  CrosstabModelUtil.addDataItem(crosstab,cell,measureView,function,rowDimension,rowLevel,colDimension,colLevel,false);
}
Program: 73788
Project: 73788
Buggy source:
private void createTextView(AggregationCellHandle cell) throws SemanticException {
  CrosstabReportItemHandle crosstab=cell.getCrosstab();
  MeasureViewHandle measureView=(MeasureViewHandle)cell.getContainer();
  LevelHandle rowLevelHandle=cell.getAggregationOnRow();
  LevelHandle colLevelHandle=cell.getAggregationOnColumn();
  String rowLevel=rowLevelHandle == null ? null : rowLevelHandle.getName();
  String colLevel=colLevelHandle == null ? null : colLevelHandle.getName();
  String rowDimension=null;
  String colDimension=null;
  if (rowLevelHandle != null && rowLevelHandle.getContainer() != null && rowLevelHandle.getContainer().getContainer() != null) {
    rowDimension=rowLevelHandle.getContainer().getContainer().getName();
  }
  if (colLevelHandle != null && colLevelHandle.getContainer() != null && colLevelHandle.getContainer().getContainer() != null) {
    colDimension=colLevelHandle.getContainer().getContainer().getName();
  }
  CrosstabUtil.addDataItem(crosstab,measureView,null,rowDimension,rowLevel,colDimension,colLevel);
}

Fixed version (ground truth):
private void createTextView(AggregationCellHandle cell) throws SemanticException {
  CrosstabReportItemHandle crosstab=cell.getCrosstab();
  MeasureViewHandle measureView=(MeasureViewHandle)cell.getContainer();
  LevelHandle rowLevelHandle=cell.getAggregationOnRow();
  LevelHandle colLevelHandle=cell.getAggregationOnColumn();
  String rowLevel=rowLevelHandle == null ? null : rowLevelHandle.getName();
  String colLevel=colLevelHandle == null ? null : colLevelHandle.getName();
  String rowDimension=null;
  String colDimension=null;
  if (rowLevelHandle != null && rowLevelHandle.getContainer() != null && rowLevelHandle.getContainer().getContainer() != null) {
    rowDimension=rowLevelHandle.getContainer().getContainer().getName();
  }
  if (colLevelHandle != null && colLevelHandle.getContainer() != null && colLevelHandle.getContainer().getContainer() != null) {
    colDimension=colLevelHandle.getContainer().getContainer().getName();
  }
  CrosstabUtil.addDataItem(crosstab,cell,measureView,null,rowDimension,rowLevel,colDimension,colLevel);
}
Program: 73789
Project: 73789
Buggy source:
/** 
 * @param dataSetDesign
 * @param cacheOption
 * @param alwaysCacheRowCount
 * @return
 */
public boolean needsToCache(IBaseDataSetDesign dataSetDesign,int cacheOption,int alwaysCacheRowCount){
  return needsToDteCache() || DataSetCacheUtil.needsToCache(dataSetDesign,cacheOption,alwaysCacheRowCount);
}

Fixed version (ground truth):
/** 
 * @param dataSetDesign
 * @param cacheOption
 * @param alwaysCacheRowCount
 * @return
 */
public boolean needsToCache(IBaseDataSetDesign dataSetDesign,int cacheOption,int alwaysCacheRowCount){
  return needsToDteCache(dataSetDesign) || needsToJVMCache(dataSetDesign,cacheOption,alwaysCacheRowCount);
}
Program: 73790
Project: 73790
Buggy source:
/** 
 * Construction
 */
public DataSetCacheManager(String tempDir,DataEngine dataEngine){
  this.tempDir=tempDir;
  this.dataSourceDesign=null;
  this.dataSetDesign=null;
  this.cacheOption=DataEngineContext.CACHE_USE_DEFAULT;
  this.alwaysCacheRowCount=0;
  this.JVMLevelCacheMapManager=new CacheMapManager(tempDir,true);
  this.DteLevelCacheMapManager=new CacheMapManager(tempDir,false);
  this.mode=DataEngineContext.CACHE_MODE_IN_DISK;
}

Fixed version (ground truth):
/** 
 * Construction
 */
public DataSetCacheManager(String tempDir,DataEngineImpl dataEngine){
  this.tempDir=tempDir;
  this.dataSourceDesign=null;
  this.dataSetDesign=null;
  this.cacheOption=DataEngineContext.CACHE_USE_DEFAULT;
  this.alwaysCacheRowCount=0;
  this.JVMLevelCacheMapManager=new CacheMapManager(tempDir,true);
  this.DteLevelCacheMapManager=new CacheMapManager(tempDir,false);
  this.mode=DataEngineContext.CACHE_MODE_IN_DISK;
  this.queryExecutionHints=dataEngine.getExecutionHints();
}
Program: 73791
Project: 73791
Buggy source:
/** 
 * @param dataSetDesign
 * @return
 */
private boolean needsToJVMCache(IBaseDataSetDesign dataSetDesign){
  return DataSetCacheUtil.needsToCache(dataSetDesign,cacheOption,alwaysCacheRowCount);
}

Fixed version (ground truth):
/** 
 * @param dataSetDesign
 * @return
 */
private boolean needsToJVMCache(IBaseDataSetDesign dataSetDesign,int cacheOption,int alwaysCacheRowCount){
  return DataSetCacheUtil.needsToCache(dataSetDesign,cacheOption,alwaysCacheRowCount);
}
Program: 73792
Project: 73792
Buggy source:
/** 
 * @param dataSetDesign
 */
private void switchCacheMap(IBaseDataSetDesign dataSetDesign){
  if (needsToJVMCache(dataSetDesign)) {
    cacheMapManager=JVMLevelCacheMapManager;
  }
 else {
    cacheMapManager=DteLevelCacheMapManager;
  }
}

Fixed version (ground truth):
/** 
 * @param dataSetDesign
 */
private void switchCacheMap(IBaseDataSetDesign dataSetDesign){
  if (needsToJVMCache(dataSetDesign,cacheOption,alwaysCacheRowCount)) {
    cacheMapManager=JVMLevelCacheMapManager;
  }
 else {
    cacheMapManager=DteLevelCacheMapManager;
  }
}
Program: 73793
Project: 73793
Buggy source:
/** 
 * @return
 */
private boolean needsToDteCache(){
  return false;
}

Fixed version (ground truth):
/** 
 * @return
 */
private boolean needsToDteCache(IBaseDataSetDesign dataSetDesign){
  if (queryExecutionHints == null || dataSetDesign == null)   return false;
  return this.queryExecutionHints.needCacheDataSet(dataSetDesign.getName());
}
Program: 73794
Project: 73794
Buggy source:
/** 
 * Returns the runtime defn of a data source. If data source is not found, returns null.
 */
DataSourceRuntime getDataSourceRuntime(String name) throws DataException {
  if (!dataSources.containsKey(name))   throw new DataException(ResourceConstants.UNDEFINED_DATA_SOURCE);
  return (DataSourceRuntime)dataSources.get(name);
}

Fixed version (ground truth):
/** 
 * Returns the runtime defn of a data source. If data source is not found, returns null.
 */
DataSourceRuntime getDataSourceRuntime(String name){
  return (DataSourceRuntime)dataSources.get(name);
}
Program: 73795
Project: 73795
Buggy source:
/** 
 * Return whether a data set need to be cached during query execution.
 * @param dataSetName
 * @return
 * @throws DataException
 */
public IQueryExecutionHints getExecutionHints() throws DataException {
  if (this.queryExecutionHints == null)   return new QueryExecutionHints(this,null);
  return this.queryExecutionHints;
}

Fixed version (ground truth):
/** 
 * Return whether a data set need to be cached during query execution.
 * @param dataSetName
 * @return
 */
public IQueryExecutionHints getExecutionHints(){
  return this.queryExecutionHints;
}
Program: 73796
Project: 73796
Buggy source:
/** 
 * Returns the design of a data set. If data set is not found, returns null.
 */
IBaseDataSetDesign getDataSetDesign(String name) throws DataException {
  if (!dataSetDesigns.containsKey(name))   throw new DataException(ResourceConstants.UNDEFINED_DATA_SET);
  return (IBaseDataSetDesign)dataSetDesigns.get(name);
}

Fixed version (ground truth):
/** 
 * Returns the design of a data set. If data set is not found, returns null.
 */
IBaseDataSetDesign getDataSetDesign(String name){
  return (IBaseDataSetDesign)dataSetDesigns.get(name);
}
Program: 73797
Project: 73797
Buggy source:
public void registerQueries(IDataQueryDefinition[] queryDefns) throws DataException {
  this.queryExecutionHints=new QueryExecutionHints(this,queryDefns);
}

Fixed version (ground truth):
public void registerQueries(IDataQueryDefinition[] queryDefns) throws DataException {
  ((QueryExecutionHints)queryExecutionHints).populateCachedDataSets(this,queryDefns);
}
Program: 73798
Project: 73798
Buggy source:
/** 
 * convert a object to given class Classes supported: Integer.class BigDecimal.class Boolean.class Time.class Date.class Double.class String.class Blob.class
 * @param source
 * @param toTypeClass
 * @return
 * @throws BirtException
 */
public static Object convert(Object source,Class toTypeClass) throws BirtException {
  if (toTypeClass == DataType.getClass(DataType.ANY_TYPE))   return source;
  if (toTypeClass == Integer.class)   return toInteger(source);
  if (toTypeClass == BigDecimal.class)   return toBigDecimal(source);
  if (toTypeClass == Boolean.class)   return toBoolean(source);
  if (toTypeClass == Time.class)   return toSqlTime(source);
  if (toTypeClass == java.sql.Date.class)   return toSqlDate(source);
  if (toTypeClass == java.sql.Timestamp.class)   return toDate(source);
  if (toTypeClass == Date.class)   return toDate(source);
  if (toTypeClass == Double.class)   return toDouble(source);
  if (toTypeClass == String.class)   return toString(source);
  if (toTypeClass == Blob.class)   return toBlob(source);
  if (toTypeClass == byte[].class)   return source;
  throw new CoreException(ResourceConstants.INVALID_TYPE,resourceBundle);
}

Fixed version (ground truth):
/** 
 * convert a object to given class Classes supported: Integer.class BigDecimal.class Boolean.class Time.class Date.class Double.class String.class Blob.class
 * @param source
 * @param toTypeClass
 * @return
 * @throws BirtException
 */
public static Object convert(Object source,Class toTypeClass) throws BirtException {
  if (toTypeClass == DataType.getClass(DataType.ANY_TYPE))   return source;
  if (toTypeClass == Integer.class)   return toInteger(source);
  if (toTypeClass == BigDecimal.class)   return toBigDecimal(source);
  if (toTypeClass == Boolean.class)   return toBoolean(source);
  if (toTypeClass == Time.class)   return toSqlTime(source);
  if (toTypeClass == java.sql.Date.class)   return toSqlDate(source);
  if (toTypeClass == java.sql.Timestamp.class)   return toDate(source);
  if (toTypeClass == Date.class)   return toDate(source);
  if (toTypeClass == Double.class)   return toDouble(source);
  if (toTypeClass == String.class)   return toString(source);
  if (toTypeClass == Blob.class) {
    if (source instanceof byte[])     return source;
 else     return toBlob(source);
  }
  if (toTypeClass == byte[].class)   return source;
  throw new CoreException(ResourceConstants.INVALID_TYPE,resourceBundle);
}
Program: 73799
Project: 73799
Buggy source:
protected boolean processOnMouseOver(ShapedAction sa,HTMLTag tag){
  Action ac=sa.getActionForCondition(TriggerCondition.ONMOUSEOVER_LITERAL);
  if (checkSupportedAction(ac)) {
switch (ac.getType().getValue()) {
case ActionType.URL_REDIRECT:
      return false;
case ActionType.SHOW_TOOLTIP:
    TooltipValue tv=(TooltipValue)ac.getValue();
  if (tv.getText() != null && tv.getText().length() > 0) {
    tag.addAttribute(HTMLAttribute.TITLE,eval2HTML(tv.getText()));
    return true;
  }
return false;
case ActionType.INVOKE_SCRIPT:
final DataPointHints dph;
if (StructureType.SERIES_DATA_POINT.equals(sa.getSource().getType())) {
dph=(DataPointHints)sa.getSource().getSource();
}
 else {
dph=null;
}
String callbackFunction=getJSMethodName(TriggerCondition.ONMOUSEOVER_LITERAL,sa) + "String_Node_Str";
callbackFunction=ScriptUtil.script(callbackFunction,dph);
callbackFunction+="String_Node_Str";
tag.addAttribute(HTMLAttribute.ONMOUSEOVER,eval2JS(callbackFunction,true));
return true;
}
}
return false;
}

Fixed version (ground truth):
protected boolean processOnMouseOver(ShapedAction sa,HTMLTag tag){
  Action ac=sa.getActionForCondition(TriggerCondition.ONMOUSEOVER_LITERAL);
  if (checkSupportedAction(ac)) {
switch (ac.getType().getValue()) {
case ActionType.URL_REDIRECT:
      return false;
case ActionType.SHOW_TOOLTIP:
    TooltipValue tv=(TooltipValue)ac.getValue();
  if (tv.getText() != null && tv.getText().length() > 0) {
    tag.addAttribute(HTMLAttribute.TITLE,eval2HTML(tv.getText()));
    return true;
  }
return false;
case ActionType.INVOKE_SCRIPT:
final DataPointHints dph;
if (StructureType.SERIES_DATA_POINT.equals(sa.getSource().getType())) {
dph=(DataPointHints)sa.getSource().getSource();
}
 else {
dph=null;
}
StringBuffer callbackFunction=new StringBuffer(getJSMethodName(TriggerCondition.ONMOUSEOVER_LITERAL,sa));
callbackFunction.append("String_Node_Str");
ScriptUtil.script(callbackFunction,dph);
callbackFunction.append("String_Node_Str");
tag.addAttribute(HTMLAttribute.ONMOUSEOVER,eval2JS(callbackFunction.toString(),true));
return true;
}
}
return false;
}
Program: 73800
Project: 73800
Buggy source:
private boolean processCommonEvent(ShapedAction sa,HTMLTag tag,TriggerCondition condition,HTMLAttribute htmlAttr){
  Action ac=sa.getActionForCondition(condition);
  if (checkSupportedAction(ac)) {
switch (ac.getType().getValue()) {
case ActionType.URL_REDIRECT:
      URLValue uv=(URLValue)ac.getValue();
    if (condition == TriggerCondition.ONCLICK_LITERAL) {
      tag.addAttribute(HTMLAttribute.HREF,eval2HTML(uv.getBaseUrl()));
      tag.addAttribute(HTMLAttribute.TARGET,eval2HTML(uv.getTarget()));
    }
 else {
      tag.addAttribute(HTMLAttribute.HREF,NO_OP_JAVASCRIPT);
      String value=getJsURLRedirect(uv);
      if (htmlAttr.equals(HTMLAttribute.ONFOCUS)) {
        value="String_Node_Str" + value;
      }
      tag.addAttribute(htmlAttr,value);
    }
  return true;
case ActionType.SHOW_TOOLTIP:
return false;
case ActionType.INVOKE_SCRIPT:
tag.addAttribute(HTMLAttribute.HREF,NO_OP_JAVASCRIPT);
final DataPointHints dph;
if (StructureType.SERIES_DATA_POINT.equals(sa.getSource().getType())) {
dph=(DataPointHints)sa.getSource().getSource();
}
 else {
dph=null;
}
String callbackFunction=getJSMethodName(condition,sa) + "String_Node_Str";
callbackFunction=ScriptUtil.script(callbackFunction,dph);
callbackFunction+="String_Node_Str";
tag.addAttribute(htmlAttr,eval2JS(callbackFunction,true));
return true;
}
}
return false;
}

Fixed version (ground truth):
private boolean processCommonEvent(ShapedAction sa,HTMLTag tag,TriggerCondition condition,HTMLAttribute htmlAttr){
  Action ac=sa.getActionForCondition(condition);
  if (checkSupportedAction(ac)) {
switch (ac.getType().getValue()) {
case ActionType.URL_REDIRECT:
      URLValue uv=(URLValue)ac.getValue();
    if (condition == TriggerCondition.ONCLICK_LITERAL) {
      tag.addAttribute(HTMLAttribute.HREF,eval2HTML(uv.getBaseUrl()));
      tag.addAttribute(HTMLAttribute.TARGET,eval2HTML(uv.getTarget()));
    }
 else {
      tag.addAttribute(HTMLAttribute.HREF,NO_OP_JAVASCRIPT);
      String value=getJsURLRedirect(uv);
      if (htmlAttr.equals(HTMLAttribute.ONFOCUS)) {
        value="String_Node_Str" + value;
      }
      tag.addAttribute(htmlAttr,value);
    }
  return true;
case ActionType.SHOW_TOOLTIP:
return false;
case ActionType.INVOKE_SCRIPT:
tag.addAttribute(HTMLAttribute.HREF,NO_OP_JAVASCRIPT);
final DataPointHints dph;
if (StructureType.SERIES_DATA_POINT.equals(sa.getSource().getType())) {
dph=(DataPointHints)sa.getSource().getSource();
}
 else {
dph=null;
}
StringBuffer callbackFunction=new StringBuffer(getJSMethodName(condition,sa));
callbackFunction.append("String_Node_Str");
ScriptUtil.script(callbackFunction,dph);
callbackFunction.append("String_Node_Str");
tag.addAttribute(htmlAttr,eval2JS(callbackFunction.toString(),true));
return true;
}
}
return false;
}
Program: 73801
Project: 73801
Buggy source:
/** 
 * Add the value of categoryData, valueData, and valueSeriesName into script.
 * @param str
 * @param dph
 * @return the output script
 */
public static String script(String str,DataPointHints dph){
  if (dph != null) {
    str+=addDataValueToScript(dph.getBaseValue());
    str+="String_Node_Str";
    str+=addDataValueToScript(dph.getOrthogonalValue());
    str+="String_Node_Str";
    str+=addDataValueToScript(dph.getSeriesValue());
  }
  return str;
}

Fixed version (ground truth):
/** 
 * Add the value of categoryData, valueData, and valueSeriesName into script.
 * @param str
 * @param dph
 * @return the output script
 */
public static void script(StringBuffer str,DataPointHints dph){
  if (dph != null) {
    str.append("String_Node_Str");
    str.append(addDataValueToScript(dph.getBaseValue()));
    str.append("String_Node_Str");
    str.append(addDataValueToScript(dph.getOrthogonalValue()));
    str.append("String_Node_Str");
    str.append(addDataValueToScript(dph.getSeriesValue()));
  }
 else {
    str.append("String_Node_Str");
  }
}
Program: 73803
Project: 73803
Buggy source:
/** 
 * Returns the categories list in BIRT chart expression builder
 * @param builderCommand
 * @return category style
 */
private int getExpressionBuilderStyle(int builderCommand){
  if (builderCommand == COMMAND_EXPRESSION_DATA_BINDINGS) {
    return ChartExpressionProvider.CATEGORY_WITH_BIRT_VARIABLES | ChartExpressionProvider.CATEGORY_WITH_COLUMN_BINDINGS | ChartExpressionProvider.CATEGORY_WITH_REPORT_PARAMS;
  }
 else   if (builderCommand == COMMAND_EXPRESSION_CHART_DATAPOINTS) {
    return ChartExpressionProvider.CATEGORY_WITH_CHART_VARIABLES;
  }
 else   if (builderCommand == COMMAND_EXPRESSION_TRIGGERS_DATAPOINTS) {
    return ChartExpressionProvider.CATEGORY_WITH_CHART_VARIABLES | ChartExpressionProvider.CATEGORY_WITH_REPORT_PARAMS;
  }
 else   if (builderCommand == COMMAND_EXPRESSION_TRIGGERS_SIMPLE) {
    return ChartExpressionProvider.CATEGORY_WITH_REPORT_PARAMS;
  }
 else   if (builderCommand == COMMAND_HYPERLINK) {
    return ChartExpressionProvider.CATEGORY_WITH_BIRT_VARIABLES | ChartExpressionProvider.CATEGORY_WITH_REPORT_PARAMS;
  }
 else   if (builderCommand == COMMAND_HYPERLINK_DATAPOINTS) {
    return ChartExpressionProvider.CATEGORY_WITH_BIRT_VARIABLES | ChartExpressionProvider.CATEGORY_WITH_COLUMN_BINDINGS | ChartExpressionProvider.CATEGORY_WITH_REPORT_PARAMS;
  }
  return ChartExpressionProvider.CATEGORY_BASE;
}

Fixed version (ground truth):
/** 
 * Returns the categories list in BIRT chart expression builder
 * @param builderCommand
 * @return category style
 */
private int getExpressionBuilderStyle(int builderCommand){
  if (builderCommand == COMMAND_EXPRESSION_DATA_BINDINGS) {
    return ChartExpressionProvider.CATEGORY_WITH_BIRT_VARIABLES | ChartExpressionProvider.CATEGORY_WITH_COLUMN_BINDINGS | ChartExpressionProvider.CATEGORY_WITH_REPORT_PARAMS;
  }
 else   if (builderCommand == COMMAND_EXPRESSION_CHART_DATAPOINTS) {
    return ChartExpressionProvider.CATEGORY_WITH_CHART_VARIABLES;
  }
 else   if (builderCommand == COMMAND_EXPRESSION_TRIGGERS_DATAPOINTS) {
    return ChartExpressionProvider.CATEGORY_WITH_CHART_VARIABLES | ChartExpressionProvider.CATEGORY_WITH_REPORT_PARAMS | ChartExpressionProvider.CATEGORY_WITH_JAVASCRIPT;
  }
 else   if (builderCommand == COMMAND_EXPRESSION_TRIGGERS_SIMPLE) {
    return ChartExpressionProvider.CATEGORY_WITH_REPORT_PARAMS | ChartExpressionProvider.CATEGORY_WITH_JAVASCRIPT;
  }
 else   if (builderCommand == COMMAND_HYPERLINK) {
    return ChartExpressionProvider.CATEGORY_WITH_BIRT_VARIABLES | ChartExpressionProvider.CATEGORY_WITH_REPORT_PARAMS;
  }
 else   if (builderCommand == COMMAND_HYPERLINK_DATAPOINTS) {
    return ChartExpressionProvider.CATEGORY_WITH_BIRT_VARIABLES | ChartExpressionProvider.CATEGORY_WITH_COLUMN_BINDINGS | ChartExpressionProvider.CATEGORY_WITH_REPORT_PARAMS;
  }
  return ChartExpressionProvider.CATEGORY_BASE;
}
Program: 73804
Project: 73804
Buggy source:
protected List getChildrenList(Object parent){
  List list=super.getChildrenList(parent);
  if (DATA_POINTS.equals(parent)) {
    list.add(ScriptHandler.BASE_VALUE);
    list.add(ScriptHandler.ORTHOGONAL_VALUE);
    list.add(ScriptHandler.SERIES_VALUE);
  }
 else {
    if (CHART_VARIABLES.equals(parent)) {
      list.add(DATA_POINTS);
    }
  }
  return list;
}

Fixed version (ground truth):
protected List getChildrenList(Object parent){
  List list=super.getChildrenList(parent);
  if (DATA_POINTS.equals(parent)) {
    list.add(ScriptHandler.BASE_VALUE);
    list.add(ScriptHandler.ORTHOGONAL_VALUE);
    list.add(ScriptHandler.SERIES_VALUE);
  }
 else   if (CHART_VARIABLES.equals(parent)) {
    if ((this._categoryStyle & CATEGORY_WITH_CHART_VARIABLES) == CATEGORY_WITH_CHART_VARIABLES)     list.add(DATA_POINTS);
    if ((this._categoryStyle & CATEGORY_WITH_JAVASCRIPT) == CATEGORY_WITH_JAVASCRIPT)     list.add(JAVASCRIPT);
  }
 else   if (JAVASCRIPT.equals(parent)) {
    list.add(JAVASCRIPT_EVENT_PARAMETER);
  }
  return list;
}
Program: 73805
Project: 73805
Buggy source:
protected List getCategoryList(){
  List list=super.getCategoryList();
  if ((this._categoryStyle & CATEGORY_WITH_CHART_VARIABLES) == CATEGORY_WITH_CHART_VARIABLES) {
    list.add(CHART_VARIABLES);
  }
  return list;
}

Fixed version (ground truth):
protected List getCategoryList(){
  List list=super.getCategoryList();
  if ((this._categoryStyle & CATEGORY_WITH_CHART_VARIABLES) == CATEGORY_WITH_CHART_VARIABLES || (this._categoryStyle & CATEGORY_WITH_JAVASCRIPT) == CATEGORY_WITH_JAVASCRIPT) {
    list.add(CHART_VARIABLES);
  }
  return list;
}
Program: 73806
Project: 73806
Buggy source:
public String getDisplayText(Object element){
  if (element.equals(ScriptHandler.BASE_VALUE)) {
    return org.eclipse.birt.chart.reportitem.ui.i18n.Messages.getString("String_Node_Str");
  }
 else   if (element.equals(ScriptHandler.ORTHOGONAL_VALUE)) {
    return org.eclipse.birt.chart.reportitem.ui.i18n.Messages.getString("String_Node_Str");
  }
 else   if (element.equals(ScriptHandler.SERIES_VALUE)) {
    return org.eclipse.birt.chart.reportitem.ui.i18n.Messages.getString("String_Node_Str");
  }
  return super.getDisplayText(element);
}

Fixed version (ground truth):
public String getDisplayText(Object element){
  if (element.equals(ScriptHandler.BASE_VALUE)) {
    return org.eclipse.birt.chart.reportitem.ui.i18n.Messages.getString("String_Node_Str");
  }
 else   if (element.equals(ScriptHandler.ORTHOGONAL_VALUE)) {
    return org.eclipse.birt.chart.reportitem.ui.i18n.Messages.getString("String_Node_Str");
  }
 else   if (element.equals(ScriptHandler.SERIES_VALUE)) {
    return org.eclipse.birt.chart.reportitem.ui.i18n.Messages.getString("String_Node_Str");
  }
 else   if (element.equals(JAVASCRIPT_EVENT_PARAMETER)) {
    return JAVASCRIPT_EVENT;
  }
  return super.getDisplayText(element);
}
Program: 73808
Project: 73808
Buggy source:
/** 
 * Test the feature of always cache.
 * @throws BirtException
 */
public void testAlwaysCache() throws BirtException {
  DataEngineContext context=DataEngineContext.newInstance(DataEngineContext.DIRECT_PRESENTATION,null,null,null);
  context.setCacheOption(DataEngineContext.CACHE_USE_ALWAYS,4);
  DataEngineImpl myDataEngine2=(DataEngineImpl)DataEngine.newDataEngine(context);
  myDataEngine2.defineDataSource(this.dataSource);
  myDataEngine2.defineDataSet(this.dataSet);
  QueryDefinition qd=newReportQuery();
  IQueryResults qr=myDataEngine2.prepare(qd).execute(null);
  assertFalse(getDataSetCacheManager(myDataEngine2).doesLoadFromCache());
  qr.getResultIterator();
  assertTrue(getDataSetCacheManager(myDataEngine2).doesLoadFromCache());
  qr.close();
  myDataEngine2.shutdown();
}

Fixed version (ground truth):
/** 
 * Test the feature of always cache.
 * @throws BirtException
 */
public void testAlwaysCache() throws BirtException {
  DataEngineContext context=DataEngineContext.newInstance(DataEngineContext.DIRECT_PRESENTATION,null,null,null);
  context.setCacheOption(DataEngineContext.CACHE_USE_ALWAYS,4);
  DataEngineImpl myDataEngine2=(DataEngineImpl)DataEngine.newDataEngine(context);
  myDataEngine2.defineDataSource(this.dataSource);
  myDataEngine2.defineDataSet(this.dataSet);
  QueryDefinition qd=newReportQuery();
  IQueryResults qr=myDataEngine2.prepare(qd).execute(null);
  assertFalse(getDataSetCacheManager(myDataEngine2).doesLoadFromCache());
  qr.getResultIterator();
  assertTrue(getDataSetCacheManager(myDataEngine2).doesLoadFromCache());
  myDataEngine2.clearCache(dataSource,dataSet);
  qr.close();
  myDataEngine2.shutdown();
}
Program: 73809
Project: 73809
Buggy source:
/** 
 * @param dataSetDesign
 * @param cacheOption
 * @param alwaysCacheRowCount
 * @return
 */
public boolean needsToCache(IBaseDataSetDesign dataSetDesign,int cacheOption,int alwaysCacheRowCount){
  return true;
}

Fixed version (ground truth):
/** 
 * @param dataSetDesign
 * @param cacheOption
 * @param alwaysCacheRowCount
 * @return
 */
public boolean needsToCache(IBaseDataSetDesign dataSetDesign,int cacheOption,int alwaysCacheRowCount){
  return needsToDteCache() || DataSetCacheUtil.needsToCache(dataSetDesign,cacheOption,alwaysCacheRowCount);
}
Program: 73810
Project: 73810
Buggy source:
/** 
 * Create the file path of the the document. The document will be put under the document folder based on different session id.
 * @param filePath the document path cretaed from the report design file.
 * @param request Http request, used to get the session Id.
 * @return
 * @throws AxisFault
 */
protected static String createDocumentPath(String filePath,HttpServletRequest request){
  String documentName=null;
  if ((filePath == null) || (filePath.length() == 0))   return "String_Node_Str";
  String sessionId=request.getSession().getId();
  String fileSeparator="String_Node_Str";
  if (filePath.lastIndexOf(fileSeparator) == -1)   fileSeparator="String_Node_Str";
  if (filePath.lastIndexOf(fileSeparator) != -1) {
    documentName=filePath.substring(filePath.lastIndexOf(fileSeparator) + 1);
  }
 else {
    documentName=filePath;
  }
  String hashCode=Integer.toHexString(filePath.hashCode());
  return documentFolder + File.separator + sessionId+ File.separator+ hashCode+ File.separator+ documentName;
}

Fixed version (ground truth):
/** 
 * Create the file path of the the document. The document will be put under the document folder based on different session id.
 * @param filePath the document path cretaed from the report design file.
 * @param request Http request, used to get the session Id.
 * @return
 * @throws AxisFault
 */
protected static String createDocumentPath(String filePath,HttpServletRequest request){
  String documentName=null;
  if ((filePath == null) || (filePath.length() == 0))   return "String_Node_Str";
  String sessionId=request.getSession().getId();
  String fileSeparator="String_Node_Str";
  if (filePath.lastIndexOf(fileSeparator) == -1)   fileSeparator="String_Node_Str";
  if (filePath.lastIndexOf(fileSeparator) != -1) {
    documentName=filePath.substring(filePath.lastIndexOf(fileSeparator) + 1);
  }
 else {
    documentName=filePath;
  }
  String hashCode=Integer.toHexString(filePath.hashCode());
  return documentFolder + File.separator + (PREFIX_SUB_DOC_FOLDER + sessionId)+ File.separator+ hashCode+ File.separator+ documentName;
}
Program: 73811
Project: 73811
Buggy source:
/** 
 * Clear the temp files when session is expired
 * @param sessionId
 */
public static void clearSessionFiles(String sessionId){
  if (sessionId == null)   return;
  String tempFolder=documentFolder + File.separator + sessionId;
  File file=new File(tempFolder);
  deleteDir(file);
  tempFolder=imageFolder + File.separator + sessionId;
  file=new File(tempFolder);
  deleteDir(file);
}

Fixed version (ground truth):
/** 
 * Clear the temp files when session is expired
 * @param sessionId
 */
public static void clearSessionFiles(String sessionId){
  if (sessionId == null)   return;
  String tempFolder=documentFolder + File.separator + (PREFIX_SUB_DOC_FOLDER + sessionId);
  File file=new File(tempFolder);
  deleteDir(file);
  tempFolder=imageFolder + File.separator + sessionId;
  file=new File(tempFolder);
  deleteDir(file);
}
Program: 73812
Project: 73812
Buggy source:
/** 
 * Clears the report document/image files which had been created last time the server starts up.
 */
protected static void clearTempFiles(){
  File file=new File(documentFolder);
  deleteDir(file);
  makeDir(documentFolder);
  file=new File(imageFolder);
  deleteDir(file);
  makeDir(imageFolder);
}

Fixed version (ground truth):
/** 
 * Clears the report document/image files which had been created last time the server starts up.
 */
protected static void clearTempFiles(){
  File file=new File(documentFolder);
  if (file != null && file.isDirectory()) {
    String[] children=file.list();
    for (int i=0; i < children.length; i++) {
      if (children[i].startsWith(PREFIX_SUB_DOC_FOLDER))       deleteDir(new File(file,children[i]));
    }
  }
  file=new File(imageFolder);
  deleteDir(file);
  makeDir(imageFolder);
}
Program: 73813
Project: 73813
Buggy source:
/** 
 * Returns the runtime defn of a data source. If data source is not found, returns null.
 */
DataSourceRuntime getDataSourceRuntime(String name){
  return (DataSourceRuntime)dataSources.get(name);
}

Fixed version (ground truth):
/** 
 * Returns the runtime defn of a data source. If data source is not found, returns null.
 */
DataSourceRuntime getDataSourceRuntime(String name) throws DataException {
  if (!dataSources.containsKey(name))   throw new DataException(ResourceConstants.UNDEFINED_DATA_SOURCE);
  return (DataSourceRuntime)dataSources.get(name);
}
Program: 73814
Project: 73814
Buggy source:
/** 
 * Returns the design of a data set. If data set is not found, returns null.
 */
IBaseDataSetDesign getDataSetDesign(String name){
  return (IBaseDataSetDesign)dataSetDesigns.get(name);
}

Fixed version (ground truth):
/** 
 * Returns the design of a data set. If data set is not found, returns null.
 */
IBaseDataSetDesign getDataSetDesign(String name) throws DataException {
  if (!dataSetDesigns.containsKey(name))   throw new DataException(ResourceConstants.UNDEFINED_DATA_SET);
  return (IBaseDataSetDesign)dataSetDesigns.get(name);
}
Program: 73815
Project: 73815
Buggy source:
/** 
 * @param dataSetDesign
 */
private void switchCacheMap(IBaseDataSetDesign dataSetDesign){
  if (!dataSetDesign.needCache()) {
    cacheMapManager=JVMLevelCacheMapManager;
  }
 else {
    cacheMapManager=DteLevelCacheMapManager;
  }
}

Fixed version (ground truth):
/** 
 * @param dataSetDesign
 */
private void switchCacheMap(IBaseDataSetDesign dataSetDesign){
  if (needsToJVMCache(dataSetDesign)) {
    cacheMapManager=JVMLevelCacheMapManager;
  }
 else {
    cacheMapManager=DteLevelCacheMapManager;
  }
}
Program: 73816
Project: 73816
Buggy source:
/** 
 * @param dataSetDesign
 * @param cacheOption
 * @param alwaysCacheRowCount
 * @return
 */
public boolean needsToCache(IBaseDataSetDesign dataSetDesign,int cacheOption,int alwaysCacheRowCount){
  return DataSetCacheUtil.needsToCache(dataSetDesign,cacheOption,alwaysCacheRowCount);
}

Fixed version (ground truth):
/** 
 * @param dataSetDesign
 * @param cacheOption
 * @param alwaysCacheRowCount
 * @return
 */
public boolean needsToCache(IBaseDataSetDesign dataSetDesign,int cacheOption,int alwaysCacheRowCount){
  return true;
}
Program: 73817
Project: 73817
Buggy source:
/** 
 * Adapts base data set properties
 */
public static void adaptBaseDataSet(DataSetHandle modelDataSet,BaseDataSetDesign dteDataSet) throws BirtException {
  if ((!(modelDataSet instanceof JointDataSetHandle)) && modelDataSet.getDataSource() == null) {
    throw new AdapterException(ResourceConstants.DATASOURCE_NULL_ERROR);
  }
  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());
  }
  populateParameter(modelDataSet,dteDataSet);
  populateComputedColumn(modelDataSet,dteDataSet);
  populateFilter(modelDataSet,dteDataSet);
  dteDataSet.setRowFetchLimit(modelDataSet.getRowFetchLimit());
  dteDataSet.setNeedCache(modelDataSet.needsCache());
  mergeHints(modelDataSet,dteDataSet);
}

Fixed version (ground truth):
/** 
 * Adapts base data set properties
 */
public static void adaptBaseDataSet(DataSetHandle modelDataSet,BaseDataSetDesign dteDataSet) throws BirtException {
  if ((!(modelDataSet instanceof JointDataSetHandle)) && modelDataSet.getDataSource() == null) {
    throw new AdapterException(ResourceConstants.DATASOURCE_NULL_ERROR);
  }
  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());
  }
  populateParameter(modelDataSet,dteDataSet);
  populateComputedColumn(modelDataSet,dteDataSet);
  populateFilter(modelDataSet,dteDataSet);
  dteDataSet.setRowFetchLimit(modelDataSet.getRowFetchLimit());
  mergeHints(modelDataSet,dteDataSet);
}
Program: 73818
Project: 73818
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());
  }
  populateParameter(modelDataSet,dteDataSet);
  populateComputedColumn(modelDataSet,dteDataSet);
  populateFilter(modelDataSet,dteDataSet);
  dteDataSet.setRowFetchLimit(modelDataSet.getRowFetchLimit());
  dteDataSet.setNeedCache(modelDataSet.needsCache());
  mergeHints(modelDataSet,dteDataSet);
}

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());
  }
  populateParameter(modelDataSet,dteDataSet);
  populateComputedColumn(modelDataSet,dteDataSet);
  populateFilter(modelDataSet,dteDataSet);
  dteDataSet.setRowFetchLimit(modelDataSet.getRowFetchLimit());
  mergeHints(modelDataSet,dteDataSet);
}
Program: 73820
Project: 73820
Buggy source:
private ThemeHandle getThemeHandle(){
  IStructuredSelection selection=null;
  if (getSelection() instanceof IStructuredSelection) {
    selection=(IStructuredSelection)getSelection();
  }
  if (selection != null && !selection.isEmpty() && selection.getFirstElement() instanceof ReportDesignEditPart) {
    return ((ReportDesignHandle)((ReportDesignEditPart)selection.getFirstElement()).getModel()).getTheme();
  }
  return null;
}

Fixed version (ground truth):
private ThemeHandle getThemeHandle(){
  IStructuredSelection selection=null;
  if (getSelection() instanceof IStructuredSelection) {
    selection=(IStructuredSelection)getSelection();
  }
  if (selection != null && !selection.isEmpty() && selection.getFirstElement() instanceof ReportDesignEditPart) {
    return ((ModuleHandle)((ReportDesignEditPart)selection.getFirstElement()).getModel()).getTheme();
  }
  return null;
}