nus-yam/ex-repair huggingface dataset:
Program: 73724
Project: 73724
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,cell,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.getFullName();
  String colLevel=colLevelHandle == null ? null : colLevelHandle.getFullName();
  String rowDimension=null;
  String colDimension=null;
  if (rowLevelHandle != null && rowLevelHandle.getContainer() != null && rowLevelHandle.getContainer().getContainer() != null) {
    rowDimension=rowLevelHandle.getContainer().getContainer().getFullName();
  }
  if (colLevelHandle != null && colLevelHandle.getContainer() != null && colLevelHandle.getContainer().getContainer() != null) {
    colDimension=colLevelHandle.getContainer().getContainer().getFullName();
  }
  CrosstabUtil.addDataItem(crosstab,cell,measureView,null,rowDimension,rowLevel,colDimension,colLevel);
}
Program: 73725
Project: 73725
Buggy source:
/** 
 * Creates view upon given multiview host
 */
DesignElementHandle createView(DesignElementHandle host);

Fixed version (ground truth):
/** 
 * Creates view upon given multiview host
 */
DesignElementHandle createView(DesignElementHandle host) throws BirtException ;
Program: 73726
Project: 73726
Buggy source:
public void run(){
  showSelectionPage(selectedNode);
}

Fixed version (ground truth):
public void run(){
  l.pageChanged(event);
}
Program: 73727
Project: 73727
Buggy source:
private final void performHelp(){
  if (currentNode != null) {
    currentNode.getPage().performHelp();
  }
}

Fixed version (ground truth):
private final void performHelp(){
  if (currentNode != null) {
    currentNode.getPageControl().notifyListeners(SWT.Help,new Event());
  }
}
Program: 73729
Project: 73729
Buggy source:
protected Control createDialogArea(Composite parent){
  ChartUIUtil.bindHelp(parent,ChartHelpContextIds.DIALOG_GROUP_AND_SORT);
  getShell().setText(Messages.getString("String_Node_Str"));
  Composite cmpContent=new Composite(parent,SWT.NONE);
{
    GridLayout glContent=new GridLayout(2,false);
    cmpContent.setLayout(glContent);
    GridData gd=new GridData(GridData.FILL_BOTH);
    cmpContent.setLayoutData(gd);
  }
  Composite cmpBasic=new Composite(cmpContent,SWT.NONE);
{
    cmpBasic.setLayout(new GridLayout(2,false));
    GridData gd=new GridData(GridData.FILL_HORIZONTAL);
    cmpBasic.setLayoutData(gd);
  }
  createSortArea(cmpBasic);
  createGroupArea(cmpBasic);
  initSortKey();
  populateLists();
  return cmpContent;
}

Fixed version (ground truth):
protected Control createDialogArea(Composite parent){
  ChartUIUtil.bindHelp(parent,ChartHelpContextIds.DIALOG_GROUP_AND_SORT);
  getShell().setText(Messages.getString("String_Node_Str"));
  Composite cmpContent=new Composite(parent,SWT.NONE);
{
    GridLayout glContent=new GridLayout(2,false);
    cmpContent.setLayout(glContent);
    GridData gd=new GridData(GridData.FILL_BOTH);
    cmpContent.setLayoutData(gd);
  }
  Composite cmpBasic=new Composite(cmpContent,SWT.NONE);
{
    cmpBasic.setLayout(new GridLayout(2,false));
    GridData gd=new GridData(GridData.FILL_HORIZONTAL);
    cmpBasic.setLayoutData(gd);
  }
  createSortArea(cmpBasic);
  if (ChartUIUtil.isGroupingSupported(wizardContext)) {
    createGroupArea(cmpBasic);
  }
  initSortKey();
  populateLists();
  return cmpContent;
}
Program: 73730
Project: 73730
Buggy source:
public void handleEvent(Event event){
  if (event.data == getDataSheet()) {
    if (event.type == IChartDataSheet.EVENT_UPDATE) {
      doLivePreview();
      updateApplyButton();
    }
  }
}

Fixed version (ground truth):
public void handleEvent(Event event){
  if (event.data == getDataSheet()) {
    if (event.type == IChartDataSheet.EVENT_PREVIEW) {
      doLivePreview();
      updateApplyButton();
    }
 else     if (event.type == IChartDataSheet.EVENT_QUERY) {
      getCustomizeUI().refreshBottomBindingArea();
      getCustomizeUI().refreshLeftBindingArea();
      getCustomizeUI().refreshRightBindingArea();
    }
  }
}
Program: 73731
Project: 73731
Buggy source:
public void createControl(Composite parent){
  if (topControl == null || topControl.isDisposed()) {
    topControl=new Composite(parent,SWT.NONE);
    GridLayout gridLayout=new GridLayout(3,false);
    gridLayout.marginWidth=0;
    gridLayout.marginHeight=0;
    topControl.setLayout(gridLayout);
    topControl.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
    dynamicArea=new SelectDataDynamicArea(this);
    getCustomizeUI().init();
    foSashForm=new SashForm(topControl,SWT.VERTICAL);
{
      GridLayout layout=new GridLayout();
      foSashForm.setLayout(layout);
      GridData gridData=new GridData(GridData.FILL_BOTH);
      gridData.heightHint=580;
      foSashForm.setLayoutData(gridData);
    }
    placeComponents();
    createPreviewPainter();
  }
 else {
    customizeUI();
  }
  if (getChartModel() instanceof ChartWithAxes) {
    changeTask(null);
  }
  doLivePreview();
  DataDefinitionTextManager.getInstance().refreshAll();
  ChartUIUtil.bindHelp(getControl(),ChartHelpContextIds.TASK_SELECT_DATA);
  getDataSheet().setChartModel(getChartModel());
  getDataSheet().addListener(IChartDataSheet.EVENT_UPDATE,this);
}

