-
CSR
-
Resolution: Approved
-
P3
-
None
-
behavioral
-
minimal
-
Java API
-
SE
Summary
Some constructors in the Path2D.Double, Path2D.Float and GeneralPath classes throw unexpected exceptions.
Problem
The specification missed the NegativeArraySizeException, IllegalArgumentException and NullPointerException.
Solution
Update the speciifcation.
Specification
src/java.desktop/share/classes/java/awt/geom/GeneralPath.java
* @param rule the winding rule
+ * @throws IllegalArgumentException if {@code rule} is not either
+ * {@link #WIND_EVEN_ODD} or {@link #WIND_NON_ZERO}
* @see #WIND_EVEN_ODD
* @see #WIND_NON_ZERO
* @since 1.2
public GeneralPath(int rule) {
* @param rule the winding rule
* @param initialCapacity the estimate for the number of path segments
* in the path
+ * @throws IllegalArgumentException if {@code rule} is not either
+ * {@link #WIND_EVEN_ODD} or {@link #WIND_NON_ZERO}
+ * @throws NegativeArraySizeException if {@code initialCapacity} is
+ * negative
* @see #WIND_EVEN_ODD
* @see #WIND_NON_ZERO
* @since 1.2
public GeneralPath(int rule, int initialCapacity) {
* @param s the specified {@code Shape} object
+ * @throws NullPointerException if {@code s} is {@code null}
* @since 1.2
*/
public GeneralPath(Shape s) {
src/java.desktop/share/classes/java/awt/geom/Path2D.java
* require the interior of the path to be defined.
*
* @param rule the winding rule
+ * @throws IllegalArgumentException if {@code rule} is not either
+ * {@link #WIND_EVEN_ODD} or {@link #WIND_NON_ZERO}
public Float(int rule) {
* @param initialCapacity the estimate for the number of path segments
* in the path
+ * @throws IllegalArgumentException if {@code rule} is not either
+ * {@link #WIND_EVEN_ODD} or {@link #WIND_NON_ZERO}
+ * @throws NegativeArraySizeException if {@code initialCapacity} is
+ * negative
* @see #WIND_EVEN_ODD
* @see #WIND_NON_ZERO
* @since 1.6
public Float(int rule, int initialCapacity) {
* @param s the specified {@code Shape} object
+ * @throws NullPointerException if {@code s} is {@code null}
* @since 1.6
*/
public Float(Shape s) {
*
* @param s the specified {@code Shape} object
* @param at the specified {@code AffineTransform} object
+ * @throws NullPointerException if {@code s} is {@code null}
* @since 1.6
*/
public Float(Shape s, AffineTransform at) {
* @param rule the winding rule
+ * @throws IllegalArgumentException if {@code rule} is not either
+ * {@link #WIND_EVEN_ODD} or {@link #WIND_NON_ZERO}
* @see #WIND_EVEN_ODD
* @see #WIND_NON_ZERO
* @since 1.6
public Double(int rule)
* @param rule the winding rule
* @param initialCapacity the estimate for the number of path segments
* in the path
+ * @throws IllegalArgumentException if {@code rule} is not either
+ * {@link #WIND_EVEN_ODD} or {@link #WIND_NON_ZERO}
+ * @throws NegativeArraySizeException if {@code initialCapacity} is
+ * negative
* @see #WIND_EVEN_ODD
* @see #WIND_NON_ZERO
* @since 1.6
public Double(int rule, int initialCapacity) {
* taken from the specified {@code Shape} object.
*
* @param s the specified {@code Shape} object
+ * @throws NullPointerException if {@code s} is {@code null}
* @since 1.6
*/
public Double(Shape s) {
* @param s the specified {@code Shape} object
* @param at the specified {@code AffineTransform} object
+ * @throws NullPointerException if {@code s} is {@code null}
* @since 1.6
*/
public Double(Shape s, AffineTransform at) {
link for convenience https://github.com/openjdk/jdk/pull/2174/files
- csr of
-
JDK-6606673 Path2D.Double, Path2D.Float and GeneralPath ctors throw exception when initialCapacity is negative
-
- Resolved
-