nus-yam/ex-repair huggingface dataset:
Program: 68258
Project: 68258
Buggy source:
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=createDataComponentsUI();
    getCustomizeUI().init();
    foSashForm=new SashForm(topControl,SWT.VERTICAL);
{
      GridLayout layout=new GridLayout();
      foSashForm.setLayout(layout);
      GridData gridData=new GridData(GridData.FILL_BOTH);
      gridData.widthHint=800;
      foSashForm.setLayoutData(gridData);
    }
    foSashForm.addListener(SWT.Resize,this);
    placeComponents();
    previewPainter=createPreviewPainter();
  }
 else {
    customizeUI();
  }
  resize();
  if (getChartModel() instanceof ChartWithAxes) {
    checkDataTypeForChartWithAxes();
  }
  doPreview();
  DataDefinitionTextManager.getInstance().refreshAll();
  ChartUIUtil.checkGroupType((ChartWizardContext)getContext(),getChartModel());
  ChartUIUtil.checkAggregateType((ChartWizardContext)getContext());
  bindHelp();
}

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=createDataComponentsUI();
    getCustomizeUI().init();
    foSashForm=new SashForm(topControl,SWT.VERTICAL);
{
      GridLayout layout=new GridLayout();
      foSashForm.setLayout(layout);
      GridData gridData=new GridData(GridData.FILL_BOTH);
      gridData.widthHint=800;
      foSashForm.setLayoutData(gridData);
    }
    foSashForm.addListener(SWT.Resize,this);
    placeComponents();
    previewPainter=createPreviewPainter();
  }
 else {
    customizeUI();
  }
  resize();
  if (getChartModel() instanceof ChartWithAxes) {
    checkDataTypeForChartWithAxes();
  }
  doPreview();
  DataDefinitionTextManager.getInstance().refreshAll();
  DataDefinitionTextManager.getInstance().setContext((IChartWizardContext)getContext());
  ChartUIUtil.checkGroupType((ChartWizardContext)getContext(),getChartModel());
  ChartUIUtil.checkAggregateType((ChartWizardContext)getContext());
  bindHelp();
}
Program: 68259
Project: 68259
Buggy source:
public void dispose(){
  super.dispose();
  if (previewPainter != null) {
    previewPainter.dispose();
  }
  previewPainter=null;
  if (dynamicArea != null) {
    dynamicArea.dispose();
  }
  dynamicArea=null;
  ColorPalette.getInstance().restore();
  DataDefinitionTextManager.getInstance().removeAll();
}

Fixed version (ground truth):
public void dispose(){
  super.dispose();
  if (previewPainter != null) {
    previewPainter.dispose();
  }
  previewPainter=null;
  if (dynamicArea != null) {
    dynamicArea.dispose();
  }
  dynamicArea=null;
  ColorPalette.getInstance().restore();
  DataDefinitionTextManager.getInstance().removeAll();
  DataDefinitionTextManager.getInstance().setContext(null);
}
Program: 68261
Project: 68261
Buggy source:
private Collection<String> getAllUsedBindingNames(){
  Set<String> set=new HashSet<String>();
  for (  IQueryExpressionManager iqem : textCollection.values()) {
    IExpressionButton eb=iqem.getExpressionButton();
    if (eb != null) {
      String name=exprCodec.getBindingName(eb.getExpression());
      if (name != null) {
        set.add(name);
      }
    }
  }
  return set;
}

Fixed version (ground truth):
private Collection<String> getAllUsedBindingNames(){
  Set<String> set=new HashSet<String>(5);
  for (  IQueryExpressionManager iqem : textCollection.values()) {
    IExpressionButton eb=iqem.getExpressionButton();
    if (eb != null) {
      String name=exprCodec.getBindingName(eb.getExpression());
      if (name != null) {
        set.add(name);
      }
    }
  }
  if (context != null) {
    set.addAll(((DefaultChartDataSheet)context.getDataSheet()).getAllValueDefinitions());
  }
  return set;
}
Program: 68262
Project: 68262
Buggy source:
public void addDataDefinitionText(Control text,IQueryExpressionManager queryManager){
  textCollection.put(text,queryManager);
  text.addDisposeListener(new DisposeListener(){
    public void widgetDisposed(    DisposeEvent e){
      if (e.widget instanceof Control) {
        removeDataDefinitionText((Control)e.widget);
      }
    }
  }
);
}

Fixed version (ground truth):
public void addDataDefinitionText(Control text,IQueryExpressionManager queryManager){
  textCollection.put(text,queryManager);
  updateControlBackground(text,queryManager.getQuery().getDefinition());
  text.addDisposeListener(new DisposeListener(){
    public void widgetDisposed(    DisposeEvent e){
      if (e.widget instanceof Control) {
        removeDataDefinitionText((Control)e.widget);
      }
    }
  }
);
}
Program: 68264
Project: 68264
Buggy source:
/** 
 * populate all output columns in viewer display. The output columns is retrieved from oda dataset handles's RESULT_SET_PROP and COMPUTED_COLUMNS_PROP.
 * @throws BirtException
 */
public DataSetViewData[] populateAllOutputColumns(DataSetHandle dataSetHandle,DataRequestSession session) throws BirtException {
  IResultMetaData metaData=session.getDataSetMetaData(dataSetHandle,false);
  if (metaData == null)   return new DataSetViewData[0];
  DataSetViewData[] items=new DataSetViewData[metaData.getColumnCount()];
  for (int i=0; i < metaData.getColumnCount(); i++) {
    items[i]=new DataSetViewData();
    items[i].setName(metaData.getColumnName(i + 1));
    items[i].setDataTypeName(DataAdapterUtil.adapterToModelDataType(metaData.getColumnType(i + 1)));
    items[i].setAlias(metaData.getColumnAlias(i + 1));
    items[i].setComputedColumn(metaData.isComputedColumn(i + 1));
    items[i].setPosition(i + 1);
    items[i].setDataType(metaData.getColumnType(i + 1));
    ColumnHintHandle hint=findColumnHint(dataSetHandle,items[i].getName());
    if (hint != null) {
      items[i].setAnalysis(hint.getAnalysis());
      items[i].setACLExpression(hint.getACLExpression());
    }
  }
  updateModel(dataSetHandle,items);
  return items;
}

Fixed version (ground truth):
/** 
 * populate all output columns in viewer display. The output columns is retrieved from oda dataset handles's RESULT_SET_PROP and COMPUTED_COLUMNS_PROP.
 * @throws BirtException
 */
public DataSetViewData[] populateAllOutputColumns(DataSetHandle dataSetHandle,DataRequestSession session) throws BirtException {
  IResultMetaData metaData=session.getDataSetMetaData(dataSetHandle,false);
  if (metaData == null)   return new DataSetViewData[0];
  DataSetViewData[] items=new DataSetViewData[metaData.getColumnCount()];
  for (int i=0; i < metaData.getColumnCount(); i++) {
    items[i]=new DataSetViewData();
    items[i].setName(metaData.getColumnName(i + 1));
    items[i].setDataTypeName(DataAdapterUtil.adapterToModelDataType(metaData.getColumnType(i + 1)));
    items[i].setAlias(metaData.getColumnAlias(i + 1));
    items[i].setComputedColumn(metaData.isComputedColumn(i + 1));
    items[i].setPosition(i + 1);
    items[i].setDataType(metaData.getColumnType(i + 1));
    ColumnHintHandle hint=findColumnHint(dataSetHandle,items[i].getName());
    if (hint != null) {
      items[i].setAnalysis(hint.getAnalysis());
      items[i].setACLExpression(hint.getACLExpression());
      items[i].setFormat(hint.getFormat());
      items[i].setDisplayLength(hint.getDisplayLength());
      items[i].setHeading(hint.getHeading());
      items[i].setHelpText(hint.getHelpText());
      items[i].setHorizontalAlign(hint.getHorizontalAlign());
      items[i].setTextFormat(hint.getTextFormat());
      items[i].setDescription(hint.getDescription());
    }
  }
  updateModel(dataSetHandle,items);
  return items;
}
Program: 68265
Project: 68265
Buggy source:
/** 
 * get Cached metadata
 * @throws BirtException
 */
public DataSetViewData[] populateAllCachedMetaData(DataSetHandle dataSetHandle,DataRequestSession session) throws BirtException {
  IResultMetaData metaData=session.getDataSetMetaData(dataSetHandle,true);
  DataSetViewData[] items=new DataSetViewData[metaData.getColumnCount()];
  for (int i=0; i < metaData.getColumnCount(); i++) {
    items[i]=new DataSetViewData();
    items[i].setName(metaData.getColumnName(i + 1));
    items[i].setDataTypeName(DataAdapterUtil.adapterToModelDataType(metaData.getColumnType(i + 1)));
    items[i].setAlias(metaData.getColumnAlias(i + 1));
    items[i].setComputedColumn(metaData.isComputedColumn(i + 1));
    items[i].setPosition(i + 1);
    items[i].setDataType(metaData.getColumnType(i + 1));
    ColumnHintHandle hint=findColumnHint(dataSetHandle,items[i].getName());
    if (hint != null) {
      items[i].setAnalysis(hint.getAnalysis());
      items[i].setACLExpression(hint.getACLExpression());
    }
  }
  return items;
}

Fixed version (ground truth):
/** 
 * get Cached metadata
 * @throws BirtException
 */
public DataSetViewData[] populateAllCachedMetaData(DataSetHandle dataSetHandle,DataRequestSession session) throws BirtException {
  IResultMetaData metaData=session.getDataSetMetaData(dataSetHandle,true);
  DataSetViewData[] items=new DataSetViewData[metaData.getColumnCount()];
  for (int i=0; i < metaData.getColumnCount(); i++) {
    items[i]=new DataSetViewData();
    items[i].setName(metaData.getColumnName(i + 1));
    items[i].setDataTypeName(DataAdapterUtil.adapterToModelDataType(metaData.getColumnType(i + 1)));
    items[i].setAlias(metaData.getColumnAlias(i + 1));
    items[i].setComputedColumn(metaData.isComputedColumn(i + 1));
    items[i].setPosition(i + 1);
    items[i].setDataType(metaData.getColumnType(i + 1));
    ColumnHintHandle hint=findColumnHint(dataSetHandle,items[i].getName());
    if (hint != null) {
      items[i].setAnalysis(hint.getAnalysis());
      items[i].setACLExpression(hint.getACLExpression());
      items[i].setFormat(hint.getFormat());
      items[i].setDisplayLength(hint.getDisplayLength());
      items[i].setHeading(hint.getHeading());
      items[i].setHelpText(hint.getHelpText());
      items[i].setHorizontalAlign(hint.getHorizontalAlign());
      items[i].setTextFormat(hint.getTextFormat());
      items[i].setDescription(hint.getDescription());
    }
  }
  return items;
}
Program: 68266
Project: 68266
Buggy source:
/** 
 * Rounds a number up, away from zero, to the nearest multiple of significance.
 * @param n
 * @param significance
 * @return
 */
private static double ceiling(double n,double significance){
  if (significance == 0 || n == 0)   return 0;
  if (n * significance < 0)   throw new IllegalArgumentException(Messages.getFormattedString("String_Node_Str",new Object[]{significance,n}));
  if (Math.abs(n) < Math.abs(significance))   return significance;
  double multiple=Math.ceil(n / significance);
  return multiple * significance;
}

Fixed version (ground truth):
/** 
 * Rounds a number up, away from zero, to the nearest multiple of significance.
 * @param n
 * @param significance
 * @return
 */
private static double ceiling(double n,double significance){
  if (significance == 0 || n == 0)   return 0;
  if (n * significance < 0)   throw new IllegalArgumentException(Messages.getFormattedString("String_Node_Str",new Object[]{significance,n}));
  if (Math.abs(n) < Math.abs(significance))   return significance;
  double multiple=Math.ceil(n / significance);
  long multiIntValue=Math.round(multiple);
  int divisor=1;
  double temp=significance;
  double MIN_VALUE=1.0E-10;
  for (int i=1; i < 30; i++) {
    divisor=divisor * 10;
    if (Math.abs(Math.round(temp * divisor) - temp * divisor) <= MIN_VALUE)     break;
  }
  return multiIntValue * (significance * divisor) / divisor;
}
Program: 68268
Project: 68268
Buggy source:
/** 
 * @param aggregations
 * @param resultSet
 * @param stopSign
 * @throws IOException
 * @throws DataException
 * @throws BirtException
 */
private void applyAggrFilters(AggregationDefinition[] aggregations,IAggregationResultSet[] resultSet,StopSign stopSign) throws IOException, DataException, BirtException {
  boolean recalculate=false;
  if (!aggrMeasureFilters.isEmpty()) {
    AggrMeasureFilterHelper filter=new AggrMeasureFilterHelper(cube,resultSet);
    cubePosFilters=filter.getCubePosFilters(aggrMeasureFilters);
    recalculate=true;
  }
  if (!aggrFilterHelpers.isEmpty()) {
    AggregationFilterHelper filterHelper=new AggregationFilterHelper(cube,aggrFilterHelpers);
    List newFilters=filterHelper.generateLevelFilters(aggregations,resultSet);
    if (newFilters == null) {
      for (int i=0; i < resultSet.length; i++) {
        resultSet[i].clear();
        recalculate=false;
      }
    }
 else {
      levelFilters.addAll(newFilters);
      for (int i=0; i < resultSet.length; i++) {
        resultSet[i].close();
        resultSet[i]=null;
      }
      recalculate=true;
    }
  }
  if (recalculate) {
    IAggregationResultSet[] temp=onePassExecute(aggregations,stopSign);
    System.arraycopy(temp,0,resultSet,0,resultSet.length);
  }
}

Fixed version (ground truth):
/** 
 * @param aggregations
 * @param resultSet
 * @param stopSign
 * @throws IOException
 * @throws DataException
 * @throws BirtException
 */
private void applyAggrFilters(AggregationDefinition[] aggregations,IAggregationResultSet[] resultSet,StopSign stopSign) throws IOException, DataException, BirtException {
  boolean recalculate=false;
  if (!aggrMeasureFilters.isEmpty()) {
    AggrMeasureFilterHelper filter=new AggrMeasureFilterHelper(cube,resultSet);
    cubePosFilters=filter.getCubePosFilters(aggrMeasureFilters);
    if (cubePosFilters == null) {
      for (int i=0; i < resultSet.length; i++) {
        resultSet[i].clear();
      }
      return;
    }
    recalculate=true;
  }
  if (!aggrFilterHelpers.isEmpty()) {
    AggregationFilterHelper filterHelper=new AggregationFilterHelper(cube,aggrFilterHelpers);
    List newFilters=filterHelper.generateLevelFilters(aggregations,resultSet);
    if (newFilters == null) {
      for (int i=0; i < resultSet.length; i++) {
        resultSet[i].clear();
        recalculate=false;
      }
    }
 else {
      levelFilters.addAll(newFilters);
      for (int i=0; i < resultSet.length; i++) {
        resultSet[i].close();
        resultSet[i]=null;
      }
      recalculate=true;
    }
  }
  if (recalculate) {
    IAggregationResultSet[] temp=onePassExecute(aggregations,stopSign);
    System.arraycopy(temp,0,resultSet,0,resultSet.length);
  }
}
Program: 68269
Project: 68269
Buggy source:
/** 
 * @param resultSet
 * @throws DataException
 * @throws IOException
 */
public List getCubePosFilters(List jsMeasureEvalFilterHelper) throws DataException, IOException {
  String[] aggregationNames=populateAggregationNames(jsMeasureEvalFilterHelper);
  List cubePosFilterList=new ArrayList();
  for (int i=0; i < resultSet.length; i++) {
    if (hasDefinition(resultSet[i],aggregationNames)) {
      Map levelMap=populateLevelMap(resultSet[i]);
      final int dimSize=levelMap.size();
      List[] levelListArray=new List[dimSize];
      levelMap.values().toArray(levelListArray);
      String[] dimensionNames=new String[dimSize];
      levelMap.keySet().toArray(dimensionNames);
      IDiskArray rowIndexArray=collectValidRowIndexArray(resultSet[i],jsMeasureEvalFilterHelper,aggregationNames);
      CubePosFilter cubePosFilter=null;
      ;
      if (rowIndexArray.size() <= resultSet[i].length() / 2) {
        cubePosFilter=getValidPosFilter(resultSet[i],rowIndexArray,dimensionNames,levelListArray);
      }
 else {
        cubePosFilter=getInvalidPosFilter(resultSet[i],rowIndexArray,dimensionNames,levelListArray);
      }
      cubePosFilterList.add(cubePosFilter);
    }
  }
  return cubePosFilterList;
}

Fixed version (ground truth):
/** 
 * @param resultSet
 * @throws DataException
 * @throws IOException
 */
public List getCubePosFilters(List jsMeasureEvalFilterHelper) throws DataException, IOException {
  String[] aggregationNames=populateAggregationNames(jsMeasureEvalFilterHelper);
  List cubePosFilterList=new ArrayList();
  for (int i=0; i < resultSet.length; i++) {
    if (hasDefinition(resultSet[i],aggregationNames)) {
      if (resultSet[i].getAllLevels() == null || resultSet[i].getAllLevels().length == 0) {
        AggregationRowAccessor rowAccessor=new AggregationRowAccessor(resultSet[i]);
        for (int j=0; j < jsMeasureEvalFilterHelper.size(); j++) {
          if (resultSet[i].getAggregationIndex(aggregationNames[j]) >= 0) {
            IAggrMeasureFilterEvalHelper filterHelper=(IAggrMeasureFilterEvalHelper)jsMeasureEvalFilterHelper.get(j);
            if (!filterHelper.evaluateFilter(rowAccessor)) {
              return null;
            }
          }
        }
        continue;
      }
      Map levelMap=populateLevelMap(resultSet[i]);
      final int dimSize=levelMap.size();
      List[] levelListArray=new List[dimSize];
      levelMap.values().toArray(levelListArray);
      String[] dimensionNames=new String[dimSize];
      levelMap.keySet().toArray(dimensionNames);
      IDiskArray rowIndexArray=collectValidRowIndexArray(resultSet[i],jsMeasureEvalFilterHelper,aggregationNames);
      CubePosFilter cubePosFilter=null;
      ;
      if (rowIndexArray.size() <= resultSet[i].length() / 2) {
        cubePosFilter=getValidPosFilter(resultSet[i],rowIndexArray,dimensionNames,levelListArray);
      }
 else {
        cubePosFilter=getInvalidPosFilter(resultSet[i],rowIndexArray,dimensionNames,levelListArray);
      }
      cubePosFilterList.add(cubePosFilter);
    }
  }
  return cubePosFilterList;
}
Program: 68270
Project: 68270
Buggy source:
synchronized public void close() throws IOException {
  try {
    closeFiles();
    if (!readOnly && !removeOnExit) {
      writeProperties();
      entryTable.write();
      nodeTable.write();
      freeTable.write();
      nodeTable.write(NodeTable.INODE_FREE_TABLE);
      writeHeader();
    }
  }
  finally {
    try {
      cacheManager.clear();
    }
  finally {
      if (rf != null) {
        rf.close();
        rf=null;
      }
      if (removeOnExit) {
        new File(fileName).delete();
      }
    }
  }
}

Fixed version (ground truth):
synchronized public void close() throws IOException {
  try {
    closeFiles();
    if (!readOnly && !removeOnExit) {
      writeProperties();
      entryTable.write();
      nodeTable.write();
      freeTable.write();
      nodeTable.write(NodeTable.INODE_FREE_TABLE);
      cacheManager.clear();
      writeHeader();
    }
  }
  finally {
    if (rf != null) {
      rf.close();
      rf=null;
    }
    if (removeOnExit) {
      new File(fileName).delete();
    }
  }
}
Program: 68272
Project: 68272
Buggy source:
public void initialize() throws BirtException {
  hasStyle=false;
  boxStyle=BoxStyle.DEFAULT;
  localProperties=LocalProperties.DEFAULT;
  maxAvaWidth=parent.getCurrentMaxContentWidth();
  if (parent.content != null) {
    if (CSSConstants.CSS_RTL_VALUE.equals(parent.content.getComputedStyle().getDirection()))     baseLevel=Bidi.DIRECTION_RIGHT_TO_LEFT;
  }
}

