RFR: 8375016: Several catch blocks for NullPointerExceptions exist in the codebase
Andy Goryachev
angorya at openjdk.org
Mon Jan 12 17:41:37 UTC 2026
On Mon, 12 Jan 2026 17:21:39 GMT, Christopher Schnick <duke at openjdk.org> wrote:
>> modules/javafx.base/src/main/java/javafx/beans/binding/Bindings.java line 7478:
>>
>>> 7476: return val;
>>> 7477: } else {
>>> 7478: Logging.getLogger().fine("Element not found in map, returning default value instead.");
>>
>> Why did you add this check? The old implementation doesn't check whether the mapping exists, it simply returns the result of `Map.get()`.
>>
>> On the other hand, `NullPointerException` is thrown by `Map.get()` if the key is null, and the map doesn't permit null keys. The old implementation would return null here end emit a warning, this implementation returns by throwing the exception.
>
> Ok that is true, let me rework this PR
I agree, the change is not equivalent...
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2032#discussion_r2683195725
More information about the openjfx-dev
mailing list