RFR: 7027: Avoid NPE for callers of TransformRegistry#getTransformData
Marcus Hirt
hirt at openjdk.java.net
Tue Dec 1 09:24:59 UTC 2020
On Sun, 29 Nov 2020 19:27:48 GMT, Gunnar Morling <github.com+28612+gunnarmorling at openjdk.org> wrote:
> …) of no transform data exists
>
> @thegreystone, @Josh-Matsuoka, et al., this fixes an NPE in the `Transformer` class if there is no metadata for the given class (we unconditionally try to iterate over the returned list). I noticed this while debugging something else, it seems this NPE gets swallowed elsewhere, but creating it over and over is costly of course.
>
> I think never returning null from a collection method is a good practice anyways, so I've changed it accordingly. Could someone log an issue for this, so I can reference it? Thanks!
Changes requested by hirt (Lead).
agent/src/main/java/org/openjdk/jmc/agent/TransformRegistry.java line 2:
> 1: /*
> 2: * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
Update copyright year - 2018, 2020.
agent/src/test/java/org/openjdk/jmc/agent/test/TestDefaultTransformRegistry.java line 2:
> 1: /*
> 2: * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
Update copyright year - 2018, 2020.
-------------
PR: https://git.openjdk.java.net/jmc/pull/169
More information about the jmc-dev
mailing list