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

REGRESSION: NPE exception throws when change in how fonts are handled in graphic rendering

XMLWordPrintable

    • 2d
    • x86
    • windows_xp

      J2SE Version (please include all output from java -version flag):
        java version "1.6.0-ea"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-ea-b35)
        Java HotSpot(TM) Client VM (build 1.6.0-ea-b35, mixed mode)

      Does this problem occur on J2SE 1.4.x or 5.0.x ? Yes / No (pick one)
        works in 1.4.2 and earlier builds of 1.6

      Operating System Configuration Information (be specific):
        Windows XP professional
       
      Hardware Configuration Information (be specific):
        All systems we tried it on

      Bug Description:
        Change in how fonts are handled in graphic rendering causes a
        NullPointerException in code that ran in previous versions of Java.

      Steps to Reproduce (be specific):
        The following code works in 1.4.2 and earlier builds of 1.6.
        It fails since mustang build33.

      import java.awt.Font;
      import java.awt.font.FontRenderContext;
      import java.awt.font.TextLayout;
      import java.awt.geom.AffineTransform;

      public class FontTest
      {
      public static void main(String[] args)
      {
      Font font = new Font("Helvetica", Font.BOLD, 12);
      FontRenderContext frc = new FontRenderContext(new AffineTransform(), true, false);
      TextLayout textLayout = new TextLayout("d", font.getAttributes(), frc);
      float h = textLayout.getDescent()+textLayout.getAscent()+textLayout.getLeading();
      System.out.println(h);
      System.exit(0);
      }
      }



      Exception in thread "main" java.lang.NullPointerException
      at java.awt.Font.getFont(Font.java:654)
      at java.awt.font.TextLayout.singleFont(TextLayout.java:557)
      at java.awt.font.TextLayout.<init>(TextLayout.java:529)
      at com.sas.graphics.applications.reportview.FontTest.main(FontTest.java:14)
      ###@###.### 2005-05-12 16:20:59 GMT

            Unassigned Unassigned
            tyao Ting-Yun Ingrid Yao (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: