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

NullPointerException in BasicGraphicsUtils

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Not an Issue
    • Affects Version/s: 6
    • Fix Version/s: None
    • Component/s: client-libs

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0-rc"
      Java(TM) SE Runtime Environment (build 1.6.0-rc-b94)
      Java HotSpot(TM) Client VM (build 1.6.0-rc-b94, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      An error in
      getPreferredButtonSize(AbstractButton b, int textIconGap)
      causes a NPE:
      Component.getFont() returns the components font, if the components font is not set (is null) the parents font will be returned, but if the component hasn't a parent yet, null will be returned!!


      REPRODUCIBILITY :
      This bug can be reproduced often.

      CUSTOMER SUBMITTED WORKAROUND :
      Insert in class
         'BasicGraphicsUtils'
      at method
         getPreferredButtonSize(AbstractButton b, int textIconGap)

      after
              Font font = b.getFont();
      the lines
      if (font == null) // If components font is null
      font = new Font(null); // use a default Font.

        Attachments

          Activity

            People

            Assignee:
            alexp Alexander Potochkin (Inactive)
            Reporter:
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: