nus-yam/ex-repair huggingface dataset:
Program: 66605
Project: 66605
Buggy source:
/** 
 * Creates a DataEngine context in the provided mode, using the provided top level scope. Also sets the handle of the report design being executed. 
 * @param mode Data Session mode. Can be MODE_GENERATION, MODE_PRESENTATION or MODE_DIRECT_PRESENTATION
 * @param moduleHandle If not null, this report module is used to look up data setand data source definition when executing queries.
 * @param scriptContext
 * @param classLoader
 * @throws AdapterException
 */
public DataSessionContext(int mode,ModuleHandle moduleHandle,ScriptContext scriptContext,ClassLoader classLoader) throws AdapterException {
  try {
    if (!(mode == MODE_GENERATION || mode == MODE_PRESENTATION || mode == MODE_DIRECT_PRESENTATION || mode == MODE_UPDATE))     throw new AdapterException(ResourceConstants.ADAPTER_INVALID_MODE,Integer.valueOf(mode));
    this.mode=mode;
    this.moduleHandle=moduleHandle;
    this.appClassLoader=classLoader;
    ScriptContext internalScriptContext=null;
    if (scriptContext == null) {
      internalScriptContext=new ScriptContext();
      scriptContext=internalScriptContext.newContext(this.getTopScope());
      isDteScriptContext=true;
    }
    this.sContext=scriptContext;
    this.topScope=((IDataScriptEngine)scriptContext.getScriptEngine(IDataScriptEngine.ENGINE_NAME)).getJSScope(scriptContext);
    this.hasExternalScope=topScope != null;
  }
 catch (  BirtException e) {
    throw new AdapterException(e.getErrorCode(),e);
  }
}

Fixed version (ground truth):
/** 
 * Creates a DataEngine context in the provided mode, using the provided top level scope. Also sets the handle of the report design being executed. 
 * @param mode Data Session mode. Can be MODE_GENERATION, MODE_PRESENTATION or MODE_DIRECT_PRESENTATION
 * @param moduleHandle If not null, this report module is used to look up data setand data source definition when executing queries.
 * @param scriptContext
 * @param classLoader
 * @throws AdapterException
 */
public DataSessionContext(int mode,ModuleHandle moduleHandle,ScriptContext scriptContext,ClassLoader classLoader) throws AdapterException {
  try {
    if (!(mode == MODE_GENERATION || mode == MODE_PRESENTATION || mode == MODE_DIRECT_PRESENTATION || mode == MODE_UPDATE))     throw new AdapterException(ResourceConstants.ADAPTER_INVALID_MODE,Integer.valueOf(mode));
    this.mode=mode;
    this.moduleHandle=moduleHandle;
    this.appClassLoader=classLoader;
    ScriptContext internalScriptContext=null;
    if (scriptContext == null) {
      internalScriptContext=new ScriptContext();
      scriptContext=internalScriptContext.newContext(this.getTopScope());
      DataEngineThreadLocal.getInstance().getCloseListener().add(new ScriptContextCloser(internalScriptContext));
    }
    this.sContext=scriptContext;
    this.topScope=((IDataScriptEngine)scriptContext.getScriptEngine(IDataScriptEngine.ENGINE_NAME)).getJSScope(scriptContext);
    this.hasExternalScope=topScope != null;
  }
 catch (  BirtException e) {
    throw new AdapterException(e.getErrorCode(),e);
  }
}
Program: 66607
Project: 66607
Buggy source:
/** 
 * If set isWorkingFolderAccessOnly as true, check the file if exist in working folder.
 * @param filePath
 * @return boolean
 */
