Skip to content

Commit

Permalink
MONDRIAN: Fixes a class cast exception which happened with the XMLA T…
Browse files Browse the repository at this point in the history
…CK. The Measure dimension is not always at ordinal 0.

[git-p4: depot-paths = "//open/mondrian/": change = 14501]
  • Loading branch information
lucboudreau committed Jul 27, 2011
1 parent 83c30b3 commit 4d14562
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions src/main/mondrian/xmla/RowsetDefinition.java
Expand Up @@ -5125,9 +5125,6 @@ protected void populateCatalog(

for (Schema schema : filter(catalog.getSchemas(), schemaNameCond)) {
for (Cube cube : filteredCubes(schema, cubeNameCond)) {
Dimension measuresDimension = cube.getDimensions().get(0);
Hierarchy measuresHierarchy =
measuresDimension.getHierarchies().get(0);

buf.setLength(0);

Expand All @@ -5150,22 +5147,20 @@ protected void populateCatalog(
String levelListStr = buf.toString();

List<Member> calcMembers = new ArrayList<Member>();
for (Level level : measuresHierarchy.getLevels()) {
for (Measure measure
: filter(
Util.<Measure>cast(level.getMembers()),
measureNameCond,
measureUnameCond))
{
if (measure.isCalculated()) {
// Output calculated measures after stored
// measures.
calcMembers.add(measure);
} else {
populateMember(
connection, catalog,
measure, cube, levelListStr, rows);
}
for (Measure measure
: filter(
cube.getMeasures(),
measureNameCond,
measureUnameCond))
{
if (measure.isCalculated()) {
// Output calculated measures after stored
// measures.
calcMembers.add(measure);
} else {
populateMember(
connection, catalog,
measure, cube, levelListStr, rows);
}
}

Expand Down Expand Up @@ -6351,7 +6346,7 @@ static Iterable<Cube> filteredCubes(
{
final Iterable<Cube> iterable =
filter(sortedCubes(schema), cubeNameCond);
if (!cubeNameCond.apply(null)) {
if (!cubeNameCond.apply(new SharedDimensionHolderCube(schema))) {
return iterable;
}
return Composite.of(
Expand Down Expand Up @@ -6524,7 +6519,7 @@ protected String getName(Hierarchy hierarchy) {
}

public List<Measure> getMeasures() {
throw new UnsupportedOperationException();
return Collections.emptyList();
}

public NamedList<NamedSet> getSets() {
Expand Down

0 comments on commit 4d14562

Please sign in to comment.