RFR: 8357598: Toolkit.removeAWTEventListener should handle null listener in AWTEventListenerProxy [v2]

Sergey Bylokhov serb at openjdk.org
Tue May 27 17:38:32 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.

Sergey Bylokhov has updated the pull request incrementally with one additional commit since the last revision:

  Update test/jdk/java/awt/Toolkit/AWTEventListenerProxyTest/AWTEventListenerProxyTest.java
  
  Co-authored-by: Alexey Ivanov <alexey.ivanov at oracle.com>

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/25401/files
  - new: https://git.openjdk.org/jdk/pull/25401/files/36560145..afb10b6d

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=25401&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25401&range=00-01

  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 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 client-libs-dev mailing list