[ https://issues.apache.org/jira/browse/GROOVY-10009?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles updated GROOVY-10009: --------------------------------- Fix Version/s: 3.0.9 > TracingInterceptor throws NullPointerException if arguments contains a null > argument > ------------------------------------------------------------------------------------ > > Key: GROOVY-10009 > URL: https://issues.apache.org/jira/browse/GROOVY-10009 > Project: Groovy > Issue Type: Bug > Components: groovy-jdk > Affects Versions: 3.0.5, 3.0.6 > Environment: Windows 10 Pro > Reporter: John Yin > Assignee: Eric Milles > Priority: Major > Fix For: 4.0.0-alpha-3, 3.0.9 > > Time Spent: 0.5h > Remaining Estimate: 0h > > If a method is called with an argument having null value, beforeInvoke throws > a NullPointerException. Here is an example: > {quote}class Foo { > String say(String s) { > return s > } > } > Foo foo = new Foo() > def tracer = new TracingInterceptor() > def proxyMetaClass = ProxyMetaClass.getInstance(Foo.class) > proxyMetaClass.interceptor = tracer > foo.metaClass = proxyMetaClass > def s > foo.say(s) > {quote} > This will cause a crash because s is null. I believe inside writeInfo() > method of TracingInterceptor, it has something like argument.getClass(). > In the example above, if we change foo.say(s) to foo.say(s as String) it > would pass the beforeInvoke but still fails afterward. If we actual set s to > a non-null value, e.g. > def s = 'Hello' > the trace would work. -- This message was sent by Atlassian Jira (v8.3.4#803005)