[Mondrian] Caculated member has no information on its cube..

Ati Rosselet ati.rosselet at gmail.com
Sat Mar 5 14:06:39 EST 2011


Hi, I've run into a strange error, and am a bit stuck.  I have
calculated Members in my Measure-s and others in various heirarchies.
Not usually a problem, but the server is throwing an npe at
AggregateFunDef.dimensionJoinsToBaseCube(), which I have traced back
to the evaluator of the
query in question returning NULL for its getMeasureCube().

 public RolapCube getMeasureCube() {
        final RolapMember measure = currentMembers[0];
        if (measure instanceof RolapStoredMeasure) {
            return ((RolapStoredMeasure) measure).getCube();
        }
        return null;
    }

now here the currentMembers[0] happens to be my CalculatedMember and
since that isn't a RolapStoredMeasure (rather a
RolapHierarchy$RolapCalculatedMeasure), I get null and then an NPE.

Any idea/suggestions on how to get around this?  My only idea is to
change the src to add something like


        if (measure instanceof RolapHierarchy.RolapCalculatedMeasure){
            return
((RolapStoredMeasure)((RolapHierarchy.RolapCalculatedMeasure)measure).getDimension().getHierarchy().getDefaultMember()).getCube();
        }

but thats quite an ugly hack....   and I don't know if it would work
in all cases....

Thanks
Ati



More information about the Mondrian mailing list