Fixed version (ground truth):
public void initialize() throws BirtException {
  hasStyle=false;
  boxStyle=BoxStyle.DEFAULT;
  localProperties=LocalProperties.DEFAULT;
  maxAvaWidth=parent.getCurrentMaxContentWidth();
  width=maxAvaWidth;
  if (parent.content != null) {
    if (CSSConstants.CSS_RTL_VALUE.equals(parent.content.getComputedStyle().getDirection()))     baseLevel=Bidi.DIRECTION_RIGHT_TO_LEFT;
  }
}
Program: 68274
Project: 68274
Buggy source:
private void generateOutputParmsBindings(DataSetHandle datasetHandle){
  List<DataSetParameterHandle> outputParams=new ArrayList<DataSetParameterHandle>();
  for (Iterator iter=datasetHandle.parametersIterator(); iter.hasNext(); ) {
    Object obj=iter.next();
    if ((obj instanceof DataSetParameterHandle) && ((DataSetParameterHandle)obj).isOutput() == true) {
      outputParams.add((DataSetParameterHandle)obj);
    }
  }
  int ret=-1;
  if (outputParams.size() > 0) {
    MessageDialog prefDialog=new MessageDialog(UIUtil.getDefaultShell(),Messages.getString("String_Node_Str"),null,Messages.getString("String_Node_Str"),MessageDialog.QUESTION,new String[]{Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str")},0);
    ret=prefDialog.open();
  }
  if (ret == 0)   for (int i=0; i < outputParams.size(); i++) {
    DataSetParameterHandle param=outputParams.get(i);
    ComputedColumn bindingColumn=StructureFactory.newComputedColumn(inputElement,param.getName());
    bindingColumn.setDataType(param.getDataType());
    ExpressionUtility.setBindingColumnExpression(param,bindingColumn);
    try {
      inputElement.addColumnBinding(bindingColumn,false);
    }
 catch (    SemanticException e) {
      ExceptionHandler.handle(e);
    }
    continue;
  }
}

Fixed version (ground truth):
private void generateOutputParmsBindings(DataSetHandle datasetHandle){
  List<DataSetParameterHandle> outputParams=new ArrayList<DataSetParameterHandle>();
  for (Iterator iter=datasetHandle.parametersIterator(); iter.hasNext(); ) {
    Object obj=iter.next();
    if ((obj instanceof DataSetParameterHandle) && ((DataSetParameterHandle)obj).isOutput() == true) {
      outputParams.add((DataSetParameterHandle)obj);
    }
  }
  int ret=-1;
  if (outputParams.size() > 0) {
    MessageDialog prefDialog=new MessageDialog(UIUtil.getDefaultShell(),Messages.getString("String_Node_Str"),null,Messages.getString("String_Node_Str"),MessageDialog.QUESTION,new String[]{Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str")},0);
    ret=prefDialog.open();
  }
  if (ret == 0)   for (int i=0; i < outputParams.size(); i++) {
    DataSetParameterHandle param=outputParams.get(i);
    ComputedColumn bindingColumn=StructureFactory.newComputedColumn(inputElement,param.getName());
    bindingColumn.setDataType(param.getDataType());
    ExpressionUtility.setBindingColumnExpression(param,bindingColumn,true);
    try {
      inputElement.addColumnBinding(bindingColumn,false);
    }
 catch (    SemanticException e) {
      ExceptionHandler.handle(e);
    }
    continue;
  }
}
Program: 68275
Project: 68275
Buggy source:
/** 
 * Adapts the specified Model Data Source to a Data Engine API data source design object
 */
public IBaseDataSourceDesign createDataSourceDesign(DataSourceHandle dataSource) throws BirtException {
  return this.dteSession.getModelAdaptor().adaptDataSource(dataSource);
}

Fixed version (ground truth):
/** 
 * Adapts the specified Model Data Source to a Data Engine API data source design object
 */
public IBaseDataSourceDesign createDataSourceDesign(DataSourceHandle dataSource) throws BirtException {
  BaseDataSourceDesign datasourceDesign=this.dteSession.getModelAdaptor().adaptDataSource(dataSource);
  IBaseDataSourceEventHandler eventHandler=null;
  if (dataSource instanceof OdaDataSourceHandle)   eventHandler=new DataSourceScriptExecutor(dataSource,context);
 else   if (dataSource instanceof ScriptDataSourceHandle)   eventHandler=new ScriptDataSourceScriptExecutor((ScriptDataSourceHandle)dataSource,context);
  datasourceDesign.setEventHandler(eventHandler);
  return datasourceDesign;
}
Program: 68277
Project: 68277
Buggy source:
public Object get(int index){
  RangeCheck(index);
  if (index / CACHESIZE != this.currentCacheNo) {
    try {
      saveToDisk();
    }
 catch (    DataException e) {
      e.printStackTrace();
    }
    this.currentCacheNo=index / CACHESIZE;
    try {
      loadFromDisk();
    }
 catch (    DataException e) {
      e.printStackTrace();
    }
  }
  return this.currentCache.get(index - this.currentCacheNo * CACHESIZE);
}

Fixed version (ground truth):
public Object get(int index){
  RangeCheck(index);
  if (index / cacheSize != this.currentCacheNo) {
    try {
      saveToDisk();
    }
 catch (    DataException e) {
      e.printStackTrace();
    }
    this.currentCacheNo=index / cacheSize;
    try {
      loadFromDisk();
    }
 catch (    DataException e) {
      e.printStackTrace();
    }
  }
  return this.currentCache.get(index - this.currentCacheNo * cacheSize);
}
Program: 68278
Project: 68278
Buggy source:
public Object set(int index,Object element){
  RangeCheck(index);
  Object oldValue=get(index);
  this.currentCache.set(index - this.currentCacheNo * CACHESIZE,element);
  return oldValue;
}

Fixed version (ground truth):
public Object set(int index,Object element){
  RangeCheck(index);
  Object oldValue=get(index);
  this.currentCache.set(index - this.currentCacheNo * cacheSize,element);
  return oldValue;
}
Program: 68279
Project: 68279
Buggy source:
public IPreparedCubeQuery prepare(ICubeQueryDefinition query,Map appContext) throws BirtException {
  ICubeQueryDefinition preparedQuery=new PreparedCubeQueryDefinition(query);
  adaptCubeQueryDefinition(preparedQuery);
  return QueryPrepareUtil.prepareQuery(this.cubeDataSourceMap,this.cubeDataObjectMap,session,context,preparedQuery,appContext);
}

Fixed version (ground truth):
public IPreparedCubeQuery prepare(ICubeQueryDefinition query,Map appContext) throws BirtException {
  setMemoryUsage(appContext);
  ICubeQueryDefinition preparedQuery=new PreparedCubeQueryDefinition(query);
  adaptCubeQueryDefinition(preparedQuery);
  return QueryPrepareUtil.prepareQuery(this.cubeDataSourceMap,this.cubeDataObjectMap,session,context,preparedQuery,appContext);
}
Program: 68280
Project: 68280
Buggy source:
/** 
 * @param base
 * @return
 * @throws IOException
 */
private static IDiskArray getRowsFromBaseResultSet(IAggregationResultSet base) throws IOException {
  int bufferSize=4096;
  String useMemoryOnly=System.getProperty("String_Node_Str");
  if (useMemoryOnly != null && useMemoryOnly.equalsIgnoreCase("String_Node_Str")) {
    bufferSize=base.length();
  }
  IDiskArray diskArray=new BufferedStructureArray(AggregationResultRow.getCreator(),bufferSize);
  for (int j=0; j < base.length(); j++) {
    base.seek(j);
    IAggregationResultRow temp=base.getCurrentRow();
    diskArray.add(temp);
  }
  return diskArray;
}

Fixed version (ground truth):
/** 
 * @param base
 * @return
 * @throws IOException
 */
private static IDiskArray getRowsFromBaseResultSet(IAggregationResultSet base) throws IOException {
  int bufferSize=4096;
  String useMemoryOnly=System.getProperty("String_Node_Str");
  if (Constants.isAggressiveMemoryUsage() || (useMemoryOnly != null && useMemoryOnly.equalsIgnoreCase("String_Node_Str"))) {
    bufferSize=base.length();
  }
  IDiskArray diskArray=new BufferedStructureArray(AggregationResultRow.getCreator(),bufferSize);
  for (int j=0; j < base.length(); j++) {
    base.seek(j);
    IAggregationResultRow temp=base.getCurrentRow();
    diskArray.add(temp);
  }
  return diskArray;
}
Program: 68281
Project: 68281
Buggy source:
private boolean validateSingleColumn(ComputedColumn computedColumn){
  if (computedColumn.getName() == null || computedColumn.getName().trim().length() == 0) {
    getContainer().setMessage(Messages.getFormattedString("String_Node_Str",new Object[]{computedColumn.getName()}),IMessageProvider.ERROR);
    return false;
  }
  Iterator iter=((DataSetHandle)getContainer().getModel()).getPropertyHandle(DataSetHandle.COLUMN_HINTS_PROP).iterator();
  while (iter.hasNext()) {
    ColumnHintHandle hint=(ColumnHintHandle)iter.next();
    if (computedColumn.getName().equals(hint.getAlias())) {
      getContainer().setMessage(Messages.getFormattedString("String_Node_Str",new Object[]{computedColumn.getName()}),IMessageProvider.ERROR);
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean validateSingleColumn(ComputedColumn computedColumn){
  if (computedColumn.getName() == null || computedColumn.getName().trim().length() == 0) {
    getContainer().setMessage(Messages.getFormattedString("String_Node_Str",new Object[]{computedColumn.getName()}),IMessageProvider.ERROR);
    return false;
  }
  Iterator iter=((DataSetHandle)getContainer().getModel()).getPropertyHandle(DataSetHandle.COLUMN_HINTS_PROP).iterator();
  while (iter.hasNext()) {
    ColumnHintHandle hint=(ColumnHintHandle)iter.next();
    if (!computedColumn.getName().equals(hint.getColumnName()) && computedColumn.getName().equals(hint.getAlias())) {
      getContainer().setMessage(Messages.getFormattedString("String_Node_Str",new Object[]{computedColumn.getName()}),IMessageProvider.ERROR);
      return false;
    }
  }
  return true;
}
Program: 68282
Project: 68282
Buggy source:
/** 
 * Destroy action
 * @param rollback true: rollback to savedItemModel false: do nothing
 */
public void destory(boolean rollback){
  if (rollback) {
    if (ds instanceof OdaDataSetHandle) {
      try {
        ((OdaDataSetHandle)ds).setQueryText(this.savedQueryText);
        DataSetProvider.getCurrentInstance().getDataSetDesign(ds,true,true);
      }
 catch (      SemanticException e) {
      }
catch (      BirtException e) {
      }
    }
    DataSetProvider.getCurrentInstance().setModelOfDataSetHandle(this.ds,savedItemModel);
  }
  Thread.currentThread().setContextClassLoader(oldContextLoader);
  ds.removeListener(this);
}

Fixed version (ground truth):
/** 
 * Destroy action
 * @param rollback true: rollback to savedItemModel false: do nothing
 */
public void destory(boolean rollback){
  if (rollback) {
    if (ds instanceof OdaDataSetHandle) {
      try {
        ((OdaDataSetHandle)ds).setQueryText(this.savedQueryText);
        DataSetProvider.getCurrentInstance().getDataSetDesign(ds,true,true);
      }
 catch (      SemanticException e) {
      }
catch (      BirtException e) {
      }
    }
    DataSetProvider.getCurrentInstance().setModelOfDataSetHandle(this.ds,savedItemModel);
  }
  Thread.currentThread().setContextClassLoader(oldContextLoader);
  if (ds != null)   ds.removeListener(this);
}
Program: 68283
Project: 68283
Buggy source:
/** 
 * The constructor.
 * @param parentShell
 */
public DataSetEditor(Shell parentShell,DataSetHandle ds,boolean needToFocusOnOutput){
  super(parentShell,ds);
  ExternalUIUtil.validateDataSetHandle(ds);
  this.needToFocusOnOutput=needToFocusOnOutput;
  String dataSourceType, dataSetType;
  if (ds instanceof OdaDataSetHandle) {
    OdaDataSourceHandle dataSource=(OdaDataSourceHandle)((OdaDataSetHandle)ds).getDataSource();
    dataSourceType=dataSource.getExtensionID();
    dataSetType=((OdaDataSetHandle)ds).getExtensionID();
  }
 else   if (ds instanceof ScriptDataSetHandle) {
    dataSourceType=DataUIConstants.DATA_SOURCE_SCRIPT;
    dataSetType=DataUIConstants.DATA_SET_SCRIPT;
  }
 else   if (ds instanceof JointDataSetHandle) {
    dataSourceType="String_Node_Str";
    dataSetType="String_Node_Str";
  }
 else {
    dataSourceType=ExternalUIUtil.getDataSourceType(ds);
    dataSetType=ExternalUIUtil.getDataSetType(ds);
  }
  boolean containsDataSource=ExternalUIUtil.containsDataSource(ds);
  if (containsDataSource) {
    addPageTo("String_Node_Str",DATA_SOURCE_SELECTION_PAGE,Messages.getString("String_Node_Str"),null,new DataSetDataSourceSelectionPage());
    if (DesignSessionUtil.hasValidOdaDesignUIExtension(dataSourceType)) {
      addCustomPageODAV3((OdaDataSetHandle)ds,dataSourceType,dataSetType);
    }
 else     addBirtPage(dataSourceType,dataSetType);
  }
  addCommonPages(ds);
  setPageFocus();
  itemModelManager.start(ds);
}

Fixed version (ground truth):
/** 
 * The constructor.
 * @param parentShell
 */
public DataSetEditor(Shell parentShell,DataSetHandle ds,boolean needToFocusOnOutput){
  super(parentShell,ds);
  ExternalUIUtil.validateDataSetHandle(ds);
  initModelManager();
  this.needToFocusOnOutput=needToFocusOnOutput;
  String dataSourceType, dataSetType;
  if (ds instanceof OdaDataSetHandle) {
    OdaDataSourceHandle dataSource=(OdaDataSourceHandle)((OdaDataSetHandle)ds).getDataSource();
    dataSourceType=dataSource.getExtensionID();
    dataSetType=((OdaDataSetHandle)ds).getExtensionID();
  }
 else   if (ds instanceof ScriptDataSetHandle) {
    dataSourceType=DataUIConstants.DATA_SOURCE_SCRIPT;
    dataSetType=DataUIConstants.DATA_SET_SCRIPT;
  }
 else   if (ds instanceof JointDataSetHandle) {
    dataSourceType="String_Node_Str";
    dataSetType="String_Node_Str";
  }
 else {
    dataSourceType=ExternalUIUtil.getDataSourceType(ds);
    dataSetType=ExternalUIUtil.getDataSetType(ds);
  }
  boolean containsDataSource=ExternalUIUtil.containsDataSource(ds);
  if (containsDataSource) {
    addPageTo("String_Node_Str",DATA_SOURCE_SELECTION_PAGE,Messages.getString("String_Node_Str"),null,new DataSetDataSourceSelectionPage());
    if (DesignSessionUtil.hasValidOdaDesignUIExtension(dataSourceType)) {
      addCustomPageODAV3((OdaDataSetHandle)ds,dataSourceType,dataSetType);
    }
 else     addBirtPage(dataSourceType,dataSetType);
  }
  addCommonPages(ds);
  setPageFocus();
  itemModelManager.start(ds);
}
Program: 68284
Project: 68284
Buggy source:
/** 
 * @param dataSet
 */
private void setContextLoader(DataSetHandle dataSet){
  oldContextLoader=Thread.currentThread().getContextClassLoader();
  ClassLoader parentLoader=oldContextLoader;
  if (parentLoader == null)   parentLoader=this.getClass().getClassLoader();
  ClassLoader newContextLoader=DataSetProvider.getCustomScriptClassLoader(parentLoader,dataSet.getModuleHandle());
  Thread.currentThread().setContextClassLoader(newContextLoader);
}

Fixed version (ground truth):
/** 
 * @param dataSet
 */
protected void setContextLoader(DataSetHandle dataSet){
  oldContextLoader=Thread.currentThread().getContextClassLoader();
  ClassLoader parentLoader=oldContextLoader;
  if (parentLoader == null)   parentLoader=this.getClass().getClassLoader();
  ClassLoader newContextLoader=DataSetProvider.getCustomScriptClassLoader(parentLoader,dataSet.getModuleHandle());
  Thread.currentThread().setContextClassLoader(newContextLoader);
}
Program: 68285
Project: 68285
Buggy source:
private static Set<String> getInternalPageNames(){
  Set<String> result=new HashSet<String>();
  result.add(DATASET_SETTINGS_PAGE);
  result.add(OUTPUT_PARAMETER_PREVIEW_PAGE);
  result.add(DATASOURCE_EDITOR_PROPERTY_PAGE);
  result.add(COMPUTED_COLUMNS_PAGE);
  result.add(RESULTSET_PREVIEW_PAGE);
  result.add(FILTERS_PAGE);
  result.add(PARAMETERS_PAGE);
  result.add(OUTPUTCOLUMN_PAGE);
  result.add(JOINT_DATA_SET_PAGE);
  result.add(DATA_SOURCE_SELECTION_PAGE);
  String extensionName="String_Node_Str";
  IExtensionRegistry extReg=Platform.getExtensionRegistry();
  IExtensionPoint extPoint=extReg.getExtensionPoint(extensionName);
  if (extPoint == null)   return result;
  IExtension[] exts=extPoint.getExtensions();
  if (exts == null)   return result;
  for (int e=0; e < exts.length; e++) {
    IConfigurationElement[] configElems=exts[e].getConfigurationElements();
    if (configElems == null)     continue;
    for (int i=0; i < configElems.length; i++) {
      if (configElems[i].getName().equals("String_Node_Str")) {
        IConfigurationElement[] elems=configElems[i].getChildren("String_Node_Str");
        if (elems != null && elems.length > 0) {
          for (int j=0; j < elems.length; j++) {
            String value=elems[j].getAttribute("String_Node_Str");
            if (value != null)             result.add(value);
          }
        }
      }
    }
  }
  return result;
}

Fixed version (ground truth):
protected static Set<String> getInternalPageNames(){
  Set<String> result=new HashSet<String>();
  result.add(DATASET_SETTINGS_PAGE);
  result.add(OUTPUT_PARAMETER_PREVIEW_PAGE);
  result.add(DATASOURCE_EDITOR_PROPERTY_PAGE);
  result.add(COMPUTED_COLUMNS_PAGE);
  result.add(RESULTSET_PREVIEW_PAGE);
  result.add(FILTERS_PAGE);
  result.add(PARAMETERS_PAGE);
  result.add(OUTPUTCOLUMN_PAGE);
  result.add(JOINT_DATA_SET_PAGE);
  result.add(DATA_SOURCE_SELECTION_PAGE);
  String extensionName="String_Node_Str";
  IExtensionRegistry extReg=Platform.getExtensionRegistry();
  IExtensionPoint extPoint=extReg.getExtensionPoint(extensionName);
  if (extPoint == null)   return result;
  IExtension[] exts=extPoint.getExtensions();
  if (exts == null)   return result;
  for (int e=0; e < exts.length; e++) {
    IConfigurationElement[] configElems=exts[e].getConfigurationElements();
    if (configElems == null)     continue;
    for (int i=0; i < configElems.length; i++) {
      if (configElems[i].getName().equals("String_Node_Str")) {
        IConfigurationElement[] elems=configElems[i].getChildren("String_Node_Str");
        if (elems != null && elems.length > 0) {
          for (int j=0; j < elems.length; j++) {
            String value=elems[j].getAttribute("String_Node_Str");
            if (value != null)             result.add(value);
          }
        }
      }
    }
  }
  return result;
}
Program: 68286
Project: 68286
Buggy source:
private void setPageProperties(){
  viewer.getNewButton().setEnabled(viewer.getViewer().getInput() != null && ((DataSetViewData[])viewer.getViewer().getInput()).length != 0);
  viewer.getNewButton().setText(Messages.getString("String_Node_Str"));
  viewer.getNewButton().setToolTipText(Messages.getString("String_Node_Str"));
  viewer.getEditButton().setVisible(false);
  viewer.getRemoveButton().setVisible(false);
  viewer.getUpButton().setVisible(false);
  viewer.getDownButton().setVisible(false);
}

Fixed version (ground truth):
protected void setPageProperties(){
  viewer.getNewButton().setEnabled(viewer.getViewer().getInput() != null && ((DataSetViewData[])viewer.getViewer().getInput()).length != 0);
  viewer.getNewButton().setText(Messages.getString("String_Node_Str"));
  viewer.getNewButton().setToolTipText(Messages.getString("String_Node_Str"));
  viewer.getEditButton().setVisible(false);
  viewer.getRemoveButton().setVisible(false);
  viewer.getUpButton().setVisible(false);
  viewer.getDownButton().setVisible(false);
}
Program: 68289
Project: 68289
Buggy source:
/** 
 * populate all output columns in viewer display. The output columns is retrieved from oda dataset handles's RESULT_SET_PROP and COMPUTED_COLUMNS_PROP.
 * @throws BirtException
 */
public DataSetViewData[] populateAllOutputColumns(DataSetHandle dataSetHandle,DataRequestSession session) throws BirtException {
  IResultMetaData metaData=session.getDataSetMetaData(dataSetHandle,false);
  if (metaData == null)   return new DataSetViewData[0];
  DataSetViewData[] items=new DataSetViewData[metaData.getColumnCount()];
  for (int i=0; i < metaData.getColumnCount(); i++) {
    items[i]=new DataSetViewData();
    items[i].setName(metaData.getColumnName(i + 1));
    items[i].setDataTypeName(DataAdapterUtil.adapterToModelDataType(metaData.getColumnType(i + 1)));
    items[i].setAlias(metaData.getColumnAlias(i + 1));
    items[i].setComputedColumn(metaData.isComputedColumn(i + 1));
    items[i].setPosition(i + 1);
    items[i].setDataType(metaData.getColumnType(i + 1));
    ColumnHintHandle hint=findColumnHint(dataSetHandle,items[i].getName());
    if (hint != null)     items[i].setAnalysis(hint.getAnalysis());
  }
  updateModel(dataSetHandle,items);
  return items;
}

Fixed version (ground truth):
/** 
 * populate all output columns in viewer display. The output columns is retrieved from oda dataset handles's RESULT_SET_PROP and COMPUTED_COLUMNS_PROP.
 * @throws BirtException
 */
public DataSetViewData[] populateAllOutputColumns(DataSetHandle dataSetHandle,DataRequestSession session) throws BirtException {
  IResultMetaData metaData=session.getDataSetMetaData(dataSetHandle,false);
  if (metaData == null)   return new DataSetViewData[0];
  DataSetViewData[] items=new DataSetViewData[metaData.getColumnCount()];
  for (int i=0; i < metaData.getColumnCount(); i++) {
    items[i]=new DataSetViewData();
    items[i].setName(metaData.getColumnName(i + 1));
    items[i].setDataTypeName(DataAdapterUtil.adapterToModelDataType(metaData.getColumnType(i + 1)));
    items[i].setAlias(metaData.getColumnAlias(i + 1));
    items[i].setComputedColumn(metaData.isComputedColumn(i + 1));
    items[i].setPosition(i + 1);
    items[i].setDataType(metaData.getColumnType(i + 1));
    ColumnHintHandle hint=findColumnHint(dataSetHandle,items[i].getName());
    if (hint != null) {
      items[i].setAnalysis(hint.getAnalysis());
      items[i].setACLExpression(hint.getACLExpression());
    }
  }
  updateModel(dataSetHandle,items);
  return items;
}
Program: 68290
Project: 68290
Buggy source:
/** 
 * get Cached metadata
 * @throws BirtException
 */
public DataSetViewData[] populateAllCachedMetaData(DataSetHandle dataSetHandle,DataRequestSession session) throws BirtException {
  IResultMetaData metaData=session.getDataSetMetaData(dataSetHandle,true);
  DataSetViewData[] items=new DataSetViewData[metaData.getColumnCount()];
  for (int i=0; i < metaData.getColumnCount(); i++) {
    items[i]=new DataSetViewData();
    items[i].setName(metaData.getColumnName(i + 1));
    items[i].setDataTypeName(DataAdapterUtil.adapterToModelDataType(metaData.getColumnType(i + 1)));
    items[i].setAlias(metaData.getColumnAlias(i + 1));
    items[i].setComputedColumn(metaData.isComputedColumn(i + 1));
    items[i].setPosition(i + 1);
    items[i].setDataType(metaData.getColumnType(i + 1));
    ColumnHintHandle hint=findColumnHint(dataSetHandle,items[i].getName());
    if (hint != null)     items[i].setAnalysis(hint.getAnalysis());
  }
  return items;
}

Fixed version (ground truth):
/** 
 * get Cached metadata
 * @throws BirtException
 */
public DataSetViewData[] populateAllCachedMetaData(DataSetHandle dataSetHandle,DataRequestSession session) throws BirtException {
  IResultMetaData metaData=session.getDataSetMetaData(dataSetHandle,true);
  DataSetViewData[] items=new DataSetViewData[metaData.getColumnCount()];
  for (int i=0; i < metaData.getColumnCount(); i++) {
    items[i]=new DataSetViewData();
    items[i].setName(metaData.getColumnName(i + 1));
    items[i].setDataTypeName(DataAdapterUtil.adapterToModelDataType(metaData.getColumnType(i + 1)));
    items[i].setAlias(metaData.getColumnAlias(i + 1));
    items[i].setComputedColumn(metaData.isComputedColumn(i + 1));
    items[i].setPosition(i + 1);
    items[i].setDataType(metaData.getColumnType(i + 1));
    ColumnHintHandle hint=findColumnHint(dataSetHandle,items[i].getName());
    if (hint != null) {
      items[i].setAnalysis(hint.getAnalysis());
      items[i].setACLExpression(hint.getACLExpression());
    }
  }
  return items;
}
Program: 68291
Project: 68291
Buggy source:
/** 
 * This method is used to get the level name that reference by a level reference expression of following format: dimension["dimensionName"]["levelName"]. String[0] dimensionName; String[1] levelName;
 * @param expr
 * @return String[]
 */
private static String[] getTargetLevel(String expr){
  if (expr == null)   return null;
  if (!expr.matches("String_Node_Str"))   return null;
  expr=expr.replaceFirst("String_Node_Str","String_Node_Str");
  String[] result=expr.split("String_Node_Str");
  result[0]=result[0].replaceAll("String_Node_Str","String_Node_Str");
  result[1]=result[1].replaceAll("String_Node_Str","String_Node_Str");
  return result;
}

Fixed version (ground truth):
/** 
 * This method is used to get the level name that reference by a level reference expression of following format: dimension["dimensionName"]["levelName"]. String[0] dimensionName; String[1] levelName;
 * @param expr
 * @return String[]
 */
private static String[] getTargetLevel(String expr){
  if (expr == null)   return null;
  if (!expr.matches("String_Node_Str"))   return null;
  expr=expr.replaceFirst("String_Node_Str","String_Node_Str");
  String[] result=expr.split("String_Node_Str");
  result[0]=result[0].replaceAll("String_Node_Str","String_Node_Str");
  result[1]=result[1].replaceAll("String_Node_Str","String_Node_Str");
  if (result.length > 2)   result[2]=result[2].replaceAll("String_Node_Str","String_Node_Str");
  return result;
}
Program: 68293
Project: 68293
Buggy source:
@Override public void run(){
  try {
    AggregationCellHandle containerCell=ChartCubeUtil.getXtabContainerCell(eih);
    if (containerCell != null) {
      ChartReportItemImpl reportItem=(ChartReportItemImpl)eih.getReportItem();
      ChartWithAxes cmOld=(ChartWithAxes)reportItem.getProperty(ChartReportItemConstants.PROPERTY_CHART);
      ChartWithAxes cmNew=cmOld.copyInstance();
      List<String> exprs=ChartCubeUtil.getAllLevelsBindingExpression(containerCell.getCrosstab());
      Query query=cmNew.getAxes().get(0).getSeriesDefinitions().get(0).getDesignTimeSeries().getDataDefinition().get(0);
      eih.getRoot().getCommandStack().startTrans(getText());
      if (cmNew.isTransposed()) {
        cmNew.setTransposed(false);
        cmNew.getBaseAxes()[0].setType(AxisType.TEXT_LITERAL);
        query.setDefinition(exprs.get(0));
        ChartCubeUtil.updateXTabForAxis(containerCell,eih,true,cmNew);
      }
 else {
        cmNew.setTransposed(true);
        cmNew.getBaseAxes()[0].setType(AxisType.TEXT_LITERAL);
        query.setDefinition(exprs.get(1));
        ChartCubeUtil.updateXTabForAxis(containerCell,eih,false,cmNew);
      }
      cmNew.setReverseCategory(cmNew.isTransposed());
      reportItem.executeSetModelCommand(eih,cmOld,cmNew);
    }
    eih.getRoot().getCommandStack().commit();
  }
 catch (  BirtException e) {
    WizardBase.displayException(e);
    eih.getRoot().getCommandStack().rollback();
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    AggregationCellHandle containerCell=ChartCubeUtil.getXtabContainerCell(eih);
    if (containerCell != null) {
      ChartReportItemImpl reportItem=(ChartReportItemImpl)eih.getReportItem();
      ChartWithAxes cmOld=(ChartWithAxes)reportItem.getProperty(ChartReportItemConstants.PROPERTY_CHART);
      ChartWithAxes cmNew=cmOld.copyInstance();
      List<String> exprs=ChartCubeUtil.getAllLevelsBindingName(containerCell.getCrosstab());
      Query query=cmNew.getAxes().get(0).getSeriesDefinitions().get(0).getDesignTimeSeries().getDataDefinition().get(0);
      eih.getRoot().getCommandStack().startTrans(getText());
      if (cmNew.isTransposed()) {
        cmNew.setTransposed(false);
        cmNew.getBaseAxes()[0].setType(AxisType.TEXT_LITERAL);
        query.setDefinition(exprs.get(0));
        ChartCubeUtil.updateXTabForAxis(containerCell,eih,true,cmNew);
      }
 else {
        cmNew.setTransposed(true);
        cmNew.getBaseAxes()[0].setType(AxisType.TEXT_LITERAL);
        query.setDefinition(exprs.get(1));
        ChartCubeUtil.updateXTabForAxis(containerCell,eih,false,cmNew);
      }
      cmNew.setReverseCategory(cmNew.isTransposed());
      reportItem.executeSetModelCommand(eih,cmOld,cmNew);
    }
    eih.getRoot().getCommandStack().commit();
  }
 catch (  BirtException e) {
    WizardBase.displayException(e);
    eih.getRoot().getCommandStack().rollback();
  }
}
Program: 68294
Project: 68294
Buggy source:
private boolean checkEnabled(){
  try {
    if (ChartCubeUtil.isAxisChart(eih)) {
      eih=(ExtendedItemHandle)eih.getElementProperty(ChartReportItemConstants.PROPERTY_HOST_CHART);
    }
    if (ChartCubeUtil.isPlotChart(eih)) {
      AggregationCellHandle containerCell=ChartCubeUtil.getXtabContainerCell(eih);
      if (containerCell != null) {
        if (DEUtil.isLinkedElement(containerCell.getCrosstabHandle())) {
          return false;
        }
        List<String> exprs=ChartCubeUtil.getAllLevelsBindingExpression(containerCell.getCrosstab());
        return exprs.size() == 2 && !ChartCubeUtil.isAggregationCell(containerCell);
      }
    }
  }
 catch (  BirtException e) {
    WizardBase.displayException(e);
  }
  return false;
}

Fixed version (ground truth):
private boolean checkEnabled(){
  try {
    if (ChartCubeUtil.isAxisChart(eih)) {
      eih=(ExtendedItemHandle)eih.getElementProperty(ChartReportItemConstants.PROPERTY_HOST_CHART);
    }
    if (ChartCubeUtil.isPlotChart(eih)) {
      AggregationCellHandle containerCell=ChartCubeUtil.getXtabContainerCell(eih);
      if (containerCell != null) {
        if (DEUtil.isLinkedElement(containerCell.getCrosstabHandle())) {
          return false;
        }
        List<String> exprs=ChartCubeUtil.getAllLevelsBindingName(containerCell.getCrosstab());
        return exprs.size() == 2 && !ChartCubeUtil.isAggregationCell(containerCell);
      }
    }
  }
 catch (  BirtException e) {
    WizardBase.displayException(e);
  }
  return false;
}