public static boolean isValidFilePath(String filePath){
  if (filePath == null)   return false;
  if (isWorkingFolderAccessOnly) {
    File docFile=new File(filePath);
    if (!docFile.isAbsolute()) {
      if (filePath.indexOf("String_Node_Str") != -1)       return false;
      return true;
    }
    File docFolder=new File(workingFolder);
    if (docFolder.isAbsolute()) {
      String absolutePath=docFile.getAbsolutePath();
      String docFolderPath=docFolder.getAbsolutePath();
      if (isWindowsPlatform()) {
        absolutePath=absolutePath.toLowerCase();
        docFolderPath=docFolderPath.toLowerCase();
      }
      return absolutePath.startsWith(docFolderPath);
    }
 else {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * If set isWorkingFolderAccessOnly as true, check the file if exist in working folder.
 * @param filePath
 * @return boolean
 */
public static boolean isValidFilePath(HttpServletRequest request,String filePath){
  if (filePath == null)   return false;
  if (!POLICY_ALL.equalsIgnoreCase(urlReportPathPolicy)) {
    File f=new File(filePath);
    if (!f.isAbsolute()) {
      try {
        URL url=new URL(filePath);
        if (POLICY_DOMAIN.equalsIgnoreCase(urlReportPathPolicy)) {
          String dm=request.getServerName();
          if (!dm.equals(url.getHost())) {
            return false;
          }
        }
 else {
          return false;
        }
      }
 catch (      MalformedURLException e) {
      }
    }
  }
  if (isWorkingFolderAccessOnly) {
    File docFile=new File(filePath);
    if (!docFile.isAbsolute()) {
      if (filePath.indexOf("String_Node_Str") != -1)       return false;
      return true;
    }
    File docFolder=new File(workingFolder);
    if (docFolder.isAbsolute()) {
      String absolutePath=docFile.getAbsolutePath();
      String docFolderPath=docFolder.getAbsolutePath();
      if (isWindowsPlatform()) {
        absolutePath=absolutePath.toLowerCase();
        docFolderPath=docFolderPath.toLowerCase();
      }
      return absolutePath.startsWith(docFolderPath);
    }
 else {
      return false;
    }
  }
  return true;
}
Program: 66608
Project: 66608
Buggy source:
/** 
 * Get report document name. If passed file path is null, get document file from request. If isCreated is true, try to create the document file when file path is null.
 * @param request
 * @param filePath
 * @param isCreated
 * @return
 * @throws ViewerException
 */
public static String getReportDocument(HttpServletRequest request,String filePath,boolean isCreated) throws ViewerException {
  if (filePath == null) {
    filePath=DataUtil.trimString(getParameter(request,PARAM_REPORT_DOCUMENT));
  }
  filePath=decodeFilePath(request,filePath);
  if (filePath.length() <= 0 && !isCreated)   return null;
  if (filePath.length() <= 0) {
    IViewingSession session=ViewingSessionUtil.getSession(request);
    if (session == null) {
      throw new ViewerException(BirtResources.getMessage(ResourceConstants.GENERAL_ERROR_NO_VIEWING_SESSION));
    }
    return session.getCachedReportDocument(getReport(request,null),null);
  }
 else {
    filePath=getRealPathOnWorkingFolder(filePath,request);
  }
  return filePath;
}

Fixed version (ground truth):
/** 
 * Get report document name. If passed file path is null, get document file from request. If isCreated is true, try to create the document file when file path is null.
 * @param request
 * @param filePath
 * @param isCreate
 * @return
 * @throws ViewerException
 */
public static String getReportDocument(HttpServletRequest request,String filePath,boolean isCreate) throws ViewerException {
  if (filePath == null) {
    filePath=DataUtil.trimString(getParameter(request,PARAM_REPORT_DOCUMENT));
  }
  filePath=decodeFilePath(request,filePath);
  if (filePath.length() <= 0 && !isCreate)   return null;
  if (filePath.length() <= 0) {
    IViewingSession session=ViewingSessionUtil.getSession(request);
    if (session == null) {
      throw new ViewerException(BirtResources.getMessage(ResourceConstants.GENERAL_ERROR_NO_VIEWING_SESSION));
    }
    return session.getCachedReportDocument(getReport(request,null),null);
  }
 else {
    filePath=getRealPathOnWorkingFolder(filePath,request);
  }
  return filePath;
}
Program: 66611
Project: 66611
Buggy source:
/** 
 * Populate records to be retrieved when re-render resultSetTable
 * @param metaData
 * @param query
 * @throws BirtException
 */
private void populateRecords(IResultIterator iter){
  try {
    if (iter != null) {
      IResultMetaData meta=iter.getResultMetaData();
      while (iter.next()) {
        CellValue[] record=new CellValue[meta.getColumnCount()];
        for (int n=0; n < record.length; n++) {
          CellValue cv=new CellValue();
          Object value=iter.getValue(meta.getColumnName(n + 1));
          String disp=null;
          if (value instanceof Number)           disp=value.toString();
 else           disp=iter.getString(meta.getColumnName(n + 1));
          cv.setDisplayValue(disp);
          cv.setRealValue(value);
          record[n]=cv;
        }
        recordList.add(record);
      }
      setPromptLabelText();
      iter.close();
    }
  }
 catch (  RuntimeException e) {
    errorList.add(e);
  }
catch (  BirtException e) {
    errorList.add(e);
  }
}

Fixed version (ground truth):
/** 
 * Populate records to be retrieved when re-render resultSetTable
 * @param metaData
 * @param query
 * @throws BirtException
 */
private void populateRecords(IResultIterator iter){
  try {
    if (iter != null) {
      IResultMetaData meta=iter.getResultMetaData();
      if (meta.getColumnCount() > 0) {
        while (iter.next()) {
          CellValue[] record=new CellValue[meta.getColumnCount()];
          for (int n=0; n < record.length; n++) {
            CellValue cv=new CellValue();
            Object value=iter.getValue(meta.getColumnName(n + 1));
            String disp=null;
            if (value instanceof Number)             disp=value.toString();
 else             disp=iter.getString(meta.getColumnName(n + 1));
            cv.setDisplayValue(disp);
            cv.setRealValue(value);
            record[n]=cv;
          }
          recordList.add(record);
        }
      }
      setPromptLabelText();
      iter.close();
    }
  }
 catch (  RuntimeException e) {
    errorList.add(e);
  }
catch (  BirtException e) {
    errorList.add(e);
  }
}
Program: 66613
Project: 66613
Buggy source:
private int getLevelSize(IDataSet4Aggregation.MetaInfo metaInfo,DimLevel[] dimLevel) throws DataException {
  if (dimLevel == null || dimLevel.length == 0) {
    return 0;
  }
  int[] dataType=new int[dimLevel.length];
  for (int i=0; i < dimLevel.length; i++) {
    DimColumn dimColumn=new DimColumn(dimLevel[i].getDimensionName(),dimLevel[i].getLevelName(),dimLevel[i].getLevelName());
    ColumnInfo columnInfo=metaInfo.getColumnInfo(dimColumn);
    dataType[i]=columnInfo.getDataType();
  }
  return SizeOfUtil.getObjectSize(dataType);
}

Fixed version (ground truth):
private int getLevelSize(IDataSet4Aggregation.MetaInfo metaInfo,DimLevel[] dimLevel) throws DataException {
  if (dimLevel == null || dimLevel.length == 0) {
    return 0;
  }
  int[] dataType=new int[dimLevel.length];
  for (int i=0; i < dimLevel.length; i++) {
    DimColumn dimColumn=null;
    if (dimLevel[i].getAttrName() == null)     dimColumn=new DimColumn(dimLevel[i].getDimensionName(),dimLevel[i].getLevelName(),dimLevel[i].getLevelName());
 else     dimColumn=new DimColumn(dimLevel[i].getDimensionName(),dimLevel[i].getLevelName(),dimLevel[i].getAttrName());
    ColumnInfo columnInfo=metaInfo.getColumnInfo(dimColumn);
    dataType[i]=columnInfo.getDataType();
  }
  return SizeOfUtil.getObjectSize(dataType);
}
Program: 66614
Project: 66614
Buggy source:
private int getLevelSize(DimLevel[] dimLevel) throws DataException {
  if (dimLevel == null || dimLevel.length == 0) {
    return 0;
  }
  int[] dataType=new int[dimLevel.length];
  for (int i=0; i < dimLevel.length; i++) {
    DimColumn dimColumn=new DimColumn(dimLevel[i].getDimensionName(),dimLevel[i].getLevelName(),dimLevel[i].getLevelName());
    ColumnInfo columnInfo=(dataSet4Aggregation.getMetaInfo()).getColumnInfo(dimColumn);
    dataType[i]=columnInfo.getDataType();
  }
  return SizeOfUtil.getObjectSize(dataType);
}

Fixed version (ground truth):
private int getLevelSize(DimLevel[] dimLevel) throws DataException {
  if (dimLevel == null || dimLevel.length == 0) {
    return 0;
  }
  int[] dataType=new int[dimLevel.length];
  for (int i=0; i < dimLevel.length; i++) {
    DimColumn dimColumn=null;
    if (dimLevel[i].getAttrName() == null)     dimColumn=new DimColumn(dimLevel[i].getDimensionName(),dimLevel[i].getLevelName(),dimLevel[i].getLevelName());
 else     dimColumn=new DimColumn(dimLevel[i].getDimensionName(),dimLevel[i].getLevelName(),dimLevel[i].getAttrName());
    ColumnInfo columnInfo=(dataSet4Aggregation.getMetaInfo()).getColumnInfo(dimColumn);
    dataType[i]=columnInfo.getDataType();
  }
  return SizeOfUtil.getObjectSize(dataType);
}
Program: 66617
Project: 66617
Buggy source:
private DimLevel[] getAggregateOnLevels(String bindingName) throws DataException {
  for (Iterator it=queryDefn.getBindings().iterator(); it.hasNext(); ) {
    IBinding binding=(IBinding)it.next();
    if (binding.getBindingName().equals(bindingName)) {
      List aggrs=binding.getAggregatOns();
      if (aggrs.size() == 0) {
        if (OlapExpressionCompiler.getReferencedScriptObject(binding.getExpression(),ScriptConstants.DIMENSION_SCRIPTABLE) != null)         return null;
        IBinding directReferenceBinding=OlapExpressionUtil.getDirectMeasureBinding(binding,queryDefn.getBindings());
        if (directReferenceBinding != null) {
          return getAggregateOnLevels(directReferenceBinding.getBindingName());
        }
        List levelList=new ArrayList();
        IEdgeDefinition rowEdge=queryDefn.getEdge(ICubeQueryDefinition.ROW_EDGE);
        populateDimLevel(levelList,rowEdge);
        IEdgeDefinition colEdge=queryDefn.getEdge(ICubeQueryDefinition.COLUMN_EDGE);
        populateDimLevel(levelList,colEdge);
        DimLevel[] levels=new DimLevel[levelList.size()];
        levelList.toArray(levels);
        return levels;
      }
 else {
        DimLevel[] levels=new DimLevel[aggrs.size()];
        for (int i=0; i < aggrs.size(); i++) {
          levels[i]=OlapExpressionUtil.getTargetDimLevel(aggrs.get(i).toString());
        }
        return levels;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private DimLevel[] getAggregateOnLevels(String bindingName) throws DataException {
  for (Iterator it=queryDefn.getBindings().iterator(); it.hasNext(); ) {
    IBinding binding=(IBinding)it.next();
    if (binding.getBindingName().equals(bindingName)) {
      List aggrs=binding.getAggregatOns();
      if (aggrs.size() == 0) {
        if (OlapExpressionCompiler.getReferencedScriptObject(binding.getExpression(),ScriptConstants.DIMENSION_SCRIPTABLE) != null)         return null;
        IBinding directReferenceBinding=OlapExpressionUtil.getDirectMeasureBinding(binding,queryDefn.getBindings());
        if (directReferenceBinding != null && directReferenceBinding != binding) {
          return getAggregateOnLevels(directReferenceBinding.getBindingName());
        }
        List levelList=new ArrayList();
        IEdgeDefinition rowEdge=queryDefn.getEdge(ICubeQueryDefinition.ROW_EDGE);
        populateDimLevel(levelList,rowEdge);
        IEdgeDefinition colEdge=queryDefn.getEdge(ICubeQueryDefinition.COLUMN_EDGE);
        populateDimLevel(levelList,colEdge);
        DimLevel[] levels=new DimLevel[levelList.size()];
        levelList.toArray(levels);
        return levels;
      }
 else {
        DimLevel[] levels=new DimLevel[aggrs.size()];
        for (int i=0; i < aggrs.size(); i++) {
          levels[i]=OlapExpressionUtil.getTargetDimLevel(aggrs.get(i).toString());
        }
        return levels;
      }
    }
  }
  return null;
}
Program: 66618
Project: 66618
Buggy source:
public void setUp() throws Exception {
  super.setUp();
  Context context=Context.enter();
  scope=context.initStandardObjects();
  Context.exit();
  expectedValue=new ArrayList();
  appContextMap.put(DataEngine.DATASET_CACHE_OPTION,"String_Node_Str");
  this.appContextMap.put(DataEngine.DATA_SET_CACHE_ROW_LIMIT,null);
  myDataEngine=newDataEngine();
}

Fixed version (ground truth):
public void setUp() throws Exception {
  super.setUp();
  Context context=Context.enter();
  scope=context.initStandardObjects();
  Context.exit();
  expectedValue=new ArrayList();
  appContextMap.put(DataEngine.DATASET_CACHE_OPTION,"String_Node_Str");
  myDataEngine=newDataEngine();
}
Program: 66619
Project: 66619
Buggy source:
/** 
 * Gets the report design file path
 * @return
 */
public URI getBIRTResourcePath(){
  try {
    return new URI(encode(ReportPlugin.getDefault().getResourceFolder(UIUtil.getCurrentProject(),(ModuleHandle)null)));
  }
 catch (  URISyntaxException e) {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Gets the report design file path
 * @return
 */
public URI getBIRTResourcePath(){
  if (UIUtil.getCurrentProject() == null) {
    try {
      ModuleHandle handle=SessionHandleAdapter.getInstance().getReportDesignHandle();
      if (handle != null) {
        return new URI(encode(handle.getResourceFolder()));
      }
    }
 catch (    URISyntaxException e) {
    }
  }
  try {
    return new URI(encode(ReportPlugin.getDefault().getResourceFolder(UIUtil.getCurrentProject(),(ModuleHandle)null)));
  }
 catch (  URISyntaxException e) {
    return null;
  }
}
Program: 66620
Project: 66620
Buggy source:
/** 
 * @param dataSetName
 * @throws AdapterException
 * @throws BirtException
 */
private void defineDataSet(DataSetHandle handle,DataSetHandleProcessContext procesCtx) throws AdapterException, BirtException {
  if (handle == null) {
    return;
  }
  DefineDataSourceSetUtil.defineDataSourceAndDataSet(handle,this.dataEngine,this.modelAdaptor,procesCtx);
}

Fixed version (ground truth):
/** 
 * @param dataSetName
 * @throws AdapterException
 * @throws BirtException
 */
private void defineDataSet(DataSetHandle handle,DataSetHandleProcessContext procesCtx) throws AdapterException, BirtException {
  if (handle == null) {
    return;
  }
  DefineDataSourceSetUtil.defineDataSourceAndDataSet(handle,this.dataEngine,this.modelAdaptor,procesCtx);
  preDefineDataSet(handle);
}
Program: 66621
Project: 66621
Buggy source:
/** 
 * @param dsAndDs
 * @return
 */
boolean doesLoadFromCache(DataSourceAndDataSet dsAndDs,int requiredCapability){
synchronized (cacheMap) {
    IDataSetCacheObject cacheObject=(IDataSetCacheObject)cacheMap.get(dsAndDs);
    if (cacheObject != null) {
      return cacheObject.isCachedDataReusable(requiredCapability);
    }
 else {
      return false;
    }
  }
}

Fixed version (ground truth):
/** 
 * @param dsAndDs
 * @return
 */
boolean doesLoadFromCache(DataSourceAndDataSet dsAndDs,int requiredCapability){
synchronized (cacheMap) {
    IDataSetCacheObject cacheObject=(IDataSetCacheObject)cacheMap.get(dsAndDs);
    if (cacheObject != null) {
      boolean reusable=cacheObject.isCachedDataReusable(requiredCapability);
      if (!reusable) {
        cacheObject.release();
        cacheMap.remove(dsAndDs);
      }
      return reusable;
    }
 else {
      return false;
    }
  }
}
Program: 66623
Project: 66623
Buggy source:
protected boolean doAction() throws Exception {
  if (Policy.TRACING_ACTIONS) {
    System.out.println("String_Node_Str");
  }
  DataSetHandle dsHandle=(DataSetHandle)getSelection();
  if (!(dsHandle instanceof JointDataSetHandle) && !(dsHandle instanceof DerivedDataSetHandle) && dsHandle.getDataSource() == null) {
    try {
      List dataSourceList=DEUtil.getDataSources();
      String[] names=new String[dataSourceList.size()];
      for (int i=0; i < names.length; i++) {
        names[i]=((DataSourceHandle)dataSourceList.get(i)).getName();
      }
      DataSourceSelectionDialog dataSorucedialog=new DataSourceSelectionDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(),Messages.getString("String_Node_Str"),names);
      if (dataSorucedialog.open() == Dialog.CANCEL)       return false;
      dsHandle.setDataSource(dataSorucedialog.getResult().toString());
    }
 catch (    SemanticException e) {
      ExceptionHandler.handle(e);
      return false;
    }
  }
  DataSetEditor dialog=new AdvancedDataSetEditor(PlatformUI.getWorkbench().getDisplay().getActiveShell(),dsHandle,false);
  return (dialog.open() == IDialogConstants.OK_ID);
}

Fixed version (ground truth):
protected boolean doAction() throws Exception {
  if (Policy.TRACING_ACTIONS) {
    System.out.println("String_Node_Str");
  }
  DataSetHandle dsHandle=(DataSetHandle)getSelection();
  if (!(dsHandle instanceof JointDataSetHandle) && !(dsHandle instanceof DerivedDataSetHandle) && dsHandle.getDataSource() == null) {
    try {
      List dataSourceList=DEUtil.getDataSources();
      String[] names=new String[dataSourceList.size()];
      for (int i=0; i < names.length; i++) {
        names[i]=((DataSourceHandle)dataSourceList.get(i)).getName();
      }
      DataSourceSelectionDialog dataSorucedialog=new DataSourceSelectionDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(),Messages.getString("String_Node_Str"),names);
      if (dataSorucedialog.open() == Dialog.CANCEL)       return false;
      dsHandle.setDataSource(dataSorucedialog.getResult().toString());
    }
 catch (    SemanticException e) {
      ExceptionHandler.handle(e);
      return false;
    }
  }
  DataSetEditor dialog=new AdvancedDataSetEditor(PlatformUI.getWorkbench().getDisplay().getActiveShell(),dsHandle,false,false);
  return (dialog.open() == IDialogConstants.OK_ID);
}
Program: 66624
Project: 66624
Buggy source:
private boolean editDataSet(DataSetHandle ds){
  dataSetHandle=ds;
  if (dataSetHandle == null)   return false;
  if (dataSetHandle instanceof ScriptDataSetHandle) {
    return false;
  }
  DataSetEditor dialog=new AdvancedDataSetEditor(PlatformUI.getWorkbench().getDisplay().getActiveShell(),dataSetHandle,true);
  return (dialog.open() == Window.OK);
}

Fixed version (ground truth):
private boolean editDataSet(DataSetHandle ds){
  dataSetHandle=ds;
  if (dataSetHandle == null)   return false;
  if (dataSetHandle instanceof ScriptDataSetHandle) {
    return false;
  }
  DataSetEditor dialog=new AdvancedDataSetEditor(PlatformUI.getWorkbench().getDisplay().getActiveShell(),dataSetHandle,true,true);
  return (dialog.open() == Window.OK);
}
Program: 66625
Project: 66625
Buggy source:
private boolean editDataSet(List existingDataSets,List newDataSets){
  if (existingDataSets == null || newDataSets == null) {
    return false;
  }
  if (newDataSets.size() <= existingDataSets.size()) {
    return false;
  }
  dataSetHandle=findNewDataSet(existingDataSets,newDataSets);
  if (dataSetHandle == null)   return false;
  if (dataSetHandle instanceof ScriptDataSetHandle) {
    return false;
  }
  DataSetEditor dialog=new AdvancedDataSetEditor(PlatformUI.getWorkbench().getDisplay().getActiveShell(),dataSetHandle,false);
  return (dialog.open() == Window.OK);
}

Fixed version (ground truth):
private boolean editDataSet(List existingDataSets,List newDataSets){
  if (existingDataSets == null || newDataSets == null) {
    return false;
  }
  if (newDataSets.size() <= existingDataSets.size()) {
    return false;
  }
  dataSetHandle=findNewDataSet(existingDataSets,newDataSets);
  if (dataSetHandle == null)   return false;
  if (dataSetHandle instanceof ScriptDataSetHandle) {
    return false;
  }
  DataSetEditor dialog=new AdvancedDataSetEditor(PlatformUI.getWorkbench().getDisplay().getActiveShell(),dataSetHandle,false,true);
  return (dialog.open() == Window.OK);
}
Program: 66626
Project: 66626
Buggy source:
public AdvancedDataSetEditor(Shell parentShell,DataSetHandle ds,boolean needToFocusOnOutput){
  super(parentShell,ds,needToFocusOnOutput);
}

Fixed version (ground truth):
public AdvancedDataSetEditor(Shell parentShell,DataSetHandle ds,boolean needToFocusOnOutput,boolean isNewlyCreated){
  super(parentShell,ds,needToFocusOnOutput,isNewlyCreated);
}
Program: 66627
Project: 66627
Buggy source:
/** 
 * The constructor.
 * @param parentShell
 */
public DataSetEditor(Shell parentShell,DataSetHandle ds,boolean needToFocusOnOutput){
  super(parentShell,ds);
  ExternalUIUtil.validateDataSetHandle(ds);
  initModelManager();
  this.needToFocusOnOutput=needToFocusOnOutput;
  String dataSourceType, dataSetType;
  if (ds instanceof OdaDataSetHandle) {
    OdaDataSourceHandle dataSource=(OdaDataSourceHandle)((OdaDataSetHandle)ds).getDataSource();
    dataSourceType=dataSource.getExtensionID();
    dataSetType=((OdaDataSetHandle)ds).getExtensionID();
  }
 else   if (ds instanceof ScriptDataSetHandle) {
    dataSourceType=DataUIConstants.DATA_SOURCE_SCRIPT;
    dataSetType=DataUIConstants.DATA_SET_SCRIPT;
  }
 else   if (ds instanceof JointDataSetHandle) {
    dataSourceType="String_Node_Str";
    dataSetType="String_Node_Str";
  }
 else {
    dataSourceType=ExternalUIUtil.getDataSourceType(ds);
    dataSetType=ExternalUIUtil.getDataSetType(ds);
  }
  boolean containsDataSource=ExternalUIUtil.containsDataSource(ds);
  if (containsDataSource) {
    addPageTo("String_Node_Str",DATA_SOURCE_SELECTION_PAGE,Messages.getString("String_Node_Str"),null,new DataSetDataSourceSelectionPage());
    if (DesignSessionUtil.hasValidOdaDesignUIExtension(dataSourceType)) {
      addCustomPageODAV3((OdaDataSetHandle)ds,dataSourceType,dataSetType);
    }
 else     addBirtPage(dataSourceType,dataSetType);
  }
  addCommonPages(ds);
  setPageFocus();
  itemModelManager.start(ds,needToFocusOnOutput);
}

Fixed version (ground truth):
/** 
 * The constructor.
 * @param parentShell
 */
public DataSetEditor(Shell parentShell,DataSetHandle ds,boolean needToFocusOnOutput,boolean isNewlyCreated){
  super(parentShell,ds);
  this.isNewlyCreated=isNewlyCreated;
  ExternalUIUtil.validateDataSetHandle(ds);
  initModelManager();
  this.needToFocusOnOutput=needToFocusOnOutput;
  String dataSourceType, dataSetType;
  if (ds instanceof OdaDataSetHandle) {
    OdaDataSourceHandle dataSource=(OdaDataSourceHandle)((OdaDataSetHandle)ds).getDataSource();
    dataSourceType=dataSource.getExtensionID();
    dataSetType=((OdaDataSetHandle)ds).getExtensionID();
  }
 else   if (ds instanceof ScriptDataSetHandle) {
    dataSourceType=DataUIConstants.DATA_SOURCE_SCRIPT;
    dataSetType=DataUIConstants.DATA_SET_SCRIPT;
  }
 else   if (ds instanceof JointDataSetHandle) {
    dataSourceType="String_Node_Str";
    dataSetType="String_Node_Str";
  }
 else {
    dataSourceType=ExternalUIUtil.getDataSourceType(ds);
    dataSetType=ExternalUIUtil.getDataSetType(ds);
  }
  boolean containsDataSource=ExternalUIUtil.containsDataSource(ds);
  if (containsDataSource) {
    addPageTo("String_Node_Str",DATA_SOURCE_SELECTION_PAGE,Messages.getString("String_Node_Str"),null,new DataSetDataSourceSelectionPage());
    if (DesignSessionUtil.hasValidOdaDesignUIExtension(dataSourceType)) {
      addCustomPageODAV3((OdaDataSetHandle)ds,dataSourceType,dataSetType);
    }
 else     addBirtPage(dataSourceType,dataSetType);
  }
  addCommonPages(ds);
  setPageFocus();
  itemModelManager.start(ds,needToFocusOnOutput);
}
Program: 66628
Project: 66628
Buggy source:
/** 
 * The constructor.
 */
public OutputColumnsPage(){
  super();
}

Fixed version (ground truth):
/** 
 * The constructor.
 */
public OutputColumnsPage(boolean isNewlyCreated){
  super();
  this.isNewlyCreated=isNewlyCreated;
}
Program: 66630
Project: 66630
Buggy source:
protected boolean performEdit(ReportElementHandle handle){
  DataSetHandle dsHandle=(DataSetHandle)handle;
  if (!(dsHandle instanceof JointDataSetHandle || dsHandle instanceof DerivedDataSetHandle) && dsHandle.getDataSource() == null) {
    try {
      List dataSourceList=DEUtil.getDataSources();
      String[] names=new String[dataSourceList.size()];
      for (int i=0; i < names.length; i++) {
        names[i]=((DataSourceHandle)dataSourceList.get(i)).getName();
      }
      DataSourceSelectionDialog dataSorucedialog=new DataSourceSelectionDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(),Messages.getString("String_Node_Str"),names);
      if (dataSorucedialog.open() == Dialog.CANCEL)       return false;
      dsHandle.setDataSource(dataSorucedialog.getResult().toString());
    }
 catch (    SemanticException e) {
      ExceptionHandler.handle(e);
      return false;
    }
  }
  DataSetEditor dialog=new AdvancedDataSetEditor(PlatformUI.getWorkbench().getDisplay().getActiveShell(),(DataSetHandle)handle,false);
  return dialog.open() == Dialog.OK;
}

Fixed version (ground truth):
protected boolean performEdit(ReportElementHandle handle){
  DataSetHandle dsHandle=(DataSetHandle)handle;
  if (!(dsHandle instanceof JointDataSetHandle || dsHandle instanceof DerivedDataSetHandle) && dsHandle.getDataSource() == null) {
    try {
      List dataSourceList=DEUtil.getDataSources();
      String[] names=new String[dataSourceList.size()];
      for (int i=0; i < names.length; i++) {
        names[i]=((DataSourceHandle)dataSourceList.get(i)).getName();
      }
      DataSourceSelectionDialog dataSorucedialog=new DataSourceSelectionDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(),Messages.getString("String_Node_Str"),names);
      if (dataSorucedialog.open() == Dialog.CANCEL)       return false;
      dsHandle.setDataSource(dataSorucedialog.getResult().toString());
    }
 catch (    SemanticException e) {
      ExceptionHandler.handle(e);
      return false;
    }
  }
  DataSetEditor dialog=new AdvancedDataSetEditor(PlatformUI.getWorkbench().getDisplay().getActiveShell(),(DataSetHandle)handle,false,false);
  return dialog.open() == Dialog.OK;
}
Program: 66635
Project: 66635
Buggy source:
/** 
 * Generate a Javascript constant expression by user input string and target BIRT data type.
 * @param input user input string.
 * @param dataType target BIRT data type. available values defined in {@code org.eclipse.birt.core.data.DataType}
 * @return generated Javascript constant expression text
 * @throws BIRTException
 */
public static String generateConstantExpr(String input,int dataType) throws BirtException {
  if (input == null) {
    return null;
  }
  if (dataType == DataType.DECIMAL_TYPE) {
    return "String_Node_Str" + input + "String_Node_Str";
  }
  if (dataType == DataType.STRING_TYPE || dataType == DataType.DATE_TYPE || dataType == DataType.SQL_DATE_TYPE || dataType == DataType.SQL_TIME_TYPE) {
    return JavascriptEvalUtil.transformToJsExpression(input);
  }
  return input;
}

Fixed version (ground truth):
/** 
 * Generate a Javascript constant expression by user input string and target BIRT data type.
 * @param input user input string.
 * @param dataType target BIRT data type. available values defined in {@code org.eclipse.birt.core.data.DataType}
 * @return generated Javascript constant expression text
 * @throws BIRTException
 */
public static String generateConstantExpr(String input,int dataType) throws BirtException {
  if (input == null) {
    return null;
  }
  if (dataType == DataType.DECIMAL_TYPE) {
    return "String_Node_Str" + input + "String_Node_Str";
  }
  if (dataType == DataType.STRING_TYPE || dataType == DataType.DATE_TYPE || dataType == DataType.SQL_DATE_TYPE || dataType == DataType.SQL_TIME_TYPE || dataType == DataType.JAVA_OBJECT_TYPE) {
    return JavascriptEvalUtil.transformToJsExpression(input);
  }
  return input;
}
Program: 66636
Project: 66636
Buggy source:
/** 
 * Gets the report design file path
 * @return
 */
public URI getBIRTResourcePath(){
  try {
    return new URI(encode(ReportPlugin.getDefault().getResourceFolder()));
  }
 catch (  URISyntaxException e) {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Gets the report design file path
 * @return
 */
public URI getBIRTResourcePath(){
  try {
    return new URI(encode(ReportPlugin.getDefault().getResourceFolder(UIUtil.getCurrentProject(),(ModuleHandle)null)));
  }
 catch (  URISyntaxException e) {
    return null;
  }
}
Program: 66637
Project: 66637
Buggy source:
public void splitColumns(int startCoordinate,int endCoordinate,int[] columnStartCoordinates,boolean autoExtend){
  int[] scale=axis.getColumnCoordinatesInRange(startCoordinate,endCoordinate);
  for (int i=0; i < scale.length - 1; i++) {
    int startPosition=scale[i];
    int endPostion=scale[i + 1];
    int[] range=inRange(startPosition,endPostion,columnStartCoordinates);
    if (range.length > 0) {
      int pos=axis.getColumnIndexByCoordinate(startPosition);
      currentCache.insertColumns(pos,range.length);
      for (int j=0; j < range.length; j++) {
        axis.addCoordinate(range[j]);
      }
    }
  }
  if (autoExtend) {
    int index=0;
    int currentColumnCount=columnStartCoordinates.length;
    while (index < currentColumnCount && columnStartCoordinates[index] <= endCoordinate) {
      index++;
    }
    for (int i=index; i < currentColumnCount; i++) {
      axis.addCoordinate(columnStartCoordinates[i]);
    }
    int newColumnCount=currentColumnCount - index;
    currentCache.insertColumns(newColumnCount);
  }
}

Fixed version (ground truth):
public void splitColumns(int startCoordinate,int endCoordinate,int[] columnStartCoordinates,boolean autoExtend){
  int[] scale=axis.getColumnCoordinatesInRange(startCoordinate,endCoordinate);
  for (int i=0; i < scale.length - 1; i++) {
    int startPosition=scale[i];
    int endPostion=scale[i + 1];
    int[] range=inRange(startPosition,endPostion,columnStartCoordinates);
    if (range.length > 0) {
      int pos=axis.getColumnIndexByCoordinate(startPosition);
      currentCache.insertColumns(pos,range.length);
      for (int j=0; j < range.length; j++) {
        axis.addCoordinate(range[j]);
      }
    }
  }
  if (autoExtend) {
    int index=0;
    int currentColumnCount=columnStartCoordinates.length;
    while (index < currentColumnCount && AxisProcessor.round(columnStartCoordinates[index]) <= endCoordinate) {
      index++;
    }
    for (int i=index; i < currentColumnCount; i++) {
      axis.addCoordinate(columnStartCoordinates[i]);
    }
    int newColumnCount=currentColumnCount - index;
    currentCache.insertColumns(newColumnCount);
  }
}
Program: 66638
Project: 66638
Buggy source:
private int[] inRange(int start,int end,int[] data){
  int[] range=new int[data.length];
  int count=0;
  for (int i=0; i < range.length; i++) {
    if ((data[i] > start) && (data[i] < end)) {
      range[count++]=data[i];
    }
  }
  int[] result=new int[count];
  System.arraycopy(range,0,result,0,count);
  return result;
}

Fixed version (ground truth):
private int[] inRange(int start,int end,int[] data){
  int[] range=new int[data.length];
  int count=0;
  for (int i=0; i < range.length; i++) {
    int value=AxisProcessor.round(data[i]);
    if ((value > start) && (value < end)) {
      range[count++]=value;
    }
  }
  int[] result=new int[count];
  System.arraycopy(range,0,result,0,count);
  return result;
}
Program: 66641
Project: 66641
Buggy source:
public DummyEngineTask(ReportEngine engine,IReportRunnable runnable,ModuleHandle moduleHandle){
  super(engine,runnable);
  setEngineTaskParameters(this,moduleHandle);
  this.taskType=IEngineTask.TASK_UNKNOWN;
}

Fixed version (ground truth):
public DummyEngineTask(ReportEngine engine,IReportRunnable runnable,ModuleHandle moduleHandle,DataSetHandle handle){
  super(engine,runnable);
  setEngineTaskParameters(this,moduleHandle);
  this.taskType=IEngineTask.TASK_UNKNOWN;
  this.dataSetHandle=handle;
}
Program: 66642
Project: 66642
Buggy source:
private void defineDataSourceDataSet(IQueryDefinition queryDefn) throws BirtException {
  String dataSetName=queryDefn.getDataSetName();
  ModuleHandle module=sessionContext.getModuleHandle();
  if (module != null) {
    List l=module.getAllDataSets();
    DataSetHandle handle=null;
    for (int i=0; i < l.size(); i++) {
      if (((DataSetHandle)l.get(i)).getQualifiedName() != null && ((DataSetHandle)l.get(i)).getQualifiedName().equals(dataSetName)) {
        handle=(DataSetHandle)l.get(i);
        break;
      }
    }
    DefineDataSourceSetUtil.defineDataSourceAndDataSet(handle,dataEngine,this.modelAdaptor);
  }
}

Fixed version (ground truth):
private void defineDataSourceDataSet(IQueryDefinition queryDefn) throws BirtException {
  String dataSetName=queryDefn.getDataSetName();
  ModuleHandle module=sessionContext.getModuleHandle();
  if (module != null) {
    List l=module.getAllDataSets();
    DataSetHandle handle=null;
    for (int i=0; i < l.size(); i++) {
      if (((DataSetHandle)l.get(i)).getQualifiedName() != null && ((DataSetHandle)l.get(i)).getQualifiedName().equals(dataSetName)) {
        handle=(DataSetHandle)l.get(i);
        break;
      }
    }
    DefineDataSourceSetUtil.defineDataSourceAndDataSet(handle,dataEngine,this.modelAdaptor,null);
  }
}
Program: 66643
Project: 66643
Buggy source:
public static void defineDataSourceAndDataSet(DataSetHandle dataSet,DataEngine dataEngine,IModelAdapter modelAdaptor) throws BirtException {
  if (dataSet == null)   return;
  DataSourceHandle dataSource=dataSet.getDataSource();
  if (dataSource != null && ((DataEngineImpl)dataEngine).getDataSourceRuntime(dataSource.getName()) == null) {
    dataEngine.defineDataSource(modelAdaptor.adaptDataSource(dataSource));
  }
  if (dataSet instanceof JointDataSetHandle) {
    JointDataSetHandle jointDataSet=(JointDataSetHandle)dataSet;
    Iterator iter=jointDataSet.dataSetsIterator();
    while (iter.hasNext()) {
      DataSetHandle childDataSet=(DataSetHandle)iter.next();
      if (childDataSet != null) {
        DataSourceHandle childDataSource=childDataSet.getDataSource();
        if (childDataSource != null) {
          dataEngine.defineDataSource(modelAdaptor.adaptDataSource(childDataSource));
        }
        defineDataSourceAndDataSet(childDataSet,dataEngine,modelAdaptor);
      }
    }
  }
  if (dataSet instanceof DerivedDataSetHandle) {
    List inputDataSet=((DerivedDataSetHandle)dataSet).getInputDataSets();
    for (int i=0; i < inputDataSet.size(); i++) {
      defineDataSourceAndDataSet((DataSetHandle)inputDataSet.get(i),dataEngine,modelAdaptor);
    }
  }
  if (((DataEngineImpl)dataEngine).getDataSetDesign(dataSet.getQualifiedName()) == null)   dataEngine.defineDataSet(modelAdaptor.adaptDataSet(dataSet));
}

Fixed version (ground truth):
public static void defineDataSourceAndDataSet(DataSetHandle dataSet,DataEngine dataEngine,IModelAdapter modelAdaptor,QueryExecutionHelper.DataSetHandleProcessContext context) throws BirtException {
  if (dataSet == null)   return;
  DataSourceHandle dataSource=dataSet.getDataSource();
  if (dataSource != null && ((DataEngineImpl)dataEngine).getDataSourceRuntime(dataSource.getName()) == null) {
    dataEngine.defineDataSource(modelAdaptor.adaptDataSource(dataSource));
  }
  if (dataSet instanceof JointDataSetHandle) {
    JointDataSetHandle jointDataSet=(JointDataSetHandle)dataSet;
    Iterator iter=jointDataSet.dataSetsIterator();
    while (iter.hasNext()) {
      DataSetHandle childDataSet=(DataSetHandle)iter.next();
      if (childDataSet != null) {
        DataSourceHandle childDataSource=childDataSet.getDataSource();
        if (childDataSource != null) {
          dataEngine.defineDataSource(modelAdaptor.adaptDataSource(childDataSource));
        }
        defineDataSourceAndDataSet(childDataSet,dataEngine,modelAdaptor,context);
      }
    }
  }
  if (dataSet instanceof DerivedDataSetHandle) {
    List inputDataSet=((DerivedDataSetHandle)dataSet).getInputDataSets();
    for (int i=0; i < inputDataSet.size(); i++) {
      defineDataSourceAndDataSet((DataSetHandle)inputDataSet.get(i),dataEngine,modelAdaptor,context);
    }
  }
  IBaseDataSetDesign design=((DataEngineImpl)dataEngine).getDataSetDesign(dataSet.getQualifiedName());
  if (design == null) {
    design=modelAdaptor.adaptDataSet(dataSet);
    dataEngine.defineDataSet(design);
  }
  if (context != null)   context.process(design,dataSet);
}
Program: 66644
Project: 66644
Buggy source:
/** 
 * @param queryDefn
 * @throws AdapterException
 * @throws BirtException
 */
private void defineDataSourceDataSet(IQueryDefinition queryDefn,boolean keepDataSetFilter,boolean allowAggregation) throws AdapterException, BirtException {
  String dataSetName=queryDefn.getDataSetName();
  ModuleHandle module=sessionContext.getModuleHandle();
  if (module != null) {
    List l=module.getAllDataSets();
    DataSetHandle handle=null;
    for (int i=0; i < l.size(); i++) {
      if (((DataSetHandle)l.get(i)).getQualifiedName() != null && ((DataSetHandle)l.get(i)).getQualifiedName().equals(dataSetName)) {
        handle=(DataSetHandle)l.get(i);
        break;
      }
    }
    major=handle;
    defineDataSet(handle,keepDataSetFilter,allowAggregation);
  }
}

Fixed version (ground truth):
/** 
 * @param queryDefn
 * @throws AdapterException
 * @throws BirtException
 */
private void defineDataSourceDataSet(IQueryDefinition queryDefn,boolean keepDataSetFilter,boolean allowAggregation) throws AdapterException, BirtException {
  String dataSetName=queryDefn.getDataSetName();
  ModuleHandle module=sessionContext.getModuleHandle();
  if (module != null) {
    List l=module.getAllDataSets();
    DataSetHandle handle=null;
    for (int i=0; i < l.size(); i++) {
      if (((DataSetHandle)l.get(i)).getQualifiedName() != null && ((DataSetHandle)l.get(i)).getQualifiedName().equals(dataSetName)) {
        handle=(DataSetHandle)l.get(i);
        break;
      }
    }
    major=handle;
    defineDataSet(handle,new DataSetHandleProcessContext(major,useResultHints,keepDataSetFilter,allowAggregation));
  }
}
Program: 66645
Project: 66645
Buggy source:
/** 
 * @param dataSetName
 * @throws AdapterException
 * @throws BirtException
 */
private void defineDataSet(DataSetHandle handle,boolean keepDataSetFilter,boolean disAllowAggregation) throws AdapterException, BirtException {
  if (handle == null) {
    return;
  }
  DataSourceHandle dataSourceHandle=handle.getDataSource();
  if (dataSourceHandle != null) {
    IBaseDataSourceDesign dsourceDesign=this.modelAdaptor.adaptDataSource(dataSourceHandle);
    dataEngine.defineDataSource(dsourceDesign);
  }
  if (handle instanceof JointDataSetHandle) {
    defineSourceDataSets((JointDataSetHandle)handle);
  }
  if (handle instanceof DerivedDataSetHandle) {
    List inputDataSet=((DerivedDataSetHandle)handle).getInputDataSets();
    for (int i=0; i < inputDataSet.size(); i++) {
      defineDataSet((DataSetHandle)inputDataSet.get(i),keepDataSetFilter,disAllowAggregation);
    }
  }
  BaseDataSetDesign baseDS=this.modelAdaptor.adaptDataSet(handle);
  if (useResultHints == false && handle.equals(major)) {
    baseDS.getResultSetHints().clear();
  }
  if (!keepDataSetFilter) {
    if (baseDS.getFilters() != null)     baseDS.getFilters().clear();
  }
  if (disAllowAggregation) {
    List computedColumns=baseDS.getComputedColumns();
    if (computedColumns != null && computedColumns.size() != 0) {
      for (int i=0; i < computedColumns.size(); i++) {
        IComputedColumn computedColumn=(IComputedColumn)computedColumns.get(i);
        if (computedColumn.getAggregateFunction() != null) {
          computedColumns.set(i,new ComputedColumn(computedColumn.getName(),"String_Node_Str"));
        }
      }
    }
  }
  session.defineDataSet(baseDS);
}

Fixed version (ground truth):
/** 
 * @param dataSetName
 * @throws AdapterException
 * @throws BirtException
 */
private void defineDataSet(DataSetHandle handle,DataSetHandleProcessContext procesCtx) throws AdapterException, BirtException {
  if (handle == null) {
    return;
  }
  DefineDataSourceSetUtil.defineDataSourceAndDataSet(handle,this.dataEngine,this.modelAdaptor,procesCtx);
}
Program: 66646
Project: 66646
Buggy source:
/** 
 * Executes a method script. Each script should be identified with a unique name within the scope (such as "afterOpen", "onFetch" etc.). This class  assumes that the content of a named method script is immutable, therefore it defines each named script only once.
 * @param methodName Identification of the script
 * @param script Script text
 * @return Return value from the script
 */
public Object runScript(String methodName,String script) throws BirtException {
  methodName=METHOD_NAME_PREFIX + methodName;
  try {
    if (!scope.has(methodName,scope)) {
      String scriptText="String_Node_Str" + methodName + "String_Node_Str"+ script+ "String_Node_Str";
      ScriptEvalUtil.evaluateJSAsExpr(cx,scope,scriptText,ScriptExpression.defaultID,1);
    }
    String callScriptText=methodName + "String_Node_Str";
    Object result=ScriptEvalUtil.evaluateJSAsExpr(cx,scope,callScriptText,ScriptExpression.defaultID,1);
    return result;
  }
 catch (  DataException e) {
    throw new DataException(ResourceConstants.SCIRPT_FUNCTION_EXECUTION_FAIL,e,new Object[]{methodName,script});
  }
}

Fixed version (ground truth):
/** 
 * Executes a method script. Each script should be identified with a unique name within the scope (such as "afterOpen", "onFetch" etc.). This class  assumes that the content of a named method script is immutable, therefore it defines each named script only once.
 * @param methodName Identification of the script
 * @param script Script text
 * @param id script id using in debug mode
 * @return Return value from the script
 */
public Object runScript(String methodName,String script,String id) throws BirtException {
  methodName=METHOD_NAME_PREFIX + methodName;
  try {
    if (!scope.has(methodName,scope)) {
      String scriptText="String_Node_Str" + methodName + "String_Node_Str"+ script+ "String_Node_Str";
      ScriptEvalUtil.evaluateJSAsExpr(cx,scope,scriptText,id,1);
    }
    String callScriptText=methodName + "String_Node_Str";
    Object result=ScriptEvalUtil.evaluateJSAsExpr(cx,scope,callScriptText,id,1);
    return result;
  }
 catch (  DataException e) {
    throw new DataException(ResourceConstants.SCIRPT_FUNCTION_EXECUTION_FAIL,e,new Object[]{methodName,script});
  }
}
Program: 66647
Project: 66647
Buggy source:
/** 
 * Evaluates a ROM script and converts the result type into one accepted by BIRT: Double (for all numeric types), java.util.Date, String, Boolean. Converts Javascript exception and script runtime exceptions to DataException
 * @param cx
 * @param scope
 * @param scriptText
 * @param source
 * @param lineNo
 * @return
 * @throws DataException
 */
public static Object evaluateJSAsExpr(ScriptContext cx,Scriptable scope,String scriptText,String source,int lineNo) throws DataException {
  if (logger.isLoggable(Level.FINER))   logger.entering(ScriptEvalUtil.class.getName(),"String_Node_Str","String_Node_Str" + scriptText + "String_Node_Str"+ source+ "String_Node_Str"+ lineNo);
  Object result;
  try {
    result=JavascriptEvalUtil.evaluateScript(Context.getCurrentContext(),scope,scriptText,"String_Node_Str",0);
  }
 catch (  BirtException e) {
    throw DataException.wrap(e);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Evaluates a ROM script and converts the result type into one accepted by BIRT: Double (for all numeric types), java.util.Date, String, Boolean. Converts Javascript exception and script runtime exceptions to DataException
 * @param cx
 * @param scope
 * @param scriptText
 * @param source
 * @param lineNo
 * @return
 * @throws DataException
 */
public static Object evaluateJSAsExpr(ScriptContext cx,Scriptable scope,String scriptText,String source,int lineNo) throws DataException {
  if (logger.isLoggable(Level.FINER))   logger.entering(ScriptEvalUtil.class.getName(),"String_Node_Str","String_Node_Str" + scriptText + "String_Node_Str"+ source+ "String_Node_Str"+ lineNo);
  Object result;
  try {
    result=JavascriptEvalUtil.evaluateScript(Context.getCurrentContext(),scope,scriptText,source,0);
  }
 catch (  BirtException e) {
    throw DataException.wrap(e);
  }
  return result;
}
Program: 66648
Project: 66648
Buggy source:
public void handleOnFetch(IDataSetInstanceHandle dataSet,IDataRow row){
  if (reportContext == null)   return;
  try {
    if (!this.useOnFetchEventHandler) {
      Scriptable scope=getScriptScope(dataSet);
      ScriptStatus status=handleJS(scope,dataSet.getName(),ON_FETCH,dataSetHandle.getOnFetch());
      if (status.didRun())       return;
    }
    if (eventHandler != null)     eventHandler.onFetch(new DataSetInstance(dataSet),new DataSetRow(row),reportContext);
  }
 catch (  Exception e) {
    addException(context,e);
  }
}

Fixed version (ground truth):
public void handleOnFetch(IDataSetInstanceHandle dataSet,IDataRow row){
  if (reportContext == null)   return;
  try {
    if (!this.useOnFetchEventHandler) {
      Scriptable scope=getScriptScope(dataSet);
      ScriptStatus status=handleJS(scope,dataSet.getName(),ON_FETCH,dataSetHandle.getOnFetch(),onFetchMethodID);
      if (status.didRun())       return;
    }
    if (eventHandler != null)     eventHandler.onFetch(new DataSetInstance(dataSet),new DataSetRow(row),reportContext);
  }
 catch (  Exception e) {
    addException(context,e);
  }
}