You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2021/04/06 14:38:00 UTC
[jira] [Assigned] (GROOVY-10009) TracingInterceptor throws
NullPointerException if arguments contains a null argument
[ https://issues.apache.org/jira/browse/GROOVY-10009?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles reassigned GROOVY-10009:
------------------------------------
Assignee: Eric Milles
> 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
>
> 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)