nus-yam/ex-repair huggingface dataset:
Program: 75884
Project: 75884
Buggy source:
/** 
 * Outputs the image
 * @param ele the IMG element instance
 */
protected void outputImg(Element ele,HashMap cssStyles,IContent content){
  String src=ele.getAttribute("String_Node_Str");
  if (src != null) {
    IImageContent image=new ImageContent(content);
    addChild(content,image);
    handleStyle(ele,cssStyles,image);
    if (!FileUtil.isLocalResource(src)) {
      image.setImageSource(IImageContent.IMAGE_URL);
      image.setURI(src);
    }
 else {
      ReportDesignHandle handle=content.getReportContent().getDesign().getReportDesign();
      URL url=handle.findResource(src,IResourceLocator.IMAGE);
      if (url != null) {
        src=url.getFile();
      }
      image.setImageSource(IImageContent.IMAGE_FILE);
      image.setURI(src);
    }
    if (null != ele.getAttribute("String_Node_Str") && !"String_Node_Str".equals(ele.getAttribute("String_Node_Str"))) {
      image.setWidth(DimensionType.parserUnit(ele.getAttribute("String_Node_Str")));
    }
    if (ele.getAttribute("String_Node_Str") != null && !"String_Node_Str".equals(ele.getAttribute("String_Node_Str"))) {
      image.setWidth(DimensionType.parserUnit(ele.getAttribute("String_Node_Str")));
    }
    if (ele.getAttribute("String_Node_Str") != null && !"String_Node_Str".equals(ele.getAttribute("String_Node_Str"))) {
      image.setAltText(ele.getAttribute("String_Node_Str"));
    }
  }
}

Fixed version (ground truth):
/** 
 * Outputs the image
 * @param ele the IMG element instance
 */
protected void outputImg(Element ele,HashMap cssStyles,IContent content){
  String src=ele.getAttribute("String_Node_Str");
  if (src != null) {
    IImageContent image=new ImageContent(content);
    addChild(content,image);
    handleStyle(ele,cssStyles,image);
    if (!FileUtil.isLocalResource(src)) {
      image.setImageSource(IImageContent.IMAGE_URL);
      image.setURI(src);
    }
 else {
      ReportDesignHandle handle=content.getReportContent().getDesign().getReportDesign();
      URL url=handle.findResource(src,IResourceLocator.IMAGE);
      if (url != null) {
        src=url.toString();
      }
      image.setImageSource(IImageContent.IMAGE_FILE);
      image.setURI(src);
    }
    if (null != ele.getAttribute("String_Node_Str") && !"String_Node_Str".equals(ele.getAttribute("String_Node_Str"))) {
      image.setWidth(DimensionType.parserUnit(ele.getAttribute("String_Node_Str")));
    }
    if (ele.getAttribute("String_Node_Str") != null && !"String_Node_Str".equals(ele.getAttribute("String_Node_Str"))) {
      image.setWidth(DimensionType.parserUnit(ele.getAttribute("String_Node_Str")));
    }
    if (ele.getAttribute("String_Node_Str") != null && !"String_Node_Str".equals(ele.getAttribute("String_Node_Str"))) {
      image.setAltText(ele.getAttribute("String_Node_Str"));
    }
  }
}
Program: 75885
Project: 75885
Buggy source:
/** 
 * To test add/remove methods on aggregateOn and argument lists.
 * @throws Exception
 */
public void testSimpleListProperties() throws Exception {
  createDesign();
  DataItemHandle data=designHandle.getElementFactory().newDataItem("String_Node_Str");
  designHandle.getBody().add(data);
  ComputedColumn column=StructureFactory.createComputedColumn();
  column.setName("String_Node_Str");
  column.setExpression("String_Node_Str");
  ComputedColumnHandle columnHandle=data.addColumnBinding(column,false);
  columnHandle.addArgument("String_Node_Str");
  List arguments=columnHandle.getArgumentList();
  assertEquals(1,arguments.size());
  columnHandle.removeArgument("String_Node_Str");
  arguments=columnHandle.getArgumentList();
  assertEquals(0,arguments.size());
  columnHandle.addAggregateOn("String_Node_Str");
  List aggregates=columnHandle.getAggregateOnList();
  assertEquals(1,aggregates.size());
  columnHandle.removeAggregateOn("String_Node_Str");
  aggregates=columnHandle.getAggregateOnList();
  assertEquals(0,aggregates.size());
}

Fixed version (ground truth):
/** 
 * To test add/remove methods on aggregateOn and argument lists.
 * @throws Exception
 */
public void testSimpleListProperties() throws Exception {
  createDesign();
  DataItemHandle data=designHandle.getElementFactory().newDataItem("String_Node_Str");
  designHandle.getBody().add(data);
  ComputedColumn column=StructureFactory.createComputedColumn();
  column.setName("String_Node_Str");
  column.setExpression("String_Node_Str");
  column.setAggregateOn("String_Node_Str");
  column.addAggregateOn("String_Node_Str");
  assertEquals(2,column.getAggregateOnList().size());
  column.clearAggregateOnList();
  assertEquals(0,column.getAggregateOnList().size());
  ComputedColumnHandle columnHandle=data.addColumnBinding(column,false);
  columnHandle.addArgument("String_Node_Str");
  List arguments=columnHandle.getArgumentList();
  assertEquals(1,arguments.size());
  columnHandle.removeArgument("String_Node_Str");
  arguments=columnHandle.getArgumentList();
  assertEquals(0,arguments.size());
  columnHandle.addAggregateOn("String_Node_Str");
  List aggregates=columnHandle.getAggregateOnList();
  assertEquals(1,aggregates.size());
  columnHandle.removeAggregateOn("String_Node_Str");
  aggregates=columnHandle.getAggregateOnList();
  assertEquals(0,aggregates.size());
  columnHandle.setAggregateOn("String_Node_Str");
  columnHandle.addAggregateOn("String_Node_Str");
  assertEquals(2,columnHandle.getAggregateOnList().size());
  columnHandle.clearAggregateOnList();
  assertEquals(0,columnHandle.getAggregateOnList().size());
}
Program: 75886
Project: 75886
Buggy source:
/** 
 * Returns the list containing levels to be aggregated on.
 * @return the list containing levels to be aggregated on
 */
public List getAggregateOnList(){
  List aggregateOns=(List)getProperty(ComputedColumn.AGGREGATEON_MEMBER);
  if (aggregateOns == null)   return null;
  return Collections.unmodifiableList(aggregateOns);
}

Fixed version (ground truth):
/** 
 * Returns the list containing levels to be aggregated on.
 * @return the list containing levels to be aggregated on
 */
public List getAggregateOnList(){
  List aggregateOns=(List)getProperty(ComputedColumn.AGGREGATEON_MEMBER);
  if (aggregateOns == null)   return Collections.EMPTY_LIST;
  return Collections.unmodifiableList(aggregateOns);
}
Program: 75887
Project: 75887
Buggy source:
/** 
 * Removes an aggregate level from the list.
 * @param aggreValue the aggregate name. For listing elements, this can be "All" or the name of a single group.
 */
public void removeAggregateOn(String aggreValue){
  if (aggregrateOn == null)   return;
  aggregrateOn.remove(aggreValue);
}

Fixed version (ground truth):
/** 
 * Removes an aggregate level from the list.
 * @param aggreValue the aggregate name. For listing elements, this can be "All" or the name of a single group.
 */
public void removeAggregateOn(String aggreValue){
  if (aggregateOn == null)   return;
  aggregateOn.remove(aggreValue);
}
Program: 75888
Project: 75888
Buggy source:
/** 
 * Returns the list containing levels to be aggregated on.
 * @return the list containing levels to be aggregated on
 */
public List getAggregateOnList(){
  return (List)getProperty(null,AGGREGATEON_MEMBER);
}

Fixed version (ground truth):
/** 
 * Returns the list containing levels to be aggregated on.
 * @return the list containing levels to be aggregated on
 */
public List getAggregateOnList(){
  List value=(List)getProperty(null,AGGREGATEON_MEMBER);
  if (value == null)   return Collections.EMPTY_LIST;
  return (List)value;
}
Program: 75889
Project: 75889
Buggy source:
/** 
 * Adds an aggregate level to the list.
 * @param aggreValue the aggregate name. For listing elements, this can be "All" or the name of a single group.
 */
public void addAggregateOn(String aggreValue){
  if (aggregrateOn == null)   aggregrateOn=new ArrayList();
  aggregrateOn.add(aggreValue);
}

Fixed version (ground truth):
/** 
 * Adds an aggregate level to the list.
 * @param aggreValue the aggregate name. For listing elements, this can be "All" or the name of a single group.
 */
public void addAggregateOn(String aggreValue){
  if (aggregateOn == null)   aggregateOn=new ArrayList();
  aggregateOn.add(aggreValue);
}
Program: 75890
Project: 75890
Buggy source:
/** 
 * Tests one report design including an inexistent library. And test status of elements that extends library elements.
 * @throws Exception if any exception
 */
public void testLoadDesignWithInexistentLibrary() throws Exception {
  openDesign("String_Node_Str");
  List libraries=designHandle.getAllLibraries();
  assertEquals(1,libraries.size());
  LibraryHandle libHandle=(LibraryHandle)libraries.get(0);
  assertFalse(libHandle.isValid());
  assertEquals(DesignParserException.DESIGN_EXCEPTION_FILE_NOT_FOUND,((ErrorDetail)libHandle.getErrorList().get(0)).getErrorCode());
  ReportElementHandle element=(ReportElementHandle)designHandle.findElement("String_Node_Str");
  assertTrue(element.isValidLayoutForCompoundElement());
  element=(ReportElementHandle)designHandle.findElement("String_Node_Str");
  assertFalse(element.isValidLayoutForCompoundElement());
  element=(ReportElementHandle)designHandle.findElement("String_Node_Str");
  assertFalse(element.isValidLayoutForCompoundElement());
  element=(ReportElementHandle)designHandle.findElement("String_Node_Str");
  assertFalse(element.isValidLayoutForCompoundElement());
}

Fixed version (ground truth):
/** 
 * Tests one report design including an inexistent library. And test status of elements that extends library elements.
 * @throws Exception if any exception
 */
public void testLoadDesignWithInexistentLibrary() throws Exception {
  openDesign("String_Node_Str");
  List libraries=designHandle.getAllLibraries();
  assertEquals(1,libraries.size());
  LibraryHandle libHandle=(LibraryHandle)libraries.get(0);
  assertFalse(libHandle.isValid());
  assertEquals("String_Node_Str",libHandle.getRelativeFileName());
  assertEquals(DesignParserException.DESIGN_EXCEPTION_FILE_NOT_FOUND,((ErrorDetail)libHandle.getErrorList().get(0)).getErrorCode());
  ReportElementHandle element=(ReportElementHandle)designHandle.findElement("String_Node_Str");
  assertTrue(element.isValidLayoutForCompoundElement());
  element=(ReportElementHandle)designHandle.findElement("String_Node_Str");
  assertFalse(element.isValidLayoutForCompoundElement());
  element=(ReportElementHandle)designHandle.findElement("String_Node_Str");
  assertFalse(element.isValidLayoutForCompoundElement());
  element=(ReportElementHandle)designHandle.findElement("String_Node_Str");
  assertFalse(element.isValidLayoutForCompoundElement());
}
Program: 75892
Project: 75892
Buggy source:
/** 
 * This method is called upon plug-in activation.
 * @param context bundle context
 * @exception Exception
 */
public void start(BundleContext context) throws Exception {
  super.start(context);
  bundleContext=context;
  plugin.getPluginPreferences().setDefault(WebViewer.MASTER_PAGE_CONTENT,true);
  plugin.getPluginPreferences().setDefault(WebViewer.PREVIEW_MAXROW,DEFAULT_MAX_ROWS);
  plugin.getPluginPreferences().setDefault(WebViewer.USER_LOCALE,ULocale.getDefault().getDisplayName());
  String pluginPath=plugin.getStateLocation().toOSString();
  System.setProperty(BIRT_VIEWER_WORKING_PATH,pluginPath);
}

Fixed version (ground truth):
/** 
 * This method is called upon plug-in activation.
 * @param context bundle context
 * @exception Exception
 */
