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

DOC: javax.swing.border.StrokeBorder.paintBorder() doesn't throw NPE in all specified cases

    Details

    • Subcomponent:
    • Resolved In Build:
      b130
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      JDK: 7b118+
      Platform: Any

      Brute force testing revealed a case when NPE is not thrown
      as specified in the following method if passed Component is null

      http://download.java.net/jdk7/docs/api/javax/swing/border/StrokeBorder.html#paintBorder(java.awt.Component, java.awt.Graphics, int, int, int, int)

      Throws:
      NullPointerException - if the specified c or g are null

      ---------------------------------------------------------------------
      import java.awt.*;
      import java.awt.image.BufferedImage;

      public class StrokeBorderNPE {

          public static void main(String[] args) {

              new javax.swing.border.StrokeBorder(
                      new BasicStroke(100,
                              BasicStroke.CAP_SQUARE,
                              BasicStroke.JOIN_ROUND), Color.BLACK)
                      // @throws NullPointerException
                      // if the specified {@code c} or {@code g} are {@code null}
                      .paintBorder(
                              (Component) null,
                              new BufferedImage(
                                      1,1, BufferedImage.TYPE_INT_RGB).createGraphics(),
                              0,0,1,1);
          }
      }
      ---------------------------------------------------------------------

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                malenkov Sergey Malenkov (Inactive)
                Reporter:
                dbessono Dmitry Bessonov
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: