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

Font(Map)/getFont(Map) do not allow null values of TextAttributes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 6
    • 2.0
    • client-libs
    • None
    • 2d
    • b33
    • generic
    • generic
    • Verified

      The spec of TextAttribute states: "the default effect if the attribute is absent (or has a null value)/If the value is null or not of the proper type then it has the default effect/ BACKGROUND...Default null" However, if any of attributes have null value, constructor Font(Map) as well as method getFont(Map) throws NullPointerException. Please see sample java code attached. The result of this code run:
      ==================================================
      java version "1.5.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
      -------------------------------------------------
      java -cp ./ Test60
      Key: java.awt.font.TextAttribute(background); value: null
        Error: java.lang.NullPointerException
      Key: java.awt.font.TextAttribute(bidi_embedding); value: null
        Error: java.lang.NullPointerException
      Key: java.awt.font.TextAttribute(char_replacement); value: null
        Error: java.lang.NullPointerException
      Key: java.awt.font.TextAttribute(family); value: null
        Error: java.lang.NullPointerException
      Key: java.awt.font.TextAttribute(font); value: null
        Error: java.lang.NullPointerException
      Key: java.awt.font.TextAttribute(foreground); value: null
        Error: java.lang.NullPointerException
      Key: java.awt.font.TextAttribute(input method highlight); value: null
        Error: java.lang.NullPointerException
      Key: java.awt.font.TextAttribute(input method underline); value: null
        Error: java.lang.NullPointerException
      Key: java.awt.font.TextAttribute(justification); value: null
        Error: java.lang.NullPointerException
      Key: java.awt.font.TextAttribute(numeric_shaping); value: null
        Error: java.lang.NullPointerException
      Key: java.awt.font.TextAttribute(posture); value: null
        Error: java.lang.NullPointerException
      Key: java.awt.font.TextAttribute(run_direction); value: null
        Error: java.lang.NullPointerException
      Key: java.awt.font.TextAttribute(size); value: null
        Error: java.lang.NullPointerException
      Key: java.awt.font.TextAttribute(strikethrough); value: null
        Error: java.lang.NullPointerException
      Key: java.awt.font.TextAttribute(superscript); value: null
        Error: java.lang.NullPointerException
      Key: java.awt.font.TextAttribute(swap_colors); value: null
        Error: java.lang.NullPointerException
      Key: java.awt.font.TextAttribute(transform); value: null
        Error: java.lang.NullPointerException
      Key: java.awt.font.TextAttribute(underline); value: null
        Error: java.lang.NullPointerException
      Key: java.awt.font.TextAttribute(weight); value: null
        Error: java.lang.NullPointerException
      Key: java.awt.font.TextAttribute(width); value: null
        Error: java.lang.NullPointerException
      ###@###.### 10/27/04 12:05 GMT

            dougfelt Doug Felt (Inactive)
            mchernyssunw Michael Chernyshov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: