nus-yam/ex-repair huggingface dataset:
Program: 75095
Project: 75095
Buggy source:
/** 
 * Evaluate the specified binding column in MANUAL_BINDING mode.
 * @param baseExpr
 * @param exprType
 * @param valueMap
 * @throws DataException
 */
Object evaluateValue(String bindingName) throws DataException {
  return this.evaluateValue(getBindingFromManualBinding(bindingName),MANUAL_BINDING);
}

Fixed version (ground truth):
/** 
 * Evaluate the specified binding column in MANUAL_BINDING mode.
 * @param baseExpr
 * @param exprType
 * @param valueMap
 * @throws DataException
 */
Object evaluateValue(IBaseExpression expr,String bindingName) throws DataException {
  return this.evaluateValue(getBindingFromManualBinding(expr,bindingName),MANUAL_BINDING);
}
Program: 75096
Project: 75096
Buggy source:
/** 
 */
public ExprManager(IBaseQueryDefinition baseQueryDefn){
  bindingExprs=new ArrayList();
  autoBindingExprMap=new HashMap();
  entryLevel=OVERALL_GROUP;
  this.baseQueryDefn=baseQueryDefn;
  this.autoBindingMap=new HashMap();
}

Fixed version (ground truth):
/** 
 * An exprManager object is to manipulate all available column bindings for specified query definition.
 * @param baseQueryDefn
 */
public ExprManager(IBaseQueryDefinition baseQueryDefn){
  this(baseQueryDefn,null);
}
Program: 75097
Project: 75097
Buggy source:
/** 
 * @param name
 * @return
 * @throws DataException
 */