Fixed version (ground truth):
public void createControl(Composite parent){
  getDataSheet().setChartModel(getChartModel());
  getDataSheet().addListener(this);
  if (topControl == null || topControl.isDisposed()) {
    topControl=new Composite(parent,SWT.NONE);
    GridLayout gridLayout=new GridLayout(3,false);
    gridLayout.marginWidth=0;
    gridLayout.marginHeight=0;
    topControl.setLayout(gridLayout);
    topControl.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
    dynamicArea=new SelectDataDynamicArea(this);
    getCustomizeUI().init();
    foSashForm=new SashForm(topControl,SWT.VERTICAL);
{
      GridLayout layout=new GridLayout();
      foSashForm.setLayout(layout);
      GridData gridData=new GridData(GridData.FILL_BOTH);
      gridData.heightHint=580;
      foSashForm.setLayoutData(gridData);
    }
    placeComponents();
    createPreviewPainter();
  }
 else {
    customizeUI();
  }
  if (getChartModel() instanceof ChartWithAxes) {
    changeTask(null);
  }
  doLivePreview();
  DataDefinitionTextManager.getInstance().refreshAll();
  ChartUIUtil.bindHelp(getControl(),ChartHelpContextIds.TASK_SELECT_DATA);
}
Program: 73732
Project: 73732
Buggy source:
public void handleEvent(Event event){
  query.setDefinition(cmbDefinition.getText());
  if (context.getModel() instanceof ChartWithAxes) {
    ((ChartWithAxes)context.getModel()).setTransposed(cmbDefinition.getSelectionIndex() > 0);
  }
}

Fixed version (ground truth):
public void handleEvent(Event event){
  query.setDefinition(cmbDefinition.getText());
}
Program: 73733
Project: 73733
Buggy source:
private void createAggregationItem(Composite composite){
  fAggEditorComposite=new AggregateEditorComposite(composite,seriesdefinition,context);
  SeriesDefinition baseSD=(SeriesDefinition)ChartUIUtil.getBaseSeriesDefinitions(context.getModel()).get(0);
  boolean enabled=!PluginSettings.instance().inEclipseEnv() && baseSD.getGrouping().isEnabled();
  fAggEditorComposite.setEnabled(PluginSettings.instance().inEclipseEnv() || enabled);
}

Fixed version (ground truth):
private void createAggregationItem(Composite composite){
  fAggEditorComposite=new AggregateEditorComposite(composite,seriesdefinition,context);
  SeriesDefinition baseSD=(SeriesDefinition)ChartUIUtil.getBaseSeriesDefinitions(context.getModel()).get(0);
  fAggEditorComposite.setEnabled(ChartUIUtil.isGroupingSupported(context) && (PluginSettings.instance().inEclipseEnv() || baseSD.getGrouping().isEnabled()));
}
Program: 73735
Project: 73735
Buggy source:
public ChartWizardContext(Chart chartModel,IUIServiceProvider uiProvider,IDataServiceProvider dataProvider,IChartDataSheet dataSheet){
  this.chartModel=chartModel;
  this.uiProvider=uiProvider;
  this.dataProvider=dataProvider;
  this.dataSheet=dataSheet;
}

Fixed version (ground truth):
public ChartWizardContext(Chart chartModel,IUIServiceProvider uiProvider,IDataServiceProvider dataProvider,IChartDataSheet dataSheet){
  this.chartModel=chartModel;
  this.uiProvider=uiProvider;
  this.dataProvider=dataProvider;
  this.dataSheet=dataSheet;
  this.dataSheet.setContext(this);
}
Program: 73736
Project: 73736
Buggy source:
/** 
 * @param stopSign
 * @throws DataException
 */
private void doGroupFiltering(StopSign stopSign) throws DataException {
  if (!groupingDone) {
    PassUtil.pass(this.populator,new OdiResultSetWrapper(populator.getResultIterator()),true,stopSign);
    groupingDone=true;
  }
  if (this.populator.getQuery().getGrouping() != null && this.populator.getQuery().getGrouping().length > 0) {
    this.populator.getGroupProcessorManager().doGroupFiltering(this.populator.getCache(),this.populator.getExpressionProcessor(),stopSign);
  }
}

Fixed version (ground truth):
/** 
 * @param stopSign
 * @throws DataException
 */
private void doGroupFiltering(StopSign stopSign) throws DataException {
  if (!this.needDoGroupFiltering())   return;
  if (!groupingDone) {
    PassUtil.pass(this.populator,new OdiResultSetWrapper(populator.getResultIterator()),true,stopSign);
    groupingDone=true;
  }
  this.populator.getGroupProcessorManager().doGroupFiltering(this.populator.getCache(),this.populator.getExpressionProcessor(),stopSign);
}
Program: 73737
Project: 73737
Buggy source:
/** 
 * @param stopSign
 * @throws DataException
 */
private void doGroupSorting(StopSign stopSign) throws DataException {
  if (!groupingDone) {
    PassUtil.pass(this.populator,new OdiResultSetWrapper(populator.getResultIterator()),true,stopSign);
    groupingDone=true;
  }
  if (this.populator.getQuery().getGrouping() != null && this.populator.getQuery().getGrouping().length > 0) {
    this.populator.getGroupProcessorManager().doGroupSorting(this.populator.getCache(),this.populator.getExpressionProcessor(),stopSign);
  }
}

Fixed version (ground truth):
/** 
 * @param stopSign
 * @throws DataException
 */
private void doGroupSorting(StopSign stopSign) throws DataException {
  if (!this.needDoGroupSorting())   return;
  if (!groupingDone) {
    PassUtil.pass(this.populator,new OdiResultSetWrapper(populator.getResultIterator()),true,stopSign);
    groupingDone=true;
  }
  this.populator.getGroupProcessorManager().doGroupSorting(this.populator.getCache(),this.populator.getExpressionProcessor(),stopSign);
}
Program: 73738
Project: 73738
Buggy source:
public List getDataDefinitionsForGrouping(Series series){
  ArrayList list=new ArrayList(1);
  EList elDD=series.getDataDefinition();
  for (int n=0; n < elDD.size(); n++) {
    String sExpression=((Query)elDD.get(n)).getDefinition();
    if (sExpression != null && sExpression.trim().length() > 0) {
      list.add(sExpression);
    }
  }
  return list;
}

Fixed version (ground truth):
/** 
 */
public List getDataDefinitionsForGrouping(Series series){
  ArrayList list=new ArrayList(1);
  EList elDD=series.getDataDefinition();
  int IDs[]=getDataDefIdsForGrouping(series);
  for (int i=0; i < IDs.length; i++) {
    Query query=(Query)elDD.get(IDs[i]);
    String sExpression=query.getDefinition();
    if (sExpression != null && sExpression.trim().length() > 0) {
      list.add(query);
    }
  }
  return list;
}
Program: 73739
Project: 73739
Buggy source:
/** 
 * @param elSD orthogonal series definitions list
 * @param lhmLookup
 */
