> This is an update to the patch integrated in 
> https://github.com/openjdk/jdk/pull/28127. It changes the exception from 
> IllegalArgumentException back to NullPointerException, which was thrown 
> previously.
> 
> Rationale:
>  - Since an NPE was already thrown before, this does not introduce a behavior 
> change
>  - Throwing NPE on null is the common pattern used across the codebase, 
> including in the affected package
> 
> Additional notes:
> The patch uses the idiomatic way to check parameters for null via 
> Objects.requireNonNull(). I am not sure whether this code path is performance 
> critical. The use of >> 1 instead of / 2 suggests that performance might 
> matter. If this code is performance sensitive, we can remove the 
> Objects.requireNonNull() call, because even without it the resulting NPE 
> would still clearly show which variable was null when its field was accessed.
> 
> It is also possible to remove the use of multiplyExact(). We can simply 
> multiply width/height as long values and compare the result with the data 
> length. In case of overflow, the existing “Data array too small” exception 
> would still be thrown.

Sergey Bylokhov has updated the pull request with a new target base due to a 
merge or a rebase. The incremental webrev excludes the unrelated changes 
brought in by the merge/rebase. The pull request contains two additional 
commits since the last revision:

 - Merge branch 'openjdk:master' into JDK-8371501
 - 8371501: Change IAE to NPE in java.awt.image.Kernel when data is null

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/28249/files
  - new: https://git.openjdk.org/jdk/pull/28249/files/b0a02731..49b5e2de

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

  Stats: 98777 lines in 1529 files changed: 62872 ins; 25756 del; 10149 mod
  Patch: https://git.openjdk.org/jdk/pull/28249.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28249/head:pull/28249

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

Reply via email to