Velocity
  1. Velocity
  2. VELOCITY-370

NullPointerException in Introspector.java

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 1.5
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      Operating System: Windows 2000
      Platform: PC

      Description

      In line 116 of the getMethod method of Introspector.java, a NullPointerException
      can be thrown at this line:

      msg = msg + params[i].getClass().getName();

      The scenario was that an overloaded method in a tool class in my context was
      being called with a null parameter (i.e., params[i] was null). That resulted in
      an AmbiguousException correctly being thrown, but the error message being built
      in this method was never being shown because a NullPointerException occurred
      first. Looking at the code, you would expect to see something like this:

      Introspection Error : Ambiguous method invocation someOverloadedMethod( null)
      for class class com.blah.blah.MyTool

      Instead I was seeing this:

      ASTMethod.execute() : exception from introspection : java.lang.NullPointerException

      Easy fix should be:

      if (params[i] == null)
      msg = msg + "null";
      else
      msg = msg + params[i].getClass().getName();

        Activity

        Reggie Riser created issue -
        Jeff Turner made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 34243 12315240
        Will Glass-Husain made changes -
        Assignee Velocity-Dev List [ velocity-dev@jakarta.apache.org ]
        Description In line 116 of the getMethod method of Introspector.java, a NullPointerException
        can be thrown at this line:

        msg = msg + params[i].getClass().getName();

        The scenario was that an overloaded method in a tool class in my context was
        being called with a null parameter (i.e., params[i] was null). That resulted in
        an AmbiguousException correctly being thrown, but the error message being built
        in this method was never being shown because a NullPointerException occurred
        first. Looking at the code, you would expect to see something like this:

        Introspection Error : Ambiguous method invocation someOverloadedMethod( null)
        for class class com.blah.blah.MyTool

        Instead I was seeing this:

        ASTMethod.execute() : exception from introspection : java.lang.NullPointerException

        Easy fix should be:

        if (params[i] == null)
            msg = msg + "null";
        else
            msg = msg + params[i].getClass().getName();
        In line 116 of the getMethod method of Introspector.java, a NullPointerException
        can be thrown at this line:

        msg = msg + params[i].getClass().getName();

        The scenario was that an overloaded method in a tool class in my context was
        being called with a null parameter (i.e., params[i] was null). That resulted in
        an AmbiguousException correctly being thrown, but the error message being built
        in this method was never being shown because a NullPointerException occurred
        first. Looking at the code, you would expect to see something like this:

        Introspection Error : Ambiguous method invocation someOverloadedMethod( null)
        for class class com.blah.blah.MyTool

        Instead I was seeing this:

        ASTMethod.execute() : exception from introspection : java.lang.NullPointerException

        Easy fix should be:

        if (params[i] == null)
            msg = msg + "null";
        else
            msg = msg + params[i].getClass().getName();
        Environment Operating System: Windows 2000
        Platform: PC
        Operating System: Windows 2000
        Platform: PC
        Bugzilla Id 34243
        Fix Version/s 1.5 [ 12310253 ]
        Will Glass-Husain made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Henning Schmiedehausen made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Workflow jira [ 12325245 ] Default workflow, editable Closed status [ 12551743 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12551743 ] jira [ 12552279 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Reggie Riser
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development