RFR: 4200096: OffScreenImageSource.removeConsumer NullPointerException [v4]

Jeremy duke at openjdk.org
Wed Apr 12 08:09:42 UTC 2023


> This resolves a 25 year old P4 ticket: a NullPointerException is printed to System.err needlessly.
> 
> This resolution involves confirming that an ImageConsumer is still registered before every notification.
> 
> I'll understand if this is rejected as unimportant, but I stumbled across this in the real world the other day and thought this was a simple enough bug to practice on.

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

  4200096: rewrite solution, only print stacktrace if theConsumer != null
  
  I don't like that we're *expecting* a NullPointerException to get thrown in the course of an allowed use case, but that's probably just a preferences on my part. More importantly: this branch passes all new unit tests. Plus it's readable and easy to code review.
  
  This is related to the latest round of PR feedback here:
  https://github.com/openjdk/jdk/pull/13408#issuecomment-1504605358

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/13408/files
  - new: https://git.openjdk.org/jdk/pull/13408/files/573bdd3a..1a6c1774

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=13408&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=13408&range=02-03

  Stats: 90 lines in 1 file changed: 6 ins; 68 del; 16 mod
  Patch: https://git.openjdk.org/jdk/pull/13408.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13408/head:pull/13408

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



More information about the client-libs-dev mailing list