nus-yam/ex-repair huggingface dataset:
Program: 65426
Project: 65426
Buggy source:
public Control createControl(Composite parent){
  container=new Composite(parent,SWT.NONE);
  RowLayout layout=new RowLayout(SWT.HORIZONTAL);
  layout.marginBottom=0;
  layout.marginHeight=0;
  layout.marginLeft=0;
  layout.marginRight=0;
  layout.marginTop=0;
  layout.marginWidth=0;
  layout.spacing=0;
  container.setLayout(layout);
  left=FormWidgetFactory.getInstance().createButton(container,SWT.TOGGLE,false);
  left.setToolTipText(Messages.getString("String_Node_Str"));
  center=FormWidgetFactory.getInstance().createButton(container,SWT.TOGGLE,false);
  center.setToolTipText(Messages.getString("String_Node_Str"));
  right=FormWidgetFactory.getInstance().createButton(container,SWT.TOGGLE,false);
  right.setToolTipText(Messages.getString("String_Node_Str"));
  justify=FormWidgetFactory.getInstance().createButton(container,SWT.TOGGLE,false);
  justify.setToolTipText(Messages.getString("String_Node_Str"));
  Button[] btns={left,center,right,justify};
  String[] values={DesignChoiceConstants.TEXT_ALIGN_LEFT,DesignChoiceConstants.TEXT_ALIGN_CENTER,DesignChoiceConstants.TEXT_ALIGN_RIGHT,DesignChoiceConstants.TEXT_ALIGN_JUSTIFY};
  for (int i=0; i < btns.length; i++) {
    btns[i].setData(values[i]);
    btns[i].addSelectionListener(listener);
  }
  return container;
}

Fixed version (ground truth):
public Control createControl(Composite parent){
  container=new Composite(parent,SWT.NONE);
  RowLayout layout=new RowLayout(SWT.HORIZONTAL);
  layout.marginBottom=0;
  layout.marginHeight=0;
  layout.marginLeft=0;
  layout.marginRight=0;
  layout.marginTop=0;
  layout.marginWidth=0;
  layout.spacing=0;
  container.setLayout(layout);
  left=FormWidgetFactory.getInstance().createButton(container,SWT.TOGGLE,false);
  left.setToolTipText(Messages.getString("String_Node_Str"));
  center=FormWidgetFactory.getInstance().createButton(container,SWT.TOGGLE,false);
  center.setToolTipText(Messages.getString("String_Node_Str"));
  right=FormWidgetFactory.getInstance().createButton(container,SWT.TOGGLE,false);
  right.setToolTipText(Messages.getString("String_Node_Str"));
  justify=FormWidgetFactory.getInstance().createButton(container,SWT.TOGGLE,false);
  justify.setToolTipText(Messages.getString("String_Node_Str"));
  Button[] btns={left,center,right,justify};
  String[] values={DesignChoiceConstants.TEXT_ALIGN_LEFT,DesignChoiceConstants.TEXT_ALIGN_CENTER,DesignChoiceConstants.TEXT_ALIGN_RIGHT,DesignChoiceConstants.TEXT_ALIGN_JUSTIFY};
  for (int i=0; i < btns.length; i++) {
    btns[i].setData(values[i]);
    btns[i].addSelectionListener(listener);
    btns[i].getAccessible().addAccessibleListener(new AccessibleAdapter(){
      public void getName(      AccessibleEvent e){
        Accessible accessible=(Accessible)e.getSource();
        Button item=(Button)accessible.getControl();
        if (item != null) {
          e.result=item.getToolTipText();
        }
      }
    }
);
  }
  return container;
}
Program: 65428
Project: 65428
Buggy source:
/** 
 * Evaluate data for all expressions, include base series, optional Y series grouping and value series.
 * @param idre
 * @param columns
 * @param areValueSeries
 * @return the evaluated results.
 * @since 2.3
 */
@SuppressWarnings("String_Node_Str") public List<Object[]> evaluateRowSet(IDataRowExpressionEvaluator idre,final Object[] columns) throws ChartException {
  List<Object[]> liResultSet=new ArrayList<Object[]>();
  final int iColumnCount=columns.length;
  Object[] oaTuple;
  final int MAX_ROW_COUNT=ChartUtil.getSupportedMaxRowCount(rtc);
  if (idre.first()) {
    int count=0;
    do {
      if (MAX_ROW_COUNT > 0 && count++ >= MAX_ROW_COUNT) {
        break;
      }
      oaTuple=new Object[iColumnCount];
      for (int i=0; i < columns.length; i++) {
        Object value=idre.evaluate((String)columns[i]);
        if (value instanceof Time) {
          Time time=(Time)value;
          Time newTime=new Time(time.getHours(),time.getMinutes(),time.getSeconds());
          value=new CDateTime(newTime);
        }
 else         if (value instanceof Date) {
          value=new CDateTime((Date)value);
        }
 else         if (value instanceof Calendar) {
          value=new CDateTime((Calendar)value);
        }
 else         if (value instanceof BirtException) {
          throw new ChartException(ChartEnginePlugin.ID,ChartException.DATA_BINDING,(BirtException)value);
        }
        oaTuple[i]=value;
      }
      liResultSet.add(oaTuple);
    }
 while (idre.next());
  }
  return liResultSet;
}

Fixed version (ground truth):
/** 
 * Evaluate data for all expressions, include base series, optional Y series grouping and value series.
 * @param idre
 * @param columns
 * @param areValueSeries
 * @return the evaluated results.
 * @since 2.3
 */
public List<Object[]> evaluateRowSet(IDataRowExpressionEvaluator idre,final Object[] columns) throws ChartException {
  List<Object[]> liResultSet=new ArrayList<Object[]>();
  final int iColumnCount=columns.length;
  Object[] oaTuple;
  final int MAX_ROW_COUNT=ChartUtil.getSupportedMaxRowCount(rtc);
  if (idre.first()) {
    int count=0;
    do {
      if (MAX_ROW_COUNT > 0 && count++ >= MAX_ROW_COUNT) {
        break;
      }
      oaTuple=new Object[iColumnCount];
      for (int i=0; i < columns.length; i++) {
        Object value=idre.evaluate((String)columns[i]);
        if (value instanceof Date) {
          CDateTime newValue=new CDateTime((Date)value);
          if (newValue.isFullDateTime() && rtc.getTimeZone() != null) {
            newValue.setTimeZone(rtc.getTimeZone());
          }
          value=newValue;
        }
 else         if (value instanceof Calendar) {
          value=new CDateTime((Calendar)value);
        }
 else         if (value instanceof BirtException) {
          throw new ChartException(ChartEnginePlugin.ID,ChartException.DATA_BINDING,(BirtException)value);
        }
        oaTuple[i]=value;
      }
      liResultSet.add(oaTuple);
    }
 while (idre.next());
  }
  return liResultSet;
}
Program: 65429
Project: 65429
Buggy source:
public String format(Calendar c,Locale lcl){
  return format(c,ULocale.forLocale(lcl));
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public String format(Calendar c,Locale lcl){
  return format(c,ULocale.forLocale(lcl));
}
Program: 65430
Project: 65430
Buggy source:
/** 
 * The property timeOnly indicates that this instance of CDateTime only represents a Time value, the Date value will be ignored.
 * @return Returns the bTimeOnly.
 */
public boolean isTimeOnly(){
  return bTimeOnly;
}

Fixed version (ground truth):
/** 
 * The property timeOnly indicates that this instance of CDateTime only represents a Time value, the Date value will be ignored.
 * @return true if time only.
 */
public boolean isTimeOnly(){
  return bTimeOnly;
}
Program: 65431
Project: 65431
Buggy source:
/** 
 * returns a CDateTime, whose value equals to the unit start of the current instance
 * @param iUnit
 * @return
 */
public CDateTime getUnitStart(int iUnit){
  CDateTime cd=new CDateTime(this);
  cd.clearBelow(iUnit);
  return cd;
}

Fixed version (ground truth):
/** 
 * returns a CDateTime, whose value equals to the unit start of the current instance
 * @param iUnit
 * @return new instance
 */
public CDateTime getUnitStart(int iUnit){
  CDateTime cd=new CDateTime(this);
  cd.clearBelow(iUnit);
  return cd;
}
Program: 65432
Project: 65432
Buggy source:
/** 
 * Zeroes out all units for this datetime instance below a specified unit.
 * @param iUnit The unit below which all values are to be zeroed out
 */
public final void clearBelow(int iUnit){
  if (iUnit == YEAR) {
    set(Calendar.MILLISECOND,0);
    set(Calendar.SECOND,0);
    set(Calendar.MINUTE,0);
    set(Calendar.HOUR,0);
    set(Calendar.DATE,1);
    set(Calendar.AM_PM,AM);
    set(Calendar.MONTH,0);
  }
 else   if (iUnit == MONTH || iUnit == GroupingUnitType.QUARTERS) {
    set(Calendar.MILLISECOND,0);
    set(Calendar.SECOND,0);
    set(Calendar.MINUTE,0);
    set(Calendar.HOUR,0);
    set(Calendar.AM_PM,AM);
    set(Calendar.DATE,1);
    if (iUnit == GroupingUnitType.QUARTERS) {
      set(Calendar.MONTH,(getMonth() / 3) * 3);
    }
  }
 else   if (iUnit == WEEK_OF_YEAR) {
    set(Calendar.MILLISECOND,0);
    set(Calendar.SECOND,0);
    set(Calendar.MINUTE,0);
    set(Calendar.HOUR,0);
    set(Calendar.AM_PM,AM);
    int weekDay=get(DAY_OF_WEEK);
    add(DATE,1 - weekDay);
  }
 else   if (iUnit == DATE) {
    set(Calendar.MILLISECOND,0);
    set(Calendar.SECOND,0);
    set(Calendar.MINUTE,0);
    set(Calendar.HOUR,0);
    set(Calendar.AM_PM,AM);
  }
 else   if (iUnit == HOUR || iUnit == HOUR_OF_DAY) {
    set(Calendar.MILLISECOND,0);
    set(Calendar.SECOND,0);
    set(Calendar.MINUTE,0);
  }
 else   if (iUnit == MINUTE) {
    set(Calendar.MILLISECOND,0);
    set(Calendar.SECOND,0);
  }
 else   if (iUnit == SECOND) {
    set(Calendar.MILLISECOND,0);
  }
}

Fixed version (ground truth):
/** 
 * Zeroes out all units for this datetime instance below a specified unit.
 * @param iUnit The unit below which all values are to be zeroed out
 */
public final void clearBelow(int iUnit){
  if (isFullDateTime()) {
    return;
  }
  if (iUnit == YEAR) {
    set(Calendar.MILLISECOND,0);
    set(Calendar.SECOND,0);
    set(Calendar.MINUTE,0);
    set(Calendar.HOUR,0);
    set(Calendar.DATE,1);
    set(Calendar.AM_PM,AM);
    set(Calendar.MONTH,0);
  }
 else   if (iUnit == MONTH || iUnit == GroupingUnitType.QUARTERS) {
    set(Calendar.MILLISECOND,0);
    set(Calendar.SECOND,0);
    set(Calendar.MINUTE,0);
    set(Calendar.HOUR,0);
    set(Calendar.AM_PM,AM);
    set(Calendar.DATE,1);
    if (iUnit == GroupingUnitType.QUARTERS) {
      set(Calendar.MONTH,(getMonth() / 3) * 3);
    }
  }
 else   if (iUnit == WEEK_OF_YEAR) {
    set(Calendar.MILLISECOND,0);
    set(Calendar.SECOND,0);
    set(Calendar.MINUTE,0);
    set(Calendar.HOUR,0);
    set(Calendar.AM_PM,AM);
    int weekDay=get(DAY_OF_WEEK);
    add(DATE,1 - weekDay);
  }
 else   if (iUnit == DATE) {
    set(Calendar.MILLISECOND,0);
    set(Calendar.SECOND,0);
    set(Calendar.MINUTE,0);
    set(Calendar.HOUR,0);
    set(Calendar.AM_PM,AM);
  }
 else   if (iUnit == HOUR || iUnit == HOUR_OF_DAY) {
    set(Calendar.MILLISECOND,0);
    set(Calendar.SECOND,0);
    set(Calendar.MINUTE,0);
  }
 else   if (iUnit == MINUTE) {
    set(Calendar.MILLISECOND,0);
    set(Calendar.SECOND,0);
  }
 else   if (iUnit == SECOND) {
    set(Calendar.MILLISECOND,0);
  }
}
Program: 65433
Project: 65433
Buggy source:
/** 
 * A convenient method used in building the ticks for a datetime scale. Computes a new datetime object relative to the existing one moving back by 'step' units.
 * @param iUnit
 * @param iStep
 * @return
 */
public CDateTime backward(int iUnit,int iStep){
  CDateTime cd=(CDateTime)clone();
  if (iUnit == QUARTER) {
    cd.add(Calendar.MONTH,(iStep == 0 ? 1 : iStep) * -3);
  }
 else {
    cd.add(iUnit,-iStep);
  }
  return cd;
}

Fixed version (ground truth):
/** 
 * A convenient method used in building the ticks for a datetime scale. Computes a new datetime object relative to the existing one moving back by 'step' units.
 * @param iUnit
 * @param iStep
 * @return new instance
 */
public CDateTime backward(int iUnit,int iStep){
  CDateTime cd=(CDateTime)clone();
  if (iUnit == QUARTER) {
    cd.add(Calendar.MONTH,(iStep == 0 ? 1 : iStep) * -3);
  }
 else {
    cd.add(iUnit,-iStep);
  }
  return cd;
}
Program: 65434
Project: 65434
Buggy source:
/** 
 * @return
 */
public Date getDateTime(){
  if (isSqlDate) {
    return new java.sql.Date(getTime().getTime());
  }
  return getTime();
}

Fixed version (ground truth):
public Date getDateTime(){
  if (bDateOnly) {
    return new java.sql.Date(getTime().getTime());
  }
  return getTime();
}
Program: 65435
Project: 65435
Buggy source:
/** 
 * A convenient method used in building the ticks for a datetime scale. Computes a new datetime object relative to the existing one moving forward by 'step' units.
 * @param iUnit
 * @param iStep
 * @return
 */
public CDateTime forward(int iUnit,int iStep){
  CDateTime cd=(CDateTime)clone();
  if (iUnit == QUARTER) {
    cd.add(Calendar.MONTH,(iStep == 0 ? 1 : iStep) * 3);
  }
 else {
    cd.add(iUnit,iStep);
  }
  return cd;
}

Fixed version (ground truth):
/** 
 * A convenient method used in building the ticks for a datetime scale. Computes a new datetime object relative to the existing one moving forward by 'step' units.
 * @param iUnit
 * @param iStep
 * @return new instance
 */
public CDateTime forward(int iUnit,int iStep){
  CDateTime cd=(CDateTime)clone();
  if (iUnit == QUARTER) {
    cd.add(Calendar.MONTH,(iStep == 0 ? 1 : iStep) * 3);
  }
 else {
    cd.add(iUnit,iStep);
  }
  return cd;
}
Program: 65437
Project: 65437
Buggy source:
/** 
 * Configure web server.
 */
private void configureServer(String webappName){
  host=ViewerPlugin.getDefault().getPluginPreferences().getString(HOST_KEY);
  int port=ViewerPlugin.getDefault().getPluginPreferences().getInt(PORT_KEY);
  try {
    String hostCommandLineOverride=System.getProperty("String_Node_Str");
    if (hostCommandLineOverride != null && hostCommandLineOverride.trim().length() > 0)     host=hostCommandLineOverride;
  }
 catch (  Exception e) {
  }
  try {
    String portCommandLineOverride=System.getProperty("String_Node_Str");
    if (portCommandLineOverride != null && portCommandLineOverride.trim().length() > 0)     port=Integer.parseInt(portCommandLineOverride);
  }
 catch (  Exception e) {
  }
  if (host == null || host.trim().length() <= 0) {
    host="String_Node_Str";
  }
  if (port <= 0) {
    port=SocketUtil.findUnusedLocalPort();
  }
  ports.put(webappName,port);
}

Fixed version (ground truth):
/** 
 * Configure web server.
 */
private void configureServer(String webappName){
  host=ViewerPlugin.getDefault().getPluginPreferences().getString(HOST_KEY);
  int port=ViewerPlugin.getDefault().getPluginPreferences().getInt(PORT_KEY);
  try {
    String hostCommandLineOverride=System.getProperty("String_Node_Str");
    if (hostCommandLineOverride != null && hostCommandLineOverride.trim().length() > 0)     host=hostCommandLineOverride;
  }
 catch (  Exception e) {
  }
  try {
    String portCommandLineOverride=System.getProperty("String_Node_Str");
    if (portCommandLineOverride != null && portCommandLineOverride.trim().length() > 0)     port=Integer.parseInt(portCommandLineOverride);
  }
 catch (  Exception e) {
  }
  if (host == null || host.trim().length() <= 0) {
    host=null;
  }
  if (port <= 0) {
    port=SocketUtil.findUnusedLocalPort();
  }
  ports.put(webappName,port);
}
Program: 65438
Project: 65438
Buggy source:
/** 
 * Start web appserver based on Jetty Http Service
 * @param webappName
 * @throws Exception
 */
public void start(String webappName,String pluginID) throws Exception {
  configureServer(webappName);
  Dictionary dict=new Hashtable();
  dict.put("String_Node_Str",ports.get(webappName));
  dict.put("String_Node_Str",host);
  dict.put("String_Node_Str","String_Node_Str" + webappName);
  dict.put("String_Node_Str",pluginID);
  JettyConfigurator.startServer(webappName,dict);
  ensureBundleStarted("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Start web appserver based on Jetty Http Service
 * @param webappName
 * @throws Exception
 */
public void start(String webappName,String pluginID) throws Exception {
  configureServer(webappName);
  Dictionary dict=new Hashtable();
  dict.put("String_Node_Str",ports.get(webappName));
  dict.put("String_Node_Str",host == null ? "String_Node_Str" : host);
  dict.put("String_Node_Str","String_Node_Str" + webappName);
  dict.put("String_Node_Str",pluginID);
  JettyConfigurator.startServer(webappName,dict);
  ensureBundleStarted("String_Node_Str");
}
Program: 65439
Project: 65439
Buggy source:
/** 
 * @return the host
 */
String getHost(){
  return host;
}

Fixed version (ground truth):
/** 
 * @return the host
 */
String getHost(){
  return host == null ? "String_Node_Str" : host;
}
Program: 65441
Project: 65441
Buggy source:
/** 
 * Creates the composite, for displaying the list of available db objects
 * @param parent
 */
private Control createDBMetaDataSelectionComposite(Composite parent){
  sComposite=new ScrolledComposite(parent,SWT.H_SCROLL | SWT.V_SCROLL);
  sComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
  sComposite.setExpandHorizontal(true);
  sComposite.setExpandVertical(true);
  sComposite.addControlListener(new ControlAdapter(){
    public void controlResized(    ControlEvent e){
      computeSize();
    }
  }
);
  boolean supportsSchema=false;
  boolean supportsProcedure=false;
  if (continueConnect) {
    supportsSchema=JdbcMetaDataProvider.getInstance().isSupportSchema();
    supportsProcedure=JdbcMetaDataProvider.getInstance().isSupportProcedure();
  }
  tablescomposite=new Composite(sComposite,SWT.NONE);
  tablescomposite.setLayout(new GridLayout());
  GridData data=new GridData(GridData.FILL_BOTH);
  data.grabExcessVerticalSpace=true;
  tablescomposite.setLayoutData(data);
  createDBObjectTree(tablescomposite);
  createObjectTreeMenu();
  createSchemaFilterComposite(supportsSchema,supportsProcedure,tablescomposite);
  createSQLOptionGroup(tablescomposite);
  addDragSupportToTree();
  addFetchDbObjectListener(metadataBidiFormatStr);
  sComposite.setContent(tablescomposite);
  return tablescomposite;
}

Fixed version (ground truth):
/** 
 * Creates the composite, for displaying the list of available db objects
 * @param parent
 */
private Control createDBMetaDataSelectionComposite(Composite parent){
  sComposite=new ScrolledComposite(parent,SWT.H_SCROLL | SWT.V_SCROLL);
  sComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
  sComposite.setExpandHorizontal(true);
  sComposite.setExpandVertical(true);
  sComposite.setMinHeight(500);
  sComposite.setMinWidth(250);
  sComposite.addControlListener(new ControlAdapter(){
    public void controlResized(    ControlEvent e){
      computeSize();
    }
  }
);
  boolean supportsSchema=false;
  boolean supportsProcedure=false;
  if (continueConnect) {
    supportsSchema=JdbcMetaDataProvider.getInstance().isSupportSchema();
    supportsProcedure=JdbcMetaDataProvider.getInstance().isSupportProcedure();
  }
  tablescomposite=new Composite(sComposite,SWT.NONE);
  tablescomposite.setLayout(new GridLayout());
  GridData data=new GridData(GridData.FILL_BOTH);
  data.grabExcessVerticalSpace=true;
  tablescomposite.setLayoutData(data);
  createDBObjectTree(tablescomposite);
  createObjectTreeMenu();
  createSchemaFilterComposite(supportsSchema,supportsProcedure,tablescomposite);
  createSQLOptionGroup(tablescomposite);
  addDragSupportToTree();
  addFetchDbObjectListener(metadataBidiFormatStr);
  sComposite.setContent(tablescomposite);
  return tablescomposite;
}
Program: 65442
Project: 65442
Buggy source:
private ExpressionProvider getExpressionProvider(){
  ExpressionProvider expressionProvider=new ExpressionProvider(handle);
  expressionProvider.addFilter(new ExpressionFilter(){
    public boolean select(    Object parentElement,    Object element){
      if (ExpressionFilter.CATEGORY.equals(parentElement) && ExpressionProvider.COLUMN_BINDINGS.equals(element)) {
        return false;
      }
      if (ExpressionFilter.CATEGORY.equals(parentElement) && ExpressionProvider.MEASURE.equals(element)) {
        return false;
      }
      if (ExpressionProvider.CURRENT_CUBE.equals(parentElement)) {
        if (element instanceof PropertyHandle) {
          PropertyHandle property=(PropertyHandle)element;
          if (ICubeModel.DIMENSIONS_PROP.equals(property.getPropertyDefn().getName())) {
            return true;
          }
 else {
            return false;
          }
        }
      }
      return true;
    }
  }
);
  return expressionProvider;
}

Fixed version (ground truth):
protected ExpressionProvider getExpressionProvider(){
  ExpressionProvider expressionProvider=new ExpressionProvider(handle);
  expressionProvider.addFilter(new ExpressionFilter(){
    public boolean select(    Object parentElement,    Object element){
      if (ExpressionFilter.CATEGORY.equals(parentElement) && ExpressionProvider.COLUMN_BINDINGS.equals(element)) {
        return false;
      }
      if (ExpressionFilter.CATEGORY.equals(parentElement) && ExpressionProvider.MEASURE.equals(element)) {
        return false;
      }
      if (ExpressionProvider.CURRENT_CUBE.equals(parentElement)) {
        if (element instanceof PropertyHandle) {
          PropertyHandle property=(PropertyHandle)element;
          if (ICubeModel.DIMENSIONS_PROP.equals(property.getPropertyDefn().getName())) {
            return true;
          }
 else {
            return false;
          }
        }
      }
      return true;
    }
  }
);
  return expressionProvider;
}
Program: 65443
Project: 65443
Buggy source:
public void modifyText(ModifyEvent e){
  if (StringUtil.isBlank(nameEditor.getText().trim())) {
    setMessage(EMPTY_NAME,ERROR);
  }
 else   if (isDuplicateName()) {
    setMessage(DUPLICATE_NAME,ERROR);
  }
 else   if (containInvalidCharactor(nameEditor.getText())) {
    String msg=Messages.getFormattedString("String_Node_Str",new Object[]{nameEditor.getText()});
    setMessage(msg,ERROR);
  }
 else {
    setMessage(CREATE_PROMPT);
  }
  setPageComplete(!hasWizard() && (getMessageType() != ERROR) && getSelectedDataSource() != null);
}

Fixed version (ground truth):
public void modifyText(ModifyEvent e){
  if (StringUtil.isBlank(nameEditor.getText().trim())) {
    setMessage(EMPTY_NAME,ERROR);
  }
 else   if (isDuplicateName()) {
    setMessage(DUPLICATE_NAME,ERROR);
  }
 else   if (containInvalidCharactor(nameEditor.getText())) {
    String msg=Messages.getFormattedString("String_Node_Str",new Object[]{nameEditor.getText()});
    setMessage(msg,ERROR);
  }
 else {
    setMessage(CREATE_PROMPT);
  }
  setPageComplete(!hasWizard() && (getMessageType() != ERROR) && getSelectedDataSource() != null);
  nameEditor.setFocus();
}
Program: 65445
Project: 65445
Buggy source:
/** 
 * @param appContext
 * @param dsource
 * @param dset
 * @param moduleHandle
 * @throws BirtException
 */
void preDefineDataSet(DataSessionContext appContext,IBaseDataSourceDesign dsource,IBaseDataSetDesign dset,ModuleHandle moduleHandle) throws BirtException ;

Fixed version (ground truth):
/** 
 * @param appContext
 * @param dsource
 * @param dset
 * @param moduleHandle
 * @throws BirtException
 */
void preDefineDataSet(DataSessionContext appContext,IBaseDataSourceDesign dsource,IBaseDataSetDesign dset,IQueryDefinition query) throws BirtException ;
Program: 65446
Project: 65446
Buggy source:
public void defineDataSet(IBaseDataSetDesign design) throws BirtException {
  IDataSetInterceptor dataSetInterceptor=DataSetInterceptorFinder.find(design);
  if (dataSetInterceptor != null) {
    dataSetInterceptor.preDefineDataSet(sessionContext,dataEngine.getDataSourceDesign(design.getDataSourceName()),design,getDataSessionContext().getModuleHandle());
  }
  dataEngine.defineDataSet(design);
}

Fixed version (ground truth):
public void defineDataSet(IBaseDataSetDesign design) throws BirtException {
  dataEngine.defineDataSet(design);
}
Program: 65447
Project: 65447
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,null);
  }
}

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);
    DefineDataSourceSetUtil.prepareForTransientQuery(sessionContext,dataEngine,handle,queryDefn);
  }
}
Program: 65448
Project: 65448
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,new DataSetHandleProcessContext(major,useResultHints,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));
    DefineDataSourceSetUtil.prepareForTransientQuery(sessionContext,(DataEngineImpl)dataEngine,handle,queryDefn);
  }
}
Program: 65449
Project: 65449
Buggy source:
private void preDefineDataSet(DataSetHandle handle) throws BirtException {
  if (handle instanceof JointDataSetHandle) {
    Iterator iter=((JointDataSetHandle)handle).dataSetsIterator();
    while (iter.hasNext()) {
      DataSetHandle dsHandle=(DataSetHandle)iter.next();
      if (dsHandle != null) {
        preDefineDataSet(dsHandle);
      }
    }
  }
  if (handle instanceof DerivedDataSetHandle) {
    List inputDataSet=((DerivedDataSetHandle)handle).getInputDataSets();
    for (int i=0; i < inputDataSet.size(); i++) {
      preDefineDataSet((DataSetHandle)inputDataSet.get(i));
    }
  }
  IBaseDataSetDesign baseDS=((DataEngineImpl)dataEngine).getDataSetDesign(handle.getQualifiedName());
  IDataSetInterceptor dataSetInterceptor=DataSetInterceptorFinder.find(baseDS);
  if (dataSetInterceptor != null) {
    dataSetInterceptor.preDefineDataSet(sessionContext,((DataEngineImpl)dataEngine).getDataSourceDesign(baseDS.getDataSourceName()),baseDS,sessionContext.getModuleHandle());
  }
}