public IBinding getBinding(String name) throws DataException {
  for (int i=0; i < bindingExprs.size(); i++) {
    GroupBindingColumn gcb=(GroupBindingColumn)bindingExprs.get(i);
    if (entryLevel != OVERALL_GROUP) {
      if (gcb.getGroupLevel() > entryLevel)       continue;
    }
    if (gcb.getBinding(name) != null)     return gcb.getBinding(name);
  }
  if (this.autoBindingMap.containsKey(name)) {
    return (IBinding)this.autoBindingMap.get(name);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * @param name
 * @return
 * @throws DataException
 */
public IBinding getBinding(String name) throws DataException {
  for (int i=0; i < bindingExprs.size(); i++) {
    GroupBindingColumn gcb=(GroupBindingColumn)bindingExprs.get(i);
    if (entryLevel != OVERALL_GROUP) {
      if (gcb.getGroupLevel() > entryLevel)       continue;
    }
    if (gcb.getBinding(name) != null)     return gcb.getBinding(name);
  }
  if (this.autoBindingMap.containsKey(name)) {
    return (IBinding)this.autoBindingMap.get(name);
  }
  if (this.parent != null) {
    return parent.getBinding(name);
  }
  return null;
}
Program: 75098
Project: 75098
Buggy source:
/** 
 * @param name
 * @return
 * @throws DataException 
 */
private IBaseExpression getBindingExpr(String name) throws DataException {
  for (int i=0; i < bindingExprs.size(); i++) {
    GroupBindingColumn gcb=(GroupBindingColumn)bindingExprs.get(i);
    if (entryLevel != OVERALL_GROUP) {
      if (gcb.getGroupLevel() > entryLevel)       continue;
    }
    Object o=gcb.getExpression(name);
    if (o != null)     return (IBaseExpression)o;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * @param name
 * @return
 * @throws DataException 
 */
private IBaseExpression getBindingExpr(String name) throws DataException {
  for (int i=0; i < bindingExprs.size(); i++) {
    GroupBindingColumn gcb=(GroupBindingColumn)bindingExprs.get(i);
    if (entryLevel != OVERALL_GROUP) {
      if (gcb.getGroupLevel() > entryLevel)       continue;
    }
    Object o=gcb.getExpression(name);
    if (o != null)     return (IBaseExpression)o;
  }
  if (this.parent != null) {
    return this.parent.getBindingExpr(name);
  }
  return null;
}
Program: 75099
Project: 75099
Buggy source:
/** 
 * @return
 */
private List getColumnNames(){
  List bindingExprs=exprManager.getBindingExprs();
  Map autoBindingExprMap=exprManager.getAutoBindingExprMap();
  List l=new ArrayList();
  l.addAll(autoBindingExprMap.keySet());
  for (int i=0; i < bindingExprs.size(); i++) {
    l.addAll(((GroupBindingColumn)bindingExprs.get(i)).getColumnNames());
  }
  return l;
}

Fixed version (ground truth):
/** 
 * @return
 */
private List getColumnNames(){
  List bindingExprs=exprManager.getBindingExprs();
  Map autoBindingExprMap=exprManager.getAutoBindingExprMap();
  List l=new ArrayList();
  l.addAll(autoBindingExprMap.keySet());
  for (int i=0; i < bindingExprs.size(); i++) {
    l.addAll(((GroupBindingColumn)bindingExprs.get(i)).getColumnNames());
  }
  ExprManager exprManager1=exprManager;
  while (exprManager1.getParentExprManager() != null) {
    bindingExprs=exprManager1.getParentExprManager().getBindingExprs();
    autoBindingExprMap=exprManager1.getParentExprManager().getAutoBindingExprMap();
    l.addAll(autoBindingExprMap.keySet());
    for (int i=0; i < bindingExprs.size(); i++) {
      l.addAll(((GroupBindingColumn)bindingExprs.get(i)).getColumnNames());
    }
    exprManager1=exprManager1.getParentExprManager();
  }
  return l;
}
Program: 75100
Project: 75100
Buggy source:
/** 
 * @param columnBindingName
 * @param queryDefn
 * @return
 */
private String findExpression(String columnBindingName,IBaseQueryDefinition queryDefn){
  if (queryDefn == null) {
    return null;
  }
  if (queryDefn.getBindings().get(columnBindingName) == null) {
    return findExpression(columnBindingName,queryDefn.getParentQuery());
  }
  IBaseExpression expr=(IBaseExpression)((IBinding)queryDefn.getBindings().get(columnBindingName));
  if (expr instanceof IScriptExpression)   return ((IScriptExpression)expr).getText();
 else   return null;
}

Fixed version (ground truth):
/** 
 * @param columnBindingName
 * @param queryDefn
 * @return
 * @throws DataException 
 */
private String findExpression(String columnBindingName,IBaseQueryDefinition queryDefn) throws DataException {
  if (queryDefn == null) {
    return null;
  }
  if (queryDefn.getBindings().get(columnBindingName) == null) {
    return findExpression(columnBindingName,queryDefn.getParentQuery());
  }
  IBaseExpression expr=((IBinding)queryDefn.getBindings().get(columnBindingName)).getExpression();
  if (expr instanceof IScriptExpression)   return ((IScriptExpression)expr).getText();
 else   return null;
}
Program: 75102
Project: 75102
Buggy source:
/** 
 * @param deContext
 * @param scope
 * @param queryDefn
 * @param queryService
 * @param appContext
 * @throws DataException
 */
PreparedQuery(DataEngineSession session,DataEngineContext deContext,IBaseQueryDefinition queryDefn,IPreparedQueryService queryService,Map appContext) throws DataException {
}

Fixed version (ground truth):
/** 
 * @param session
 * @param deContext
 * @param queryDefn
 * @param queryService
 * @param appContext
 * @param parentExprManager
 * @throws DataException
 */
PreparedQuery(DataEngineSession session,DataEngineContext deContext,IBaseQueryDefinition queryDefn,IPreparedQueryService queryService,Map appContext) throws DataException {
  this(session,deContext,queryDefn,queryService,appContext,null);
}
Program: 75104
Project: 75104
Buggy source:
/** 
 * @param subquery Subquery definition
 * @param parentQuery Parent query (which can be a subquery itself, or a PreparedReportQuery)
 * @param groupLevel Index of group in which this subquery is defined within the parent query. If 0, subquery is defined outside of any groups.
 * @throws DataException
 */
PreparedSubquery(DataEngineSession session,DataEngineContext context,ISubqueryDefinition subquery,IPreparedQueryService queryService,int groupLevel) throws DataException {
  Object[] params={session,context,subquery,queryService,new Integer(groupLevel)};
  logger.entering(PreparedSubquery.class.getName(),"String_Node_Str",params);
  this.groupLevel=groupLevel;
  this.queryService=queryService;
  this.subQueryOnGroup=subquery.applyOnGroup();
  logger.logp(Level.FINER,PreparedSubquery.class.getName(),"String_Node_Str","String_Node_Str");
  this.session=session;
  this.preparedQuery=new PreparedQuery(session,context,subquery,this,null);
  logger.exiting(PreparedSubquery.class.getName(),"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @param subquery Subquery definition
 * @param parentQuery Parent query (which can be a subquery itself, or a PreparedReportQuery)
 * @param groupLevel Index of group in which this subquery is defined within the parent query. If 0, subquery is defined outside of any groups.
 * @param parentExprManager Parent query's expression manager
 * @throws DataException
 */
PreparedSubquery(DataEngineSession session,DataEngineContext context,ISubqueryDefinition subquery,IPreparedQueryService queryService,int groupLevel,ExprManager parentExprManager) throws DataException {
  Object[] params={session,context,subquery,queryService,new Integer(groupLevel)};
  logger.entering(PreparedSubquery.class.getName(),"String_Node_Str",params);
  this.groupLevel=groupLevel;
  this.queryService=queryService;
  this.subQueryOnGroup=subquery.applyOnGroup();
  logger.logp(Level.FINER,PreparedSubquery.class.getName(),"String_Node_Str","String_Node_Str");
  this.session=session;
  this.preparedQuery=new PreparedQuery(session,context,subquery,this,null,parentExprManager);
  logger.exiting(PreparedSubquery.class.getName(),"String_Node_Str");
}
Program: 75105
Project: 75105
Buggy source:
/** 
 * @return session temp dir
 * @throws IOException 
 */
public static String createSessionTempDir(String tempRootDir){
  final String prefix="String_Node_Str";
  File sessionFile=null;
synchronized (cacheCounter2) {
    String sessionTempDir=tempRootDir + File.separator + prefix+ System.currentTimeMillis()+ cacheCounter2.intValue();
    cacheCounter2=new Integer(cacheCounter2.intValue() + 1);
    sessionFile=new File(sessionTempDir);
    int i=0;
    while (sessionFile.exists() || !sessionFile.mkdir()) {
      i++;
      sessionTempDir=sessionTempDir + "String_Node_Str" + i;
      sessionFile=new File(sessionTempDir);
    }
    sessionFile.deleteOnExit();
  }
  System.out.println("String_Node_Str" + sessionFile.getAbsolutePath());
  return getCanonicalPath(sessionFile);
}

Fixed version (ground truth):
/** 
 * @return session temp dir
 * @throws IOException 
 */
public static String createSessionTempDir(String tempRootDir){
  final String prefix="String_Node_Str";
  File sessionFile=null;
synchronized (cacheCounter2) {
    String sessionTempDir=tempRootDir + File.separator + prefix+ System.currentTimeMillis()+ cacheCounter2.intValue();
    cacheCounter2=new Integer(cacheCounter2.intValue() + 1);
    sessionFile=new File(sessionTempDir);
    int i=0;
    while (sessionFile.exists() || !sessionFile.mkdir()) {
      i++;
      sessionTempDir=sessionTempDir + "String_Node_Str" + i;
      sessionFile=new File(sessionTempDir);
    }
    sessionFile.deleteOnExit();
  }
  return getCanonicalPath(sessionFile);
}
Program: 75106
Project: 75106
Buggy source:
public IResultObject next() throws DataException {
  if (this.rowFetchLimit <= 0 || this.rowCount < this.rowFetchLimit) {
    IResultObject result=doNext();
    if (result != null)     this.rowCount++;
    return result;
  }
  return null;
}

Fixed version (ground truth):
public IResultObject next() throws DataException {
  if (this.rowFetchLimit <= 0 || this.rowCount < this.rowFetchLimit) {
    IResultObject result=doNext();
    while (this.shouldContinueSeek) {
      result=doNext();
    }
    if (result != null)     this.rowCount++;
    return result;
  }
  return null;
}
Program: 75107
Project: 75107
Buggy source:
/** 
 * Return the IResultObject instance of a data set when curComparedResult is less than 0;
 * @return
 * @throws DataException
 */
private IResultObject lessNext() throws DataException {
  if (curPrimaryMatchValues == null) {
    return null;
  }
  if (joinType == IJointDataSetDesign.INNER_JOIN && curSecondaryMatchValues == null) {
    return null;
  }
  IResultObject resultObject=null;
  if (joinType != IJointDataSetDesign.INNER_JOIN)   resultObject=createResultObject(curPrimaryResultObject,null);
  fetchPrimaryObject();
  curComparedResult=getCompartorResult();
  if (joinType != IJointDataSetDesign.INNER_JOIN) {
    return resultObject;
  }
 else {
    return doNext();
  }
}

Fixed version (ground truth):
/** 
 * Return the IResultObject instance of a data set when curComparedResult is less than 0;
 * @return
 * @throws DataException
 */
private IResultObject lessNext() throws DataException {
  if (curPrimaryMatchValues == null) {
    return null;
  }
  if (joinType == IJointDataSetDesign.INNER_JOIN && curSecondaryMatchValues == null) {
    return null;
  }
  IResultObject resultObject=null;
  if (joinType != IJointDataSetDesign.INNER_JOIN)   resultObject=createResultObject(curPrimaryResultObject,null);
  fetchPrimaryObject();
  curComparedResult=getCompartorResult();
  if (joinType != IJointDataSetDesign.INNER_JOIN) {
    return resultObject;
  }
 else {
    this.shouldContinueSeek=true;
    return null;
  }
}
Program: 75108
Project: 75108
Buggy source:
/** 
 * Return the IResultObject instance of a data set when curComparedResult is greater than 0;
 * @return
 * @throws DataException
 */
private IResultObject greaterNext() throws DataException {
  if (curPrimaryMatchValues == null && joinType != IJointDataSetDesign.FULL_OUTER_JOIN) {
    return null;
  }
  if (joinType == IJointDataSetDesign.FULL_OUTER_JOIN && curSecondaryResultObjects.next() && !beSecondaryUsed) {
    return createResultObject(null,curSecondaryResultObjects.getCurrentResult());
  }
  fetchSecondaryObjects();
  curComparedResult=getCompartorResult();
  return doNext();
}

Fixed version (ground truth):
/** 
 * Return the IResultObject instance of a data set when curComparedResult is greater than 0;
 * @return
 * @throws DataException
 */
private IResultObject greaterNext() throws DataException {
  if (curPrimaryMatchValues == null && joinType != IJointDataSetDesign.FULL_OUTER_JOIN) {
    return null;
  }
  if (joinType == IJointDataSetDesign.FULL_OUTER_JOIN && curSecondaryResultObjects.next() && !beSecondaryUsed) {
    return createResultObject(null,curSecondaryResultObjects.getCurrentResult());
  }
  fetchSecondaryObjects();
  curComparedResult=getCompartorResult();
  this.shouldContinueSeek=true;
  return null;
}
Program: 75109
Project: 75109
Buggy source:
/** 
 * Constructor.
 * @param left
 * @param right
 * @param meta
 * @param jcm
 * @param joinType
 * @param seeker
 * @throws DataException
 */
public BaseJointDataSetPopulator(IResultIterator left,IResultIterator right,JointResultMetadata meta,IJoinConditionMatcher jcm,int joinType,IMatchResultObjectSeeker seeker,DataEngineSession session,int rowFetchLimit) throws DataException {
  this.meta=meta;
  this.joinType=joinType;
  this.jcm=jcm;
  this.session=session;
  if (isPrimaryLeft()) {
    this.primaryIterator=left;
    this.secondaryIterator=right;
  }
 else {
    this.primaryIterator=right;
    this.secondaryIterator=left;
  }
  beInitialized=false;
  this.rowFetchLimit=rowFetchLimit;
  this.rowCount=0;
}

Fixed version (ground truth):
/** 
 * Constructor.
 * @param left
 * @param right
 * @param meta
 * @param jcm
 * @param joinType
 * @param seeker
 * @throws DataException
 */
public BaseJointDataSetPopulator(IResultIterator left,IResultIterator right,JointResultMetadata meta,IJoinConditionMatcher jcm,int joinType,IMatchResultObjectSeeker seeker,DataEngineSession session,int rowFetchLimit) throws DataException {
  this.meta=meta;
  this.joinType=joinType;
  this.jcm=jcm;
  this.session=session;
  if (isPrimaryLeft()) {
    this.primaryIterator=left;
    this.secondaryIterator=right;
  }
 else {
    this.primaryIterator=right;
    this.secondaryIterator=left;
  }
  beInitialized=false;
  this.rowFetchLimit=rowFetchLimit;
  this.rowCount=0;
  this.shouldContinueSeek=false;
}
Program: 75110
Project: 75110
Buggy source:
/** 
 * @return
 * @throws DataException
 */
private IResultObject doNext() throws DataException {
  if (!beInitialized) {
    initialize();
    beInitialized=true;
  }
  if (curComparedResult == 0) {
    return equalNext();
  }
  if (curComparedResult < 0) {
    return lessNext();
  }
  if (curComparedResult > 0) {
    return greaterNext();
  }
  return null;
}

Fixed version (ground truth):
/** 
 * @return
 * @throws DataException
 */
private IResultObject doNext() throws DataException {
  this.shouldContinueSeek=false;
  if (!beInitialized) {
    initialize();
    beInitialized=true;
  }
  if (curComparedResult == 0) {
    return equalNext();
  }
  if (curComparedResult < 0) {
    return lessNext();
  }
  if (curComparedResult > 0) {
    return greaterNext();
  }
  return null;
}
Program: 75111
Project: 75111
Buggy source:
/** 
 * Return the IResultObject instance of a data set when curComparedResult is equal to 0;
 * @return
 * @throws DataException
 */
private IResultObject equalNext() throws DataException {
  if (curSecondaryResultObjects.next()) {
    beSecondaryUsed=true;
    return createResultObject(curPrimaryResultObject,(IResultObject)(curSecondaryResultObjects.getCurrentResult()));
  }
 else {
    fetchPrimaryObject();
    curComparedResult=getCompartorResult();
    return doNext();
  }
}

Fixed version (ground truth):
/** 
 * Return the IResultObject instance of a data set when curComparedResult is equal to 0;
 * @return
 * @throws DataException
 */
private IResultObject equalNext() throws DataException {
  if (curSecondaryResultObjects.next()) {
    beSecondaryUsed=true;
    return createResultObject(curPrimaryResultObject,(IResultObject)(curSecondaryResultObjects.getCurrentResult()));
  }
 else {
    fetchPrimaryObject();
    curComparedResult=getCompartorResult();
    this.shouldContinueSeek=true;
    return null;
  }
}
Program: 75114
Project: 75114
Buggy source:
public static TableInfo createTable(ITableContent table,int width){
  int colcount=table.getColumnCount();
  int[] index=new int[colcount];
  int know=0;
  List unmount=new ArrayList();
  for (int i=0; i < colcount; i++) {
    DimensionType value=table.getColumn(i).getWidth();
    if (value == null) {
      unmount.add(new Integer(i));
    }
 else {
      try {
        index[i]=ExcelUtil.covertDimensionType(value,width);
        know+=index[i];
      }
 catch (      IllegalArgumentException ex) {
        unmount.add(new Integer(i));
      }
    }
  }
  int left=width - know;
  if (left > 0 && unmount.size() == 0) {
    index[index.length - 1]=index[index.length - 1] + left;
    return new DefaultTableInfo(index);
  }
 else   if (left < 0) {
    return new DefaultTableInfo(split(width,colcount));
  }
 else   if (left > 0 && unmount.size() > 0) {
    int[] size=split(left,unmount.size());
    Iterator iter=unmount.iterator();
    int i=0;
    while (iter.hasNext()) {
      int pos=((Integer)iter.next()).intValue();
      index[pos]=size[i];
      i++;
    }
    return new DefaultTableInfo(index);
  }
 else {
    return new DefaultTableInfo(index);
  }
}

Fixed version (ground truth):
public static TableInfo createTable(ITableContent table,int width){
  int colcount=table.getColumnCount();
  if (colcount == 0) {
    return null;
  }
  int[] index=new int[colcount];
  int know=0;
  List unmount=new ArrayList();
  for (int i=0; i < colcount; i++) {
    DimensionType value=table.getColumn(i).getWidth();
    if (value == null) {
      unmount.add(new Integer(i));
    }
 else {
      try {
        index[i]=ExcelUtil.covertDimensionType(value,width);
        know+=index[i];
      }
 catch (      IllegalArgumentException ex) {
        unmount.add(new Integer(i));
      }
    }
  }
  int left=width - know;
  if (left > 0 && unmount.size() == 0) {
    index[index.length - 1]=index[index.length - 1] + left;
    return new DefaultTableInfo(index);
  }
 else   if (left < 0) {
    return new DefaultTableInfo(split(width,colcount));
  }
 else   if (left > 0 && unmount.size() > 0) {
    int[] size=split(left,unmount.size());
    Iterator iter=unmount.iterator();
    int i=0;
    while (iter.hasNext()) {
      int pos=((Integer)iter.next()).intValue();
      index[pos]=size[i];
      i++;
    }
    return new DefaultTableInfo(index);
  }
 else {
    return new DefaultTableInfo(index);
  }
}
Program: 75115
Project: 75115
Buggy source:
public void endTable(){
  tables.pop();
  endContainer();
}

Fixed version (ground truth):
public void endTable(){
  if (!tables.isEmpty()) {
    tables.pop();
    endContainer();
  }
}
Program: 75118
Project: 75118
Buggy source:
/** 
 * @param measurename
 * @param functionName
 */
public AggregationFunctionDefinition(String measurename,String functionName){
  Object[] params={measurename,functionName};
  logger.entering(AggregationFunctionDefinition.class.getName(),"String_Node_Str",params);
  this.measureName=measurename;
  this.functionName=functionName;
  logger.exiting(AggregationFunctionDefinition.class.getName(),"String_Node_Str");
}

Fixed version (ground truth):
/** 
 * @param measurename
 * @param functionName
 */
public AggregationFunctionDefinition(String measureName,String functionName){
  this(null,measureName,null,null,functionName,null);
}
Program: 75119
Project: 75119
Buggy source:
/** 
 * @param key1
 * @param key2
 * @return
 */
private static int compare(Object[] key1,Object[] key2){
  for (int i=0; i < key1.length; i++) {
    int result=((Comparable)key1[i]).compareTo(key2[i]);
    if (result < 0) {
      return result;
    }
 else     if (result > 0) {
      return result;
    }
  }
  return 0;
}

Fixed version (ground truth):
/** 
 * @param key1
 * @param key2
 * @return
 */
private int compare(Object[] key1,Object[] key2){
  for (int i=0; i < aggregation.getLevels().length; i++) {
    int result=((Comparable)key1[i]).compareTo(key2[i]);
    if (result < 0) {
      return result;
    }
 else     if (result > 0) {
      return result;
    }
  }
  return 0;
}
Program: 75120
Project: 75120
Buggy source:
/** 
 * @param row
 * @throws IOException
 * @throws DataException
 */
void onRow(Row4Aggregation row) throws IOException, DataException {
  if (currentResultObj == null) {
    newAggregationResultRow(row);
  }
 else {
    if (currentResultObj.getLevelMembers() == null || compare(row.getLevelMembers(),currentResultObj.getLevelMembers()) == 0) {
      if (accumulators != null) {
        for (int i=0; i < accumulators.length; i++) {
          accumulators[i].onRow(getAccumulatorParameter(row,i));
        }
      }
    }
 else {
      if (accumulators != null) {
        currentResultObj.setAggregationValues(new Object[accumulators.length]);
        for (int i=0; i < accumulators.length; i++) {
          accumulators[i].finish();
          currentResultObj.getAggregationValues()[i]=accumulators[i].getValue();
          accumulators[i].start();
        }
      }
      result.add(currentResultObj);
      newAggregationResultRow(row);
    }
  }
}

Fixed version (ground truth):
/** 
 * @param row
 * @throws IOException
 * @throws DataException
 */
void onRow(Row4Aggregation row) throws IOException, DataException {
  if (currentResultObj == null) {
    newAggregationResultRow(row);
  }
 else {
    if (currentResultObj.getLevelMembers() == null || compare(row.getLevelMembers(),currentResultObj.getLevelMembers()) == 0) {
      if (accumulators != null) {
        for (int i=0; i < accumulators.length; i++) {
          if (!getFilterResult(row,i)) {
            continue;
          }
          accumulators[i].onRow(getAccumulatorParameter(row,i));
        }
      }
    }
 else {
      if (accumulators != null) {
        currentResultObj.setAggregationValues(new Object[accumulators.length]);
        for (int i=0; i < accumulators.length; i++) {
          accumulators[i].finish();
          currentResultObj.getAggregationValues()[i]=accumulators[i].getValue();
          accumulators[i].start();
        }
      }
      result.add(currentResultObj);
      newAggregationResultRow(row);
    }
  }
}
Program: 75122
Project: 75122
Buggy source:
/** 
 * @param row
 * @throws DataException
 */
private void newAggregationResultRow(Row4Aggregation row) throws DataException {
  currentResultObj=new AggregationResultRow();
  if (levelCount > 0) {
    currentResultObj.setLevelMembers(new Member[levelCount]);
    System.arraycopy(row.getLevelMembers(),0,currentResultObj.getLevelMembers(),0,currentResultObj.getLevelMembers().length);
  }
  if (accumulators != null) {
    for (int i=0; i < accumulators.length; i++) {
      accumulators[i].onRow(getAccumulatorParameter(row,i));
    }
  }
}

Fixed version (ground truth):
/** 
 * @param row
 * @throws DataException
 */
private void newAggregationResultRow(Row4Aggregation row) throws DataException {
  currentResultObj=new AggregationResultRow();
  if (levelCount > 0) {
    currentResultObj.setLevelMembers(new Member[levelCount]);
    System.arraycopy(row.getLevelMembers(),0,currentResultObj.getLevelMembers(),0,currentResultObj.getLevelMembers().length);
  }
  if (accumulators != null) {
    for (int i=0; i < accumulators.length; i++) {
      if (!getFilterResult(row,i)) {
        continue;
      }
      accumulators[i].onRow(getAccumulatorParameter(row,i));
    }
  }
}
Program: 75123
Project: 75123
Buggy source:
/** 
 * @param stopSign
 * @return
 * @throws IOException
 * @throws BirtException
 */
public IAggregationResultSet[] execute(StopSign stopSign) throws IOException, BirtException {
  populateSortedFactRows(stopSign);
  for (int i=0; i < allSortedFactRows.size(); i++) {
    DiskSortedStackWrapper diskSortedStackWrapper=(DiskSortedStackWrapper)allSortedFactRows.get(i);
    int[] calculatorIndexs=new int[sortedFactRows.length];
    int pos=0;
    for (int j=0; j < calculatorIndexs.length; j++) {
      if (sortedFactRows[j] == diskSortedStackWrapper) {
        calculatorIndexs[pos]=j;
        pos++;
      }
    }
    while (diskSortedStackWrapper.pop() != null && !stopSign.isStopped()) {
      Row4Aggregation row=(Row4Aggregation)diskSortedStackWrapper.getCurrentObject();
      for (int j=0; j < pos; j++) {
        aggregationCalculators[calculatorIndexs[j]].onRow(cut(row,levelIndex[calculatorIndexs[j]].length / 2));
      }
    }
  }
  IAggregationResultSet[] resultSets=new IAggregationResultSet[aggregationCalculators.length];
  for (int i=0; i < aggregationCalculators.length; i++) {
    resultSets[i]=new AggregationResultSet(aggregationCalculators[i].aggregation,aggregationCalculators[i].getResult(),getKeyNames(i),getAttributeNames(i));
  }
  return resultSets;
}

Fixed version (ground truth):
/** 
 * @param stopSign
 * @return
 * @throws IOException
 * @throws BirtException
 */
public IAggregationResultSet[] execute(StopSign stopSign) throws IOException, BirtException {
  populateSortedFactRows(stopSign);
  for (int i=0; i < allSortedFactRows.size(); i++) {
    DiskSortedStackWrapper diskSortedStackWrapper=(DiskSortedStackWrapper)allSortedFactRows.get(i);
    int[] calculatorIndexs=new int[sortedFactRows.length];
    int pos=0;
    for (int j=0; j < calculatorIndexs.length; j++) {
      if (sortedFactRows[j] == diskSortedStackWrapper) {
        calculatorIndexs[pos]=j;
        pos++;
      }
    }
    while (diskSortedStackWrapper.pop() != null && !stopSign.isStopped()) {
      Row4Aggregation row=(Row4Aggregation)diskSortedStackWrapper.getCurrentObject();
      for (int j=0; j < pos; j++) {
        aggregationCalculators[calculatorIndexs[j]].onRow(row);
      }
    }
  }
  IAggregationResultSet[] resultSets=new IAggregationResultSet[aggregationCalculators.length];
  for (int i=0; i < aggregationCalculators.length; i++) {
    resultSets[i]=new AggregationResultSet(aggregationCalculators[i].aggregation,aggregationCalculators[i].getResult(),getKeyNames(i),getAttributeNames(i));
  }
  return resultSets;
}
Program: 75126
Project: 75126
Buggy source:
public void testVisionOptimize() throws EngineException, IOException {
  HTMLRenderOption options=new HTMLRenderOption();
  options.setEnableAgentStyleEngine(false);
  ByteArrayOutputStream output=new ByteArrayOutputStream();
  List instanceIDs=new ArrayList();
  options.setInstanceIDs(instanceIDs);
  options.setOutputStream(output);
  options.setEnableMetadata(true);
  IRenderTask task=createRenderTask(designFile);
  task.setRenderOption(options);
  task.render();
  task.close();
  String content=new String(output.toByteArray());
  output.close();
  content=content.replaceAll("String_Node_Str","String_Node_Str");
  String regex="String_Node_Str";
  Matcher matcher=Pattern.compile(regex).matcher(content);
  assertEquals(true,matcher.find());
}

Fixed version (ground truth):
public void testVisionOptimize() throws EngineException, IOException {
  HTMLRenderOption options=new HTMLRenderOption();
  options.setEnableAgentStyleEngine(false);
  options.setEmbeddable(true);
  ByteArrayOutputStream output=new ByteArrayOutputStream();
  List instanceIDs=new ArrayList();
  options.setInstanceIDs(instanceIDs);
  options.setOutputStream(output);
  options.setEnableMetadata(true);
  IRenderTask task=createRenderTask(designFile);
  task.setRenderOption(options);
  task.render();
  task.close();
  String content=new String(output.toByteArray());
  output.close();
  String regex="String_Node_Str";
  Matcher matcher=Pattern.compile(regex).matcher(content);
  assertEquals(true,matcher.find());
}
Program: 75127
Project: 75127
Buggy source:
public void testPerformanceOptimize() throws EngineException, IOException {
  HTMLRenderOption options=new HTMLRenderOption();
  options.setEnableAgentStyleEngine(true);
  ByteArrayOutputStream output=new ByteArrayOutputStream();
  List instanceIDs=new ArrayList();
  options.setInstanceIDs(instanceIDs);
  options.setOutputStream(output);
  options.setEnableMetadata(true);
  IRenderTask task=createRenderTask(designFile);
  task.setRenderOption(options);
  task.render();
  task.close();
  String content=new String(output.toByteArray());
  output.close();
  content=content.replaceAll("String_Node_Str","String_Node_Str");
  String regex="String_Node_Str";
  Matcher matcher=Pattern.compile(regex).matcher(content);
  assertEquals(false,matcher.find());
}

Fixed version (ground truth):
public void testPerformanceOptimize() throws EngineException, IOException {
  HTMLRenderOption options=new HTMLRenderOption();
  options.setEnableAgentStyleEngine(true);
  options.setEmbeddable(true);
  ByteArrayOutputStream output=new ByteArrayOutputStream();
  List instanceIDs=new ArrayList();
  options.setInstanceIDs(instanceIDs);
  options.setOutputStream(output);
  options.setEnableMetadata(true);
  IRenderTask task=createRenderTask(designFile);
  task.setRenderOption(options);
  task.render();
  task.close();
  String content=new String(output.toByteArray());
  output.close();
  String regex="String_Node_Str";
  Matcher matcher=Pattern.compile(regex).matcher(content);
  assertEquals(true,matcher.find());
  regex="String_Node_Str";
  matcher=Pattern.compile(regex).matcher(content);
  assertEquals(false,matcher.find());
}
Program: 75128
Project: 75128
Buggy source:
static void handleStyle(Element ele,Map cssStyles,IContent content){
  String tagName=ele.getTagName();
  StyleDeclaration style=new StyleDeclaration(content.getCSSEngine());
  if ("String_Node_Str".equals(tagName)) {
    String attr=ele.getAttribute("String_Node_Str");
    if (null != attr && !"String_Node_Str".equals(attr)) {
      style.setFontSize(attr);
    }
    attr=ele.getAttribute("String_Node_Str");
    if (null != attr && !"String_Node_Str".equals(attr)) {
      style.setColor(attr);
    }
    attr=ele.getAttribute("String_Node_Str");
    if (null != attr && !"String_Node_Str".equals(attr)) {
      style.setFontFamily(attr);
    }
  }
  if (htmlDisplayMode.contains(tagName)) {
    style.setDisplay("String_Node_Str");
  }
 else {
    style.setDisplay("String_Node_Str");
  }
  IStyle inlineStyle=(IStyle)cssStyles.get(ele);
  if (inlineStyle != null) {
    style.setProperties(inlineStyle);
  }
  if (tag2Style.containsKey(ele.getTagName())) {
    StyleDeclaration tagStyle=(StyleDeclaration)content.getCSSEngine().parseStyleDeclaration((String)tag2Style.get(ele.getTagName()));
    if (tagStyle != null) {
      style.setProperties(tagStyle);
    }
  }
  content.setInlineStyle(style);
}

Fixed version (ground truth):
static void handleStyle(Element ele,Map cssStyles,IContent content){
  String tagName=ele.getTagName();
  StyleDeclaration style=new StyleDeclaration(content.getCSSEngine());
  if ("String_Node_Str".equals(tagName)) {
    String attr=ele.getAttribute("String_Node_Str");
    if (null != attr && !"String_Node_Str".equals(attr)) {
      style.setFontSize(attr);
    }
    attr=ele.getAttribute("String_Node_Str");
    if (null != attr && !"String_Node_Str".equals(attr)) {
      style.setColor(attr);
    }
    attr=ele.getAttribute("String_Node_Str");
    if (null != attr && !"String_Node_Str".equals(attr)) {
      style.setFontFamily(attr);
    }
  }
  if (htmlDisplayMode.contains(tagName)) {
    style.setDisplay("String_Node_Str");
  }
 else {
    style.setDisplay("String_Node_Str");
  }
  IStyle inlineStyle=(IStyle)cssStyles.get(ele);
  if (inlineStyle != null) {
    style.setProperties(inlineStyle);
  }
  StyleProcessor tag2Style=StyleProcessor.getStyleProcess(tagName);
  if (tag2Style != null) {
    tag2Style.process(style);
  }
  content.setInlineStyle(style);
}
Program: 75131
Project: 75131
Buggy source:
private BaseFont getPhysicalFont(FontMappingManager fontManager,String physicalFont,int fontStyle){
  BaseFont font=(BaseFont)fonts.get(physicalFont);
  if (font == null) {
    font=fontManager.createFont(physicalFont,fontStyle);
    fonts.put(physicalFont,font);
  }
  return font;
}

Fixed version (ground truth):
private BaseFont getPhysicalFont(FontMappingManager fontManager,String physicalFont,int fontStyle){
  BaseFont font=(BaseFont)fonts.get(physicalFont);
  if (font == null) {
    font=fontManager.createFont(physicalFont,fontStyle);
    if (font != null) {
      fonts.put(physicalFont,font);
    }
  }
  return font;
}
Program: 75132
Project: 75132
Buggy source:
private String getEncoding(String fontFamilyName){
  String encoding=(String)fontEncodings.get(fontFamilyName);
  return (null == encoding) ? BaseFont.IDENTITY_H : encoding;
}

Fixed version (ground truth):
public String getEncoding(String fontFamilyName){
  String encoding=(String)fontEncodings.get(fontFamilyName);
  return (null == encoding) ? BaseFont.IDENTITY_H : encoding;
}
Program: 75133
Project: 75133
Buggy source:
/** 
 * Creates iText BaseFont with the given font family name.
 * @param ffn the specified font family name.
 * @param encoding the encoding for the font.
 * @return the created BaseFont.
 */
public BaseFont createFont(String ffn,int fontStyle){
  String key=ffn + fontStyle;
synchronized (baseFonts) {
    BaseFont font=(BaseFont)baseFonts.get(key);
    if (font == null) {
      String encoding=getEncoding(ffn);
      Font f=null;
      try {
        f=FontFactory.getFont(ffn,encoding,BaseFont.NOT_EMBEDDED,14,fontStyle);
      }
 catch (      Throwable de) {
        logger.log(Level.WARNING,de.getLocalizedMessage());
        return null;
      }
      font=f.getBaseFont();
      if (font != null) {
        baseFonts.put(key,font);
      }
    }
    return font;
  }
}

Fixed version (ground truth):
/** 
 * Creates iText BaseFont with the given font family name.
 * @param ffn the specified font family name.
 * @param encoding the encoding for the font.
 * @return the created BaseFont.
 */
public BaseFont createFont(String ffn,int fontStyle){
  String key=ffn + fontStyle;
synchronized (baseFonts) {
    BaseFont font=(BaseFont)baseFonts.get(key);
    if (font == null) {
      String encoding=getEncoding(ffn);
      Font f=null;
      try {
        f=FontFactory.getFont(ffn,encoding,BaseFont.NOT_EMBEDDED,14,fontStyle);
        font=f.getBaseFont();
        if (font != null) {
          baseFonts.put(key,font);
        }
      }
 catch (      Throwable de) {
        logger.log(Level.WARNING,de.getLocalizedMessage());
      }
    }
    return font;
  }
}
Program: 75134
Project: 75134
Buggy source:
private HyperlinkDef parseHyperLink(IContent content){
  IHyperlinkAction linkaction=content.getHyperlinkAction();
  if (linkaction != null) {
    if (linkaction.getType() == IHyperlinkAction.ACTION_BOOKMARK) {
      return new HyperlinkDef(linkaction.getBookmark().replaceAll("String_Node_Str","String_Node_Str"),IHyperlinkAction.ACTION_BOOKMARK,null);
    }
 else     if (linkaction.getType() == IHyperlinkAction.ACTION_HYPERLINK) {
      return new HyperlinkDef(linkaction.getHyperlink(),IHyperlinkAction.ACTION_HYPERLINK,null);
    }
 else     if (linkaction.getType() == IHyperlinkAction.ACTION_DRILLTHROUGH) {
      Action act=new Action(linkaction);
      IHTMLActionHandler actionHandler=null;
      Object ac=service.getOption(RenderOptionBase.ACTION_HANDLER);
      if (ac != null && ac instanceof IHTMLActionHandler) {
        actionHandler=(IHTMLActionHandler)ac;
        actionHandler.getURL(act,null);
        return new HyperlinkDef(actionHandler.getURL(act,service.getReportContext()),IHyperlinkAction.ACTION_DRILLTHROUGH,null);
      }
    }
  }
 else   if (getBookMark(content) != null) {
    return getBookMark(content);
  }
  return null;
}

Fixed version (ground truth):
private HyperlinkDef parseHyperLink(IContent content){
  IHyperlinkAction linkaction=content.getHyperlinkAction();
  if (linkaction != null) {
    if (linkaction.getType() == IHyperlinkAction.ACTION_BOOKMARK) {
      return new HyperlinkDef(linkaction.getBookmark().replaceAll("String_Node_Str","String_Node_Str"),IHyperlinkAction.ACTION_BOOKMARK,null);
    }
 else     if (linkaction.getType() == IHyperlinkAction.ACTION_HYPERLINK) {
      return new HyperlinkDef(linkaction.getHyperlink(),IHyperlinkAction.ACTION_HYPERLINK,null);
    }
 else     if (linkaction.getType() == IHyperlinkAction.ACTION_DRILLTHROUGH) {
      Action act=new Action(linkaction);
      IHTMLActionHandler actionHandler=null;
      Object ac=service.getOption(RenderOptionBase.ACTION_HANDLER);
      if (ac != null && ac instanceof IHTMLActionHandler) {
        actionHandler=(IHTMLActionHandler)ac;
        return new HyperlinkDef(actionHandler.getURL(act,service.getReportContext()),IHyperlinkAction.ACTION_DRILLTHROUGH,null);
      }
    }
  }
 else   if (getBookMark(content) != null) {
    return getBookMark(content);
  }
  return null;
}
Program: 75135
Project: 75135
Buggy source:
/** 
 * Tests cases for cube1 extends another cube2. <ul> <li>if one new access control is added to the cube1. Access controls on cube2 will be copies to cube1 first. <li>if one new value access control is added to the level in the cube1. Value access controls on the level cube2 will be copies to the level of cube1 first. </ul>
 * @throws Exception
 */
public void testExtends() throws Exception {
  openDesign(FILE_NAME_EXTENDS);
  assertNotNull(designHandle);
  libraryHandle=designHandle.getLibrary("String_Node_Str");
  TabularCubeHandle cube=(TabularCubeHandle)libraryHandle.findCube("String_Node_Str");
  TabularCubeHandle newCube=(TabularCubeHandle)designHandle.getElementFactory().newElementFrom(cube,null);
  designHandle.getCubes().add(newCube);
  save();
  assertTrue(compareFile("String_Node_Str"));
  AccessControlHandle control=designHandle.getElementFactory().newAccessControl();
  control.addUserName("String_Node_Str");
  newCube.add(ICubeModel.ACCESS_CONTROLS_PROP,control);
  save();
  assertTrue(compareFile("String_Node_Str"));
  designHandle.getCommandStack().undo();
  LevelHandle level=designHandle.findLevel("String_Node_Str");
  ValueAccessControlHandle valueAccess=designHandle.getElementFactory().newValueAccessControl();
  valueAccess.addValue("String_Node_Str");
  level.add(ILevelModel.VALUE_ACCESS_CONTROLS_PROP,valueAccess);
  save();
  assertTrue(compareFile("String_Node_Str"));
  valueAccess.setPermission(DesignChoiceConstants.ACCESS_PERMISSION_ALLOW);
}

Fixed version (ground truth):
/** 
 * Tests cases for cube1 extends another cube2. <ul> <li>if one new access control is added to the cube1. Access controls on cube2 will be copies to cube1 first. <li>if one new value access control is added to the level in the cube1. Value access controls on the level cube2 will be copies to the level of cube1 first. </ul>
 * @throws Exception
 */
public void testExtends() throws Exception {
  openDesign(FILE_NAME_EXTENDS);
  assertNotNull(designHandle);
  libraryHandle=designHandle.getLibrary("String_Node_Str");
  TabularCubeHandle cube=(TabularCubeHandle)libraryHandle.findCube("String_Node_Str");
  TabularCubeHandle newCube=(TabularCubeHandle)designHandle.getElementFactory().newElementFrom(cube,"String_Node_Str");
  designHandle.getCubes().add(newCube);
  save();
  assertTrue(compareFile("String_Node_Str"));
  AccessControlHandle control=designHandle.getElementFactory().newAccessControl();
  control.addUserName("String_Node_Str");
  newCube.add(ICubeModel.ACCESS_CONTROLS_PROP,control);
  save();
  assertTrue(compareFile("String_Node_Str"));
  designHandle.getCommandStack().undo();
  LevelHandle level=designHandle.findLevel("String_Node_Str");
  ValueAccessControlHandle valueAccess=designHandle.getElementFactory().newValueAccessControl();
  valueAccess.addValue("String_Node_Str");
  level.add(ILevelModel.VALUE_ACCESS_CONTROLS_PROP,valueAccess);
  save();
  assertTrue(compareFile("String_Node_Str"));
  valueAccess.setPermission(DesignChoiceConstants.ACCESS_PERMISSION_ALLOW);
}
Program: 75136
Project: 75136
Buggy source:
/** 
 * @param context
 * @throws DataException 
 */
public StreamManager(DataEngineContext context,QueryResultInfo queryResultInfo) throws DataException {
  this.context=context;
  this.rootQueryResultID=queryResultInfo.getRootQueryResultID();
  this.parentQueryResultID=queryResultInfo.getParentQueryResultID();
  this.selfQueryResultID=queryResultInfo.getSelfQueryResultID();
  this.subQueryName=queryResultInfo.getSubQueryName();
  this.subQueryID=subQueryName == null ? null : QueryResultIDUtil.buildSubQueryID(subQueryName,queryResultInfo.getIndex());
  this.cachedStreamManagers=new HashMap();
  this.metaManagers=new HashMap();
  VersionManager vm=new VersionManager(context);
  if (context.getMode() == DataEngineContext.MODE_GENERATION) {
    vm.setVersion(vm.getLatestVersion());
    this.version=vm.getLatestVersion();
  }
 else {
    this.version=vm.getVersion();
  }
}

Fixed version (ground truth):
/** 
 * @param context
 * @throws DataException 
 */
public StreamManager(DataEngineContext context,QueryResultInfo queryResultInfo) throws DataException {
  this.context=context;
  this.rootQueryResultID=queryResultInfo.getRootQueryResultID();
  this.parentQueryResultID=queryResultInfo.getParentQueryResultID();
  this.selfQueryResultID=queryResultInfo.getSelfQueryResultID();
  this.subQueryName=queryResultInfo.getSubQueryName();
  this.subQueryID=subQueryName == null ? null : QueryResultIDUtil.buildSubQueryID(subQueryName,queryResultInfo.getIndex());
  this.cachedStreamManagers=new HashMap();
  this.metaManagers=new HashMap();
  VersionManager vm=new VersionManager(context);
  if (context.getMode() == DataEngineContext.MODE_GENERATION) {
    vm.setVersion(VersionManager.getLatestVersion());
    this.version=VersionManager.getLatestVersion();
  }
 else {
    this.version=vm.getVersion();
  }
}
Program: 75137
Project: 75137
Buggy source:
/** 
 * @return
 */
int getVersion(){
  int version=this.getLatestVersion();
  if (dataEngineContext.hasInStream(null,null,DataEngineContext.VERSION_INFO_STREAM) == false) {
    version=VERSION_2_0;
    return version;
  }
  try {
    DataInputStream is=new DataInputStream(dataEngineContext.getInputStream(null,null,DataEngineContext.VERSION_INFO_STREAM));
    version=IOUtil.readInt(is);
    is.close();
  }
 catch (  DataException e) {
    logger.log(Level.FINE,e.getMessage(),e);
  }
catch (  IOException e) {
    logger.log(Level.FINE,e.getMessage(),e);
  }
  return version;
}

Fixed version (ground truth):
/** 
 * @return
 */
public int getVersion(){
  int version=getLatestVersion();
  if (dataEngineContext.hasInStream(null,null,DataEngineContext.VERSION_INFO_STREAM) == false) {
    version=VERSION_2_0;
    return version;
  }
  try {
    DataInputStream is=new DataInputStream(dataEngineContext.getInputStream(null,null,DataEngineContext.VERSION_INFO_STREAM));
    version=IOUtil.readInt(is);
    is.close();
  }
 catch (  DataException e) {
    logger.log(Level.FINE,e.getMessage(),e);
  }
catch (  IOException e) {
    logger.log(Level.FINE,e.getMessage(),e);
  }
  return version;
}
Program: 75138
Project: 75138
Buggy source:
VersionManager(DataEngineContext context){
  this.dataEngineContext=context;
}

Fixed version (ground truth):
public VersionManager(DataEngineContext context){
  this.dataEngineContext=context;
}
Program: 75139
Project: 75139
Buggy source:
/** 
 * @return
 */
int getLatestVersion(){
  return VERSION_2_2_1;
}

Fixed version (ground truth):
/** 
 * @return
 */
public static int getLatestVersion(){
  return VERSION_2_2_1_1;
}
Program: 75140
Project: 75140
Buggy source:
/** 
 * @param pathName
 * @param name
 * @return
 * @throws IOException
 */
public static IAggregationResultSet[] loadAggregationResultSet(String pathName,String name) throws IOException {
  IDocArchiveReader reader=new FileArchiveReader(getTmpFileName(pathName,name));
  IAggregationResultSet[] result=AggregationResultSetSaveUtil.load(name,reader);
  reader.close();
  return result;
}

Fixed version (ground truth):
/** 
 * @param pathName
 * @param name
 * @return
 * @throws IOException
 */
public static IAggregationResultSet[] loadAggregationResultSet(String pathName,String name) throws IOException {
  IDocArchiveReader reader=new FileArchiveReader(getTmpFileName(pathName,name));
  IAggregationResultSet[] result=AggregationResultSetSaveUtil.load(name,reader,VersionManager.getLatestVersion());
  reader.close();
  return result;
}
Program: 75141
Project: 75141
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();
  inputStream.close();
  if (size <= 0) {
    return null;
  }
  IAggregationResultSet[] result=new IAggregationResultSet[size];
  for (int i=0; i < size; i++) {
    inputStream=reader.getStream(name + PREFIX_RESULTSET + i);
    dataInputStream=new DataInputStream(inputStream);
    result[i]=loadOneResultSet(dataInputStream);
    dataInputStream.close();
  }
  return result;
}

Fixed version (ground truth):
/** 
 * @param name
 * @param reader
 * @throws IOException
 */
public static IAggregationResultSet[] load(String name,IDocArchiveReader reader,int version) 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++) {
    if (version != VersionManager.VERSION_2_2_1)     inputStream=reader.getStream(name + PREFIX_RESULTSET + i);
 else     inputStream=reader.getStream(name + i);
    dataInputStream=new DataInputStream(inputStream);
    result[i]=loadOneResultSet(dataInputStream);
    dataInputStream.close();
  }
  return result;
}