<i18n dev> RFR: 8357598: Toolkit.removeAWTEventListener should handle null listener in AWTEventListenerProxy

Alexey Ivanov aivanov at openjdk.org
Tue May 27 17:19:07 UTC 2025


On Thu, 22 May 2025 21:21:30 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:

> The issue was found here: https://github.com/openjdk/jdk/pull/24692#discussion_r2089545502
> 
> AWTEventListener and AWTEventListenerProxy are public classes and there's no assertion that EventListenerProxy.getListener() will always return a non-null value. So removeAWTEventListener method should fetch the listener from the proxy and check it for null similar to how it is implemented in addAWTEventListener. Currently, it works fine because we never insert null values into the map. So it is just a code clarification.
> 
> One of the test is updated just to touch that codepath.

Looks good.

I'll submit a test job.

test/jdk/java/awt/Toolkit/AWTEventListenerProxyTest/AWTEventListenerProxyTest.java line 171:

> 169:             System.out.println("[Simple test failed!!]");
> 170:             throw new RuntimeException(
> 171:                     "Test failed didn't return " + expected + "-sized array");

Suggestion:

                    "Test didn't return " + expected + "-sized array");

-------------

Marked as reviewed by aivanov (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/25401#pullrequestreview-2871915591
PR Review Comment: https://git.openjdk.org/jdk/pull/25401#discussion_r2109746291


More information about the i18n-dev mailing list