public void addSeriesDefinitions(EList elSD,GroupingLookupHelper lhmLookup) throws ChartException {
  for (int k=0; k < elSD.size(); k++) {
    SeriesDefinition sdOrthogonal=(SeriesDefinition)elSD.get(k);
    Series series=sdOrthogonal.getDesignTimeSeries();
    List qlist=ChartEngine.instance().getDataSetProcessor(series.getClass()).getDataDefinitionsForGrouping(series);
    String strOrtAgg=lhmLookup.getOrthogonalAggregationExpression(sdOrthogonal);
    if (strOrtAgg != null) {
      addAggregation(strOrtAgg,qlist);
    }
 else {
      baseQueryList.addAll(qlist);
    }
  }
}

Fixed version (ground truth):
/** 
 * @param elSD orthogonal series definitions list
 * @param lhmLookup
 */
public void addSeriesDefinitions(EList elSD,GroupingLookupHelper lhmLookup) throws ChartException {
  for (int k=0; k < elSD.size(); k++) {
    SeriesDefinition sdOrthogonal=(SeriesDefinition)elSD.get(k);
    Series series=sdOrthogonal.getDesignTimeSeries();
    List qlist=ChartEngine.instance().getDataSetProcessor(series.getClass()).getDataDefinitionsForGrouping(series);
    List slist=new ArrayList(1);
    for (int i=0; i < qlist.size(); i++) {
      slist.add(((Query)qlist.get(i)).getDefinition());
    }
    String strOrtAgg=lhmLookup.getOrthogonalAggregationExpression(sdOrthogonal);
    if (strOrtAgg != null) {
      addAggregation(strOrtAgg,slist);
    }
 else {
      baseQueryList.addAll(slist);
    }
  }
}
Program: 73741
Project: 73741
Buggy source:
/** 
 * Create base query definition.
 * @param columns
 * @return
 * @throws DataException
 */
public abstract IDataQueryDefinition createBaseQuery(List columns) throws DataException ;

Fixed version (ground truth):
/** 
 * Create base query definition.
 * @param columns
 * @return
 * @throws DataException
 */
public abstract IDataQueryDefinition createBaseQuery(List columns) throws ChartException ;
Program: 73743
Project: 73743
Buggy source:
void setDataSet(String datasetName){
  boolean needClean=false;
  boolean needAddBinding=false;
  try {
    itemHandle.setCube(null);
    if (itemHandle.getDataBindingType() == ReportItemHandle.DATABINDING_TYPE_REPORT_ITEM_REF) {
      itemHandle.setDataBindingReference(null);
    }
    if (datasetName == null) {
      if (getBoundDataSet() != null) {
        needClean=true;
      }
      itemHandle.setDataSet(null);
    }
 else {
      DataSetHandle dataset=getReportDesignHandle().findDataSet(datasetName);
      if (itemHandle.getDataSet() != dataset) {
        itemHandle.setDataSet(dataset);
        needClean=true;
        needAddBinding=true;
      }
    }
    if (needClean) {
      clearBindings();
    }
    if (needAddBinding) {
      generateBindings();
    }
  }
 catch (  SemanticException e) {
    ChartWizard.showException(e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
void setDataSet(String datasetName){
  boolean needClean=false;
  boolean needAddBinding=false;
  try {
    if (itemHandle.getDataBindingType() == ReportItemHandle.DATABINDING_TYPE_REPORT_ITEM_REF) {
      itemHandle.setDataBindingReference(null);
    }
    itemHandle.setCube(null);
    if (datasetName == null) {
      if (getBoundDataSet() != null) {
        needClean=true;
      }
      itemHandle.setDataSet(null);
    }
 else {
      DataSetHandle dataset=getReportDesignHandle().findDataSet(datasetName);
      if (itemHandle.getDataSet() != dataset) {
        itemHandle.setDataSet(dataset);
        needClean=true;
        needAddBinding=true;
      }
    }
    if (needClean) {
      clearBindings();
    }
    if (needAddBinding) {
      generateBindings();
    }
  }
 catch (  SemanticException e) {
    ChartWizard.showException(e.getLocalizedMessage());
  }
}
Program: 73744
Project: 73744
Buggy source:
void setDataCube(String cubeName){
  try {
    itemHandle.setDataSet(null);
    itemHandle.setDataBindingReference(null);
    if (cubeName == null) {
      itemHandle.setCube(null);
    }
 else {
      if (!cubeName.equals(getDataCube())) {
        itemHandle.setCube(getReportDesignHandle().findCube(cubeName));
        clearBindings();
      }
    }
  }
 catch (  SemanticException e) {
    ChartWizard.showException(e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
void setDataCube(String cubeName){
  try {
    if (itemHandle.getDataBindingType() == ReportItemHandle.DATABINDING_TYPE_REPORT_ITEM_REF) {
      itemHandle.setDataBindingReference(null);
    }
    itemHandle.setDataSet(null);
    if (cubeName == null) {
      itemHandle.setCube(null);
    }
 else {
      if (!cubeName.equals(getDataCube())) {
        itemHandle.setCube(getReportDesignHandle().findCube(cubeName));
        clearBindings();
      }
    }
  }
 catch (  SemanticException e) {
    ChartWizard.showException(e.getLocalizedMessage());
  }
}
Program: 73746
Project: 73746
Buggy source:
void fireEvent(Widget widget,int eventType){
  Event event=new Event();
  event.data=this;
  event.widget=widget;
  event.type=eventType;
  notifyListeners(eventType,event);
}

Fixed version (ground truth):
void fireEvent(Widget widget,int eventType){
  Event event=new Event();
  event.data=this;
  event.widget=widget;
  event.type=eventType;
  notifyListeners(event);
}
Program: 73748
Project: 73748
Buggy source:
private void switchDataSet(String datasetName) throws ChartException {
  if (isCubeMode()) {
    return;
  }
  try {
    tablePreview.clearContents();
    if (datasetName == null) {
      datasetName=getDataServiceProvider().getReportDataSet();
    }
    if (datasetName != null) {
      switchDataTable();
    }
 else {
      tablePreview.createDummyTable();
    }
    tablePreview.layout();
  }
 catch (  Throwable t) {
    throw new ChartException(ChartEnginePlugin.ID,ChartException.DATA_BINDING,t);
  }
  DataDefinitionTextManager.getInstance().refreshAll();
  fireEvent(tablePreview,EVENT_UPDATE);
}

Fixed version (ground truth):
private void switchDataSet(String datasetName) throws ChartException {
  if (isCubeMode()) {
    return;
  }
  try {
    tablePreview.clearContents();
    if (datasetName == null) {
      datasetName=getDataServiceProvider().getReportDataSet();
    }
    if (datasetName != null) {
      switchDataTable();
    }
 else {
      tablePreview.createDummyTable();
    }
    tablePreview.layout();
  }
 catch (  Throwable t) {
    throw new ChartException(ChartEnginePlugin.ID,ChartException.DATA_BINDING,t);
  }
  DataDefinitionTextManager.getInstance().refreshAll();
  fireEvent(tablePreview,EVENT_PREVIEW);
}
Program: 73749
Project: 73749
Buggy source:
public void notifyListeners(int eventType,Event event){
  for (Iterator iterator=listeners.iterator(); iterator.hasNext(); ) {
    ((Listener)iterator.next()).handleEvent(event);
  }
}

Fixed version (ground truth):
public void notifyListeners(Event event){
  for (Iterator iterator=listeners.iterator(); iterator.hasNext(); ) {
    ((Listener)iterator.next()).handleEvent(event);
  }
}
Program: 73750
Project: 73750
Buggy source:
public void removeListener(int eventType,Listener listener){
  listeners.remove(listener);
}

Fixed version (ground truth):
public void removeListener(Listener listener){
  listeners.remove(listener);
}
Program: 73751
Project: 73751
Buggy source:
public void addListener(int eventType,Listener listener){
  listeners.add(listener);
}

Fixed version (ground truth):
public void addListener(Listener listener){
  if (!listeners.contains(listener)) {
    listeners.add(listener);
  }
}
Program: 73752
Project: 73752
Buggy source:
private final void updateOverlayAxes(AllAxes aax) throws ChartException, IllegalArgumentException {
  int iDirection=(aax.getOrientation() == HORIZONTAL) ? 1 : -1;
  final Axis[] axa=cwa.getPrimaryBaseAxes();
  final Axis axPrimaryBase=axa[0];
  final Axis[] axaOverlayOrthogonal=cwa.getOrthogonalAxes(axPrimaryBase,false);
  OneAxis axOverlay, axPrimary=aax.getPrimaryOrthogonal();
  AutoScale scOA, sc=axPrimary.getScale();
  double dStart, dEnd;
  Object[] oaMinMax;
  int iAxisType=(aax.getOverlayCount() > 0) ? aax.getOverlay(0).getScale().getType() : 0;
  Label la;
  for (int i=0; i < aax.getOverlayCount(); i++) {
    axOverlay=aax.getOverlay(i);
    la=axOverlay.getLabel();
    scOA=axOverlay.getScale();
    scOA.setEndPoints(scOA.getStart() - scOA.getStartShift() * iDirection,scOA.getEnd() + scOA.getEndShift() * iDirection);
    dStart=sc.getStart();
    dEnd=sc.getEnd();
    scOA.setEndPoints(dStart,dEnd);
    scOA.computeTicks(ids,la,axOverlay.getLabelPosition(),aax.getOrientation(),dStart,dEnd,false,null);
    if (!scOA.isStepFixed()) {
      oaMinMax=scOA.getMinMax();
      while (!scOA.checkFit(ids,la,axOverlay.getLabelPosition())) {
        if (!scOA.zoomOut()) {
          break;
        }
        scOA.updateAxisMinMax(oaMinMax[0],oaMinMax[1]);
        scOA.computeTicks(ids,la,axOverlay.getLabelPosition(),aax.getOrientation(),dStart,dEnd,false,null);
      }
    }
    scOA.setData(getTypedDataSet(axaOverlayOrthogonal[i],iAxisType,0));
  }
}

Fixed version (ground truth):
private final void updateOverlayAxes(AllAxes aax) throws ChartException, IllegalArgumentException {
  int iDirection=(aax.getOrientation() == HORIZONTAL) ? 1 : -1;
  final Axis[] axa=cwa.getPrimaryBaseAxes();
  final Axis axPrimaryBase=axa[0];
  final Axis[] axaOverlayOrthogonal=cwa.getOrthogonalAxes(axPrimaryBase,false);
  OneAxis axOverlay, axPrimary=aax.getPrimaryOrthogonal();
  AutoScale scOA, sc=axPrimary.getScale();
  double dStart, dEnd;
  Object[] oaMinMax;
  Label la;
  for (int i=0; i < aax.getOverlayCount(); i++) {
    axOverlay=aax.getOverlay(i);
    int iAxisType=axOverlay.getAxisType();
    la=axOverlay.getLabel();
    scOA=axOverlay.getScale();
    scOA.setEndPoints(scOA.getStart() - scOA.getStartShift() * iDirection,scOA.getEnd() + scOA.getEndShift() * iDirection);
    dStart=sc.getStart();
    dEnd=sc.getEnd();
    scOA.setEndPoints(dStart,dEnd);
    scOA.computeTicks(ids,la,axOverlay.getLabelPosition(),aax.getOrientation(),dStart,dEnd,false,null);
    if (!scOA.isStepFixed()) {
      oaMinMax=scOA.getMinMax();
      while (!scOA.checkFit(ids,la,axOverlay.getLabelPosition())) {
        if (!scOA.zoomOut()) {
          break;
        }
        scOA.updateAxisMinMax(oaMinMax[0],oaMinMax[1]);
        scOA.computeTicks(ids,la,axOverlay.getLabelPosition(),aax.getOrientation(),dStart,dEnd,false,null);
      }
    }
    scOA.setData(getTypedDataSet(axaOverlayOrthogonal[i],iAxisType,0));
  }
}
Program: 73755
Project: 73755
Buggy source:
private void initializeScriptHandler(BIRTExternalContext externalContext) throws ChartException {
  String javaHandlerClass=handle.getEventHandlerClass();
  if (javaHandlerClass != null && javaHandlerClass.length() > 0) {
    cm.setScript(javaHandlerClass);
  }
  rtc.setScriptClassLoader(new BIRTScriptClassLoader(appClassLoader));
  ScriptHandler sh=rtc.getScriptHandler();
  if (sh == null) {
    sh=new ScriptHandler();
    rtc.setScriptHandler(sh);
    sh.setScriptClassLoader(rtc.getScriptClassLoader());
    sh.setScriptContext(rtc.getScriptContext());
    final String sScriptContent=cm.getScript();
    if (externalContext != null && externalContext.getScriptable() != null) {
      sh.init(externalContext.getScriptable());
    }
 else {
      sh.init(null);
    }
    sh.setRunTimeModel(cm);
    if (sScriptContent != null && sScriptContent.length() > 0 && rtc.isScriptingEnabled()) {
      sh.register(sScriptContent);
    }
  }
}

Fixed version (ground truth):
private void initializeScriptHandler(BIRTExternalContext externalContext) throws ChartException {
  String javaHandlerClass=handle.getEventHandlerClass();
  if (javaHandlerClass != null && javaHandlerClass.length() > 0) {
    cm.setScript(javaHandlerClass);
  }
  rtc.setScriptClassLoader(new BIRTScriptClassLoader(appClassLoader));
  ScriptHandler sh=rtc.getScriptHandler();
  if (sh == null) {
    sh=new ScriptHandler();
    rtc.setScriptHandler(sh);
    sh.setScriptClassLoader(rtc.getScriptClassLoader());
    sh.setScriptContext(rtc.getScriptContext());
    final String sScriptContent=cm.getScript();
    if (externalContext != null && externalContext.getScriptable() != null) {
      sh.init(externalContext.getScriptable());
    }
 else {
      sh.init(null);
    }
    sh.setRunTimeModel(cm);
    if (sScriptContent != null && sScriptContent.length() > 0 && rtc.isScriptingEnabled()) {
      sh.register(ModuleUtil.getScriptUID(handle.getPropertyHandle(IReportItemModel.ON_RENDER_METHOD)),sScriptContent);
    }
  }
}
Program: 73756
Project: 73756
Buggy source:
/** 
 * Evaluate a filter expression.
 * @param cx
 * @param filter
 * @return
 * @throws DataException
 */
private Object evaluteFilterExpression(Context cx,IFilterDefinition filter) throws DataException {
  IBaseExpression expr=filter.getExpression();
  FilterUtil.prepareFilterExpression(tempDir,expr,filterPass,this.populator.getEventHandler().getExecutorHelper());
  Object result=ScriptEvalUtil.evalExpr(expr,cx,this.groupProcessor.getExpressionProcessor().getScope(),"String_Node_Str",0);
  if (result == null) {
    Object info=null;
    if (expr instanceof IScriptExpression)     info=((IScriptExpression)expr).getText();
 else     info=expr;
    throw new DataException(ResourceConstants.INVALID_EXPRESSION_IN_FILTER,info);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Evaluate a filter expression.
 * @param cx
 * @param filter
 * @return
 * @throws DataException
 */
private Object evaluteFilterExpression(Context cx,IFilterDefinition filter) throws DataException {
  IBaseExpression expr=filter.getExpression();
  FilterUtil.prepareFilterExpression(tempDir,expr,filterPass,this.populator.getEventHandler().getExecutorHelper());
  Object result=ScriptEvalUtil.evalExpr(expr,cx,this.groupProcessor.getExpressionProcessor().getScope(),ScriptExpression.defaultID,0);
  if (result == null) {
    Object info=null;
    if (expr instanceof IScriptExpression)     info=((IScriptExpression)expr).getText();
 else     info=expr;
    throw new DataException(ResourceConstants.INVALID_EXPRESSION_IN_FILTER,info);
  }
  return result;
}
Program: 73757
Project: 73757
Buggy source:
/** 
 * Add sort infos to GroupBoundaryInfo in groupArray.
 * @param cx
 * @param groupArray
 * @param groupPosition groupPosition = groupLevel - 1; it is 0-based;
 * @param groupIndex
 * @throws DataException
 */
private void populateGroupBoundaryInfoSortings(Context cx,List[] groupArray,int groupPosition,int groupIndex) throws DataException {
  Object[] sortKeys=new Object[this.populator.getQuery().getGrouping()[groupPosition].getSorts().size()];
  boolean[] sortDirections=new boolean[sortKeys.length];
  this.populator.getResultIterator().last(groupPosition + 1);
  for (int l=0; l < sortKeys.length; l++) {
    sortKeys[l]=ScriptEvalUtil.evalExpr(((ISortDefinition)this.populator.getQuery().getGrouping()[groupPosition].getSorts().get(l)).getExpression(),cx,this.groupProcessor.getExpressionProcessor().getScope(),"String_Node_Str",0);
    sortDirections[l]=((ISortDefinition)this.populator.getQuery().getGrouping()[groupPosition].getSorts().get(l)).getSortDirection() == ISortDefinition.SORT_ASC ? true : false;
  }
  ((GroupBoundaryInfo)groupArray[groupPosition].get(groupIndex)).setSortCondition(sortKeys,sortDirections);
  this.populator.getResultIterator().next();
}

Fixed version (ground truth):
/** 
 * Add sort infos to GroupBoundaryInfo in groupArray.
 * @param cx
 * @param groupArray
 * @param groupPosition groupPosition = groupLevel - 1; it is 0-based;
 * @param groupIndex
 * @throws DataException
 */
private void populateGroupBoundaryInfoSortings(Context cx,List[] groupArray,int groupPosition,int groupIndex) throws DataException {
  Object[] sortKeys=new Object[this.populator.getQuery().getGrouping()[groupPosition].getSorts().size()];
  boolean[] sortDirections=new boolean[sortKeys.length];
  this.populator.getResultIterator().last(groupPosition + 1);
  for (int l=0; l < sortKeys.length; l++) {
    sortKeys[l]=ScriptEvalUtil.evalExpr(((ISortDefinition)this.populator.getQuery().getGrouping()[groupPosition].getSorts().get(l)).getExpression(),cx,this.groupProcessor.getExpressionProcessor().getScope(),ScriptExpression.defaultID,0);
    sortDirections[l]=((ISortDefinition)this.populator.getQuery().getGrouping()[groupPosition].getSorts().get(l)).getSortDirection() == ISortDefinition.SORT_ASC ? true : false;
  }
  ((GroupBoundaryInfo)groupArray[groupPosition].get(groupIndex)).setSortCondition(sortKeys,sortDirections);
  this.populator.getResultIterator().next();
}
Program: 73758
Project: 73758
Buggy source:
/** 
 * @see org.eclipse.birt.data.engine.expression.CompiledExpression#evaluate(org.mozilla.javascript.Context,org.mozilla.javascript.Scriptable)
 */
public Object evaluate(Context context,Scriptable scope) throws DataException {
  StringBuffer expr=new StringBuffer(this.rowIndicator + "String_Node_Str");
  if (isIndexed()) {
    expr.append(m_columnIndex);
  }
 else {
    expr.append('"');
    expr.append(JavascriptEvalUtil.transformToJsConstants(m_columnName));
    expr.append('"');
  }
  expr.append(']');
  try {
    return DataTypeUtil.convert(ScriptEvalUtil.evaluateJSAsExpr(context,scope,expr.toString(),"String_Node_Str",0),this.dataType);
  }
 catch (  BirtException e) {
    throw DataException.wrap(e);
  }
}

Fixed version (ground truth):
/** 
 * @see org.eclipse.birt.data.engine.expression.CompiledExpression#evaluate(org.mozilla.javascript.Context,org.mozilla.javascript.Scriptable)
 */
public Object evaluate(Context context,Scriptable scope) throws DataException {
  StringBuffer expr=new StringBuffer(this.rowIndicator + "String_Node_Str");
  if (isIndexed()) {
    expr.append(m_columnIndex);
  }
 else {
    expr.append('"');
    expr.append(JavascriptEvalUtil.transformToJsConstants(m_columnName));
    expr.append('"');
  }
  expr.append(']');
  try {
    return DataTypeUtil.convert(ScriptEvalUtil.evaluateJSAsExpr(context,scope,expr.toString(),ScriptExpression.defaultID,0),this.dataType);
  }
 catch (  BirtException e) {
    throw DataException.wrap(e);
  }
}
Program: 73759
Project: 73759
Buggy source:
/** 
 * @param groupKeyValues
 * @param columnExprs
 * @param i
 * @return
 * @throws BirtException
 */
private boolean groupKeyValuesEqual(org.eclipse.birt.data.engine.odi.IResultIterator odiResult,Object[] groupKeyValues,String[] columnExprs,int i) throws BirtException {
  Object fieldValue=null;
  try {
    Context cx=Context.enter();
    fieldValue=ScriptEvalUtil.evalExpr(new ScriptExpression(columnExprs[i]),cx,ResultIterator.this.scope,"String_Node_Str",0);
  }
  finally {
    Context.exit();
  }
  boolean retValue=false;
  if (fieldValue == groupKeyValues[i]) {
    retValue=true;
  }
 else   if (fieldValue != null && groupKeyValues[i] != null) {
    if (fieldValue.getClass().equals(groupKeyValues[i].getClass())) {
      retValue=isTwoObjectEqual(fieldValue,groupKeyValues[i]);
    }
 else {
      Object convertedOb=DataTypeUtil.convert(groupKeyValues[i],fieldValue.getClass());
      retValue=isTwoObjectEqual(fieldValue,convertedOb);
    }
  }
  return retValue;
}

Fixed version (ground truth):
/** 
 * @param groupKeyValues
 * @param columnExprs
 * @param i
 * @return
 * @throws BirtException
 */
private boolean groupKeyValuesEqual(org.eclipse.birt.data.engine.odi.IResultIterator odiResult,Object[] groupKeyValues,String[] columnExprs,int i) throws BirtException {
  Object fieldValue=null;
  try {
    Context cx=Context.enter();
    fieldValue=ScriptEvalUtil.evalExpr(new ScriptExpression(columnExprs[i]),cx,ResultIterator.this.scope,org.eclipse.birt.core.script.ScriptExpression.defaultID,0);
  }
  finally {
    Context.exit();
  }
  boolean retValue=false;
  if (fieldValue == groupKeyValues[i]) {
    retValue=true;
  }
 else   if (fieldValue != null && groupKeyValues[i] != null) {
    if (fieldValue.getClass().equals(groupKeyValues[i].getClass())) {
      retValue=isTwoObjectEqual(fieldValue,groupKeyValues[i]);
    }
 else {
      Object convertedOb=DataTypeUtil.convert(groupKeyValues[i],fieldValue.getClass());
      retValue=isTwoObjectEqual(fieldValue,convertedOb);
    }
  }
  return retValue;
}
Program: 73760
Project: 73760
Buggy source:
/** 
 * Get the value of current column.
 * @return
 * @throws DataException
 */
public Object getColumnValue() throws DataException {
  Context cx=Context.enter();
  try {
    Object leftValue=ScriptEvalUtil.evalExpr(this.expr,cx,this.scope,"String_Node_Str",0);
    return leftValue;
  }
  finally {
    Context.exit();
  }
}

Fixed version (ground truth):
/** 
 * Get the value of current column.
 * @return
 * @throws DataException
 */
public Object getColumnValue() throws DataException {
  Context cx=Context.enter();
  try {
    Object leftValue=ScriptEvalUtil.evalExpr(this.expr,cx,this.scope,ScriptExpression.defaultID,0);
    return leftValue;
  }
  finally {
    Context.exit();
  }
}
Program: 73761
Project: 73761
Buggy source:
public Object[] computeMeasureValues(IFacttableRow factTableRow) throws DataException {
  this.populator.setData(factTableRow);
  try {
    Context cx=Context.enter();
    Object[] result=new Object[this.measureInfos.length];
    for (int i=0; i < this.measureInfos.length; i++) {
      try {
        result[i]=ScriptEvalUtil.evalExpr((IBaseExpression)this.exprMap.get(this.measureInfos[i].getMeasureName()),cx,scope,null,0);
      }
 catch (      Exception e) {
        result[i]=null;
      }
    }
    return result;
  }
  finally {
    Context.exit();
  }
}

Fixed version (ground truth):
public Object[] computeMeasureValues(IFacttableRow factTableRow) throws DataException {
  this.populator.setData(factTableRow);
  try {
    Context cx=Context.enter();
    Object[] result=new Object[this.measureInfos.length];
    for (int i=0; i < this.measureInfos.length; i++) {
      try {
        result[i]=ScriptEvalUtil.evalExpr((IBaseExpression)this.exprMap.get(this.measureInfos[i].getMeasureName()),cx,scope,ScriptExpression.defaultID,0);
      }
 catch (      Exception e) {
        result[i]=null;
      }
    }
    return result;
  }
  finally {
    Context.exit();
  }
}
Program: 73762
Project: 73762
Buggy source:
public Object get(String aggrName,Scriptable scope){
  if (this.resultRow != null) {
    try {
      if (this.computedMeasures.containsKey(aggrName)) {
        try {
          Context cx=Context.enter();
          return ScriptEvalUtil.evalExpr(((IBaseExpression)this.computedMeasures.get(aggrName)),cx,this.scope,null,0);
        }
 catch (        Exception e) {
          return null;
        }
 finally {
          Context.exit();
        }
      }
      return this.resultRow.getMeasureValue(aggrName);
    }
 catch (    DataException e) {
      return null;
    }
  }
 else   return null;
}

Fixed version (ground truth):
public Object get(String aggrName,Scriptable scope){
  if (this.resultRow != null) {
    try {
      if (this.computedMeasures.containsKey(aggrName)) {
        try {
          Context cx=Context.enter();
          return ScriptEvalUtil.evalExpr(((IBaseExpression)this.computedMeasures.get(aggrName)),cx,this.scope,ScriptExpression.defaultID,0);
        }
 catch (        Exception e) {
          return null;
        }
 finally {
          Context.exit();
        }
      }
      return this.resultRow.getMeasureValue(aggrName);
    }
 catch (    DataException e) {
      return null;
    }
  }
 else   return null;
}
Program: 73763
Project: 73763
Buggy source:
public boolean evaluateFilter(IResultRow resultRow) throws DataException {
  super.setData(resultRow);
  Context cx=Context.enter();
  try {
    Object result=ScriptEvalUtil.evalExpr(expr,cx,scope,null,0);
    return DataTypeUtil.toBoolean(result).booleanValue();
  }
 catch (  IJSObjectPopulator.InMatchDimensionIndicator e) {
    return true;
  }
catch (  BirtException e) {
    throw DataException.wrap(e);
  }
 finally {
    Context.exit();
  }
}

Fixed version (ground truth):
public boolean evaluateFilter(IResultRow resultRow) throws DataException {
  super.setData(resultRow);
  Context cx=Context.enter();
  try {
    Object result=ScriptEvalUtil.evalExpr(expr,cx,scope,ScriptExpression.defaultID,0);
    return DataTypeUtil.toBoolean(result).booleanValue();
  }
 catch (  IJSObjectPopulator.InMatchDimensionIndicator e) {
    return true;
  }
catch (  BirtException e) {
    throw DataException.wrap(e);
  }
 finally {
    Context.exit();
  }
}
Program: 73764
Project: 73764
Buggy source:
public boolean evaluateFilter(IResultRow resultRow) throws DataException {
  super.setData(resultRow);
  Context cx=Context.enter();
  try {
    if (this.isAxisFilter) {
      for (int i=0; i < axisLevels.length; i++) {
        DimLevel level=new DimLevel(axisLevels[i]);
        if (CompareUtil.compare(resultRow.getFieldValue(level.toString()),axisValues[i]) != 0) {
          return false;
        }
      }
    }
    Object result=ScriptEvalUtil.evalExpr(expr,cx,scope,null,0);
    return DataTypeUtil.toBoolean(result).booleanValue();
  }
 catch (  IJSObjectPopulator.InMatchDimensionIndicator e) {
    return true;
  }
catch (  BirtException e) {
    throw DataException.wrap(e);
  }
 finally {
    Context.exit();
  }
}

Fixed version (ground truth):
public boolean evaluateFilter(IResultRow resultRow) throws DataException {
  super.setData(resultRow);
  Context cx=Context.enter();
  try {
    if (this.isAxisFilter) {
      for (int i=0; i < axisLevels.length; i++) {
        DimLevel level=new DimLevel(axisLevels[i]);
        if (CompareUtil.compare(resultRow.getFieldValue(level.toString()),axisValues[i]) != 0) {
          return false;
        }
      }
    }
    Object result=ScriptEvalUtil.evalExpr(expr,cx,scope,ScriptExpression.defaultID,0);
    return DataTypeUtil.toBoolean(result).booleanValue();
  }
 catch (  IJSObjectPopulator.InMatchDimensionIndicator e) {
    return true;
  }
catch (  BirtException e) {
    throw DataException.wrap(e);
  }
 finally {
    Context.exit();
  }
}
Program: 73765
Project: 73765
Buggy source:
public Object evaluateFilterExpr(IResultRow resultRow) throws DataException {
  super.setData(resultRow);
  Context cx=Context.enter();
  try {
    Object result=ScriptEvalUtil.evalExpr(((IConditionalExpression)expr).getExpression(),cx,scope,null,0);
    return result;
  }
 catch (  IJSObjectPopulator.InMatchDimensionIndicator e) {
    throw new DataException(e.getMessage());
  }
catch (  BirtException e) {
    throw DataException.wrap(e);
  }
 finally {
    Context.exit();
  }
}

Fixed version (ground truth):
public Object evaluateFilterExpr(IResultRow resultRow) throws DataException {
  super.setData(resultRow);
  Context cx=Context.enter();
  try {
    Object result=ScriptEvalUtil.evalExpr(((IConditionalExpression)expr).getExpression(),cx,scope,ScriptExpression.defaultID,0);
    return result;
  }
 catch (  IJSObjectPopulator.InMatchDimensionIndicator e) {
    throw new DataException(e.getMessage());
  }
catch (  BirtException e) {
    throw DataException.wrap(e);
  }
 finally {
    Context.exit();
  }
}
Program: 73766
Project: 73766
Buggy source:
/** 
 * @param cx
 * @throws DataException
 */
private void populateN(Context cx) throws DataException {
  Object o=ScriptEvalUtil.evalExpr(((IConditionalExpression)expr).getOperand1(),cx,scope,null,0);
  this.N=Double.valueOf(o.toString()).doubleValue();
}

Fixed version (ground truth):
/** 
 * @param cx
 * @throws DataException
 */
private void populateN(Context cx) throws DataException {
  Object o=ScriptEvalUtil.evalExpr(((IConditionalExpression)expr).getOperand1(),cx,scope,ScriptExpression.defaultID,0);
  this.N=Double.valueOf(o.toString()).doubleValue();
}
Program: 73767
Project: 73767
Buggy source:
/** 
 */
public Object evaluate(IResultRow resultRow) throws DataException {
  super.setData(resultRow);
  Context cx=Context.enter();
  try {
    return ScriptEvalUtil.evalExpr(expr,cx,scope,null,0);
  }
 catch (  IJSObjectPopulator.InMatchDimensionIndicator e) {
    return null;
  }
catch (  BirtException e) {
    throw DataException.wrap(e);
  }
 finally {
    Context.exit();
  }
}

Fixed version (ground truth):
/** 
 */
public Object evaluate(IResultRow resultRow) throws DataException {
  super.setData(resultRow);
  Context cx=Context.enter();
  try {
    return ScriptEvalUtil.evalExpr(expr,cx,scope,ScriptExpression.defaultID,0);
  }
 catch (  IJSObjectPopulator.InMatchDimensionIndicator e) {
    return null;
  }
catch (  BirtException e) {
    throw DataException.wrap(e);
  }
 finally {
    Context.exit();
  }
}
Program: 73768
Project: 73768
Buggy source:
/** 
 * Constructor
 * @param scope Javascript scope within which to execute JS code. This should bethe Javascript object implementing the data source or data set
 * @param scopeName A descriptive name describing the scope. This name is usedfor error reporting purposes. Example, "DataSet(my_sql_dataset)".
 */
public JSMethodRunner(Scriptable scope,String scopeName){
  this.scope=scope;
  this.scopeName=scopeName;
}

Fixed version (ground truth):
/** 
 * Constructor
 * @param scope Javascript scope within which to execute JS code. This should bethe Javascript object implementing the data source or data set
 * @param scopeName A descriptive name describing the scope. This name is usedfor error reporting purposes. Example, "DataSet(my_sql_dataset)".
 */
public JSMethodRunner(Scriptable scope,String scopeName){
  this.scope=scope;
}
Program: 73769
Project: 73769
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;
  String methodDesc=scopeName + "String_Node_Str" + methodName;
  Context cx=Context.enter();
  try {
    if (!scope.has(methodName,scope)) {
      String scriptText="String_Node_Str" + methodName + "String_Node_Str"+ script+ "String_Node_Str";
      ScriptEvalUtil.evaluateJSAsExpr(cx,scope,scriptText,methodDesc,1);
    }
    String callScriptText=methodName + "String_Node_Str";
    Object result=ScriptEvalUtil.evaluateJSAsExpr(cx,scope,callScriptText,methodDesc,1);
    return result;
  }
  finally {
    Context.exit();
  }
}

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
 * @return Return value from the script
 */
public Object runScript(String methodName,String script) throws BirtException {
  methodName=METHOD_NAME_PREFIX + methodName;
  Context cx=Context.enter();
  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;
  }
  finally {
    Context.exit();
  }
}
Program: 73770
Project: 73770
Buggy source:
/** 
 * Evaluate the given value
 * @param value
 * @param n
 * @return
 * @throws DataException
 */
public boolean evaluate(Context cx,Scriptable scope) throws DataException {
  if (filterPassController.getForceReset()) {
    doReset();
    filterPassController.setForceReset(false);
  }
  if (N == -1) {
    Object n_object=null;
    try {
      n_object=ExprEvaluateUtil.evaluateRawExpression2(n_expr,scope);
    }
 catch (    BirtException e1) {
      throw DataException.wrap(e1);
    }
    double n_value=-1;
    try {
      n_value=DataTypeUtil.toDouble(n_object).doubleValue();
    }
 catch (    BirtException e) {
      throw new DataException(ResourceConstants.INVALID_TOP_BOTTOM_ARGUMENT,e);
    }
    if (n_percent) {
      if (n_value < 0 || n_value > 100)       throw new DataException(ResourceConstants.INVALID_TOP_BOTTOM_PERCENT_ARGUMENT);
      N=(int)Math.round(n_value / 100 * filterPassController.getRowCount());
    }
 else {
      if (n_value < 0)       throw new DataException(ResourceConstants.INVALID_TOP_BOTTOM_N_ARGUMENT);
      N=(int)n_value;
    }
  }
  Object value=ScriptEvalUtil.evalExpr(op_expr,cx,scope,"String_Node_Str",0);
  if (filterPassController.getPassLevel() == FilterPassController.FIRST_PASS) {
    return doFirstPass(value);
  }
 else   if (filterPassController.getPassLevel() == FilterPassController.SECOND_PASS) {
    return doSecondPass();
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Evaluate the given value
 * @param value
 * @param n
 * @return
 * @throws DataException
 */
public boolean evaluate(Context cx,Scriptable scope) throws DataException {
  if (filterPassController.getForceReset()) {
    doReset();
    filterPassController.setForceReset(false);
  }
  if (N == -1) {
    Object n_object=null;
    try {
      n_object=ExprEvaluateUtil.evaluateRawExpression2(n_expr,scope);
    }
 catch (    BirtException e1) {
      throw DataException.wrap(e1);
    }
    double n_value=-1;
    try {
      n_value=DataTypeUtil.toDouble(n_object).doubleValue();
    }
 catch (    BirtException e) {
      throw new DataException(ResourceConstants.INVALID_TOP_BOTTOM_ARGUMENT,e);
    }
    if (n_percent) {
      if (n_value < 0 || n_value > 100)       throw new DataException(ResourceConstants.INVALID_TOP_BOTTOM_PERCENT_ARGUMENT);
      N=(int)Math.round(n_value / 100 * filterPassController.getRowCount());
    }
 else {
      if (n_value < 0)       throw new DataException(ResourceConstants.INVALID_TOP_BOTTOM_N_ARGUMENT);
      N=(int)n_value;
    }
  }
  Object value=ScriptEvalUtil.evalExpr(op_expr,cx,scope,ScriptExpression.defaultID,0);
  if (filterPassController.getPassLevel() == FilterPassController.FIRST_PASS) {
    return doFirstPass(value);
  }
 else   if (filterPassController.getPassLevel() == FilterPassController.SECOND_PASS) {
    return doSecondPass();
  }
  return false;
}
Program: 73773
Project: 73773
Buggy source:
/** 
 * Evaluates a property binding Javascript expression
 */
String evaluatePropertyBindingExpr(String expr) throws BirtException {
  Object result=JavascriptEvalUtil.evaluateScript(null,jsScope,expr,"String_Node_Str",0);
  return result == null ? null : result.toString();
}

Fixed version (ground truth):
/** 
 * Evaluates a property binding Javascript expression
 */
String evaluatePropertyBindingExpr(String expr) throws BirtException {
  Object result=JavascriptEvalUtil.evaluateScript(null,jsScope,expr,org.eclipse.birt.core.script.ScriptExpression.defaultID,0);
  return result == null ? null : result.toString();
}