Program: 67947
Project: 67947
Buggy source:
private void prepareMetaData(){
  if (isMetaDataPrepared == true)   return;
  Map appContext=executionContext.getAppContext();
  IDataEngine dataEngine=executionContext.getDataEngine();
  dataEngine.prepare(report,appContext);
  HashMap queryIds=report.getQueryIDs();
  HashMap query2itemMapping=report.getReportItemToQueryMap();
  Iterator iter=queryIds.entrySet().iterator();
  while (iter.hasNext()) {
    Map.Entry entry=(Map.Entry)iter.next();
    IDataQueryDefinition baseQuery=(IDataQueryDefinition)entry.getKey();
    if (baseQuery instanceof IQueryDefinition) {
      IQueryDefinition query=(IQueryDefinition)baseQuery;
      String queryId=(String)entry.getValue();
      ReportItemDesign item=(ReportItemDesign)query2itemMapping.get(query);
      String queryName=item.getName();
      if (queryName == null) {
        queryName="String_Node_Str" + item.getID();
      }
      queryId2NameMapping.put(queryId,queryName);
      queryId2QueryMapping.put(queryId,query);
      query2QueryIdMapping.put(query,queryId);
    }
 else     if (baseQuery instanceof IBaseCubeQueryDefinition) {
      IBaseCubeQueryDefinition query=(IBaseCubeQueryDefinition)baseQuery;
      ReportItemDesign item=(ReportItemDesign)query2itemMapping.get(query);
      DesignElementHandle cube=item.getHandle();
      String name=cube.getStringProperty(ReportItemHandle.CUBE_PROP);
      cubeNameList.add(name);
    }
  }
  try {
    loadResultSetMetaData();
  }
 catch (  Exception e) {
    logger.log(Level.WARNING,e.getMessage(),e);
  }
  isMetaDataPrepared=true;
}

Fixed version (ground truth):
private void prepareMetaData() throws EngineException {
  if (isMetaDataPrepared == true)   return;
  Map appContext=executionContext.getAppContext();
  IDataEngine dataEngine=executionContext.getDataEngine();
  dataEngine.prepare(report,appContext);
  HashMap queryIds=report.getQueryIDs();
  HashMap query2itemMapping=report.getReportItemToQueryMap();
  Iterator iter=queryIds.entrySet().iterator();
  while (iter.hasNext()) {
    Map.Entry entry=(Map.Entry)iter.next();
    IDataQueryDefinition baseQuery=(IDataQueryDefinition)entry.getKey();
    if (baseQuery instanceof IQueryDefinition) {
      IQueryDefinition query=(IQueryDefinition)baseQuery;
      String queryId=(String)entry.getValue();
      ReportItemDesign item=(ReportItemDesign)query2itemMapping.get(query);
      String queryName=item.getName();
      if (queryName == null) {
        queryName="String_Node_Str" + item.getID();
      }
      queryId2NameMapping.put(queryId,queryName);
      queryId2QueryMapping.put(queryId,query);
      query2QueryIdMapping.put(query,queryId);
    }
 else     if (baseQuery instanceof IBaseCubeQueryDefinition) {
      IBaseCubeQueryDefinition query=(IBaseCubeQueryDefinition)baseQuery;
      ReportItemDesign item=(ReportItemDesign)query2itemMapping.get(query);
      DesignElementHandle cube=item.getHandle();
      String name=cube.getStringProperty(ReportItemHandle.CUBE_PROP);
      cubeNameList.add(name);
    }
  }
  try {
    loadResultSetMetaData();
  }
 catch (  Exception e) {
    logger.log(Level.WARNING,e.getMessage(),e);
  }
  isMetaDataPrepared=true;
}