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

java.awt.Font.decode: "Dialog" instead of "dialog"

    XMLWordPrintable

    Details

    • Subcomponent:
      2d
    • Resolved In Build:
      b38
    • CPU:
      x86, sparc
    • OS:
      solaris_2.6, windows_xp
    • Verification:
      Verified

      Description



      Name: sdR10048 Date: 12/20/2003


      Filed By : SPB JCK team (###@###.###)
      JDK : java full version "1.5.0-beta-b31"
      JCK : 1.5
      Platform[s] : Solaris
      JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
      Failing Test [s] :
      api/java_awt/Font/descriptions.html#Decode[Font1002]
      api/java_awt/Font/descriptions.html#GetFont[Font1003]
      (Updated version of these testcases will be in master ws soon)


      Specification excerpt:
      ======================
      --------- J2SE API spec v.1.5 ---------
      ...
      public static Font decode(String str)

      Returns the Font that the str argument describes. To ensure that this method
      returns the desired Font, format the str parameter in one of two ways:

      "fontfamilyname-style-pointsize" or
      "fontfamilyname style pointsize"

      in which style is one of the three case-insensitive strings: "BOLD", "BOLDITALIC",
      or "ITALIC", and pointsize is a decimal representation of the point size.
      For example, if you want a font that is Arial, bold, and a point size of 18, you would
      call this method with: "Arial-BOLD-18".

      The default size is 12 and the default style is PLAIN. If you don't specify a valid size,
      the returned Font has a size of 12. If you don't specify a valid style, the returned Font
      has a style of PLAIN. If you do not provide a valid font family name in the str argument,
       this method still returns a valid font with a family name of "dialog". To determine what
       font family names are available on your system, use the GraphicsEnvironment.
      getAvailableFontFamilyNames() method. If str is null, a new Font is returned with the
      family name "dialog", a size of 12 and a PLAIN style. If str is null, a new Font is
      returned with the name "dialog", a size of 12 and a PLAIN style.

      Parameters:
          str - the name of the font, or null

      Returns:
          the Font object that str describes, or a new default Font if str is null.
      ...
      ---------- end-of-excerpt ---------------

      Problem description
      ===================
      The spec clearly states that in case 'str' parameter does not denote family name
      then Font with family name == "dialog" will be returned. SUN RI returns "Dialog" insead.
      Please see demo.

          
      Minimized test:
      ===============
      ------- J2.java -------
      import java.awt.*;

      public class J2 {
          public static void main(String[] args) {
              Font font = Font.decode("-bold-12");
              String family = font.getFamily();
              System.out.println( family );
              System.out.println( family.equals("dialog") );
          }
      }

      ------- end-of-J2.java -------

      Minimized test output:
      ======================
      ] dsv@orion ~/tmp
      ] java -showversion J2
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b31)
      Java HotSpot(TM) Server VM (build 1.5.0-beta-b31, mixed mode)

      Dialog
      false


      JCK test source location:
      ==========================
      /java/re/jck/1.5/promoted/latest/JCK-runtime-15/tests

      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              prr Philip Race
              Reporter:
              dsvsunw Dsv Dsv (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: