Program: 73250
Project: 73250
Buggy source:
/** 
 * @param cubeHandle
 * @param cubeMaterializer
 * @param stopSign
 * @throws IOException
 * @throws BirtException
 * @throws DataException
 */
private void createCube(TabularCubeHandle cubeHandle,CubeMaterializer cubeMaterializer,Map appContext,StopSign stopSign) throws IOException, BirtException, DataException {
  List dataSetList=this.needCachedDataSetToEnhancePerformance(cubeHandle);
  Set involvedDataSet=new HashSet();
  for (int i=0; i < dataSetList.size(); i++) {
    involvedDataSet.add(dataSetList.get(i));
  }
  boolean doPerfTuning=(involvedDataSet.size() != dataSetList.size()) && (appContext == null || (appContext != null && appContext.get(DataEngine.DATA_SET_CACHE_ROW_LIMIT) == null && appContext.get(DataEngine.MEMORY_DATA_SET_CACHE) == null));
  Map candidateAppContext=new HashMap();
  if (appContext != null)   candidateAppContext.putAll(appContext);
  if (doPerfTuning) {
    candidateAppContext.put(DataEngine.DATA_SET_CACHE_ROW_LIMIT,new Integer(-1));
    this.dataSetCache.addAll(involvedDataSet);
  }
  List measureNames=new ArrayList();
  List measureGroups=cubeHandle.getContents(CubeHandle.MEASURE_GROUPS_PROP);
  for (int i=0; i < measureGroups.size(); i++) {
    MeasureGroupHandle mgh=(MeasureGroupHandle)measureGroups.get(i);
    List measures=mgh.getContents(MeasureGroupHandle.MEASURES_PROP);
    for (int j=0; j < measures.size(); j++) {
      MeasureHandle measure=(MeasureHandle)measures.get(j);
      measureNames.add(measure.getName());
    }
  }
  IDimension[] dimensions=populateDimensions(cubeMaterializer,cubeHandle,candidateAppContext,stopSign);
  String[][] factTableKey=new String[dimensions.length][];
  String[][] dimensionKey=new String[dimensions.length][];
  for (int i=0; i < dimensions.length; i++) {
    TabularDimensionHandle dim=(TabularDimensionHandle)cubeHandle.getDimension(dimensions[i].getName());
    TabularHierarchyHandle hier=(TabularHierarchyHandle)dim.getDefaultHierarchy();
    if (cubeHandle.getDataSet().equals(hier.getDataSet()) || hier.getDataSet() == null) {
      String[] keyNames=dimensions[i].getHierarchy().getLevels()[dimensions[i].getHierarchy().getLevels().length - 1].getKeyNames();
      for (int j=0; j < keyNames.length; j++) {
        keyNames[j]=dimensions[i].getName() + "String_Node_Str" + keyNames[j];
      }
      factTableKey[i]=keyNames;
      dimensionKey[i]=factTableKey[i];
    }
 else {
      Iterator it=cubeHandle.joinConditionsIterator();
      if (!it.hasNext())       throw new AdapterException(ResourceConstants.MISSING_JOIN_CONDITION,dim.getName());
      boolean foundJoinCondition=false;
      while (it.hasNext()) {
        DimensionConditionHandle dimCondHandle=(DimensionConditionHandle)it.next();
        if (dimCondHandle.getHierarchy().equals(hier)) {
          Iterator conditionIt=dimCondHandle.getJoinConditions().iterator();
          List dimensionKeys=new ArrayList();
          List factTableKeys=new ArrayList();
          while (conditionIt.hasNext()) {
            foundJoinCondition=true;
            DimensionJoinConditionHandle joinCondition=(DimensionJoinConditionHandle)conditionIt.next();
            String levelName=joinCondition.getLevelName();
            if (levelName != null && isAttribute(dimensions[i],levelName,joinCondition.getHierarchyKey())) {
              dimensionKeys.add(OlapExpressionUtil.getAttributeColumnName(getLevelName(dimensions[i],levelName),joinCondition.getHierarchyKey()));
            }
 else {
              dimensionKeys.add(joinCondition.getHierarchyKey());
            }
            factTableKeys.add(OlapExpressionUtil.getQualifiedLevelName(dimensions[i].getName(),joinCondition.getCubeKey()));
          }
          factTableKey[i]=new String[factTableKeys.size()];
          dimensionKey[i]=new String[dimensionKeys.size()];
          for (int j=0; j < dimensionKeys.size(); j++) {
            factTableKey[i][j]=factTableKeys.get(j).toString();
            dimensionKey[i][j]=dimensionKeys.get(j).toString();
          }
        }
      }
      if (!foundJoinCondition)       throw new AdapterException(ResourceConstants.MISSING_JOIN_CONDITION,dim.getName());
    }
  }
  cubeMaterializer.createCube(cubeHandle.getQualifiedName(),factTableKey,dimensionKey,dimensions,new DataSetIterator(this,cubeHandle,candidateAppContext),this.toStringArray(measureNames),stopSign);
}

Fixed version (ground truth):
/** 
 * @param cubeHandle
 * @param cubeMaterializer
 * @param stopSign
 * @throws IOException
 * @throws BirtException
 * @throws DataException
 */
private void createCube(TabularCubeHandle cubeHandle,CubeMaterializer cubeMaterializer,Map appContext,StopSign stopSign) throws IOException, BirtException, DataException {
  List dataSetList=this.getDataSetsToCache(cubeHandle);
  Set involvedDataSet=new HashSet(dataSetList);
  boolean doPerfTuning=(involvedDataSet.size() != dataSetList.size()) && (appContext == null || (appContext != null && appContext.get(DataEngine.DATA_SET_CACHE_ROW_LIMIT) == null && appContext.get(DataEngine.MEMORY_DATA_SET_CACHE) == null));
  Map candidateAppContext=new HashMap();
  if (appContext != null)   candidateAppContext.putAll(appContext);
  if (doPerfTuning) {
    candidateAppContext.put(DataEngine.DATA_SET_CACHE_ROW_LIMIT,new Integer(-1));
    this.dataSetCache.addAll(involvedDataSet);
  }
  List measureNames=new ArrayList();
  List measureGroups=cubeHandle.getContents(CubeHandle.MEASURE_GROUPS_PROP);
  for (int i=0; i < measureGroups.size(); i++) {
    MeasureGroupHandle mgh=(MeasureGroupHandle)measureGroups.get(i);
    List measures=mgh.getContents(MeasureGroupHandle.MEASURES_PROP);
    for (int j=0; j < measures.size(); j++) {
      MeasureHandle measure=(MeasureHandle)measures.get(j);
      measureNames.add(measure.getName());
    }
  }
  IDimension[] dimensions=populateDimensions(cubeMaterializer,cubeHandle,candidateAppContext,stopSign);
  String[][] factTableKey=new String[dimensions.length][];
  String[][] dimensionKey=new String[dimensions.length][];
  for (int i=0; i < dimensions.length; i++) {
    TabularDimensionHandle dim=(TabularDimensionHandle)cubeHandle.getDimension(dimensions[i].getName());
    TabularHierarchyHandle hier=(TabularHierarchyHandle)dim.getDefaultHierarchy();
    if (cubeHandle.getDataSet().equals(hier.getDataSet()) || hier.getDataSet() == null) {
      String[] keyNames=dimensions[i].getHierarchy().getLevels()[dimensions[i].getHierarchy().getLevels().length - 1].getKeyNames();
      for (int j=0; j < keyNames.length; j++) {
        keyNames[j]=dimensions[i].getName() + "String_Node_Str" + keyNames[j];
      }
      factTableKey[i]=keyNames;
      dimensionKey[i]=factTableKey[i];
    }
 else {
      Iterator it=cubeHandle.joinConditionsIterator();
      if (!it.hasNext())       throw new AdapterException(ResourceConstants.MISSING_JOIN_CONDITION,dim.getName());
      boolean foundJoinCondition=false;
      while (it.hasNext()) {
        DimensionConditionHandle dimCondHandle=(DimensionConditionHandle)it.next();
        if (dimCondHandle.getHierarchy().equals(hier)) {
          Iterator conditionIt=dimCondHandle.getJoinConditions().iterator();
          List dimensionKeys=new ArrayList();
          List factTableKeys=new ArrayList();
          while (conditionIt.hasNext()) {
            foundJoinCondition=true;
            DimensionJoinConditionHandle joinCondition=(DimensionJoinConditionHandle)conditionIt.next();
            String levelName=joinCondition.getLevelName();
            if (levelName != null && isAttribute(dimensions[i],levelName,joinCondition.getHierarchyKey())) {
              dimensionKeys.add(OlapExpressionUtil.getAttributeColumnName(getLevelName(dimensions[i],levelName),joinCondition.getHierarchyKey()));
            }
 else {
              dimensionKeys.add(joinCondition.getHierarchyKey());
            }
            factTableKeys.add(OlapExpressionUtil.getQualifiedLevelName(dimensions[i].getName(),joinCondition.getCubeKey()));
          }
          factTableKey[i]=new String[factTableKeys.size()];
          dimensionKey[i]=new String[dimensionKeys.size()];
          for (int j=0; j < dimensionKeys.size(); j++) {
            factTableKey[i][j]=factTableKeys.get(j).toString();
            dimensionKey[i][j]=dimensionKeys.get(j).toString();
          }
        }
      }
      if (!foundJoinCondition)       throw new AdapterException(ResourceConstants.MISSING_JOIN_CONDITION,dim.getName());
    }
  }
  cubeMaterializer.createCube(cubeHandle.getQualifiedName(),factTableKey,dimensionKey,dimensions,new DataSetIterator(this,cubeHandle,candidateAppContext),this.toStringArray(measureNames),stopSign);
}