Fixed version (ground truth):
private void preDefineDataSet(DataSetHandle handle) throws BirtException {
  if (handle instanceof JointDataSetHandle) {
    Iterator iter=((JointDataSetHandle)handle).dataSetsIterator();
    while (iter.hasNext()) {
      DataSetHandle dsHandle=(DataSetHandle)iter.next();
      if (dsHandle != null) {
        preDefineDataSet(dsHandle);
      }
    }
  }
  if (handle instanceof DerivedDataSetHandle) {
    List inputDataSet=((DerivedDataSetHandle)handle).getInputDataSets();
    for (int i=0; i < inputDataSet.size(); i++) {
      preDefineDataSet((DataSetHandle)inputDataSet.get(i));
    }
  }
}
Program: 65450
Project: 65450
Buggy source:
/** 
 * Test getters and setters.
 * @throws DesignFileException
 */
public void testGetterAndSetter() throws DesignFileException {
  IElementDefn elementDefn=MetaDataDictionary.getInstance().getElement("String_Node_Str");
  assertNotNull(elementDefn);
  slotDefn=(SlotDefn)elementDefn.getSlot(0);
  MetadataTestUtil.setMultipleCardinality(slotDefn,true);
  MetadataTestUtil.setDisplayNameKey(slotDefn,"String_Node_Str");
  MetadataTestUtil.setName(slotDefn,"String_Node_Str");
  MetadataTestUtil.setID(slotDefn,99);
  assertEquals(true,slotDefn.isMultipleCardinality());
  assertEquals("String_Node_Str",slotDefn.getDisplayName());
  assertEquals("String_Node_Str",slotDefn.getDisplayNameID());
  assertEquals("String_Node_Str",slotDefn.getName());
  assertEquals(99,slotDefn.getSlotID());
}

