Program: 67934
Project: 67934
Buggy source:
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;
}

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();
    String queryId=(String)entry.getValue();
    if (baseQuery instanceof IQueryDefinition) {
      IQueryDefinition query=(IQueryDefinition)baseQuery;
      ReportItemDesign item=(ReportItemDesign)query2itemMapping.get(query);
      String queryName=item.getName();
      if (queryName == null) {
        queryName="String_Node_Str" + item.getID();
      }
      queryId2NameMapping.put(queryId,queryName);
    }
 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);
      queryId2NameMapping.put(queryId,name);
    }
    queryId2QueryMapping.put(queryId,baseQuery);
    query2QueryIdMapping.put(baseQuery,queryId);
  }
  try {
    loadResultSetMetaData();
  }
 catch (  Exception e) {
    logger.log(Level.WARNING,e.getMessage(),e);
  }
  isMetaDataPrepared=true;
}