Hello,
I am using beanshell version 1.3.0 in DEBUG mode. In the java class bsh.Reflect I get an Nullpointer Exception when my method argument is NULL.
The Nullpointer occured in method invokeOnMethod.
--> Interpreter.debug("tmpArgs[" + k + "] = " + aobj1[k] + " type = " + aobj1[k].getClass()); // when aobj1[k] is null then getClass will cause the NullPointerException
Code:
private static Object invokeOnMethod(Method method, Object obj, Object aobj[])
throws ReflectError, InvocationTargetException
{
Object aobj1[];
....
aobj1 = new Object[aobj.length];
Class aclass[] = method.getParameterTypes();
try
{
for(int j = 0; j < aobj.length; j++)
{
aobj1[j] = NameSpace.getAssignableForm(aobj[j], aclass[j]);
}
}
catch(UtilEvalError utilevalerror)
{
throw new InterpreterError("illegal argument type in method invocation: " + utilevalerror);
}
aobj1 = unwrapPrimitives(aobj1);
if(Interpreter.DEBUG)
{
Interpreter.debug("Invoking method (after massaging values): " + method + " with tmpArgs:");
for(int k = 0; k < aobj1.length; k++)
{
Interpreter.debug("tmpArgs[" + k + "] = " + aobj1[k] + " type = " + aobj1[k].getClass()); // when aobj1[k] is null then getClass will cause the NullPointerException
}
}
....
Maybe it is possible to get a patch for release 1.3.0 that fixes this error?
Kind regards,
Marco.
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
Don't get the point here:
> when aobj1[k] is null then getClass will cause the NullPointerException
This is your code so you are responsible for preventing this NPE.
Nevertheless you could give the BeanShell fork (BeanShell2) a try: Look at at http://code.google.com/p/beanshell2
Dowonload it here: http://beanshell2.googlecode.com/files/bsh-2.1b0.jar
View and moderate all "bugs Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs"
Got it now, this is a duplicate of issue 2562805 and will be fixed in BeanShell2 fork at http://code.google.com/p/beanshell2
See http://code.google.com/p/beanshell2/issues/detail?id=44
Ticket has been migrated to github.
Please follow up on this over here: https://github.com/beanshell/beanshell/issues/472