Fixed version (ground truth):
/** 
 * Test getters and setters.
 * @throws DesignFileException
 */
public void testGetterAndSetter() throws DesignFileException {
  slotDefn=new SlotDefn();
  MetadataTestUtil.setMultipleCardinality(slotDefn,true);
  MetadataTestUtil.setDisplayNameKey(slotDefn,"String_Node_Str");
  MetadataTestUtil.setName(slotDefn,"String_Node_Str");
  MetadataTestUtil.setID(slotDefn,99);
  assertEquals(true,slotDefn.isMultipleCardinality());
  assertEquals("String_Node_Str",slotDefn.getDisplayName());
  assertEquals("String_Node_Str",slotDefn.getDisplayNameID());
  assertEquals("String_Node_Str",slotDefn.getName());
  assertEquals(99,slotDefn.getSlotID());
}
Program: 65451
Project: 65451
Buggy source:
/** 
 * Tests design file with css file that can't be found
 * @throws Exception
 */
public void testOpenBadCssFile() throws Exception {
  openDesign("String_Node_Str");
  List errorList=design.getAllErrors();
  assertEquals(1,errorList.size());
  String errorCode=((ErrorDetail)errorList.get(0)).getErrorCode();
  assertEquals(errorCode,CssException.DESIGN_EXCEPTION_CSS_NOT_FOUND);
}

