Uploaded image for project: 'Pentaho Analysis - Mondrian'
  1. Pentaho Analysis - Mondrian
  2. MONDRIAN-745

NullPointerException when passing in null param value

    Details

    • Type: Bug
    • Status: Closed
    • Severity: High
    • Resolution: Fixed
    • Affects Version/s: 3.2.0 GA (3.6.0 GA Suite Release)
    • Component/s: None
    • Labels:
      None
    • Notice:
      When an issue is open, the "Fix Version/s" field conveys a target, not necessarily a commitment. When an issue is closed, the "Fix Version/s" field conveys the version that the issue was fixed in.

      Description

      In 3.2.0.13583, The following unit test passes. In 3.2.0.13643, the test fails with a NullPointerException

      public void testNullStrToMember() {
      Connection connection = getConnection();
      Query query = connection.parseQuery(
      "select NON EMPTY

      {[Time].[1997]} ON COLUMNS, " +
      "NON EMPTY {StrToMember(Parameter(\"sProduct\", STRING, \"[Gender].[Gender].[F]\"))} ON ROWS " +
      "from [Sales]"
      );
      Parameter[] parameters = query.getParameters();
      parameters[0].setValue(null);
      Result result = connection.execute(query);
      String resultString = TestContext.toString(result);
      TestContext.assertEqualsVerbose(
      "Axis #0:\n"
      + "{}\n"
      + "Axis #1:\n"
      + "{[Time].[1997]}

      \n"
      + "Axis #2:\n"
      + "

      {[Gender].[F]}

      \n"
      + "Row #0: 131,558\n",
      resultString);
      }

      mondrian.olap.MondrianException: Mondrian Error:Internal error: Error while executing query [select NON EMPTY

      {[Time].[1997]}

      ON COLUMNS,
      NON EMPTY

      {StrToMember(Parameter("sProduct", STRING, "[Gender].[Gender].[F]"))}

      ON ROWS
      from [Sales]
      ]
      at mondrian.resource.MondrianResource$_Def0.ex(MondrianResource.java:821)
      at mondrian.olap.Util.newInternal(Util.java:1490)
      at mondrian.olap.Util.newError(Util.java:1506)
      at mondrian.rolap.RolapConnection.execute(RolapConnection.java:622)
      at mondrian.test.ParameterTest.testNullStrToMember(ParameterTest.java:170)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at junit.framework.TestCase.runTest(TestCase.java:154)
      at junit.framework.TestCase.runBare(TestCase.java:127)
      at junit.framework.TestResult$1.protect(TestResult.java:106)
      at junit.framework.TestResult.runProtected(TestResult.java:124)
      at junit.framework.TestResult.run(TestResult.java:109)
      at junit.framework.TestCase.run(TestCase.java:118)
      at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      Caused by: java.lang.NullPointerException
      at mondrian.util.IdentifierParser.parseMember(IdentifierParser.java:148)
      at mondrian.olap.fun.FunUtil.parseMember(FunUtil.java:2319)
      at mondrian.olap.fun.FunUtil.parseMember(FunUtil.java:2326)
      at mondrian.olap.fun.StrToMemberFunDef$1.evaluateMember(StrToMemberFunDef.java:43)
      at mondrian.olap.fun.SetFunDef$MemberSetListCalc$2.evaluateVoid(SetFunDef.java:173)
      at mondrian.olap.fun.SetFunDef$MemberSetListCalc.evaluateMemberList(SetFunDef.java:190)
      at mondrian.calc.impl.AbstractExpCompiler$MemberListIterCalc.evaluateMemberIterable(AbstractExpCompiler.java:592)
      at mondrian.calc.impl.AbstractMemberIterCalc.evaluate(AbstractMemberIterCalc.java:52)
      at mondrian.rolap.RolapResult.executeAxis(RolapResult.java:732)
      at mondrian.rolap.RolapResult.evalLoad(RolapResult.java:575)
      at mondrian.rolap.RolapResult.loadMembers(RolapResult.java:541)
      at mondrian.rolap.RolapResult.<init>(RolapResult.java:273)
      at mondrian.rolap.RolapConnection.execute(RolapConnection.java:593)
      ... 17 more

        Attachments

          Activity

            People

            • Assignee:
              sflatley Sean Flatley (Inactive)
              Reporter:
              wgorman Will Gorman (Inactive)
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: