Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8261033

BasicStroke.createStrokedShape(Shape): NPE is not specified

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 17
    • Component/s: client-libs
    • Labels:
      None
    • Subcomponent:
      2d
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      No behavior change - specification only so minimal risk
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      Specify that java.awt.BasicStroke.createStrokedShape(Shape) will throw NullPointerException when passed a null object reference for the parameter.

      Problem

      Method createStrokedShape(Shape) of the java.awt.BasicStroke class throws NullPointerException when passed a null object reference for the parameter but it is not specified in the specification.

      Solution

      Update the specification to document that NullPointerException will be thrown for null a Shape object passed to createStrokedShape()

      Specification

      diff --git a/src/java.desktop/share/classes/java/awt/BasicStroke.java b/src/java.desktop/share/classes/java/awt/BasicStroke.java
      index e74753265e3..2c3ddde106c 100644
      --- a/src/java.desktop/share/classes/java/awt/BasicStroke.java
      +++ b/src/java.desktop/share/classes/java/awt/BasicStroke.java
      @@ -294,6 +294,7 @@ public class BasicStroke implements Stroke {
            * stroked outline of a specified {@code Shape}.
            * @param s the {@code Shape} boundary be stroked
            * @return the {@code Shape} of the stroked outline.
      +     * @throws NullPointerException if {@code s} is {@code null}
            */
           public Shape createStrokedShape(Shape s) {
               sun.java2d.pipe.RenderingEngine re =

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              psadhukhan Prasanta Sadhukhan
              Reporter:
              ydanilev Yury Danilevich (Inactive)
              Reviewed By:
              Philip Race, Sergey Bylokhov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: