Program: 51684
Project: 51684
Buggy source:
public RolapMember[] getMembersInLevel(RolapLevel level,int startOrdinal,int endOrdinal){
  ResultSet resultSet=null;
  final RolapLevel[] levels=(RolapLevel[])hierarchy.getLevels();
  final RolapLevel lastLevel=levels[levels.length - 1];
  String sql=makeLevelSql(level);
  try {
    resultSet=RolapUtil.executeQuery(jdbcConnection,sql,"String_Node_Str");
    ArrayList list=new ArrayList();
    int ordinal=0;
    final int levelDepth=level.getDepth();
    RolapMember allMember=null;
    if (hierarchy.hasAll()) {
      Member[] rootMembers=hierarchy.getRootMembers();
      Util.assertTrue(rootMembers.length == 1);
      allMember=(RolapMember)rootMembers[0];
    }
    RolapMember[] members=new RolapMember[levels.length];
    ArrayList[] siblings=new ArrayList[levels.length + 1];
    while (resultSet.next()) {
      int column=0;
      RolapMember member=null;
      for (int i=0; i <= levelDepth; i++) {
        RolapLevel level2=levels[i];
        if (level2.isAll()) {
          member=allMember;
          continue;
        }
        Object value=resultSet.getObject(column + 1);
        if (value == null) {
          value=sqlNullValue;
        }
        RolapMember parent=member;
        Object key=cache.makeKey(parent,value);
        member=cache.getMember(key);
        if (member == null) {
          member=new RolapMember(parent,level2,value);
          member.ordinal=ordinal;
          for (int j=0; j < level.properties.length; j++) {
            RolapProperty property=level.properties[j];
            member.setProperty(property.getName(),resultSet.getObject(column + 3 + j));
          }
          cache.putMember(key,member);
        }
        if (member != members[i]) {
          ArrayList children=siblings[i + 1];
          if (children != null) {
            cache.putChildren(members[i],children);
          }
          if (i < levelDepth && !cache.hasChildren(member)) {
            siblings[i + 1]=new ArrayList();
          }
 else {
            siblings[i + 1]=null;
          }
          members[i]=member;
          if (siblings[i] != null) {
            siblings[i].add(member);
          }
        }
        ordinal++;
        column++;
      }
      list.add(member);
    }
    for (int i=0; i < members.length; i++) {
      RolapMember member=members[i];
      final ArrayList children=siblings[i + 1];
      if (member != null && children != null) {
        cache.putChildren(member,list);
      }
    }
    return RolapUtil.toArray(list);
  }
 catch (  SQLException e) {
    throw Util.getRes().newInternal("String_Node_Str" + sql + "String_Node_Str",e);
  }
 finally {
    try {
      if (resultSet != null) {
        resultSet.getStatement().close();
        resultSet.close();
      }
    }
 catch (    SQLException e) {
    }
  }
}

Fixed version (ground truth):
public RolapMember[] getMembersInLevel(RolapLevel level,int startOrdinal,int endOrdinal){
  if (level.isAll()) {
    return (RolapMember[])hierarchy.getRootMembers();
  }
  ResultSet resultSet=null;
  final RolapLevel[] levels=(RolapLevel[])hierarchy.getLevels();
  String sql=makeLevelSql(level);
  try {
    resultSet=RolapUtil.executeQuery(jdbcConnection,sql,"String_Node_Str");
    ArrayList list=new ArrayList();
    int ordinal=0;
    final int levelDepth=level.getDepth();
    RolapMember allMember=null;
    if (hierarchy.hasAll()) {
      Member[] rootMembers=hierarchy.getRootMembers();
      Util.assertTrue(rootMembers.length == 1);
      allMember=(RolapMember)rootMembers[0];
    }
    RolapMember[] members=new RolapMember[levels.length];
    ArrayList[] siblings=new ArrayList[levels.length + 1];
    while (resultSet.next()) {
      int column=0;
      RolapMember member=null;
      for (int i=0; i <= levelDepth; i++) {
        RolapLevel level2=levels[i];
        if (level2.isAll()) {
          member=allMember;
          continue;
        }
        Object value=resultSet.getObject(column + 1);
        if (value == null) {
          value=sqlNullValue;
        }
        RolapMember parent=member;
        Object key=cache.makeKey(parent,value);
        member=cache.getMember(key);
        if (member == null) {
          member=new RolapMember(parent,level2,value);
          member.ordinal=ordinal;
          for (int j=0; j < level.properties.length; j++) {
            RolapProperty property=level.properties[j];
            member.setProperty(property.getName(),resultSet.getObject(column + 3 + j));
          }
          cache.putMember(key,member);
        }
        if (member != members[i]) {
          ArrayList children=siblings[i + 1];
          if (children != null) {
            cache.putChildren(members[i],children);
          }
          if (i < levelDepth && !cache.hasChildren(member)) {
            siblings[i + 1]=new ArrayList();
          }
 else {
            siblings[i + 1]=null;
          }
          members[i]=member;
          if (siblings[i] != null) {
            siblings[i].add(member);
          }
        }
        ordinal++;
        column++;
      }
      list.add(member);
    }
    for (int i=0; i < members.length; i++) {
      RolapMember member=members[i];
      final ArrayList children=siblings[i + 1];
      if (member != null && children != null) {
        cache.putChildren(member,list);
      }
    }
    return RolapUtil.toArray(list);
  }
 catch (  Throwable e) {
    throw Util.getRes().newInternal("String_Node_Str" + level.getUniqueName() + "String_Node_Str"+ sql+ "String_Node_Str",e);
  }
 finally {
    try {
      if (resultSet != null) {
        resultSet.getStatement().close();
        resultSet.close();
      }
    }
 catch (    SQLException e) {
    }
  }
}