Program: 75444
Project: 75444
Buggy source:
/** 
 * @throws DataException 
 */
public List getReferableBindings(String targetLevel,ICubeQueryDefinition cubeDefn,boolean isSort) throws AdapterException {
  try {
    List bindings=cubeDefn.getBindings();
    if (bindings == null)     return new ArrayList();
    DimLevel target=OlapExpressionUtil.getTargetDimLevel(targetLevel);
    List result=new ArrayList();
    for (int i=0; i < bindings.size(); i++) {
      IBinding binding=(IBinding)bindings.get(i);
      Set refDimLevel=OlapExpressionCompiler.getReferencedDimLevel(binding.getExpression(),bindings,isSort);
      if (refDimLevel.size() > 1)       continue;
      if (!refDimLevel.contains(target)) {
        List aggrOns=binding.getAggregatOns();
        if (aggrOns.size() == 0) {
          if (this.getReferencedMeasureName(binding.getExpression()) != null) {
            result.add(binding);
            continue;
          }
        }
        for (int j=0; j < aggrOns.size(); j++) {
          DimLevel dimLevel=OlapExpressionUtil.getTargetDimLevel(aggrOns.get(j).toString());
          if (dimLevel.equals(target)) {
            if (j == aggrOns.size() - 1)             result.add(binding);
 else {
              DimLevel next=OlapExpressionUtil.getTargetDimLevel(aggrOns.get(j + 1).toString());
              if (getAxisQualifierLevel(next,cubeDefn.getEdge(getAxisQualifierEdgeType(dimLevel,cubeDefn))) == null)               continue;
 else               result.add(binding);
            }
            break;
          }
        }
        continue;
      }
      result.add(binding);
    }
    return result;
  }
 catch (  DataException e) {
    throw new AdapterException(e.getLocalizedMessage(),e);
  }
}

Fixed version (ground truth):
/** 
 * @throws DataException 
 */
public List getReferableBindings(String targetLevel,ICubeQueryDefinition cubeDefn,boolean isSort) throws AdapterException {
  try {
    List bindings=cubeDefn.getBindings();
    if (bindings == null)     return new ArrayList();
    DimLevel target=OlapExpressionUtil.getTargetDimLevel(targetLevel);
    List result=new ArrayList();
    for (int i=0; i < bindings.size(); i++) {
      IBinding binding=(IBinding)bindings.get(i);
      Set refDimLevel=OlapExpressionCompiler.getReferencedDimLevel(binding.getExpression(),bindings,isSort);
      if (refDimLevel.size() > 1)       continue;
      if (!refDimLevel.contains(target)) {
        List aggrOns=binding.getAggregatOns();
        if (aggrOns.size() == 0) {
          if (this.getReferencedMeasureName(binding.getExpression()) != null) {
            result.add(binding);
            continue;
          }
        }
        for (int j=0; j < aggrOns.size(); j++) {
          DimLevel dimLevel=OlapExpressionUtil.getTargetDimLevel(aggrOns.get(j).toString());
          if (dimLevel.equals(target)) {
            if (j == aggrOns.size() - 1)             result.add(binding);
 else {
              DimLevel next=OlapExpressionUtil.getTargetDimLevel(aggrOns.get(j + 1).toString());
              if (getAxisQualifierEdgeType(target,cubeDefn) == ICubeQueryDefinition.COLUMN_EDGE) {
                continue;
              }
              if (getAxisQualifierLevel(next,cubeDefn.getEdge(getAxisQualifierEdgeType(dimLevel,cubeDefn))) == null)               continue;
 else               result.add(binding);
            }
            break;
          }
        }
        continue;
      }
      result.add(binding);
    }
    return result;
  }
 catch (  DataException e) {
    throw new AdapterException(e.getLocalizedMessage(),e);
  }
}