commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "matthew.hawthorne" <>
Subject Re: Problem using beanutils: MethodUtils.invokeMethod throw a null pointer exception
Date Thu, 01 Apr 2004 17:34:56 GMT
Eric BELLARD wrote:
> I got a null point exception when passing as
> parameters a table with a null value inside like this:
>  [, , null, avionCargoFret, , ]
> The following code inside beanutils send me the
> exception when it does getClass the null element of
> the table:
>        Class parameterTypes [] = new Class[arguments];
>         for (int i = 0; i < arguments; i++) {
>             parameterTypes[i] = args[i].getClass();
>         }
> Is this a misuse of the MethodUtils.invokeMethod?
> Is this a known limitation of the implementation?
> Is  this a bug?
> Is there any solution out there?

I had the same problem a few weeks ago.  There is another version of 
invokeMethod that takes an array of Classes which represent parameter 
types.  It then uses the array instead of trying to dynamically get the 
parameter types from the parameters, which fails when a parameter is null.

It should look like:

invokeMethod(Object, Class, Object[], Class[])

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message