Program: 77692
Project: 77692
Buggy source:
/** 
 * load map from query id to result set id from report document.
 */
private void loadResultSetMetaData() throws EngineException {
  DataInputStream dis=null;
  try {
    HashMap query2ResultMetaData=report.getResultMetaData();
    IDocArchiveReader reader=reportDocReader.getArchive();
    dis=new DataInputStream(reader.getStream(ReportDocumentConstants.DATA_META_STREAM));
    HashMap queryCounts=new HashMap();
    while (true) {
      IOUtil.readString(dis);
      IOUtil.readLong(dis);
      String queryId=IOUtil.readString(dis);
      String rsetId=IOUtil.readString(dis);
      rsetId2queryIdMapping.put(rsetId,queryId);
      int count=-1;
      Integer countObj=(Integer)queryCounts.get(queryId);
      if (countObj != null) {
        count=countObj.intValue();
      }
      count++;
      String rsetName=getQueryName(queryId);
      if (count > 0) {
        rsetName=rsetName + "String_Node_Str" + count;
      }
      queryCounts.put(queryId,new Integer(count));
      rsetName2IdMapping.put(rsetName,rsetId);
      if (null != query2ResultMetaData) {
        IQueryDefinition query=getQuery(queryId);
        ResultMetaData metaData=(ResultMetaData)query2ResultMetaData.get(query);
        if (metaData.getColumnCount() > 0) {
          IResultSetItem resultItem=new ResultSetItem(rsetName,metaData);
          resultMetaList.add(resultItem);
        }
      }
    }
  }
 catch (  EOFException eofe) {
  }
catch (  IOException ioe) {
    logger.log(Level.SEVERE,ioe.getMessage(),ioe);
  }
 finally {
    if (dis != null) {
      try {
        dis.close();
      }
 catch (      IOException ex) {
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * load map from query id to result set id from report document.
 */
private void loadResultSetMetaData() throws EngineException {
  DataInputStream dis=null;
  try {
    HashMap query2ResultMetaData=report.getResultMetaData();
    IDocArchiveReader reader=reportDocReader.getArchive();
    dis=new DataInputStream(reader.getStream(ReportDocumentConstants.DATA_META_STREAM));
    HashMap queryCounts=new HashMap();
    while (true) {
      IOUtil.readString(dis);
      IOUtil.readLong(dis);
      String queryId=IOUtil.readString(dis);
      String rsetId=IOUtil.readString(dis);
      rsetId2queryIdMapping.put(rsetId,queryId);
      int count=-1;
      Integer countObj=(Integer)queryCounts.get(queryId);
      if (countObj != null) {
        count=countObj.intValue();
      }
      count++;
      String rsetName=getQueryName(queryId);
      if (count > 0) {
        rsetName=rsetName + "String_Node_Str" + count;
      }
      queryCounts.put(queryId,new Integer(count));
      rsetName2IdMapping.put(rsetName,rsetId);
      if (null != query2ResultMetaData) {
        IQueryDefinition query=getQuery(queryId);
        if (isMasterQuery(query)) {
          ResultMetaData metaData=(ResultMetaData)query2ResultMetaData.get(query);
          if (metaData.getColumnCount() > 0) {
            IResultSetItem resultItem=new ResultSetItem(rsetName,metaData);
            resultMetaList.add(resultItem);
          }
        }
      }
    }
  }
 catch (  EOFException eofe) {
  }
catch (  IOException ioe) {
    logger.log(Level.SEVERE,ioe.getMessage(),ioe);
  }
 finally {
    if (dis != null) {
      try {
        dis.close();
      }
 catch (      IOException ex) {
      }
    }
  }
}