Program: 50900
Project: 50900
Buggy source:
private List<String> getLevels(String hierarchy){
  if (hierarchy == null || hierarchy.equals("String_Node_Str")) {
    return hlevels;
  }
  if (hierarchy.startsWith("String_Node_Str") && hierarchy.endsWith("String_Node_Str")) {
    hierarchy=hierarchy.substring(1,hierarchy.length() - 1);
  }
  Object po=getParentObject();
  if (po == null) {
    return hlevels;
  }
  MondrianGuiDef.CubeGrant parent=(MondrianGuiDef.CubeGrant)po;
  if (parent.cube == null || parent.cube.equals("String_Node_Str")) {
    return hlevels;
  }
  if (cacheCube.equals(parent.cube) && cacheHierarchy.equals(hierarchy)) {
    return hlevels;
  }
  hlevels=new ArrayList<String>();
  cacheCube=parent.cube;
  cacheHierarchy=hierarchy;
  MondrianGuiDef.Schema s=getSchema();
  if (s == null) {
    return hlevels;
  }
  for (int i=0; i < s.cubes.length; i++) {
    final MondrianGuiDef.Cube cube=s.cubes[i];
    if (!cube.name.equals(parent.cube)) {
      continue;
    }
    for (int j=0; j < cube.dimensions.length; j++) {
      final MondrianGuiDef.CubeDimension dimension=cube.dimensions[j];
      if (!dimension.name.equals(hierarchy)) {
        continue;
      }
      MondrianGuiDef.Dimension d=lookupDimension(s,dimension);
      final MondrianGuiDef.Hierarchy hierarchy1=d.hierarchies[0];
      if (hierarchy1 != null) {
        for (int k=0; k < hierarchy1.levels.length; k++) {
          hlevels.add(hierarchy1.levels[k].name);
        }
      }
      break;
    }
    break;
  }
  return hlevels;
}

Fixed version (ground truth):
private List<String> getLevels(String hierarchy){
  if (hierarchy == null || hierarchy.equals("String_Node_Str")) {
    return hlevels;
  }
  List<Id.Segment> segments=Util.parseIdentifier(hierarchy);
  if (segments == null || segments.size() == 0) {
    return hlevels;
  }
  if (!MondrianProperties.instance().SsasCompatibleNaming.get()) {
    String data=((Id.NameSegment)segments.get(0)).getName();
    if (data.indexOf("String_Node_Str") >= 0) {
      Id.Segment segment=segments.get(0);
      segments.clear();
      segments.add(new Id.NameSegment(data.substring(0,data.indexOf("String_Node_Str")),segment.getQuoting()));
      segments.add(new Id.NameSegment(data.substring(data.indexOf("String_Node_Str") + 1),segment.getQuoting()));
    }
  }
  Object po=getParentObject();
  if (po == null) {
    return hlevels;
  }
  MondrianGuiDef.CubeGrant parent=(MondrianGuiDef.CubeGrant)po;
  if (parent.cube == null || parent.cube.equals("String_Node_Str")) {
    return hlevels;
  }
  if (cacheCube.equals(parent.cube) && cacheHierarchy.equals(hierarchy)) {
    return hlevels;
  }
  hlevels=new ArrayList<String>();
  cacheCube=parent.cube;
  cacheHierarchy=hierarchy;
  MondrianGuiDef.Schema s=getSchema();
  if (s == null) {
    return hlevels;
  }
  for (int i=0; i < s.cubes.length; i++) {
    final MondrianGuiDef.Cube cube=s.cubes[i];
    if (!cube.name.equals(parent.cube)) {
      continue;
    }
    for (int j=0; j < cube.dimensions.length; j++) {
      final MondrianGuiDef.CubeDimension dimension=cube.dimensions[j];
      if (!segments.get(0).matches(dimension.name)) {
        continue;
      }
      MondrianGuiDef.Dimension d=lookupDimension(s,dimension);
      NodeDef[] children=d.getChildren();
      MondrianGuiDef.Hierarchy hierarchyObj=null;
      for (int k=0; k < children.length; k++) {
        if (children[k] instanceof Hierarchy) {
          if ((segments.size() == 1 && ((Hierarchy)children[k]).name == null) || (segments.size() != 0 && segments.get(1).matches(((Hierarchy)children[k]).name))) {
            hierarchyObj=(Hierarchy)children[k];
            break;
          }
        }
      }
      if (hierarchyObj != null) {
        for (int k=0; k < hierarchyObj.levels.length; k++) {
          hlevels.add(hierarchy + "String_Node_Str" + Util.quoteMdxIdentifier(hierarchyObj.levels[k].name));
        }
      }
    }
    break;
  }
  return hlevels;
}