Fixed version (ground truth):
/** 
 * Tests design file with css file that can't be found
 * @throws Exception
 */
public void testOpenBadCssFile() throws Exception {
  openDesign("String_Node_Str");
  List errorList=design.getAllErrors();
  assertTrue(!errorList.isEmpty());
  String errorCode=((ErrorDetail)errorList.get(0)).getErrorCode();
  assertEquals(errorCode,CssException.DESIGN_EXCEPTION_CSS_NOT_FOUND);
}
Program: 65453
Project: 65453
Buggy source:
public void testHideRuleFormatCompatibility() throws Exception {
  openDesign("String_Node_Str");
  List<ErrorDetail> errors=design.getAllErrors();
  assertEquals(1,errors.size());
  assertEquals(PropertyValueException.DESIGN_EXCEPTION_INVALID_VALUE,errors.get(0).getErrorCode());
  TableHandle tableHandle=(TableHandle)designHandle.findElement("String_Node_Str");
  RowHandle rowHandle=(RowHandle)tableHandle.getHeader().get(0);
  Iterator rules=rowHandle.visibilityRulesIterator();
  assertNotNull(rules);
  HideRuleHandle handle=(HideRuleHandle)rules.next();
  assertEquals("String_Node_Str",handle.getFormat());
  handle=(HideRuleHandle)rules.next();
  assertEquals(DesignChoiceConstants.FORMAT_TYPE_ALL,handle.getFormat());
  try {
    handle.setFormat("String_Node_Str");
    fail();
  }
 catch (  SemanticException e) {
    assertEquals(PropertyValueException.DESIGN_EXCEPTION_INVALID_VALUE,e.getErrorCode());
  }
}

