nus-yam/ex-repair huggingface dataset:
Program: 69592
Project: 69592
Buggy source:
private void setQueryExpression(String expression){
  if (query != null) {
    query.setDefinition(expression);
  }
 else {
    query=QueryImpl.create(expression);
    query.eAdapters().addAll(seriesdefinition.eAdapters());
    seriesdefinition.setQuery(query);
  }
}

Fixed version (ground truth):
private void setQueryExpression(String expression){
  if (query != null) {
    query.setDefinition(expression);
  }
 else {
    query=QueryImpl.create(expression);
    query.eAdapters().addAll(seriesdefinition.eAdapters());
    seriesdefinition.setQuery(query);
  }
  if (ChartUIConstants.QUERY_VALUE.equals(queryType)) {
    if (!(context.getChartType() instanceof GanttChart) && !context.getDataServiceProvider().checkState(IDataServiceProvider.SHARE_QUERY) && context.getDataServiceProvider().checkState(IDataServiceProvider.HAS_DATA_SET)) {
      if (context.getDataServiceProvider().getDataType(expression) == DataType.DATE_TIME_LITERAL) {
        if (query.getGrouping() == null) {
          query.setGrouping(DataFactoryImpl.init().createSeriesGrouping());
        }
        SeriesGrouping group=query.getGrouping();
        group.setEnabled(true);
        group.setAggregateExpression("String_Node_Str");
      }
    }
  }
}
Program: 69593
Project: 69593
Buggy source:
public void moveTo(int destIndex) throws DataException {
  checkValid(destIndex);
  int advancedStep;
  if (destIndex >= currResultIndex) {
    advancedStep=destIndex - currResultIndex;
  }
 else {
    if (!needCache) {
      reset();
      initCache();
      advancedStep=destIndex + 1;
      for (int i=0; i < advancedStep; i++)       next();
    }
 else {
      SimpleCachedObject cachedRow;
      try {
        cachedRow=(SimpleCachedObject)cache.get(destIndex);
        currResultObject=new ResultObject(rsMeta,cachedRow.getFieldValues());
      }
 catch (      IOException e) {
        throw new DataException(ResourceConstants.READ_TEMPFILE_ERROR,e);
      }
    }
  }
  currResultIndex=destIndex;
  if (currResultIndex == -1 || currResultIndex == countOfResult)   currResultObject=null;
}

Fixed version (ground truth):
public void moveTo(int destIndex) throws DataException {
  checkValid(destIndex);
  int advancedStep;
  if (destIndex >= currResultIndex) {
    advancedStep=destIndex - currResultIndex;
    for (int i=0; i < advancedStep; i++)     next();
  }
 else {
    if (!needCache) {
      reset();
      initCache();
      advancedStep=destIndex + 1;
      for (int i=0; i < advancedStep; i++)       next();
    }
 else {
      SimpleCachedObject cachedRow;
      try {
        cachedRow=(SimpleCachedObject)cache.get(destIndex);
        currResultObject=new ResultObject(rsMeta,cachedRow.getFieldValues());
      }
 catch (      IOException e) {
        throw new DataException(ResourceConstants.READ_TEMPFILE_ERROR,e);
      }
    }
  }
  currResultIndex=destIndex;
  if (currResultIndex == -1 || currResultIndex == countOfResult)   currResultObject=null;
}
Program: 69594
Project: 69594
Buggy source:
/** 
 * This method return the OrderingInfo that will be finally used to re-generate the smartcache.
 * @param groups
 * @return
 */
OrderingInfo getOrderingInfo(List[] groups){
  for (int i=1; i < groups.length; i++) {
    groups[i]=mergeTwoGroupBoundaryInfoGroups(groups[i - 1],groups[i]);
  }
  OrderingInfo odInfo=new OrderingInfo();
  for (int i=0; i < groups[groups.length - 1].size(); i++) {
    odInfo.add(((GroupBoundaryInfo)groups[groups.length - 1].get(i)).getStartIndex(),((GroupBoundaryInfo)groups[groups.length - 1].get(i)).getEndIndex());
  }
  return odInfo;
}

Fixed version (ground truth):
/** 
 * This method return the OrderingInfo that will be finally used to re-generate the smartcache.
 * @param groups
 * @return
 */
OrderingInfo getOrderingInfo(List[] groups){
  for (int i=1; i < groups.length; i++) {
    try {
      groups[i]=mergeTwoGroupBoundaryInfoGroups(groups[i - 1],groups[i]);
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
  OrderingInfo odInfo=new OrderingInfo();
  for (int i=0; i < groups[groups.length - 1].size(); i++) {
    odInfo.add(((GroupBoundaryInfo)groups[groups.length - 1].get(i)).getStartIndex(),((GroupBoundaryInfo)groups[groups.length - 1].get(i)).getEndIndex());
  }
  return odInfo;
}
Program: 69595
Project: 69595
Buggy source:
/** 
 * Re-sort the GroupBoundaryInfo instances of a lower group level according the ordering of GroupBoundaryInfo instances of a higher group level .
 * @param higherGroup
 * @param lowerGroup
 * @return
 */
private List mergeTwoGroupBoundaryInfoGroups(List higherGroup,List lowerGroup){
  List result=new CachedList(tempDir,DataEngineSession.getCurrentClassLoader(),GroupBoundaryInfo.getCreator());
  for (int i=0; i < higherGroup.size(); i++) {
    GroupBoundaryInfo gbi1=(GroupBoundaryInfo)higherGroup.get(i);
    for (int j=0; j < lowerGroup.size(); j++) {
      if (gbi1.isInBoundary((GroupBoundaryInfo)lowerGroup.get(j)))       result.add(lowerGroup.get(j));
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Re-sort the GroupBoundaryInfo instances of a lower group level according the ordering of GroupBoundaryInfo instances of a higher group level .
 * @param higherGroup
 * @param lowerGroup
 * @return
 * @throws IOException 
 */
private List mergeTwoGroupBoundaryInfoGroups(List higherGroup,List lowerGroup) throws IOException {
  List result=new CachedList(tempDir,DataEngineSession.getCurrentClassLoader(),GroupBoundaryInfo.getCreator());
  GroupInfoWithIndex groupInfoWithIndex;
  DiskSortedStack higherSortedStack=new DiskSortedStack(0,false,new GroupInfoWithIndexComparator(GroupInfoWithIndexComparator.START_INDEX_KEY),GroupInfoWithIndex.getCreator());
  DiskSortedStack lowerSortedStack=new DiskSortedStack(0,false,new GroupInfoWithIndexComparator(GroupInfoWithIndexComparator.START_INDEX_KEY),GroupInfoWithIndex.getCreator());
  for (int i=0; i < higherGroup.size(); i++) {
    groupInfoWithIndex=new GroupInfoWithIndex();
    groupInfoWithIndex.groupIndex=i;
    groupInfoWithIndex.groupBoundaryInfo=(GroupBoundaryInfo)higherGroup.get(i);
    higherSortedStack.push(groupInfoWithIndex);
  }
  for (int i=0; i < lowerGroup.size(); i++) {
    groupInfoWithIndex=new GroupInfoWithIndex();
    groupInfoWithIndex.groupIndex=i;
    groupInfoWithIndex.groupBoundaryInfo=(GroupBoundaryInfo)lowerGroup.get(i);
    lowerSortedStack.push(groupInfoWithIndex);
  }
  DiskSortedStack resultSortedStack=new DiskSortedStack(0,false,new GroupInfoWithIndexComparator(GroupInfoWithIndexComparator.PARENT_GROUP_INDEX_KEY),GroupInfoWithIndex.getCreator());
  GroupInfoWithIndex gbiH;
  GroupInfoWithIndex gbiL=(GroupInfoWithIndex)lowerSortedStack.pop();
  for (int i=0; i < higherSortedStack.size(); i++) {
    gbiH=(GroupInfoWithIndex)higherSortedStack.pop();
    while (gbiL != null && gbiL.groupBoundaryInfo.getStartIndex() <= gbiH.groupBoundaryInfo.getEndIndex()) {
      if (gbiH.groupBoundaryInfo.isInBoundary(gbiL.groupBoundaryInfo)) {
        gbiL.parentGroupIndex=gbiH.groupIndex;
        resultSortedStack.push(gbiL);
      }
      gbiL=(GroupInfoWithIndex)lowerSortedStack.pop();
    }
  }
  for (int i=0; i < resultSortedStack.size(); i++) {
    result.add(((GroupInfoWithIndex)resultSortedStack.pop()).groupBoundaryInfo);
  }
  return result;
}
Program: 69596
Project: 69596
Buggy source:
public void startTable(ITableContent table){
  ContainerSizeInfo sizeInfo=engine.getCurrentContainer().getSizeInfo();
  int width=sizeInfo.getWidth();
  TableInfo info=LayoutUtil.createTable(table,width);
  if (info == null) {
    return;
  }
  String caption=table.getCaption();
  if (caption != null) {
    engine.addCaption(caption);
  }
  engine.addTable(table,info,sizeInfo);
}

Fixed version (ground truth):
public void startTable(ITableContent table){
  ContainerSizeInfo sizeInfo=engine.getCurrentContainer().getSizeInfo();
  int width=sizeInfo.getWidth();
  ColumnsInfo info=LayoutUtil.createTable(table,width);
  if (info == null) {
    return;
  }
  String caption=table.getCaption();
  if (caption != null) {
    engine.addCaption(caption);
  }
  engine.addTable(table,info,sizeInfo);
}
Program: 69597
Project: 69597
Buggy source:
public void startList(IListContent list){
  ContainerSizeInfo size=engine.getCurrentContainer().getSizeInfo();
  TableInfo table=LayoutUtil.createTable(list,size.getWidth());
  engine.addTable(list,table,size);
  if (list.getChildren() == null) {
    HyperlinkDef link=parseHyperLink(list);
    BookmarkDef bookmark=getBookmark(list);
    engine.addData(ExcelLayoutEngine.EMPTY,list.getComputedStyle(),link,bookmark);
  }
}

Fixed version (ground truth):
public void startList(IListContent list){
  ContainerSizeInfo size=engine.getCurrentContainer().getSizeInfo();
  ColumnsInfo table=LayoutUtil.createTable(list,size.getWidth());
  engine.addTable(list,table,size);
  if (list.getChildren() == null) {
    HyperlinkDef link=parseHyperLink(list);
    BookmarkDef bookmark=getBookmark(list);
    engine.addData(ExcelLayoutEngine.EMPTY,list.getComputedStyle(),link,bookmark);
  }
}
Program: 69598
Project: 69598
Buggy source:
public void addTable(IContainerContent content,TableInfo table,ContainerSizeInfo size){
  IStyle style=content.getComputedStyle();
  XlsContainer currentContainer=getCurrentContainer();
  ContainerSizeInfo parentSizeInfo=currentContainer.getSizeInfo();
  int startCoordinate=parentSizeInfo.getStartCoordinate();
  int endCoordinate=parentSizeInfo.getEndCoordinate();
  int[] columnStartCoordinates=calculateColumnCoordinates(table,startCoordinate,endCoordinate);
  splitColumns(startCoordinate,endCoordinate,columnStartCoordinates);
  createTable(table,style,currentContainer,columnStartCoordinates);
}

Fixed version (ground truth):
public void addTable(IContainerContent content,ColumnsInfo table,ContainerSizeInfo size){
  IStyle style=content.getComputedStyle();
  XlsContainer currentContainer=getCurrentContainer();
  ContainerSizeInfo parentSizeInfo=currentContainer.getSizeInfo();
  int[] columnStartCoordinates=splitColumns(table,parentSizeInfo);
  createTable(table,style,currentContainer,columnStartCoordinates);
}
Program: 69599
Project: 69599
Buggy source:
public RowData next(){
  SheetData[] row=rowIterator.next();
  List<SheetData> data=new ArrayList<SheetData>();
  int width=Math.min(row.length,maxCol - 1);
  double rowHeight=DEFAULT_ROW_HEIGHT;
  for (int i=0; i < width; i++) {
    SheetData d=row[i];
    if (d == null || d.isBlank()) {
      continue;
    }
    if (d.isProcessed()) {
      continue;
    }
    d.setProcessed(true);
    data.add(row[i]);
    if (d instanceof ImageData) {
      ImageData imagedata=(ImageData)d;
      double height=imagedata.getHeight();
      if (height > rowHeight)       rowHeight=height;
    }
 else {
      double height=d.getRowHeight();
      rowHeight=height > rowHeight ? height : rowHeight;
    }
  }
  SheetData[] rowdata=new SheetData[data.size()];
  data.toArray(rowdata);
  return new RowData(rowdata,rowHeight);
}

Fixed version (ground truth):
public RowData next(){
  SheetData[] row=rowIterator.next();
  List<SheetData> data=new ArrayList<SheetData>();
  int width=Math.min(row.length,maxCol - 1);
  double rowHeight=DEFAULT_ROW_HEIGHT;
  for (int i=0; i < width; i++) {
    SheetData d=row[i];
    if (d == null || d.isBlank()) {
      continue;
    }
    if (d.isProcessed()) {
      continue;
    }
    d.setProcessed(true);
    data.add(row[i]);
    double height=d.getRowHeight();
    rowHeight=height > rowHeight ? height : rowHeight;
  }
  SheetData[] rowdata=new SheetData[data.size()];
  data.toArray(rowdata);
  return new RowData(rowdata,rowHeight);
}
Program: 69600
Project: 69600
Buggy source:
private void createTable(TableInfo tableInfo,IStyle style,XlsContainer currentContainer,int[] columnStartCoordinates){
  int leftCordinate=columnStartCoordinates[0];
  int width=columnStartCoordinates[columnStartCoordinates.length - 1] - leftCordinate;
  ContainerSizeInfo sizeInfo=new ContainerSizeInfo(leftCordinate,width);
  StyleEntry styleEntry=engine.createEntry(sizeInfo,style);
  XlsTable table=new XlsTable(tableInfo,styleEntry,sizeInfo,currentContainer);
  tables.push(table);
  addContainer(table);
}

Fixed version (ground truth):
private void createTable(ColumnsInfo tableInfo,IStyle style,XlsContainer currentContainer,int[] columnStartCoordinates){
  int leftCordinate=columnStartCoordinates[0];
  int width=columnStartCoordinates[columnStartCoordinates.length - 1] - leftCordinate;
  ContainerSizeInfo sizeInfo=new ContainerSizeInfo(leftCordinate,width);
  StyleEntry styleEntry=engine.createEntry(sizeInfo,style);
  XlsTable table=new XlsTable(tableInfo,styleEntry,sizeInfo,currentContainer);
  tables.push(table);
  addContainer(table);
}
Program: 69601
Project: 69601
Buggy source:
private int[] calculateColumnCoordinates(TableInfo table,int startCoordinate,int endCoordinate){
  int columnCount=table.getColumnCount();
  int[] columnStartCoordinates=new int[columnCount + 1];
  columnStartCoordinates[0]=startCoordinate;
  for (int i=1; i <= columnCount; i++) {
    columnStartCoordinates[i]=columnStartCoordinates[i - 1] + table.getColumnWidth(i - 1);
  }
  return columnStartCoordinates;
}

Fixed version (ground truth):
private int[] calculateColumnCoordinates(ColumnsInfo table,int startCoordinate,int endCoordinate){
  int columnCount=table.getColumnCount();
  int[] columnStartCoordinates=new int[columnCount + 1];
  columnStartCoordinates[0]=startCoordinate;
  for (int i=1; i <= columnCount; i++) {
    columnStartCoordinates[i]=columnStartCoordinates[i - 1] + table.getColumnWidth(i - 1);
  }
  return columnStartCoordinates;
}
Program: 69602
Project: 69602
Buggy source:
public static TableInfo createTable(ITableContent table,int width){
  int tableWidth=getElementWidth(table,width);
  int columnCount=table.getColumnCount();
  if (columnCount == 0) {
    return null;
  }
  int[] columns=new int[columnCount];
  int unassignedCount=0;
  int totalAssigned=0;
  for (int i=0; i < columnCount; i++) {
    DimensionType value=table.getColumn(i).getWidth();
    if (value == null) {
      columns[i]=-1;
      unassignedCount++;
    }
 else {
      columns[i]=ExcelUtil.covertDimensionType(value,tableWidth);
      totalAssigned+=columns[i];
    }
  }
  int leftWidth=tableWidth - totalAssigned;
  if (leftWidth != 0 && unassignedCount == 0) {
    for (int i=0; i < columnCount; i++) {
      columns[i]=resize(columns[i],totalAssigned,leftWidth);
    }
  }
 else   if (leftWidth < 0 && unassignedCount > 0) {
    for (int i=0; i < columnCount; i++) {
      if (columns[i] == -1)       columns[1]=0;
 else       columns[i]=resize(columns[i],totalAssigned,leftWidth);
    }
  }
 else   if (leftWidth >= 0 && unassignedCount > 0) {
    int per=(int)leftWidth / unassignedCount;
    int index=0;
    for (int i=0; i < columns.length; i++) {
      if (columns[i] == -1) {
        columns[i]=per;
        index=i;
      }
    }
    columns[index]=leftWidth - per * (unassignedCount - 1);
  }
  return new DefaultTableInfo(columns);
}

Fixed version (ground truth):
public static ColumnsInfo createTable(ITableContent table,int width){
  int tableWidth=getElementWidth(table,width);
  int columnCount=table.getColumnCount();
  if (columnCount == 0) {
    return null;
  }
  int[] columns=new int[columnCount];
  int unassignedCount=0;
  int totalAssigned=0;
  for (int i=0; i < columnCount; i++) {
    DimensionType value=table.getColumn(i).getWidth();
    if (value == null) {
      columns[i]=-1;
      unassignedCount++;
    }
 else {
      columns[i]=ExcelUtil.covertDimensionType(value,tableWidth);
      totalAssigned+=columns[i];
    }
  }
  int leftWidth=tableWidth - totalAssigned;
  if (leftWidth != 0 && unassignedCount == 0) {
    for (int i=0; i < columnCount; i++) {
      columns[i]=resize(columns[i],totalAssigned,leftWidth);
    }
  }
 else   if (leftWidth < 0 && unassignedCount > 0) {
    for (int i=0; i < columnCount; i++) {
      if (columns[i] == -1)       columns[1]=0;
 else       columns[i]=resize(columns[i],totalAssigned,leftWidth);
    }
  }
 else   if (leftWidth >= 0 && unassignedCount > 0) {
    int per=(int)leftWidth / unassignedCount;
    int index=0;
    for (int i=0; i < columns.length; i++) {
      if (columns[i] == -1) {
        columns[i]=per;
        index=i;
      }
    }
    columns[index]=leftWidth - per * (unassignedCount - 1);
  }
  return new ColumnsInfo(columns);
}
Program: 69603
Project: 69603
Buggy source:
public XlsTable(TableInfo table,XlsContainer container){
  this(table,container.getStyle(),container.getSizeInfo(),container);
}

Fixed version (ground truth):
public XlsTable(ColumnsInfo table,XlsContainer container){
  this(table,container.getStyle(),container.getSizeInfo(),container);
}
Program: 69604
Project: 69604
Buggy source:
private final void showTooltip(Action ac){
  TooltipValue tv=(TooltipValue)ac.getValue();
  String tooltip=tv.getText().replaceAll("String_Node_Str","String_Node_Str");
  if (!tooltip.equals(tv.getText())) {
    tooltip="String_Node_Str" + tooltip + "String_Node_Str";
  }
 else {
    tooltip=tv.getText();
  }
  ((JComponent)iun.peerInstance()).setToolTipText(tooltip);
}

Fixed version (ground truth):
private final void showTooltip(Action ac){
  TooltipValue tv=(TooltipValue)ac.getValue();
  if (tv.getText() == null) {
    return;
  }
  String tooltip=tv.getText().replaceAll("String_Node_Str","String_Node_Str");
  if (!tooltip.equals(tv.getText())) {
    tooltip="String_Node_Str" + tooltip + "String_Node_Str";
  }
 else {
    tooltip=tv.getText();
  }
  ((JComponent)iun.peerInstance()).setToolTipText(tooltip);
}
Program: 69605
Project: 69605
Buggy source:
public boolean next() throws DataException {
  if (currResultIndex > countOfResult - 1) {
    currResultObject=null;
  }
 else {
    currResultIndex++;
    if (currResultIndex == countOfResult)     currResultObject=null;
 else     try {
      currResultObject=diskBasedResultSet.nextRow();
    }
 catch (    IOException e) {
      throw new DataException(ResourceConstants.READ_TEMPFILE_ERROR,e);
    }
  }
  return currResultObject != null;
}

Fixed version (ground truth):
public boolean next() throws DataException {
  if (currResultIndex > countOfResult - 1) {
    currResultObject=null;
    return false;
  }
 else {
    currResultIndex++;
    if (currResultIndex == countOfResult) {
      currResultObject=null;
      return false;
    }
  }
  try {
    if (needCache) {
      if (currResultIndex < cache.size()) {
        SimpleCachedObject cachedRow=(SimpleCachedObject)cache.get(currResultIndex);
        currResultObject=new ResultObject(rsMeta,cachedRow.getFieldValues());
      }
 else {
        currResultObject=diskBasedResultSet.nextRow();
        cache.add(new SimpleCachedObject(getAllFields(currResultObject)));
      }
    }
 else {
      currResultObject=diskBasedResultSet.nextRow();
    }
  }
 catch (  IOException e) {
    throw new DataException(ResourceConstants.READ_TEMPFILE_ERROR,e);
  }
  return currResultObject != null;
}
Program: 69606
Project: 69606
Buggy source:
public void reset() throws DataException {
  diskBasedResultSet.reset();
  currResultIndex=-1;
  currResultObject=null;
}

Fixed version (ground truth):
public void reset() throws DataException {
  diskBasedResultSet.reset();
  needCache=false;
  if (cache != null) {
    try {
      cache.close();
    }
 catch (    IOException e) {
      throw new DataException(ResourceConstants.READ_TEMPFILE_ERROR,e);
    }
    cache=null;
  }
  currResultIndex=-1;
  currResultObject=null;
}
Program: 69607
Project: 69607
Buggy source:
public void close() throws DataException {
  diskBasedResultSet.close();
  File goalFile=new File(goalFileStr);
  FileSecurity.fileDelete(goalFile);
  File tempDir=new File(sessionRootDirStr);
  FileSecurity.fileDelete(tempDir);
  currResultIndex=-1;
  currResultObject=null;
}

Fixed version (ground truth):
public void close() throws DataException {
  if (cache != null) {
    try {
      cache.close();
    }
 catch (    IOException e) {
      throw new DataException(ResourceConstants.READ_TEMPFILE_ERROR,e);
    }
    cache=null;
  }
  diskBasedResultSet.close();
  File goalFile=new File(goalFileStr);
  FileSecurity.fileDelete(goalFile);
  File tempDir=new File(sessionRootDirStr);
  FileSecurity.fileDelete(tempDir);
  currResultIndex=-1;
  currResultObject=null;
}
Program: 69608
Project: 69608
Buggy source:
public void moveTo(int destIndex) throws DataException {
  checkValid(destIndex);
  int advancedStep;
  if (destIndex >= currResultIndex) {
    advancedStep=destIndex - currResultIndex;
  }
 else {
    reset();
    advancedStep=destIndex + 1;
  }
  for (int i=0; i < advancedStep; i++)   next();
  currResultIndex=destIndex;
  if (currResultIndex == -1 || currResultIndex == countOfResult)   currResultObject=null;
}

Fixed version (ground truth):
public void moveTo(int destIndex) throws DataException {
  checkValid(destIndex);
  int advancedStep;
  if (destIndex >= currResultIndex) {
    advancedStep=destIndex - currResultIndex;
  }
 else {
    if (!needCache) {
      reset();
      initCache();
      advancedStep=destIndex + 1;
      for (int i=0; i < advancedStep; i++)       next();
    }
 else {
      SimpleCachedObject cachedRow;
      try {
        cachedRow=(SimpleCachedObject)cache.get(destIndex);
        currResultObject=new ResultObject(rsMeta,cachedRow.getFieldValues());
      }
 catch (      IOException e) {
        throw new DataException(ResourceConstants.READ_TEMPFILE_ERROR,e);
      }
    }
  }
  currResultIndex=destIndex;
  if (currResultIndex == -1 || currResultIndex == countOfResult)   currResultObject=null;
}
Program: 69609
Project: 69609
Buggy source:
/** 
 * @param outResults
 * @param defn
 * @param session
 * @param scope
 * @param context
 * @throws DataException 
 */
public CubeQueryExecutor(IBaseQueryResults outResults,ICubeQueryDefinition defn,DataEngineSession session,Scriptable scope,DataEngineContext context) throws DataException {
  this.defn=defn;
  this.scope=scope;
  this.context=context;
  this.session=session;
  this.outResults=outResults;
  this.dimensionFilterEvalHelpers=new ArrayList<IJSFilterHelper>();
  this.aggrMeasureFilterEvalHelpers=new ArrayList<IAggrMeasureFilterEvalHelper>();
  this.advancedFacttableBasedFilterEvalHelper=new ArrayList<IJSFacttableFilterEvalHelper>();
  populateFilterHelpers();
}

Fixed version (ground truth):
/** 
 * @param outResults
 * @param defn
 * @param session
 * @param scope
 * @param context
 * @throws DataException 
 */
public CubeQueryExecutor(IBaseQueryResults outResults,ICubeQueryDefinition defn,DataEngineSession session,Scriptable scope,DataEngineContext context) throws DataException {
  this.defn=defn;
  this.scope=scope;
  this.context=context;
  this.session=session;
  TempPathManager.setTempPath(session.getTempDir());
  this.outResults=outResults;
  this.dimensionFilterEvalHelpers=new ArrayList<IJSFilterHelper>();
  this.aggrMeasureFilterEvalHelpers=new ArrayList<IAggrMeasureFilterEvalHelper>();
  this.advancedFacttableBasedFilterEvalHelper=new ArrayList<IJSFacttableFilterEvalHelper>();
  populateFilterHelpers();
}
Program: 69611
Project: 69611
Buggy source:
protected String format(Object oText) throws ChartException {
  DecimalFormat df=null;
  if (fs == null && oText instanceof Number) {
    String sPattern=ValueFormatter.getNumericPattern(((Number)oText).doubleValue());
    df=dfCache.get(sPattern);
  }
  try {
    return ValueFormatter.format(oText,fs,lgData.rtc.getULocale(),df);
  }
 catch (  ChartException e) {
    return oText.toString();
  }
}

Fixed version (ground truth):
@Override protected String format(Object oText) throws ChartException {
  if (defaultDateFormat != null && fs == null && oText instanceof Calendar) {
    return ValueFormatter.format(oText,fs,lgData.rtc.getULocale(),defaultDateFormat);
  }
 else {
    return super.format(oText);
  }
}
Program: 69612
Project: 69612
Buggy source:
protected CategoryContentProvider(LegendData lgData) throws ChartException {
  super(lgData);
  sdBase=ChartUtil.getBaseSeriesDefinitions(lgData.cm).get(0);
  seBase=sdBase.getRunTimeSeries().get(0);
  dsiBase=createDataSetIterator(seBase,lgData.cm);
  fs=lgData.cm.getLegend().getFormatSpecifier();
  boolean bDataReverse=bNeedInvert;
  if (lgData.cm instanceof ChartWithAxes) {
    ChartWithAxes cwa=(ChartWithAxes)lgData.cm;
    bDataReverse=ChartUtil.XOR(bNeedInvert,cwa.isReverseCategory());
  }
  dsiBase.reverse(bDataReverse);
}

Fixed version (ground truth):
protected CategoryContentProvider(LegendData lgData) throws ChartException {
  super(lgData);
  sdBase=ChartUtil.getBaseSeriesDefinitions(lgData.cm).get(0);
  seBase=sdBase.getRunTimeSeries().get(0);
  dsiBase=createDataSetIterator(seBase,lgData.cm);
  fs=lgData.cm.getLegend().getFormatSpecifier();
  int iDateTimeUnit=ChartUtil.computeDateTimeCategoryUnit(lgData.cm,dsiBase);
  if (iDateTimeUnit != IConstants.UNDEFINED) {
    defaultDateFormat=DateFormatWrapperFactory.getPreferredDateFormat(iDateTimeUnit,lgData.rtc.getULocale());
  }
  boolean bDataReverse=bNeedInvert;
  if (lgData.cm instanceof ChartWithAxes) {
    ChartWithAxes cwa=(ChartWithAxes)lgData.cm;
    bDataReverse=ChartUtil.XOR(bNeedInvert,cwa.isReverseCategory());
  }
  dsiBase.reverse(bDataReverse);
}
Program: 69615
Project: 69615
Buggy source:
public ScaleInfo(int iType,RunTimeContext rtc,FormatSpecifier fs,OneAxis ax,int iScaleDirection,boolean bExpandMinMax){
  this.type=iType;
  this.rtc=rtc;
  this.fs=fs;
  this.iScaleDirection=iScaleDirection;
  this.bExpandMinMax=bExpandMinMax;
  cacheNumFormat=new ChartUtil.CacheDecimalFormat(rtc.getULocale());
  cacheDateFormat=new ChartUtil.CacheDateFormat(rtc.getULocale());
  cComp=rtc.getState(StateKey.CHART_COMPUTATION_KEY);
  if (ax != null) {
    bAxisLabelStaggered=ax.isAxisLabelStaggered();
    iLabelShowingInterval=ax.getLableShowingInterval();
    bTickBetweenCategories=ax.isTickBwtweenCategories();
    bAlignZero=ax.getModelAxis().isAligned();
    bLabelWithinAxes=ax.getModelAxis().isLabelWithinAxes();
    bCategoryScale=(iType & TEXT) == TEXT || ax.isCategoryScale();
  }
 else {
    bAxisLabelStaggered=false;
    iLabelShowingInterval=0;
    bTickBetweenCategories=true;
    bAlignZero=false;
    bLabelWithinAxes=false;
    bCategoryScale=false;
  }
}

Fixed version (ground truth):
public ScaleInfo(PlotComputation plotComp,int iType,RunTimeContext rtc,FormatSpecifier fs,OneAxis ax,int iScaleDirection,boolean bExpandMinMax){
  this.plotComp=plotComp;
  this.oax=ax;
  this.type=iType;
  this.rtc=rtc;
  this.fs=fs;
  this.iScaleDirection=iScaleDirection;
  this.bExpandMinMax=bExpandMinMax;
  cacheNumFormat=new ChartUtil.CacheDecimalFormat(rtc.getULocale());
  cacheDateFormat=new ChartUtil.CacheDateFormat(rtc.getULocale());
  cComp=rtc.getState(StateKey.CHART_COMPUTATION_KEY);
  if (ax != null) {
    bAxisLabelStaggered=ax.isAxisLabelStaggered();
    iLabelShowingInterval=ax.getLableShowingInterval();
    bTickBetweenCategories=ax.isTickBwtweenCategories();
    bAlignZero=ax.getModelAxis().isAligned();
    bLabelWithinAxes=ax.getModelAxis().isLabelWithinAxes();
    bCategoryScale=(iType & TEXT) == TEXT || ax.isCategoryScale();
  }
 else {
    bAxisLabelStaggered=false;
    iLabelShowingInterval=0;
    bTickBetweenCategories=true;
    bAlignZero=false;
    bLabelWithinAxes=false;
    bCategoryScale=false;
  }
}
Program: 69616
Project: 69616
Buggy source:
private void edit(){
  int pos=table.getSelectionIndex();
  if (pos == -1) {
    table.setFocus();
    return;
  }
  CommandStack stack=getActionStack();
  stack.startTrans(Messages.getString("String_Node_Str"));
  if (!provider.doEditItem(pos)) {
    stack.rollback();
    return;
  }
  stack.commit();
  table.setSelection(pos);
}

Fixed version (ground truth):
private void edit(){
  int pos=table.getSelectionIndex();
  if (pos == -1) {
    table.setFocus();
    return;
  }
  CommandStack stack=getActionStack();
  stack.startTrans(Messages.getString("String_Node_Str"));
  if (!provider.doEditItem(pos)) {
    stack.rollback();
    return;
  }
  stack.commit();
  table.setSelection(pos);
  refresh();
}
Program: 69617
Project: 69617
Buggy source:
private void computeDateTimeMinMax(){
  int iStep=asInteger(oStep);
  CDateTime cdtMinValue=bMinimumFixed ? asDateTime(oMinFixed) : asDateTime(oMinAuto);
  CDateTime cdtMaxValue=bMaximumFixed ? asDateTime(oMaxFixed) : asDateTime(oMaxAuto);
  int iUnit=((Integer)oUnit).intValue();
  if (bMaximumFixed && !bMinimumFixed) {
    oMax=cdtMaxValue;
    double diff=CDateTime.computeDifference(cdtMaxValue,cdtMinValue,iUnit) / iStep;
    int count=(int)diff * iStep;
    if (!ChartUtil.mathEqual(diff,Math.floor(diff))) {
      count+=iStep;
    }
    CDateTime cdtMinValue_new=(CDateTime)cdtMaxValue.clone();
    cdtMinValue_new.add(iUnit,-count);
    oMin=cdtMinValue_new;
  }
 else {
    if (bExpandMinmax) {
      if (!bMinimumFixed) {
        cdtMinValue=cdtMinValue.backward(iUnit,iStep);
        cdtMinValue.clearBelow(iUnit);
        if (!bMaximumFixed) {
          cdtMaxValue=cdtMaxValue.forward(iUnit,1);
          cdtMaxValue.clearBelow(iUnit);
        }
      }
    }
 else {
      cdtMinValue.clearBelow(iUnit);
      long lMax0=cdtMaxValue.getTimeInMillis();
      cdtMaxValue.clearBelow(iUnit);
      if (lMax0 > cdtMaxValue.getTimeInMillis()) {
        cdtMaxValue=cdtMaxValue.forward(iUnit,1);
      }
    }
    oMin=cdtMinValue;
    double diff=CDateTime.computeDifference(cdtMaxValue,cdtMinValue,iUnit) / iStep;
    int count=(int)diff * iStep;
    if (!ChartUtil.mathEqual(diff,Math.floor(diff))) {
      count+=iStep;
    }
    CDateTime cdtMaxValue_new=(CDateTime)cdtMinValue.clone();
    cdtMaxValue_new.add(iUnit,count);
    oMax=cdtMaxValue_new;
  }
  oMinAuto=null;
  oMaxAuto=null;
}

Fixed version (ground truth):
private void computeDateTimeMinMax(){
  int iStep=asInteger(oStep);
  CDateTime cdtMinValue=bMinimumFixed ? asDateTime(oMinFixed) : asDateTime(oMinAuto);
  CDateTime cdtMaxValue=bMaximumFixed ? asDateTime(oMaxFixed) : asDateTime(oMaxAuto);
  int iUnit=((Integer)oUnit).intValue();
  if (bMaximumFixed && !bMinimumFixed) {
    oMax=cdtMaxValue;
    double diff=CDateTime.computeDifference(cdtMaxValue,cdtMinValue,iUnit) / iStep;
    int count=(int)diff * iStep;
    if (!ChartUtil.mathEqual(diff,Math.floor(diff))) {
      count+=iStep;
    }
    CDateTime cdtMinValue_new=(CDateTime)cdtMaxValue.clone();
    cdtMinValue_new.add(iUnit,-count);
    oMin=cdtMinValue_new;
  }
 else {
    if (bExpandMinmax) {
      if (!bMinimumFixed) {
        cdtMinValue=cdtMinValue.backward(iUnit,iStep);
        cdtMinValue.clearBelow(iUnit);
        if (!bMaximumFixed) {
          cdtMaxValue=cdtMaxValue.forward(iUnit,1);
          cdtMaxValue.clearBelow(iUnit);
        }
      }
    }
 else {
      cdtMinValue.clearBelow(iUnit);
    }
    oMin=cdtMinValue;
    double diff=CDateTime.computeDifference(cdtMaxValue,cdtMinValue,iUnit) / iStep;
    int count=(int)diff * iStep;
    if (!ChartUtil.mathEqual(diff,Math.floor(diff))) {
      count+=iStep;
    }
    CDateTime cdtMaxValue_new=(CDateTime)cdtMinValue.clone();
    cdtMaxValue_new.add(iUnit,count);
    oMax=cdtMaxValue_new;
  }
  oMinAuto=null;
  oMaxAuto=null;
}
Program: 69618
Project: 69618
Buggy source:
/** 
 * retrieve the binding meta data information.
 * @return
 * @throws DataException
 */
public IResultMetaData getBindingMetaData() throws DataException {
  if (bindingMetaData == null) {
    ExprMetaInfo[] metaInfo=getRDLoad(subQueryName,queryResultID).loadExprMetaInfo();
    bindingMetaData=new BindingMetaData(metaInfo);
  }
  return bindingMetaData;
}

Fixed version (ground truth):
/** 
 * retrieve the binding meta data information.
 * @return
 * @throws DataException
 */
public IResultMetaData getBindingMetaData() throws DataException {
  if (bindingMetaData == null) {
    ExprMetaInfo[] metaInfo=getRDLoad(subQueryName,queryResultID).loadExprMetaInfo();
    if (ExprMetaUtil.isBasedOnRD(metaInfo)) {
      ExprMetaInfo[] infos=new ExprMetaInfo[metaInfo.length - 1];
      for (int i=0, k=0; i < infos.length; i++, k++) {
        if (isInternalMetaInfo(metaInfo[k]))         i--;
 else         infos[i]=metaInfo[k];
      }
      bindingMetaData=new BindingMetaData(infos);
    }
 else {
      bindingMetaData=new BindingMetaData(metaInfo);
    }
  }
  return bindingMetaData;
}
Program: 69621
Project: 69621
Buggy source:
/** 
 * Look for the Driver from drivers directory if it not in plugin class path
 * @param className
 * @return Driver instance
 * @throws OdaException 
 */
private Driver findDriver(String className,Collection<String> driverClassPath,boolean refreshClassLoader) throws OdaException {
  Class driverClass=null;
  try {
    driverClass=Class.forName(className);
    logger.info("String_Node_Str" + className);
  }
 catch (  ClassNotFoundException e) {
    if (logger.isLoggable(Level.FINE)) {
      logger.info("String_Node_Str" + className + "String_Node_Str");
    }
    driverClass=loadExtraDriver(className,true,refreshClassLoader,driverClassPath);
    if (driverClass == null) {
      logger.warning("String_Node_Str" + className);
      throw new JDBCException(ResourceConstants.CANNOT_LOAD_DRIVER,null,className);
    }
  }
  Driver driver=null;
  try {
    driver=this.getDriverInstance(driverClass);
  }
 catch (  Exception e) {
    logger.log(Level.WARNING,"String_Node_Str" + className,e);
    throw new JDBCException(ResourceConstants.CANNOT_INSTANTIATE_DRIVER,null,className);
  }
  return driver;
}

Fixed version (ground truth):
/** 
 * Look for the Driver from drivers directory if it not in plugin class path
 * @param className
 * @return Driver instance
 * @throws OdaException 
 */
private Driver findDriver(String className,Collection<String> driverClassPath,boolean refreshClassLoader) throws OdaException {
  Class driverClass=null;
  try {
    driverClass=Class.forName(className);
    logger.info("String_Node_Str" + className);
  }
 catch (  ClassNotFoundException e) {
    if (logger.isLoggable(Level.FINE)) {
      logger.info("String_Node_Str" + className + "String_Node_Str");
    }
    driverClass=loadExtraDriver(className,true,refreshClassLoader,driverClassPath);
    if (driverClass == null) {
      ClassLoader loader=Thread.currentThread().getContextClassLoader();
      if (loader != null) {
        try {
          driverClass=Class.forName(className,true,loader);
        }
 catch (        ClassNotFoundException e1) {
          driverClass=null;
        }
      }
    }
  }
  if (driverClass == null) {
    logger.warning("String_Node_Str" + className);
    throw new JDBCException(ResourceConstants.CANNOT_LOAD_DRIVER,null,className);
  }
  Driver driver=null;
  try {
    driver=this.getDriverInstance(driverClass);
  }
 catch (  Exception e) {
    logger.log(Level.WARNING,"String_Node_Str" + className,e);
    throw new JDBCException(ResourceConstants.CANNOT_INSTANTIATE_DRIVER,null,className);
  }
  return driver;
}
Program: 69622
Project: 69622
Buggy source:
/** 
 * This method is used to register the Java Script Objects which are defined in the scope of source ResultSet ( might be IResultSet or CubeCursor ) to target scope. One possible client of this method is Report Engine. A classic use case is that instead of register its own "row" object  the Report Engine can simply call this method with proper argument so that the "row" object registered in IResultIterator's scope, that is, JSResultSetRow, can be accessed by engine using engine scope. 
 * @param targetScope
 * @param source
 */
public static void registerJSObject(Scriptable targetScope,ILinkedResult source){
  int type=((ILinkedResult)source).getCurrentResultType();
  if (type == ILinkedResult.TYPE_TABLE) {
    targetScope.put("String_Node_Str",targetScope,new JSResultIteratorObject((ILinkedResult)source));
  }
 else   if (type == ILinkedResult.TYPE_CUBE) {
    Scriptable scope=((ICubeCursor)source.getCurrentResult()).getScope();
    targetScope.put("String_Node_Str",targetScope,scope.get("String_Node_Str",scope));
    targetScope.put("String_Node_Str",targetScope,scope.get("String_Node_Str",scope));
    targetScope.put("String_Node_Str",targetScope,scope.get("String_Node_Str",scope));
  }
}

Fixed version (ground truth):
/** 
 * This method is used to register the Java Script Objects which are defined in the scope of source ResultSet ( might be IResultSet or CubeCursor ) to target scope. One possible client of this method is Report Engine. A classic use case is that instead of register its own "row" object  the Report Engine can simply call this method with proper argument so that the "row" object registered in IResultIterator's scope, that is, JSResultSetRow, can be accessed by engine using engine scope. 
 * @param targetScope
 * @param source
 */
public static void registerJSObject(Scriptable targetScope,ILinkedResult source,ScriptContext context){
  int type=((ILinkedResult)source).getCurrentResultType();
  if (type == ILinkedResult.TYPE_TABLE) {
    targetScope.put("String_Node_Str",targetScope,new JSResultIteratorObject((ILinkedResult)source,context));
  }
 else   if (type == ILinkedResult.TYPE_CUBE) {
    Scriptable scope=((ICubeCursor)source.getCurrentResult()).getScope();
    targetScope.put("String_Node_Str",targetScope,scope.get("String_Node_Str",scope));
    targetScope.put("String_Node_Str",targetScope,scope.get("String_Node_Str",scope));
    targetScope.put("String_Node_Str",targetScope,scope.get("String_Node_Str",scope));
  }
}
Program: 69623
Project: 69623
Buggy source:
JSResultIteratorObject(ILinkedResult it){
  this.it=it;
  if (it.getCurrentResultType() == ILinkedResult.TYPE_TABLE)   this.currentIterator=(IResultIterator)it.getCurrentResult();
}

Fixed version (ground truth):
JSResultIteratorObject(ILinkedResult it,ScriptContext context){
  this.it=it;
  this.sContext=context;
  if (it.getCurrentResultType() == ILinkedResult.TYPE_TABLE)   this.currentIterator=(IResultIterator)it.getCurrentResult();
}
Program: 69624
Project: 69624
Buggy source:
public void setResultSets(IBaseResultSet[] rsets){
  if (this.rsets == rsets) {
    return;
  }
  if (rsets != null) {
    this.rsets=rsets;
    if (rsets[0] != null) {
      Scriptable scope=getScriptContext().getRootScope();
      DataAdapterUtil.registerJSObject(scope,new ResultIteratorTree(rsets[0]));
    }
  }
 else {
    this.rsets=null;
  }
}

Fixed version (ground truth):
public void setResultSets(IBaseResultSet[] rsets){
  if (this.rsets == rsets) {
    return;
  }
  if (rsets != null) {
    this.rsets=rsets;
    if (rsets[0] != null) {
      Scriptable scope=getScriptContext().getRootScope();
      DataAdapterUtil.registerJSObject(scope,new ResultIteratorTree(rsets[0]),this.getScriptContext());
    }
  }
 else {
    this.rsets=null;
  }
}
Program: 69628
Project: 69628
Buggy source:
/** 
 * @throws BirtException
 */
private void genSubQuery3() throws BirtException {
  QueryDefinition queryDefn=newReportQuery();
  SubqueryDefinition subQueryDefn=new SubqueryDefinition(subQueryName,queryDefn);
  subQueryDefn.setApplyOnGroupFlag(false);
  queryDefn.addSubquery(subQueryDefn);
  IBaseExpression[] rowBeArray=getRowExpr();
  IBaseExpression[] totalBeArray=getAggrExpr();
  rowExprName=getRowExprName();
  totalExprName=getAggrExprName();
  prepareExprNameAndQuery(rowExprName,rowBeArray,totalExprName,totalBeArray,subQueryDefn);
  IQueryResults qr=myGenDataEngine.prepare(queryDefn).execute(scope);
  saveForPresentation(qr,rowBeArray,totalBeArray);
  IResultIterator ri=qr.getResultIterator();
  while (ri.next()) {
    IResultIterator ri2=ri.getSecondaryIterator(subQueryName,subScope);
    while (ri2.next()) {
      for (int i=0; i < rowBeArray.length; i++)       expectedValue.add(ri2.getValue(rowExprName[i]));
      for (int i=0; i < totalBeArray.length; i++)       expectedValue.add(ri2.getValue(totalExprName[i]));
    }
    ri2.close();
  }
  qr.close();
  myGenDataEngine.shutdown();
}

Fixed version (ground truth):
/** 
 * @throws BirtException
 */
private void genSubQuery3() throws BirtException {
  QueryDefinition queryDefn=newReportQuery();
  SubqueryDefinition subQueryDefn=new SubqueryDefinition(subQueryName,queryDefn);
  subQueryDefn.setApplyOnGroupFlag(false);
  queryDefn.addSubquery(subQueryDefn);
  prepareExprNameAndQuery(subQueryDefn);
  IQueryResults qr=myGenDataEngine.prepare(queryDefn).execute(scope);
  saveForPresentation(qr);
  IResultIterator ri=qr.getResultIterator();
  while (ri.next()) {
    IResultIterator ri2=ri.getSecondaryIterator(subQueryName,subScope);
    while (ri2.next()) {
      for (int i=0; i < rowExprName.length; i++)       expectedValue.add(ri2.getValue(rowExprName[i]));
      for (int i=0; i < totalExprName.length; i++)       expectedValue.add(ri2.getValue(totalExprName[i]));
    }
    ri2.close();
  }
  qr.close();
  myGenDataEngine.shutdown();
}
Program: 69629
Project: 69629
Buggy source:
/** 
 * @throws BirtException
 */
private void genSubQuery2() throws BirtException {
  QueryDefinition queryDefn=newReportQuery();
  SubqueryDefinition subQueryDefn=new SubqueryDefinition(subQueryName,queryDefn);
  queryDefn.addSubquery(subQueryDefn);
  IBaseExpression[] rowBeArray=getRowExpr();
  IBaseExpression[] totalBeArray=getAggrExpr();
  rowExprName=getRowExprName();
  totalExprName=getAggrExprName();
  prepareExprNameAndQuery(rowExprName,rowBeArray,totalExprName,totalBeArray,subQueryDefn);
  IQueryResults qr=myGenDataEngine.prepare(queryDefn).execute(scope);
  saveForPresentation(qr,rowBeArray,totalBeArray);
  IResultIterator ri=qr.getResultIterator();
  while (ri.next())   ;
  IResultIterator ri2=ri.getSecondaryIterator(subQueryName,subScope);
  while (ri2.next()) {
    for (int i=0; i < rowBeArray.length; i++)     expectedValue.add(ri2.getValue(rowExprName[i]));
    for (int i=0; i < totalBeArray.length; i++)     expectedValue.add(ri2.getValue(totalExprName[i]));
  }
  ri2.close();
  qr.close();
  myGenDataEngine.shutdown();
}

Fixed version (ground truth):
/** 
 * @throws BirtException
 */
private void genSubQuery2() throws BirtException {
  QueryDefinition queryDefn=newReportQuery();
  SubqueryDefinition subQueryDefn=new SubqueryDefinition(subQueryName,queryDefn);
  queryDefn.addSubquery(subQueryDefn);
  prepareExprNameAndQuery(subQueryDefn);
  IQueryResults qr=myGenDataEngine.prepare(queryDefn).execute(scope);
  saveForPresentation(qr);
  IResultIterator ri=qr.getResultIterator();
  while (ri.next())   ;
  IResultIterator ri2=ri.getSecondaryIterator(subQueryName,subScope);
  while (ri2.next()) {
    for (int i=0; i < rowExprName.length; i++)     expectedValue.add(ri2.getValue(rowExprName[i]));
    for (int i=0; i < totalExprName.length; i++)     expectedValue.add(ri2.getValue(totalExprName[i]));
  }
  ri2.close();
  qr.close();
  myGenDataEngine.shutdown();
}
Program: 69631
Project: 69631
Buggy source:
/** 
 * @throws BirtException 
 */
private void genBasicSkipToEnd() throws BirtException {
  QueryDefinition qd=newReportQuery();
  IBaseExpression[] rowBeArray=getRowExpr();
  IBaseExpression[] totalBeArray=getAggrExpr();
  rowExprName=getRowExprName();
  totalExprName=getAggrExprName();
  prepareExprNameAndQuery(rowExprName,rowBeArray,totalExprName,totalBeArray,qd);
  GroupDefinition groupDefn=new GroupDefinition();
  groupDefn.setKeyColumn("String_Node_Str");
  qd.addGroup(groupDefn);
  groupDefn=new GroupDefinition();
  groupDefn.setKeyColumn("String_Node_Str");
  qd.addGroup(groupDefn);
  IQueryResults qr=myGenDataEngine.prepare(qd).execute(scope);
  saveForPresentation(qr,rowBeArray,totalBeArray);
  IResultIterator ri=qr.getResultIterator();
  ri.next();
  ri.skipToEnd(1);
  while (ri.next()) {
    for (int i=0; i < rowBeArray.length; i++)     expectedValue.add(ri.getValue(rowExprName[i]));
    for (int i=0; i < totalBeArray.length; i++)     expectedValue.add(ri.getValue(totalExprName[i]));
    this.expectedStartingGroupLevelValueList.add(new Integer(ri.getStartingGroupLevel()));
    this.expectedEndingGroupLevelValueList.add(new Integer(ri.getEndingGroupLevel()));
  }
  ri.close();
  ri.close();
  qr.close();
  qr.close();
  myGenDataEngine.shutdown();
}

Fixed version (ground truth):
/** 
 * @throws BirtException 
 */
private void genBasicSkipToEnd() throws BirtException {
  QueryDefinition qd=newReportQuery();
  IBaseExpression[] rowBeArray=getRowExpr();
  IBaseExpression[] totalBeArray=getAggrExpr();
  rowExprName=getRowExprName();
  totalExprName=getAggrExprName();
  prepareExprNameAndQuery(qd);
  GroupDefinition groupDefn=new GroupDefinition();
  groupDefn.setKeyColumn("String_Node_Str");
  qd.addGroup(groupDefn);
  groupDefn=new GroupDefinition();
  groupDefn.setKeyColumn("String_Node_Str");
  qd.addGroup(groupDefn);
  IQueryResults qr=myGenDataEngine.prepare(qd).execute(scope);
  saveForPresentation(qr);
  IResultIterator ri=qr.getResultIterator();
  ri.next();
  ri.skipToEnd(1);
  while (ri.next()) {
    for (int i=0; i < rowBeArray.length; i++)     expectedValue.add(ri.getValue(rowExprName[i]));
    for (int i=0; i < totalBeArray.length; i++)     expectedValue.add(ri.getValue(totalExprName[i]));
    this.expectedStartingGroupLevelValueList.add(new Integer(ri.getStartingGroupLevel()));
    this.expectedEndingGroupLevelValueList.add(new Integer(ri.getEndingGroupLevel()));
  }
  ri.close();
  ri.close();
  qr.close();
  qr.close();
  myGenDataEngine.shutdown();
}
Program: 69632
Project: 69632
Buggy source:
/** 
 * @throws BirtException 
 */
private void genBasicGroupLevel2() throws BirtException {
  QueryDefinition qd=newReportQuery();
  qd.setUsesDetails(false);
  IBaseExpression[] rowBeArray=getRowExpr();
  IBaseExpression[] totalBeArray=getAggrExpr();
  rowExprName=getRowExprName();
  totalExprName=getAggrExprName();
  prepareExprNameAndQuery(rowExprName,rowBeArray,totalExprName,totalBeArray,qd);
  GroupDefinition groupDefn=new GroupDefinition();
  groupDefn.setKeyColumn("String_Node_Str");
  qd.addGroup(groupDefn);
  groupDefn=new GroupDefinition();
  groupDefn.setKeyColumn("String_Node_Str");
  qd.addGroup(groupDefn);
  IQueryResults qr=myGenDataEngine.prepare(qd).execute(scope);
  saveForPresentation(qr,rowBeArray,totalBeArray);
  IResultIterator ri=qr.getResultIterator();
  while (ri.next()) {
    for (int i=0; i < rowBeArray.length; i++)     expectedValue.add(ri.getValue(rowExprName[i]));
    for (int i=0; i < totalBeArray.length; i++)     expectedValue.add(ri.getValue(totalExprName[i]));
    this.expectedStartingGroupLevelValueList.add(new Integer(ri.getStartingGroupLevel()));
    this.expectedEndingGroupLevelValueList.add(new Integer(ri.getEndingGroupLevel()));
  }
  ri.close();
  ri.close();
  qr.close();
  qr.close();
  myGenDataEngine.shutdown();
}

Fixed version (ground truth):
/** 
 * @throws BirtException 
 */
private void genBasicGroupLevel2() throws BirtException {
  QueryDefinition qd=newReportQuery();
  qd.setUsesDetails(false);
  prepareExprNameAndQuery(qd);
  GroupDefinition groupDefn=new GroupDefinition();
  groupDefn.setKeyColumn("String_Node_Str");
  qd.addGroup(groupDefn);
  groupDefn=new GroupDefinition();
  groupDefn.setKeyColumn("String_Node_Str");
  qd.addGroup(groupDefn);
  IQueryResults qr=myGenDataEngine.prepare(qd).execute(scope);
  saveForPresentation(qr);
  IResultIterator ri=qr.getResultIterator();
  while (ri.next()) {
    for (int i=0; i < rowExprName.length; i++)     expectedValue.add(ri.getValue(rowExprName[i]));
    for (int i=0; i < totalExprName.length; i++)     expectedValue.add(ri.getValue(totalExprName[i]));
    this.expectedStartingGroupLevelValueList.add(new Integer(ri.getStartingGroupLevel()));
    this.expectedEndingGroupLevelValueList.add(new Integer(ri.getEndingGroupLevel()));
  }
  ri.close();
  ri.close();
  qr.close();
  qr.close();
  myGenDataEngine.shutdown();
}
Program: 69633
Project: 69633
Buggy source:
/** 
 * @param rowBeArray
 * @param totalBeArray
 */
private void saveForPresentation(IQueryResults queryResuls,IBaseExpression[] rowBeArray,IBaseExpression[] totalBeArray){
  queryResultID=queryResuls.getID();
}

Fixed version (ground truth):
/** 
 * @param rowBeArray
 * @param totalBeArray
 */
private void saveForPresentation(IQueryResults qr){
  queryResultID=qr.getID();
}