[OpenJDK 2D-Dev] RFR: 6206189: Graphics2D.clip specifies incorrectly that a 'null' is a valid value for this method [v3]
Phil Race
prr at openjdk.java.net
Wed Feb 10 18:50:40 UTC 2021
On Wed, 10 Feb 2021 06:01:59 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:
>> The API doc for Graphics2D.clip(shape s) claims that passing a null argument would actually clear the existing clipping area, which is incorrect.
>> This statement is applicable only to G2D.setClip() and not for the clip() method. G2D.clip() would throw a NullPointerException when it encounters a null argument.
>> Updated spec to rectify this.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
>
> Fix
test/jdk/java/awt/Graphics2D/TestNullClip.java line 52:
> 50: throw new RuntimeException("NPE is expected");
> 51: } catch (NullPointerException e) {
> 52: //expected
Why is this wrapping everything ? There's only one line here where you expect an NPE and so you should only catch an exception from that one line.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2476
More information about the 2d-dev
mailing list