Program: 51444
Project: 51444
Buggy source:
private void getMemberChildren(RolapMember parentMember,List children,Connection jdbcConnection,MemberChildrenConstraint constraint){
  String sql;
  boolean parentChild;
  final RolapLevel parentLevel=(RolapLevel)parentMember.getLevel();
  RolapLevel childLevel;
  if (parentLevel.isParentChild()) {
    sql=makeChildMemberSqlPC(parentMember,jdbcConnection);
    parentChild=true;
    childLevel=parentLevel;
  }
 else {
    childLevel=getChildLevel(parentLevel);
    if (childLevel == null) {
      return;
    }
    if (childLevel.isParentChild()) {
      sql=makeChildMemberSql_PCRoot(parentMember,jdbcConnection);
      parentChild=true;
    }
 else {
      sql=makeChildMemberSql(parentMember,jdbcConnection,constraint);
      parentChild=false;
    }
  }
  ResultSet resultSet=null;
  try {
    resultSet=RolapUtil.executeQuery(jdbcConnection,sql,"String_Node_Str");
    IntegerProperty ip=MondrianProperties.instance().ResultLimit;
    int limit=ip.get();
    int nFetch=0;
    while (resultSet.next()) {
      if (limit > 0 && limit < ++nFetch) {
        throw MondrianResource.instance().MemberFetchLimitExceeded.ex(new Long(limit));
      }
      Object value=resultSet.getObject(1);
      if (value == null) {
        value=RolapUtil.sqlNullValue;
      }
      Object captionValue;
      if (childLevel.hasCaptionColumn()) {
        captionValue=resultSet.getObject(2);
      }
 else {
        captionValue=null;
      }
      Object key=cache.makeKey(parentMember,value);
      RolapMember member=cache.getMember(key);
      if (member == null) {
        member=makeMember(parentMember,childLevel,value,captionValue,parentChild,resultSet,key,1);
      }
      if (value == RolapUtil.sqlNullValue) {
        addAsOldestSibling(children,member);
      }
 else {
        children.add(member);
      }
    }
  }
 catch (  SQLException e) {
    throw Util.newInternal(e,"String_Node_Str" + sql + "String_Node_Str");
  }
 finally {
    try {
      if (resultSet != null) {
        resultSet.getStatement().close();
        resultSet.close();
      }
    }
 catch (    SQLException e) {
    }
  }
}

Fixed version (ground truth):
private void getMemberChildren(RolapMember parentMember,List children,Connection jdbcConnection,MemberChildrenConstraint constraint){
  String sql;
  boolean parentChild;
  final RolapLevel parentLevel=(RolapLevel)parentMember.getLevel();
  RolapLevel childLevel;
  if (parentLevel.isParentChild()) {
    sql=makeChildMemberSqlPC(parentMember,jdbcConnection);
    parentChild=true;
    childLevel=parentLevel;
  }
 else {
    childLevel=(RolapLevel)parentLevel.getChildLevel();
    if (childLevel == null) {
      return;
    }
    if (childLevel.isParentChild()) {
      sql=makeChildMemberSql_PCRoot(parentMember,jdbcConnection);
      parentChild=true;
    }
 else {
      sql=makeChildMemberSql(parentMember,jdbcConnection,constraint);
      parentChild=false;
    }
  }
  ResultSet resultSet=null;
  try {
    resultSet=RolapUtil.executeQuery(jdbcConnection,sql,"String_Node_Str");
    int limit=MondrianProperties.instance().ResultLimit.get();
    int nFetch=0;
    while (resultSet.next()) {
      if (limit > 0 && limit < ++nFetch) {
        throw MondrianResource.instance().MemberFetchLimitExceeded.ex(new Long(limit));
      }
      Object value=resultSet.getObject(1);
      if (value == null) {
        value=RolapUtil.sqlNullValue;
      }
      Object captionValue;
      if (childLevel.hasCaptionColumn()) {
        captionValue=resultSet.getObject(2);
      }
 else {
        captionValue=null;
      }
      Object key=cache.makeKey(parentMember,value);
      RolapMember member=cache.getMember(key);
      if (member == null) {
        member=makeMember(parentMember,childLevel,value,captionValue,parentChild,resultSet,key,1);
      }
      if (value == RolapUtil.sqlNullValue) {
        addAsOldestSibling(children,member);
      }
 else {
        children.add(member);
      }
    }
  }
 catch (  SQLException e) {
    throw Util.newInternal(e,"String_Node_Str" + sql + "String_Node_Str");
  }
 finally {
    try {
      if (resultSet != null) {
        resultSet.getStatement().close();
        resultSet.close();
      }
    }
 catch (    SQLException e) {
    }
  }
}