public void start(BundleContext context) throws Exception {
  super.start(context);
  bundleContext=context;
  plugin.getPluginPreferences().setDefault(WebViewer.MASTER_PAGE_CONTENT,true);
  plugin.getPluginPreferences().setDefault(WebViewer.PREVIEW_MAXROW,DEFAULT_MAX_ROWS);
  plugin.getPluginPreferences().setDefault(WebViewer.USER_LOCALE,ULocale.getDefault().getDisplayName());
  if (plugin.getStateLocation() != null)   System.setProperty(BIRT_VIEWER_WORKING_PATH,plugin.getStateLocation().toOSString());
}
Program: 75894
Project: 75894
Buggy source:
/** 
 * convert path from System Properties Definition. For example: ${java.io.tmpdir}
 * @param path
 * @return
 */
protected static String convertSystemPath(String path){
  if (path == null)   return path;
  Pattern p=Pattern.compile("String_Node_Str",Pattern.CASE_INSENSITIVE);
  Matcher m=p.matcher(path);
  if (m.find()) {
    String sysPath=DataUtil.trimSepEnd(System.getProperty(m.group(1).trim()));
    return DataUtil.trimString(sysPath) + m.group(2).trim();
  }
  return path;
}

Fixed version (ground truth):
/** 
 * convert path from System Properties Definition. For example: ${java.io.tmpdir}
 * @param path
 * @return
 */
protected static String convertSystemPath(String path){
  if (path == null)   return path;
  Pattern p=Pattern.compile("String_Node_Str",Pattern.CASE_INSENSITIVE);
  Matcher m=p.matcher(path);
  if (m.find()) {
    String sysPath=DataUtil.trimSepEnd(System.getProperty(m.group(1).trim()));
    if (sysPath.length() <= 0)     return DataUtil.trimSepFirst(m.group(2).trim());
 else     return sysPath + m.group(2).trim();
  }
  return path;
}
Program: 75895
Project: 75895
Buggy source:
public void endCell(ICellContent cell){
  if ((cell == leafCell) && (false == cellFilled)) {
    writer.text("String_Node_Str");
  }
  leafCell=null;
  cellFilled=false;
  if (pop()) {
    return;
  }
  logger.log(Level.FINE,"String_Node_Str");
  if (enableMetadata) {
    metadataEmitter.endCell(cell);
  }
  if (isCellInTableHead(cell)) {
    writer.closeTag(HTMLTags.TAG_TH);
  }
 else {
    writer.closeTag(HTMLTags.TAG_TD);
  }
}

