Program: 51382
Project: 51382
Buggy source:
private int internalAddRow(ResultSet resultSet,int column) throws SQLException {
  RolapMember member=null;
  if (currMember != null) {
    member=currMember;
  }
 else {
    boolean checkCacheStatus=true;
    for (int i=0; i <= levelDepth; i++) {
      RolapLevel childLevel=levels[i];
      if (childLevel.isAll()) {
        member=level.getHierarchy().getAllMember();
        continue;
      }
      Object value=resultSet.getObject(++column);
      if (value == null) {
        value=RolapUtil.sqlNullValue;
      }
      Object captionValue;
      if (childLevel.hasCaptionColumn()) {
        captionValue=resultSet.getObject(++column);
      }
 else {
        captionValue=null;
      }
      RolapMember parentMember=member;
      Object key=cache.makeKey(parentMember,value);
      member=cache.getMember(key,checkCacheStatus);
      checkCacheStatus=false;
      if (member == null) {
        member=memberBuilder.makeMember(parentMember,childLevel,value,captionValue,parentChild,resultSet,key,column);
      }
      if (!childLevel.getOrdinalExp().equals(childLevel.getKeyExp())) {
        ++column;
      }
      column+=childLevel.getProperties().length;
      if (member != members[i]) {
        List<RolapMember> children=siblings[i + 1];
        if (children != null) {
          MemberChildrenConstraint mcc=constraint.getMemberChildrenConstraint(members[i]);
          if (mcc != null)           cache.putChildren(members[i],mcc,children);
        }
        MemberChildrenConstraint mcc=constraint.getMemberChildrenConstraint(member);
        List cachedChildren=cache.getChildrenFromCache(member,mcc);
        if (i < levelDepth && cachedChildren == null) {
          siblings[i + 1]=new ArrayList<RolapMember>();
        }
 else {
          siblings[i + 1]=null;
        }
        members[i]=member;
        if (siblings[i] != null) {
          if (value == RolapUtil.sqlNullValue) {
            addAsOldestSibling(siblings[i],member);
          }
 else {
            siblings[i].add(member);
          }
        }
      }
    }
    currMember=member;
  }
  list.add(member);
  return column;
}

Fixed version (ground truth):
private int internalAddRow(ResultSet resultSet,int column) throws SQLException {
  RolapMember member=null;
  if (currMember != null) {
    member=currMember;
  }
 else {
    boolean checkCacheStatus=true;
    for (int i=0; i <= levelDepth; i++) {
      RolapLevel childLevel=levels[i];
      if (childLevel.isAll()) {
        member=level.getHierarchy().getAllMember();
        continue;
      }
      Object value=resultSet.getObject(++column);
      if (value == null) {
        value=RolapUtil.sqlNullValue;
      }
      Object captionValue;
      if (childLevel.hasCaptionColumn()) {
        captionValue=resultSet.getObject(++column);
      }
 else {
        captionValue=null;
      }
      RolapMember parentMember=member;
      Object key=cache.makeKey(parentMember,value);
      member=cache.getMember(key,checkCacheStatus);
      checkCacheStatus=false;
      if (member == null) {
        member=memberBuilder.makeMember(parentMember,childLevel,value,captionValue,parentChild,resultSet,key,column);
      }
      if (!childLevel.getOrdinalExp().equals(childLevel.getKeyExp())) {
        ++column;
      }
      column+=childLevel.getProperties().length;
      if (member != members[i]) {
        List<RolapMember> children=siblings[i + 1];
        if (children != null) {
          MemberChildrenConstraint mcc=constraint.getMemberChildrenConstraint(members[i]);
          if (mcc != null) {
            cache.putChildren(members[i],mcc,children);
          }
        }
        MemberChildrenConstraint mcc=constraint.getMemberChildrenConstraint(member);
        List cachedChildren=cache.getChildrenFromCache(member,mcc);
        if (i < levelDepth && cachedChildren == null) {
          siblings[i + 1]=new ArrayList<RolapMember>();
        }
 else {
          siblings[i + 1]=null;
        }
        members[i]=member;
        if (siblings[i] != null) {
          if (value == RolapUtil.sqlNullValue) {
            addAsOldestSibling(siblings[i],member);
          }
 else {
            siblings[i].add(member);
          }
        }
      }
    }
    currMember=member;
  }
  list.add(member);
  return column;
}