Fixed version (ground truth):
public void testHideRuleFormatCompatibility() throws Exception {
  openDesign("String_Node_Str");
  List<ErrorDetail> errors=design.getAllErrors();
  assertTrue(!errors.isEmpty());
  assertEquals(PropertyValueException.DESIGN_EXCEPTION_INVALID_VALUE,errors.get(0).getErrorCode());
  TableHandle tableHandle=(TableHandle)designHandle.findElement("String_Node_Str");
  RowHandle rowHandle=(RowHandle)tableHandle.getHeader().get(0);
  Iterator rules=rowHandle.visibilityRulesIterator();
  assertNotNull(rules);
  HideRuleHandle handle=(HideRuleHandle)rules.next();
  assertEquals("String_Node_Str",handle.getFormat());
  handle=(HideRuleHandle)rules.next();
  assertEquals(DesignChoiceConstants.FORMAT_TYPE_ALL,handle.getFormat());
  try {
    handle.setFormat("String_Node_Str");
    fail();
  }
 catch (  SemanticException e) {
    assertEquals(PropertyValueException.DESIGN_EXCEPTION_INVALID_VALUE,e.getErrorCode());
  }
}
Program: 65454
Project: 65454
Buggy source:
public void createPageCustomControl(Composite parent){
  sComposite=new ScrolledComposite(parent,SWT.H_SCROLL | SWT.V_SCROLL);
  sComposite.setLayout(new GridLayout());
  sComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
  sComposite.setMinWidth(600);
  sComposite.setExpandHorizontal(true);
  Composite mainComposite=new Composite(sComposite,SWT.NONE);
  mainComposite.setLayout(new GridLayout(1,false));
  GridData gridData=new GridData(GridData.FILL_BOTH);
  mainComposite.setLayoutData(gridData);
  createTopArea(mainComposite);
  createFieldsSelectionArea(mainComposite);
  createBottomArea(mainComposite);
  Point size=mainComposite.computeSize(SWT.DEFAULT,SWT.DEFAULT);
  mainComposite.setSize(size.x,size.y);
  sComposite.setContent(mainComposite);
  setControl(sComposite);
  setPageComplete(false);
  try {
    initPageInfos();
  }
 catch (  final OdaException e) {
    initializeControl();
    Display.getDefault().asyncExec(new Runnable(){
      public void run(){
        String errorMsg=UIHelper.getUserErrorMessage("String_Node_Str",e);
        ExceptionHandler.showException(sComposite.getShell(),Messages.getString("String_Node_Str"),errorMsg,e);
      }
    }
);
    return;
  }
  initializeControl();
  resetLabelWidth();
  modelChanged=false;
}

