cbuschka / beanshell2

Automatically exported from code.google.com/p/beanshell2
0 stars 0 forks source link

Debug fails if called method argument is null #44

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Copied from 
https://sourceforge.net/tracker/?func=detail&aid=2562805&group_id=4075&atid=1040
75

In bsh.Reflect.java the below code fails if debug is turned on and one of 
method arguments is null.

Since args[i] is null, args[i].getClass() throws NullPointerException.

This makes debuging impossible in some cases.

Line:
+" type = "+args[i].getClass() );

Should be:
+" type = "+(args[i] == null ? "void" : args[i].getClass()) );

{{{
    private static void logInvokeMethod(String msg, Method method, Object[] args) {
        if (Interpreter.DEBUG) {
            Interpreter.debug(msg + method + " with args:");
            for (int i = 0; i < args.length; i++) {
                Interpreter.debug("args[" + i + "] = " + args[i] + " type = " + args[i].getClass());
            }
        }
    }
}}}

Original issue reported on code.google.com by pejob...@gmail.com on 27 Feb 2011 at 12:30

GoogleCodeExporter commented 8 years ago

Original comment by pejob...@gmail.com on 27 Feb 2011 at 12:31

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r68.

Original comment by `` on 27 Feb 2011 at 2:23

GoogleCodeExporter commented 8 years ago

Original comment by pejob...@gmail.com on 20 Oct 2011 at 7:12