Program: 51573
Project: 51573
Buggy source:
public SchemaReader getSchemaReader(){
  final SchemaReader cubeSchemaReader=mdxCube.getSchemaReader(getConnection().getRole());
  return new DelegatingSchemaReader(cubeSchemaReader){
    public Member getMemberByUniqueName(    String[] uniqueNameParts,    boolean failIfNotFound){
      Member member=lookupMemberFromCache(Util.implode(uniqueNameParts));
      if (member == null) {
        member=schemaReader.getMemberByUniqueName(uniqueNameParts,failIfNotFound);
      }
      return member;
    }
    public OlapElement getElementChild(    OlapElement parent,    String s){
      OlapElement mdxElement=schemaReader.getElementChild(parent,s);
      if (mdxElement != null) {
        return mdxElement;
      }
      Iterator definedMembers=getDefinedMembers().iterator();
      while (definedMembers.hasNext()) {
        Member mdxMember=(Member)definedMembers.next();
        if (mdxMember.getName().equalsIgnoreCase(s)) {
          return mdxMember;
        }
      }
      for (int i=0; i < formulas.length; i++) {
        Formula formula=formulas[i];
        if (formula.isMember) {
          continue;
        }
        if (formula.names[0].equals(s)) {
          return formula.mdxSet;
        }
      }
      return mdxElement;
    }
  }
;
}

Fixed version (ground truth):
public SchemaReader getSchemaReader(){
  final SchemaReader cubeSchemaReader=mdxCube.getSchemaReader(getConnection().getRole());
  return new DelegatingSchemaReader(cubeSchemaReader){
    public Member getMemberByUniqueName(    String[] uniqueNameParts,    boolean failIfNotFound){
      Member member=lookupMemberFromCache(Util.implode(uniqueNameParts));
      if (member == null) {
        member=schemaReader.getMemberByUniqueName(uniqueNameParts,failIfNotFound);
      }
      return member;
    }
    public OlapElement getElementChild(    OlapElement parent,    String s){
      OlapElement mdxElement=schemaReader.getElementChild(parent,s);
      if (mdxElement != null) {
        return mdxElement;
      }
      Iterator definedMembers=getDefinedMembers().iterator();
      definedMemberLoop:       while (definedMembers.hasNext()) {
        Member mdxMember=(Member)definedMembers.next();
        if (parent != null) {
          Level lev=mdxMember.getLevel();
          if (parent instanceof Level) {
            if (!parent.equals(lev))             continue definedMemberLoop;
          }
 else {
            Hierarchy hier=lev.getHierarchy();
            if (parent instanceof Hierarchy) {
              if (!parent.equals(hier))               continue definedMemberLoop;
            }
 else {
              Dimension dim=hier.getDimension();
              if (parent instanceof Dimension && !parent.equals(dim))               continue definedMemberLoop;
            }
          }
        }
        if (mdxMember.getName().equalsIgnoreCase(s)) {
          return mdxMember;
        }
      }
      for (int i=0; i < formulas.length; i++) {
        Formula formula=formulas[i];
        if (formula.isMember) {
          continue;
        }
        if (formula.names[0].equals(s)) {
          return formula.mdxSet;
        }
      }
      return mdxElement;
    }
  }
;
}