Fixed version (ground truth):
public void createPageCustomControl(Composite parent){
  sComposite=new ScrolledComposite(parent,SWT.H_SCROLL | SWT.V_SCROLL);
  sComposite.setLayout(new GridLayout());
  sComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
  sComposite.setMinWidth(600);
  sComposite.setExpandHorizontal(true);
  Composite mainComposite=new Composite(sComposite,SWT.NONE);
  mainComposite.setLayout(new GridLayout(1,false));
  GridData gridData=new GridData(GridData.FILL_BOTH);
  mainComposite.setLayoutData(gridData);
  createTopArea(mainComposite);
  createFieldsSelectionArea(mainComposite);
  createBottomArea(mainComposite);
  Point size=mainComposite.computeSize(SWT.DEFAULT,SWT.DEFAULT);
  mainComposite.setSize(size.x,size.y);
  sComposite.setContent(mainComposite);
  setControl(sComposite);
  setPageComplete(false);
  try {
    initPageInfos();
  }
 catch (  final OdaException e) {
    initializeControl();
    Display.getDefault().asyncExec(new Runnable(){
      public void run(){
        String errorMsg=UIHelper.getUserErrorMessage("String_Node_Str",e);
        ExceptionHandler.showException(sComposite.getShell(),Messages.getString("String_Node_Str"),errorMsg,e);
      }
    }
);
    return;
  }
  initializeControl();
  resetLabelWidth();
  modelChanged=false;
  UIHelper.setSystemHelp(getControl(),IHelpConstants.CONTEXT_ID_WIZARD_DATASET_MONGODB);
}
Program: 65455
Project: 65455
Buggy source:
public boolean canLeave(){
  if (propertyPage instanceof DataSetEditorPage) {
    try {
      DataSetDesign requestDesign=null;
      DesignSessionResponse response=null;
      if (dataSetSession != null) {
        requestDesign=dataSetSession.getRequest().getDataSetDesign();
        response=dataSetSession.flush().getResponse();
      }
 else       response=((DataSetEditorPage)propertyPage).collectPageResponse();
      DTPUtil.getInstance().updateDataSetHandle(response,requestDesign,(OdaDataSetHandle)((DataSetEditor)getContainer()).getModel(),false);
    }
 catch (    OdaException e) {
      ExceptionHandler.handle(e);
    }
    return true;
  }
  if (propertyPage instanceof DataSourceEditorPage) {
    if (propertyPage.okToLeave()) {
      try {
        DataSourceDesign requestDesign=null;
        if (this.dataSourceSession != null)         requestDesign=this.dataSourceSession.getRequest().getDataSourceDesign();
        DTPUtil.getInstance().updateDataSourceHandle(((DataSourceEditorPage)propertyPage).getEditSessionResponse().getResponse(),requestDesign,(OdaDataSourceHandle)(getContainer()).getModel());
        ((DataSourceEditor)this.getContainer()).updateDesignSession();
      }
 catch (      OdaException e) {
        ExceptionHandler.handle(e);
      }
    }
    return propertyPage.okToLeave();
  }
  return super.canLeave();
}

Fixed version (ground truth):
public boolean canLeave(){
  if (propertyPage instanceof DataSetEditorPage) {
    boolean okToLeave=((DataSetEditorPage)propertyPage).okToLeave();
    if (okToLeave) {
      try {
        DataSetDesign requestDesign=null;
        DesignSessionResponse response=null;
        if (dataSetSession != null) {
          requestDesign=dataSetSession.getRequest().getDataSetDesign();
          response=dataSetSession.flush().getResponse();
        }
 else         response=((DataSetEditorPage)propertyPage).collectPageResponse();
        DTPUtil.getInstance().updateDataSetHandle(response,requestDesign,(OdaDataSetHandle)((DataSetEditor)getContainer()).getModel(),false);
      }
 catch (      OdaException e) {
        ExceptionHandler.handle(e);
      }
    }
    return okToLeave;
  }
  if (propertyPage instanceof DataSourceEditorPage) {
    if (propertyPage.okToLeave()) {
      try {
        DataSourceDesign requestDesign=null;
        if (this.dataSourceSession != null)         requestDesign=this.dataSourceSession.getRequest().getDataSourceDesign();
        DTPUtil.getInstance().updateDataSourceHandle(((DataSourceEditorPage)propertyPage).getEditSessionResponse().getResponse(),requestDesign,(OdaDataSourceHandle)(getContainer()).getModel());
        ((DataSourceEditor)this.getContainer()).updateDesignSession();
      }
 catch (      OdaException e) {
        ExceptionHandler.handle(e);
      }
    }
    return propertyPage.okToLeave();
  }
  return super.canLeave();
}
Program: 65456
Project: 65456
Buggy source:
protected void checkDisplayNone(IContent content,boolean isStart){
  if (isStart) {
    if (context.isDisplayNone()) {
      return;
    }
 else {
      if (PropertyUtil.isDisplayNone(content)) {
        contentDisplayNone=content;
        context.setDisplayNone(true);
      }
    }
  }
 else {
    if (context.isDisplayNone()) {
      if (PropertyUtil.isDisplayNone(content)) {
        if (contentDisplayNone == content) {
          context.setDisplayNone(false);
          contentDisplayNone=null;
        }
      }
    }
  }
}

