Skip to content

Commit

Permalink
MONDRIAN - Fixed construction of null member when ignore invalid members
Browse files Browse the repository at this point in the history
       property is set and non-existent member found.

[git-p4: depot-paths = "//open/mondrian/": change = 8181]
  • Loading branch information
Zelaine Fong committed Nov 18, 2006
1 parent 6d5d857 commit 39a6499
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions src/main/mondrian/olap/Util.java
Expand Up @@ -594,23 +594,31 @@ public static Exp lookup(
createExpr(olapElement)});
}
}
// if we're in the middle of loading the schema, the
// property has been set to ignore invalid members, and the member
// is non-existent, return the null member; find the null member
// by first finding a member at the same level and then
// getting the null member from that member's hierarchy; if
// we can't find a member of the specified hierarchy, then just
// return the null member from the first hierarchy
// if we're in the middle of loading the schema, the property has
// been set to ignore invalid members, and the member is
// non-existent, return the null member corresponding to the
// hierarchy of the element we're looking for; locate the
// hierarchy by incrementally truncating the name of the element
if (q.ignoreInvalidMembers()) {
olapElement = schemaReader.lookupCompound(
q.getCube(), nameParts, false, Category.Member,
MatchType.BEFORE);
int nameLen = nameParts.length - 1;
olapElement = null;
while (nameLen > 0 && olapElement == null) {
String[] partialName = new String[nameLen];
System.arraycopy(
nameParts,
0,
partialName,
0,
nameLen);
olapElement = schemaReader.lookupCompound(
q.getCube(), partialName, false, Category.Unknown);
nameLen--;
}
if (olapElement != null) {
olapElement = olapElement.getHierarchy().getNullMember();
} else {
olapElement =
q.getCube().getDimensions()[0].getHierarchy().
getNullMember();
throw MondrianResource.instance().MdxChildObjectNotFound.ex(
fullName, q.getCube().getQualifiedName());
}
} else {
throw MondrianResource.instance().MdxChildObjectNotFound.ex(
Expand Down

0 comments on commit 39a6499

Please sign in to comment.