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

Sergey Bylokhov serb at openjdk.org
Sun May 25 07:55:38 UTC 2025


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.

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

Commit messages:
 - Merge branch 'openjdk:master' into JDK-8357598
 - Update AWTEventListenerProxyTest.java
 - Update AWTEventListenerProxyTest.java
 - 8357598:  Toolkit.removeAWTEventListener should handle null listener in AWTEventListenerProxy

Changes: https://git.openjdk.org/jdk/pull/25401/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25401&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8357598
  Stats: 48 lines in 2 files changed: 28 ins; 15 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/25401.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25401/head:pull/25401

PR: https://git.openjdk.org/jdk/pull/25401


More information about the i18n-dev mailing list