Fixed version (ground truth):
protected void checkDisplayNone(IContent content,boolean isStart){
  if (isStart) {
    if (context.isDisplayNone()) {
      return;
    }
 else {
      if (PropertyUtil.isDisplayNone(content)) {
        contentDisplayNone=content;
        context.setDisplayNone(true);
      }
    }
  }
 else {
    if (context.isDisplayNone()) {
      if (PropertyUtil.isDisplayNone(content)) {
        if (contentDisplayNone.getInstanceID() == content.getInstanceID()) {
          context.setDisplayNone(false);
          contentDisplayNone=null;
        }
      }
    }
  }
}
Program: 65457
Project: 65457
Buggy source:
public void initialize() throws BirtException {
  createRoot();
  Color backgroundColor=PropertyUtil.getColor(pageContent.getComputedStyle().getProperty(StyleConstants.STYLE_BACKGROUND_COLOR));
  ReportDesignHandle designHandle=pageContent.getReportContent().getDesign().getReportDesign();
  IStyle style=pageContent.getStyle();
  String imageUrl=EmitterUtil.getBackgroundImageUrl(style,designHandle,pageContent.getReportContent().getReportContext() == null ? null : pageContent.getReportContent().getReportContext().getAppContext());
  if (backgroundColor != null || imageUrl != null) {
    boxStyle=new BoxStyle();
    boxStyle.setBackgroundColor(backgroundColor);
    if (imageUrl != null) {
      boxStyle.setBackgroundImage(createBackgroundImage(imageUrl));
    }
  }
  context.setMaxHeight(root.getHeight());
  context.setMaxWidth(root.getWidth());
  context.setMaxBP(root.getHeight());
  layoutHeader();
  layoutFooter();
  updateBodySize();
  context.setMaxHeight(body.getHeight());
  context.setMaxWidth(body.getWidth());
  context.setMaxBP(body.getHeight());
  maxAvaWidth=context.getMaxWidth();
  context.resetUnresolvedRowHints();
}

Fixed version (ground truth):
public void initialize() throws BirtException {
  createRoot();
  Color backgroundColor=PropertyUtil.getColor(pageContent.getComputedStyle().getProperty(StyleConstants.STYLE_BACKGROUND_COLOR));
  ReportDesignHandle designHandle=pageContent.getReportContent().getDesign().getReportDesign();
  IStyle style=pageContent.getStyle();
  String imageUrl=EmitterUtil.getBackgroundImageUrl(style,designHandle,pageContent.getReportContent().getReportContext() == null ? null : pageContent.getReportContent().getReportContext().getAppContext());
  if (backgroundColor != null || imageUrl != null) {
    boxStyle=new BoxStyle();
    boxStyle.setBackgroundColor(backgroundColor);
    if (imageUrl != null) {
      boxStyle.setBackgroundImage(createBackgroundImage(imageUrl));
    }
  }
  context.setMaxHeight(root.getHeight());
  context.setMaxWidth(root.getWidth());
  context.setMaxBP(root.getHeight());
  layoutHeader();
  layoutFooter();
  updateBodySize();
  context.setMaxHeight(body.getHeight());
  context.setMaxWidth(body.getWidth());
  int overFlowType=context.getPageOverflow();
  if (overFlowType == IPDFRenderOption.FIT_TO_PAGE_SIZE || overFlowType == IPDFRenderOption.ENLARGE_PAGE_SIZE) {
    context.setMaxBP(Integer.MAX_VALUE);
  }
 else {
    context.setMaxBP(body.getHeight());
  }
  maxAvaWidth=context.getMaxWidth();
  context.resetUnresolvedRowHints();
}
Program: 65459
Project: 65459
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());
      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);
  }
}

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;
    this.hasExternalScope=scriptContext != null;
    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);
  }
 catch (  BirtException e) {
    throw new AdapterException(e.getErrorCode(),e);
  }
}
Program: 65460
Project: 65460
Buggy source:
/** 
 * uses to clear the data cach.
 * @param dataSet the dataset handle
 * @throws BirtException
 */
public void clearCache(DataSetHandle dataSet) throws BirtException {
  DataSessionContext context;
  DataRequestSession requestSession=null;
  try {
    context=new DataSessionContext(DataSessionContext.MODE_DIRECT_PRESENTATION,dataSet.getModuleHandle(),null);
    requestSession=DataRequestSession.newSession(context);
    IModelAdapter modelAdaptor=requestSession.getModelAdaptor();
    DataSourceHandle dataSource=dataSet.getDataSource();
    IBaseDataSourceDesign sourceDesign=modelAdaptor.adaptDataSource(dataSource);
    IBaseDataSetDesign dataSetDesign=modelAdaptor.adaptDataSet(dataSet);
    requestSession.clearCache(sourceDesign,dataSetDesign);
  }
 catch (  Exception e) {
    ExceptionUtil.handle(e);
  }
 finally {
    if (requestSession != null) {
      requestSession.shutdown();
    }
  }
}

Fixed version (ground truth):
/** 
 * uses to clear the data cach.
 * @param dataSet the dataset handle
 * @throws BirtException
 */
public void clearCache(DataSetHandle dataSet) throws BirtException {
  DataSessionContext context;
  DataRequestSession requestSession=null;
  try {
    context=new DataSessionContext(DataSessionContext.MODE_DIRECT_PRESENTATION,dataSet.getModuleHandle(),null);
    requestSession=DataRequestSession.newSession(context);
    IModelAdapter modelAdaptor=requestSession.getModelAdaptor();
    DataSourceHandle dataSource=dataSet.getDataSource();
    IBaseDataSourceDesign sourceDesign=modelAdaptor.adaptDataSource(dataSource);
    IBaseDataSetDesign dataSetDesign=modelAdaptor.adaptDataSet(dataSet);
    requestSession.clearCache(sourceDesign,dataSetDesign);
  }
  finally {
    if (requestSession != null) {
      requestSession.shutdown();
    }
  }
}