hi,
Michiel Meeuwissen wrote:
[snip NullPointerException]
This line is:
return functionMethod.invoke(functionInstance,
parameters.toArray());
According to javadoc of Method, 'invoke' can give NPE if first
argument is null and the method is an instance method.
Hmm, you're right - if what I thought was happening (problems converting
an argument to a primitive type) it _should_ throw an
IllegalArgumentExeception, not a NullPointerException.
I would start with checking that, by adding a line of logging there
(or perhaps you can add a watch in your debugger).
Anyway, it may be useful to also inspect the values present in the
parameters array in the same way. You would see odd values in that
immediately. But if that would cause NPE in the function code itself,
I would not expect the stacktrace to originate from the reflection
code itself.
I already did have a line that logged the situation _after_ the
exception - that one didn't suggest that the functionInstance was null.
Now I've added logging before the actual function call - this one
doesn't raise an exception:
2005-07-07 12:26:26,284 SERVICE mmbase.util.functions.SetFunction -
Function call to: getPostings,
method: public java.util.List
org.mmbase.applications.mmbob.gui.Controller.getPostings(java.lang.String,java.lang.String,java.lang.String,int,int,int,java.lang.String),
instance: [EMAIL PROTECTED],
parameters: [class java.lang.String forumid=1041, class
java.lang.Stringpostareaid=1715, class java.lang.String
postthreadid=1717, int posterid=1628, int page=1, int pagesize=5, class
java.lang.String imagecontext=/mmbase/thememanager/images]
But this one does! :
2005-07-07 12:41:48,887 SERVICE mmbase.util.functions.SetFunction -
Function call to: getPostThreadNavigation,
method: public org.mmbase.module.core.MMObjectNode
org.mmbase.applications.mmbob.gui.Controller.getPostThreadNavigation(java.lang.String,java.lang.String,java.lang.String,int,int,int,java.lang.String,java.lang.String),
instance: [EMAIL PROTECTED],
parameters: [class java.lang.String forumid=1041, class java.lang.String
postareaid=1715, class java.lang.String postthreadid=1717, int
posterid=null, int page=1, int pagesize=5, class java.lang.String
baseurl=thread.jsp, class java.lang.String cssclass=null]
2005-07-07 12:41:48,887 FATAL STDERR - java.lang.NullPointerException
2005-07-07 12:41:48,898 WARN STDERR - at
sun.reflect.NativeMethodAcces
sorImpl.invoke0(Native Method)
2005-07-07 12:41:48,898 WARN STDERR - at
sun.reflect.NativeMethodAcces
sorImpl.invoke(NativeMethodAccessorImpl.java:39)
And the difference looks to be the 'posterid=null'
Perhaps it has gotten confused by the negative parameter
before calling 'initalize' or so? I don't recall excactly when that is
supposed to happen, but surely it can't be hard to find that out.
So I still don't know _why_ the posterid=null (instead of being -1 like
it should be) but it sure does look like this is causing the trouble.
Simon
PS: this is all 1.8 / cvs head stuff
_______________________________________________
Developers mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/developers