Fixed version (ground truth):
public void endCell(ICellContent cell){
  leafCell=null;
  cellFilled=false;
  if (pop()) {
    return;
  }
  logger.log(Level.FINE,"String_Node_Str");
  if (enableMetadata) {
    metadataEmitter.endCell(cell);
  }
  if (isCellInTableHead(cell)) {
    writer.closeTag(HTMLTags.TAG_TH);
  }
 else {
    writer.closeTag(HTMLTags.TAG_TD);
  }
}
Program: 75898
Project: 75898
Buggy source:
protected boolean existDropCells(){
  if (unresolvedRow != null) {
    for (int i=0; i < columnNumber; i++) {
      CellArea cell=unresolvedRow.getCell(start + i);
      if (cell != null && cell.getRowSpan() < 0) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
protected boolean existDropCells(){
  if (unresolvedRow != null) {
    for (int i=0; i < columnNumber; i++) {
      CellArea cell=unresolvedRow.getCell(start + i);
      if (cell != null && isDropCell(cell)) {
        return true;
      }
    }
  }
  return false;
}
Program: 75902
Project: 75902
Buggy source:
public Object get(String arg0,Scriptable scope){
  try {
    return it.getValue(arg0);
  }
 catch (  BirtException e) {
    return null;
  }
}

Fixed version (ground truth):
public Object get(String arg0,Scriptable scope){
  try {
    if ("String_Node_Str".equalsIgnoreCase(arg0) || "String_Node_Str".equalsIgnoreCase(arg0)) {
      return new Integer(it.getCurrentIterator().getRowIndex());
    }
    if ("String_Node_Str".equalsIgnoreCase(arg0)) {
      return new JSResultIteratorObject(it.getParent());
    }
    return it.getCurrentIterator().getValue(arg0);
  }
 catch (  BirtException e) {
    return null;
  }
}
Program: 75903
Project: 75903
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,Object source){
  if (source instanceof IResultIterator) {
    targetScope.put("String_Node_Str",targetScope,new JSResultIteratorObject((IResultIterator)source));
  }
 else   if (source instanceof ICubeCursor) {
    Scriptable scope=((ICubeCursor)source).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,Object source,Object parent){
  if (source instanceof ILinkedResultIterator) {
    targetScope.put("String_Node_Str",targetScope,new JSResultIteratorObject((ILinkedResultIterator)source));
  }
 else   if (source instanceof ICubeCursor) {
    Scriptable scope=((ICubeCursor)source).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: 75904
Project: 75904
Buggy source:
JSResultIteratorObject(IResultIterator it){
  this.it=it;
}

Fixed version (ground truth):
JSResultIteratorObject(ILinkedResultIterator it){
  this.it=it;
}
Program: 75905
Project: 75905
Buggy source:
RowArea(IRowContent row){
  super(row);
  style.setProperty(IStyle.STYLE_BORDER_TOP_WIDTH,IStyle.NUMBER_0);
  style.setProperty(IStyle.STYLE_BORDER_LEFT_WIDTH,IStyle.NUMBER_0);
  style.setProperty(IStyle.STYLE_BORDER_RIGHT_WIDTH,IStyle.NUMBER_0);
  style.setProperty(IStyle.STYLE_BORDER_BOTTOM_WIDTH,IStyle.NUMBER_0);
}

Fixed version (ground truth):
RowArea(IRowContent row){
  super(row);
  style.setProperty(IStyle.STYLE_BORDER_TOP_WIDTH,IStyle.NUMBER_0);
  style.setProperty(IStyle.STYLE_BORDER_LEFT_WIDTH,IStyle.NUMBER_0);
  style.setProperty(IStyle.STYLE_BORDER_RIGHT_WIDTH,IStyle.NUMBER_0);
  style.setProperty(IStyle.STYLE_BORDER_BOTTOM_WIDTH,IStyle.NUMBER_0);
  style.setProperty(IStyle.STYLE_MARGIN_TOP,IStyle.NUMBER_0);
  style.setProperty(IStyle.STYLE_MARGIN_LEFT,IStyle.NUMBER_0);
  style.setProperty(IStyle.STYLE_MARGIN_RIGHT,IStyle.NUMBER_0);
  style.setProperty(IStyle.STYLE_MARGIN_BOTTOM,IStyle.NUMBER_0);
}
Program: 75906
Project: 75906
Buggy source:
public void seek(int index) throws IOException {
  if (index >= length) {
    return;
  }
  if (index >= aggregationResultRow.size()) {
    for (int i=0; i <= index - aggregationResultRow.size(); i++) {
      aggregationResultRow.add(AggregationResultSetSaveUtil.loadAggregationRow(inputStream));
    }
  }
  currentPosition=index;
  resultObject=(AggregationResultRow)aggregationResultRow.get(index);
}

Fixed version (ground truth):
public void seek(int index) throws IOException {
  if (index >= length) {
    throw new IndexOutOfBoundsException("String_Node_Str" + index + "String_Node_Str"+ length);
  }
  if (index >= aggregationResultRow.size()) {
    for (int i=0; i <= index - aggregationResultRow.size(); i++) {
      aggregationResultRow.add(AggregationResultSetSaveUtil.loadAggregationRow(inputStream));
    }
  }
  currentPosition=index;
  resultObject=(AggregationResultRow)aggregationResultRow.get(index);
}
Program: 75907
Project: 75907
Buggy source:
public void seek(int index) throws IOException {
  if (index >= aggregationResultRow.size()) {
    return;
  }
  currentPosition=index;
  resultObject=(IAggregationResultRow)aggregationResultRow.get(index);
}

Fixed version (ground truth):
public void seek(int index) throws IOException {
  if (index >= aggregationResultRow.size()) {
    throw new IndexOutOfBoundsException("String_Node_Str" + index + "String_Node_Str"+ aggregationResultRow.size());
  }
  currentPosition=index;
  resultObject=(IAggregationResultRow)aggregationResultRow.get(index);
}
Program: 75908
Project: 75908
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,Object source,Object parent){
  if (source instanceof ILinkedResultIterator) {
    targetScope.put("String_Node_Str",targetScope,new JSResultIteratorObject((ILinkedResultIterator)source));
  }
 else   if (source instanceof ICubeCursor) {
    Scriptable scope=((ICubeCursor)source).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,Object source){
  if (source instanceof ILinkedResultIterator) {
    targetScope.put("String_Node_Str",targetScope,new JSResultIteratorObject((ILinkedResultIterator)source));
  }
 else   if (source instanceof ICubeCursor) {
    Scriptable scope=((ICubeCursor)source).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: 75937
Project: 75937
Buggy source:
/** 
 * without row edge
 * @throws OLAPException
 * @throws BirtException 
 */
public void testCursorModel2() throws OLAPException, BirtException {
  ICubeQueryDefinition cqd=new CubeQueryDefinition(CubeCreator.cubeName);
  cqd.createMeasure("String_Node_Str");
  cqd.createMeasure("String_Node_Str");
  IEdgeDefinition columnEdge=cqd.createEdge(ICubeQueryDefinition.COLUMN_EDGE);
  IDimensionDefinition geographyDim=columnEdge.createDimension("String_Node_Str");
  IHierarchyDefinition geographyHier=geographyDim.createHierarchy("String_Node_Str");
  geographyHier.createLevel("String_Node_Str");
  geographyHier.createLevel("String_Node_Str");
  geographyHier.createLevel("String_Node_Str");
  BirtCubeView cubeView=new BirtCubeView(new CubeQueryExecutor(cqd,this.scope,DataEngineContext.newInstance(DataEngineContext.DIRECT_PRESENTATION,scope,null,null)));
  CubeCursor dataCursor=cubeView.getCubeCursor();
  EdgeCursor columnCursor=cubeView.getColumnEdgeView().getEdgeCursor();
  DimensionCursor countryCursor=(DimensionCursor)columnCursor.getDimensionCursor().get(0);
  DimensionCursor cityCursor=(DimensionCursor)columnCursor.getDimensionCursor().get(1);
  DimensionCursor productCursor=(DimensionCursor)columnCursor.getDimensionCursor().get(2);
  printCubeAlongDimension(dataCursor,countryCursor,cityCursor,productCursor,null);
}

Fixed version (ground truth):
/** 
 * without row edge
 * @throws OLAPException
 * @throws BirtException 
 */
public void testCursorModel2() throws OLAPException, BirtException {
  ICubeQueryDefinition cqd=new CubeQueryDefinition(CubeCreator.cubeName);
  cqd.createMeasure("String_Node_Str");
  cqd.createMeasure("String_Node_Str");
  IEdgeDefinition columnEdge=cqd.createEdge(ICubeQueryDefinition.COLUMN_EDGE);
  IDimensionDefinition geographyDim=columnEdge.createDimension("String_Node_Str");
  IHierarchyDefinition geographyHier=geographyDim.createHierarchy("String_Node_Str");
  geographyHier.createLevel("String_Node_Str");
  geographyHier.createLevel("String_Node_Str");
  geographyHier.createLevel("String_Node_Str");
  BirtCubeView cubeView=new BirtCubeView(new CubeQueryExecutor(cqd,de.getSession(),this.scope,de.getContext()));
  CubeCursor dataCursor=cubeView.getCubeCursor();
  EdgeCursor columnCursor=cubeView.getColumnEdgeView().getEdgeCursor();
  DimensionCursor countryCursor=(DimensionCursor)columnCursor.getDimensionCursor().get(0);
  DimensionCursor cityCursor=(DimensionCursor)columnCursor.getDimensionCursor().get(1);
  DimensionCursor productCursor=(DimensionCursor)columnCursor.getDimensionCursor().get(2);
  printCubeAlongDimension(dataCursor,countryCursor,cityCursor,productCursor,null);
}
Program: 75939
Project: 75939
Buggy source:
protected void setUp() throws Exception {
  super.setUp();
  new CubeCreator().createCube();
  this.scope=new ImporterTopLevel();
}

Fixed version (ground truth):
protected void setUp() throws Exception {
  super.setUp();
  this.scope=new ImporterTopLevel();
  de=(DataEngineImpl)DataEngine.newDataEngine(DataEngineContext.newInstance(DataEngineContext.DIRECT_PRESENTATION,scope,null,null));
  new CubeCreator().createCube(de);
}
Program: 75942
Project: 75942
Buggy source:
/** 
 * without column edge
 * @throws OLAPException
 * @throws BirtException 
 */
public void testCursorModel3() throws OLAPException, BirtException {
  ICubeQueryDefinition cqd=new CubeQueryDefinition(CubeCreator.cubeName);
  cqd.createMeasure("String_Node_Str");
  cqd.createMeasure("String_Node_Str");
  IEdgeDefinition columnEdge=cqd.createEdge(ICubeQueryDefinition.ROW_EDGE);
  IDimensionDefinition timeDim=columnEdge.createDimension("String_Node_Str");
  IHierarchyDefinition timeHier=timeDim.createHierarchy("String_Node_Str");
  timeHier.createLevel("String_Node_Str");
  BirtCubeView cubeView=new BirtCubeView(new CubeQueryExecutor(cqd,this.scope,DataEngineContext.newInstance(DataEngineContext.DIRECT_PRESENTATION,scope,null,null)));
  CubeCursor dataCursor=cubeView.getCubeCursor();
  EdgeCursor rowCursor=cubeView.getRowEdgeView().getEdgeCursor();
  DimensionCursor timeCursor=(DimensionCursor)rowCursor.getDimensionCursor().get(0);
  printCubeAlongDimension(dataCursor,null,null,null,timeCursor);
}

Fixed version (ground truth):
/** 
 * without column edge
 * @throws OLAPException
 * @throws BirtException 
 */
public void testCursorModel3() throws OLAPException, BirtException {
  ICubeQueryDefinition cqd=new CubeQueryDefinition(CubeCreator.cubeName);
  cqd.createMeasure("String_Node_Str");
  cqd.createMeasure("String_Node_Str");
  IEdgeDefinition columnEdge=cqd.createEdge(ICubeQueryDefinition.ROW_EDGE);
  IDimensionDefinition timeDim=columnEdge.createDimension("String_Node_Str");
  IHierarchyDefinition timeHier=timeDim.createHierarchy("String_Node_Str");
  timeHier.createLevel("String_Node_Str");
  BirtCubeView cubeView=new BirtCubeView(new CubeQueryExecutor(cqd,de.getSession(),this.scope,de.getContext()));
  CubeCursor dataCursor=cubeView.getCubeCursor();
  EdgeCursor rowCursor=cubeView.getRowEdgeView().getEdgeCursor();
  DimensionCursor timeCursor=(DimensionCursor)rowCursor.getDimensionCursor().get(0);
  printCubeAlongDimension(dataCursor,null,null,null,timeCursor);
}
Program: 75945
Project: 75945
Buggy source:
protected void setUp() throws Exception {
  super.setUp();
  new CubeCreator().createCube();
  this.scope=new ImporterTopLevel();
}

Fixed version (ground truth):
protected void setUp() throws Exception {
  super.setUp();
  this.scope=new ImporterTopLevel();
  de=(DataEngineImpl)DataEngine.newDataEngine(DataEngineContext.newInstance(DataEngineContext.DIRECT_PRESENTATION,scope,null,null));
  new CubeCreator().createCube(de);
}
Program: 75947
Project: 75947
Buggy source:
public IPreparedCubeQuery prepare(ICubeQueryDefinition query,Map appContext) throws BirtException {
  return new PreparedCubeQuery(query,this.session.getSharedScope(),this.context);
}

Fixed version (ground truth):
public IPreparedCubeQuery prepare(ICubeQueryDefinition query,Map appContext) throws BirtException {
  return new PreparedCubeQuery(query,this.session,this.context);
}
Program: 75948
Project: 75948
Buggy source:
/** 
 * @param dirName
 * @param managerName
 * @throws IOException
 * @throws DataException
 */
private void create(String dirName,String managerName) throws IOException, DataException {
  documentObjectMap=new HashMap();
  File file=new File(dirName + File.separatorChar + managerName+ "String_Node_Str");
  if (!file.exists()) {
    if (!file.createNewFile()) {
      throw new DataException(ResourceConstants.OLAPFILE_CREATE_FAIL,file.getAbsolutePath());
    }
  }
  objectFile=new BufferedRandomAccessFile(file,"String_Node_Str",1024);
  objectFile.setLength(0);
  file=new File(dirName + File.separatorChar + managerName+ "String_Node_Str");
  if (!file.exists()) {
    if (!file.createNewFile()) {
      throw new DataException(ResourceConstants.OLAPFILE_CREATE_FAIL,file.getAbsolutePath());
    }
  }
  OatFile=new BufferedRandomAccessFile(file,"String_Node_Str",1024);
  OatFile.setLength(0);
  file=new File(dirName + File.separatorChar + managerName+ "String_Node_Str");
  if (!file.exists()) {
    if (!file.createNewFile()) {
      throw new DataException(ResourceConstants.OLAPFILE_CREATE_FAIL,file.getAbsolutePath());
    }
  }
  dataFile=new BufferedRandomAccessFile(file,"String_Node_Str",1024);
  dataFile.setLength(0);
}

Fixed version (ground truth):
/** 
 * @param dirName
 * @param managerName
 * @throws IOException
 * @throws DataException
 */
private void create(String dirName,String managerName) throws IOException, DataException {
  documentObjectMap=new HashMap();
  File file=new File(dirName + File.separatorChar + managerName+ "String_Node_Str");
  if (!file.exists()) {
    if (!new File(dirName).exists()) {
      new File(dirName).mkdirs();
    }
    if (!file.createNewFile()) {
      throw new DataException(ResourceConstants.OLAPFILE_CREATE_FAIL,file.getAbsolutePath());
    }
  }
  objectFile=new BufferedRandomAccessFile(file,"String_Node_Str",1024);
  objectFile.setLength(0);
  file=new File(dirName + File.separatorChar + managerName+ "String_Node_Str");
  if (!file.exists()) {
    if (!file.createNewFile()) {
      throw new DataException(ResourceConstants.OLAPFILE_CREATE_FAIL,file.getAbsolutePath());
    }
  }
  OatFile=new BufferedRandomAccessFile(file,"String_Node_Str",1024);
  OatFile.setLength(0);
  file=new File(dirName + File.separatorChar + managerName+ "String_Node_Str");
  if (!file.exists()) {
    if (!file.createNewFile()) {
      throw new DataException(ResourceConstants.OLAPFILE_CREATE_FAIL,file.getAbsolutePath());
    }
  }
  dataFile=new BufferedRandomAccessFile(file,"String_Node_Str",1024);
  dataFile.setLength(0);
}
Program: 75949
Project: 75949
Buggy source:
/** 
 * Get the document manager.
 * @param executor
 * @return
 * @throws DataException
 * @throws IOException
 */
private IDocumentManager getDocumentManager(CubeQueryExecutor executor) throws DataException, IOException {
  if (executor.getContext().getMode() == DataEngineContext.DIRECT_PRESENTATION || executor.getContext().getMode() == DataEngineContext.MODE_GENERATION) {
    return DocumentManagerFactory.loadFileDocumentManager(executor.getContext().getTmpdir(),executor.getCubeQueryDefinition().getName());
  }
 else {
    return DocumentManagerFactory.createRADocumentManager(executor.getContext().getDocReader());
  }
}

Fixed version (ground truth):
/** 
 * Get the document manager.
 * @param executor
 * @return
 * @throws DataException
 * @throws IOException
 */
private IDocumentManager getDocumentManager(CubeQueryExecutor executor) throws DataException, IOException {
  if (executor.getContext().getMode() == DataEngineContext.DIRECT_PRESENTATION || executor.getContext().getMode() == DataEngineContext.MODE_GENERATION) {
    return DocumentManagerFactory.loadFileDocumentManager(executor.getContext().getTmpdir() + executor.getSession().getEngine().hashCode(),executor.getCubeQueryDefinition().getName());
  }
 else {
    return DocumentManagerFactory.createRADocumentManager(executor.getContext().getDocReader());
  }
}
Program: 75950
Project: 75950
Buggy source:
public void defineCube(CubeHandle cubeHandle) throws BirtException {
  int mode=this.sessionContext.getDataEngineContext().getMode();
  try {
    CubeMaterializer cubeMaterializer=null;
    if (mode == DataEngineContext.DIRECT_PRESENTATION) {
      cubeMaterializer=new org.eclipse.birt.data.engine.olap.api.cube.CubeMaterializer(this.sessionContext.getDataEngineContext().getTmpdir(),cubeHandle.getQualifiedName());
      createCube((TabularCubeHandle)cubeHandle,cubeMaterializer);
    }
 else     if (mode == DataEngineContext.MODE_GENERATION) {
      cubeMaterializer=new org.eclipse.birt.data.engine.olap.api.cube.CubeMaterializer(this.sessionContext.getDataEngineContext().getTmpdir(),cubeHandle.getQualifiedName());
      createCube((TabularCubeHandle)cubeHandle,cubeMaterializer);
      cubeMaterializer.saveCubeToReportDocument(cubeHandle.getQualifiedName(),this.sessionContext.getDocumentWriter(),null);
    }
  }
 catch (  Exception e) {
    throw new DataException(e.getLocalizedMessage());
  }
}

Fixed version (ground truth):
public void defineCube(CubeHandle cubeHandle) throws BirtException {
  int mode=this.sessionContext.getDataEngineContext().getMode();
  try {
    CubeMaterializer cubeMaterializer=null;
    if (mode == DataEngineContext.DIRECT_PRESENTATION) {
      cubeMaterializer=createCubeMaterializer(cubeHandle);
      createCube((TabularCubeHandle)cubeHandle,cubeMaterializer);
    }
 else     if (mode == DataEngineContext.MODE_GENERATION) {
      cubeMaterializer=createCubeMaterializer(cubeHandle);
      createCube((TabularCubeHandle)cubeHandle,cubeMaterializer);
      cubeMaterializer.saveCubeToReportDocument(cubeHandle.getQualifiedName(),this.sessionContext.getDocumentWriter(),null);
    }
  }
 catch (  Exception e) {
    throw new DataException(e.getLocalizedMessage());
  }
}
Program: 75951
Project: 75951
Buggy source:
protected IBaseResultSet doExecuteCube(IBaseResultSet parentResult,ICubeQueryDefinition query){
  String queryID=(String)queryIDMap.get(query);
  try {
    String resultSetID=loadResultSetID(parentResult,queryID);
    IBaseQueryResults queryResults=null;
    if (resultSetID == null) {
      IBasePreparedQuery pQuery=dteSession.prepare(query,context.getAppContext());
      if (parentResult != null) {
        queryResults=dteSession.execute(pQuery,parentResult.getQueryResults(),context.getSharedScope());
      }
 else {
        queryResults=dteSession.execute(pQuery,null,context.getSharedScope());
      }
    }
 else {
      queryResults=dteSession.getQueryResults(resultSetID);
    }
    CubeResultSet resultSet=null;
    if (parentResult == null) {
      resultSet=new CubeResultSet(this,context,query,(ICubeQueryResults)queryResults);
    }
 else {
      resultSet=new CubeResultSet(this,context,resultSet,query,(ICubeQueryResults)queryResults);
    }
    return resultSet;
  }
 catch (  BirtException be) {
    logger.log(Level.SEVERE,be.getMessage());
    context.addException(be);
    return null;
  }
}

Fixed version (ground truth):
protected IBaseResultSet doExecuteCube(IBaseResultSet parentResult,ICubeQueryDefinition query){
  String queryID=(String)queryIDMap.get(query);
  try {
    String resultSetID=loadResultSetID(parentResult,queryID);
    IBaseQueryResults queryResults=null;
    query.setQueryResultsID(resultSetID);
    IBasePreparedQuery pQuery=dteSession.prepare(query,context.getAppContext());
    if (parentResult != null) {
      queryResults=dteSession.execute(pQuery,parentResult.getQueryResults(),context.getSharedScope());
    }
 else {
      queryResults=dteSession.execute(pQuery,null,context.getSharedScope());
    }
    CubeResultSet resultSet=null;
    if (parentResult == null) {
      resultSet=new CubeResultSet(this,context,query,(ICubeQueryResults)queryResults);
    }
 else {
      resultSet=new CubeResultSet(this,context,resultSet,query,(ICubeQueryResults)queryResults);
    }
    return resultSet;
  }
 catch (  BirtException be) {
    logger.log(Level.SEVERE,be.getMessage());
    context.addException(be);
    return null;
  }
}
Program: 75952
Project: 75952
Buggy source:
/** 
 * layout the content and its children. It can be called in three status: 1. start, the first time it is called, in this status, it first check if it need page-break-before, 2. inprogress, the second or more time it is called. In this status, it tries to layout the content and its children to the current page. 3. end, the last time it is called. In this status, it means all the content has been layout, it is the time to handle the page-break-after.
 */
public boolean layout(){
switch (status) {
case STATUS_INTIALIZE:
    if (handleVisibility()) {
      status=STATUS_END;
      return false;
    }
  if (isPageBreakBefore() && !context.isPageEmpty()) {
    status=STATUS_START;
    context.endContentWithPageBreak(null);
    return true;
  }
case STATUS_START:
context.startContent(content);
case STATUS_INPROGRESS:
if (status == STATUS_INPROGRESS) {
context.continueContent(content);
}
start();
boolean hasNext=layoutChildren();
end();
if (isChildrenFinished()) {
status=STATUS_END;
}
 else {
status=STATUS_INPROGRESS;
}
if (hasNext) {
context.endContentWithPageBreak(content);
return true;
}
context.endContent(content);
if (isPageBreakAfter()) {
return true;
}
return false;
}
return false;
}

Fixed version (ground truth):
/** 
 * layout the content and its children. It can be called in three status: 1. start, the first time it is called, in this status, it first check if it need page-break-before, 2. inprogress, the second or more time it is called. In this status, it tries to layout the content and its children to the current page. 3. end, the last time it is called. In this status, it means all the content has been layout, it is the time to handle the page-break-after.
 */
public boolean layout(){
switch (status) {
case STATUS_INTIALIZE:
    if (handleVisibility()) {
      status=STATUS_END;
      return false;
    }
  if (isPageBreakBefore()) {
    status=STATUS_START;
    context.endContentWithPageBreak(null);
    return true;
  }
case STATUS_START:
context.startContent(content);
case STATUS_INPROGRESS:
if (status == STATUS_INPROGRESS) {
context.continueContent(content);
}
start();
boolean hasNext=layoutChildren();
end();
if (isChildrenFinished()) {
status=STATUS_END;
}
 else {
status=STATUS_INPROGRESS;
}
if (hasNext) {
context.endContentWithPageBreak(content);
return true;
}
context.endContent(content);
if (isPageBreakAfter()) {
return true;
}
return false;
}
return false;
}
Program: 75953
Project: 75953
Buggy source:
public boolean layout(){
  boolean hasNext=super.layout();
  if (!context.getSkipPageHint()) {
    context.setPageEmpty(false);
  }
  return hasNext;
}

Fixed version (ground truth):
public boolean layout(){
  boolean hasNext=super.layout();
  if (!context.getSkipPageHint() && !hasNext) {
    context.setPageEmpty(false);
  }
  return hasNext;
}
Program: 75955
Project: 75955
Buggy source:
/** 
 * Sets the value of the given property, which is extension property.
 * @param propName the name of the property
 * @param value the value to set
 */
private void setExtensionPropertyValue(String propName,Object value){
  if (value != null)   extensionPropValues.put(propName,value);
 else   extensionPropValues.remove(propName);
}

Fixed version (ground truth):
/** 
 * Sets the value of the given property, which is extension property.
 * @param propName the name of the property
 * @param value the value to set
 */
private void setExtensionPropertyValue(ElementPropertyDefn prop,Object value){
  String propName=prop.getName();
  Object oldValue=extensionPropValues.get(propName);
  if (prop.getTypeCode() == IPropertyType.ELEMENT_REF_TYPE) {
    ElementRefValue oldRef=(ElementRefValue)oldValue;
    ReferenceValueUtil.updateReference(element,oldRef,(ReferenceValue)value,prop);
  }
  if (value != null)   extensionPropValues.put(propName,value);
 else   extensionPropValues.remove(propName);
}
Program: 75956
Project: 75956
Buggy source:
/** 
 * Computes value precision if more precise than existing one For instance 3.4 has a precision of 0.1 and 1400 has a precision of 100. That is the position where the first significant digit appears, or in double representation, the value of the exponent
 * @param precision
 * @param value
 * @return
 */
protected static double getPrecision(double precision,double pValue){
  double value=Math.abs(pValue);
  if (value == 0) {
    if (precision < 0)     return precision;
 else     if (precision >= 0)     return 1;
  }
  if (precision == 0) {
    precision=Math.pow(10,Math.floor(Math.log(value) / Math.log(10)));
  }
  double check=value / precision;
  int loopCounter=0;
  while (Math.floor(check) != check && loopCounter < 20) {
    loopCounter++;
    precision/=10;
    check=value / precision;
  }
  if (loopCounter == 20)   logger.log(ILogger.WARNING,"String_Node_Str" + value);
  return precision;
}

Fixed version (ground truth):
/** 
 * Computes value precision if more precise than existing one For instance 3.4 has a precision of 0.1 and 1400 has a precision of 100. That is the position where the first significant digit appears, or in double representation, the value of the exponent
 * @param precision
 * @param value
 * @return
 */
protected static double getPrecision(double precision,double pValue,FormatSpecifier fs,ULocale locale){
  double value=Math.abs(pValue);
  if (value == 0) {
    if (precision < 0)     return precision;
 else     if (precision >= 0)     return 1;
  }
  if (precision == 0) {
    precision=Math.pow(10,Math.floor(Math.log(value) / Math.log(10)));
  }
  double check=value / precision;
  int loopCounter=0;
  while (Math.floor(check) != check && loopCounter < 20) {
    loopCounter++;
    precision/=10;
    check=value / precision;
  }
  if (loopCounter == 20)   logger.log(ILogger.WARNING,"String_Node_Str" + value);
  if (fs != null) {
    if (fs instanceof NumberFormatSpecifier) {
      NumberFormatSpecifier ns=(NumberFormatSpecifier)fs;
      if (ns.isSetFractionDigits()) {
        double multiplier=ns.isSetMultiplier() ? ns.getMultiplier() : 1;
        if (multiplier != 0) {
          double formatPrecision=Math.pow(10,-ns.getFractionDigits()) / multiplier;
          if (precision == 0)           precision=formatPrecision;
 else           precision=Math.max(precision,formatPrecision);
        }
      }
    }
  }
  return precision;
}
Program: 75958
Project: 75958
Buggy source:
public String format(Date date){
  try {
    return dateFormat.format(date);
  }
 catch (  Exception e) {
    logger.log(Level.WARNING,e.getMessage(),e);
    return null;
  }
}

Fixed version (ground truth):
public String format(Date date){
  try {
    if (formatPattern == null || formatPattern.length() == 0) {
      if (date instanceof java.sql.Date) {
        dateFormat=com.ibm.icu.text.DateFormat.getDateInstance(com.ibm.icu.text.DateFormat.MEDIUM,locale);
        return dateFormat.format(date);
      }
 else       if (date instanceof java.sql.Time) {
        dateFormat=com.ibm.icu.text.DateFormat.getTimeInstance(com.ibm.icu.text.DateFormat.MEDIUM,locale);
        return dateFormat.format(date);
      }
    }
    return dateFormat.format(date);
  }
 catch (  Exception e) {
    logger.log(Level.WARNING,e.getMessage(),e);
    return null;
  }
}
Program: 75961
Project: 75961
Buggy source:
/** 
 * @param name
 * @param resultSets
 * @param writer
 * @throws IOException
 */
public static void save(String name,IAggregationResultSet[] resultSets,IDocArchiveWriter writer) throws IOException {
  RAOutputStream outputStream=writer.createRandomAccessStream(name);
  DataOutputStream dataOutputStream=new DataOutputStream(outputStream);
  if (resultSets == null) {
    dataOutputStream.writeInt(-1);
    return;
  }
  dataOutputStream.writeInt(resultSets.length);
  for (int i=0; i < resultSets.length; i++) {
    saveOneResultSet(dataOutputStream,resultSets[i]);
  }
}

Fixed version (ground truth):
/** 
 * @param name
 * @param resultSets
 * @param writer
 * @throws IOException
 */
public static void save(String name,IAggregationResultSet[] resultSets,IDocArchiveWriter writer) throws IOException {
  RAOutputStream outputStream=writer.createRandomAccessStream(name);
  DataOutputStream dataOutputStream=new DataOutputStream(outputStream);
  if (resultSets == null) {
    dataOutputStream.writeInt(-1);
    return;
  }
  dataOutputStream.writeInt(resultSets.length);
  dataOutputStream.close();
  for (int i=0; i < resultSets.length; i++) {
    outputStream=writer.createRandomAccessStream(name + i);
    dataOutputStream=new DataOutputStream(outputStream);
    saveOneResultSet(dataOutputStream,resultSets[i]);
  }
}
Program: 75962
Project: 75962
Buggy source:
/** 
 * @param name
 * @param reader
 * @throws IOException
 */
public static IAggregationResultSet[] load(String name,IDocArchiveReader reader) throws IOException {
  RAInputStream inputStream=reader.getStream(name);
  DataInputStream dataInputStream=new DataInputStream(inputStream);
  int size=dataInputStream.readInt();
  if (size <= 0) {
    return null;
  }
  IAggregationResultSet[] result=new IAggregationResultSet[size];
  for (int i=0; i < size; i++) {
    result[i]=loadOneResultSet(dataInputStream);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * @param name
 * @param reader
 * @throws IOException
 */
public static IAggregationResultSet[] load(String name,IDocArchiveReader reader) throws IOException {
  RAInputStream inputStream=reader.getStream(name);
  DataInputStream dataInputStream=new DataInputStream(inputStream);
  int size=dataInputStream.readInt();
  inputStream.close();
  if (size <= 0) {
    return null;
  }
  IAggregationResultSet[] result=new IAggregationResultSet[size];
  for (int i=0; i < size; i++) {
    inputStream=reader.getStream(name + i);
    dataInputStream=new DataInputStream(inputStream);
    result[i]=loadOneResultSet(dataInputStream);
  }
  return result;
}
Program: 75963
Project: 75963
Buggy source:
/** 
 * @param outputStream
 * @param resultSet
 * @throws IOException
 */
private static void saveOneResultSet(DataOutputStream outputStream,IAggregationResultSet resultSet) throws IOException {
  if (resultSet instanceof AggregationResultSet) {
    saveMetaData(outputStream,(AggregationResultSet)resultSet);
    saveAggregationRowSet(outputStream,(AggregationResultSet)resultSet);
  }
}

Fixed version (ground truth):
/** 
 * @param outputStream
 * @param resultSet
 * @throws IOException
 */
private static void saveOneResultSet(DataOutputStream outputStream,IAggregationResultSet resultSet) throws IOException {
  if (resultSet instanceof AggregationResultSet) {
    saveMetaData(outputStream,(AggregationResultSet)resultSet);
    saveAggregationRowSet(outputStream,(AggregationResultSet)resultSet);
  }
  outputStream.close();
}
Program: 75964
Project: 75964
Buggy source:
public void seek(int index) throws IOException {
  if (index >= aggregationResultRow.size()) {
    return;
  }
  currentPosition=index;
  resultObject=(AggregationResultRow)aggregationResultRow.get(index);
}

Fixed version (ground truth):
public void seek(int index) throws IOException {
  if (index >= length) {
    return;
  }
  if (index >= aggregationResultRow.size()) {
    for (int i=0; i <= index - aggregationResultRow.size(); i++) {
      aggregationResultRow.add(AggregationResultSetSaveUtil.loadAggregationRow(inputStream));
    }
  }
  currentPosition=index;
  resultObject=(AggregationResultRow)aggregationResultRow.get(index);
}