Program: 51609
Project: 51609
Buggy source:
private List getMembersInLevel(RolapLevel level,Connection jdbcConnection,final RolapLevel[] levels){
  String sql=makeLevelSql(level,jdbcConnection);
  ResultSet resultSet=null;
  try {
    resultSet=RolapUtil.executeQuery(jdbcConnection,sql,"String_Node_Str");
    ArrayList list=new ArrayList();
    final int levelDepth=level.getDepth();
    RolapMember allMember=null;
    if (hierarchy.hasAll()) {
      final List rootMembers=getRootMembers();
      Util.assertTrue(rootMembers.size() == 1);
      allMember=(RolapMember)rootMembers.get(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);
        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=lastOrdinal++;
          for (int j=0; j < level2.properties.length; j++) {
            RolapProperty property=level2.properties[j];
            member.setProperty(property.getName(),resultSet.getObject(++column));
          }
          cache.putMember(key,member);
        }
 else {
          column+=level2.properties.length;
        }
        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) {
            if (value == sqlNullValue) {
              addAsOldestSibling(siblings[i],member);
            }
 else {
              siblings[i].add(member);
            }
          }
        }
      }
      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 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) {
    }
  }
}

Fixed version (ground truth):
private List getMembersInLevel(RolapLevel level,Connection jdbcConnection,final RolapLevel[] levels){
  String sql=makeLevelSql(level,jdbcConnection);
  ResultSet resultSet=null;
  try {
    resultSet=RolapUtil.executeQuery(jdbcConnection,sql,"String_Node_Str");
    ArrayList list=new ArrayList();
    final int levelDepth=level.getDepth();
    RolapMember allMember=null;
    if (hierarchy.hasAll()) {
      final List rootMembers=getRootMembers();
      Util.assertTrue(rootMembers.size() == 1);
      allMember=(RolapMember)rootMembers.get(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);
        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=lastOrdinal++;
          for (int j=0; j < level2.properties.length; j++) {
            RolapProperty property=level2.properties[j];
            member.setProperty(property.getName(),resultSet.getObject(++column));
          }
          cache.putMember(key,member);
        }
 else {
          column+=level2.properties.length;
        }
        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) {
            if (value == sqlNullValue) {
              addAsOldestSibling(siblings[i],member);
            }
 else {
              siblings[i].add(member);
            }
          }
        }
      }
      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,children);
      }
    }
    return 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) {
    }
  }
}