[OpenJDK 2D-Dev] RFR: 6211257: BasicStroke.createStrokedShape(Shape): NPE is not specified [v2]

Alexey Ivanov aivanov at openjdk.java.net
Fri Feb 5 16:19:45 UTC 2021


On Thu, 4 Feb 2021 04:15:03 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> Method createStrokedShape(Shape) for java.awt.BasicStroke class throws NullPointerException when passed a null object reference for a input parameter but it's not specified in the spec.
>> Updated spec to illustrate this.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Doc change to @throws

test/jdk/java/awt/BasicStroke/TestNullShape.java line 44:

> 42:             return;
> 43:         }
> 44:         throw new RuntimeException("NPE is expected");

I would suggest moving this into the try-block as it would make the intention clearer: if NPE is not thrown, it's a failure.

Also catch should be on the same line as the closing brace of try.

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

PR: https://git.openjdk.java.net/jdk/pull/2377


More information about the 2d-dev mailing list