You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by bu...@apache.org on 2005/03/30 20:29:52 UTC

DO NOT REPLY [Bug 34243] New: - NullPointerException in Introspector.java

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34243>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34243

           Summary: NullPointerException in Introspector.java
           Product: Velocity
           Version: 1.5
          Platform: PC
        OS/Version: Windows 2000
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Source
        AssignedTo: velocity-dev@jakarta.apache.org
        ReportedBy: rriser@informs.com


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();

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org