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

FontMetrics.getWidths() crashes JVM under Solaris

XMLWordPrintable

    • 2d
    • 1.2fcs
    • sparc
    • solaris_2.6
    • Verified



      Name: akC57697 Date: 07/10/98


                                
       The FontMetrics.getWidths() crashes JVM for some fonts under
       Solaris 2.6
       
       java: JDK1.2-Beta4K

      The example:
      ------------------------------8-<--------------------------------------------
      import com.sun.java.swing.*;
      import java.awt.*;

      class Test {
        public static void main(String[] argv) {
            FontMetrics fm = null;
            String strings [] ={""," "," ","a","test string"};
            Toolkit t = Toolkit.getDefaultToolkit();

            Font fonts [] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();

           for (int ff=0;ff<fonts.length;ff++) { // Try all fonts
            fm = t.getFontMetrics(fonts[ff]);

            System.out.println("The "+ff+"-th FontMetrics:"+fm);
            System.out.print("The widths:");
            System.out.println(fm.getWidths()); // Call getWidths()
                                                 // Call SwingUtilities.computeStringWidth
                                                 // for swing testing purposes
            for (int i=0;i<strings.length;i++) {
             System.out.println("StringWidth:"+
                               SwingUtilities.computeStringWidth(fm,strings[i]));
            }
           }
         System.out.println("OKAY");
          
         }
      }
      ---------------------------->-8----------------------------------------------
      Solaris 2.6:

      ...........
      The 150-th FontMetrics:sun.awt.font.FontDesignMetrics[font=java.awt.Font[family=LucidaBrightLat2,name=Lucida Bright Lat2 Demi Italic,style=plain,size=1]ascent=1, descent=1, height=3]
      The widths:SIGSEGV 11* segmentation violation
          si_signo [11]: SIGSEGV 11* segmentation violation
          si_errno [0]: Error 0
          si_code [1]: SEGV_MAPERR [addr: 0x0]

      stackpointer=EFFFD5D4

      Full thread dump:
          "AWT-Motif" (TID:0xebca7248, sys_thread_t:0x236cf0, state:CW) prio=5
      at java.lang.Object.wait(Native Method)
      at sun.awt.motif.MToolkit.run(Native Method)
      at java.lang.Thread.run(Compiled Code)
          "AWT-Input" (TID:0xebca71b0, sys_thread_t:0x230d30, state:R) prio=5
      at java.lang.Object.wait(Native Method)
      at sun.awt.motif.InputThread.run(Native Method)
          "AWT-EventQueue-0" (TID:0xebca8150, sys_thread_t:0x2175f0, state:CW) prio=6
      at java.lang.Object.wait(Native Method)
      at java.lang.Object.wait(Compiled Code)
      at java.awt.EventQueue.getNextEvent(Compiled Code)
      at java.awt.EventDispatchThread.run(Compiled Code)
          "Finalizer" (TID:0xebc983a0, sys_thread_t:0x64c10, state:CW) prio=8
      at java.lang.Object.wait(Native Method)
      at java.lang.ref.ReferenceQueue.remove(Compiled Code)
      at java.lang.ref.ReferenceQueue.remove(Compiled Code)
      at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:128)
          "Reference Handler" (TID:0xebc98430, sys_thread_t:0x369d8, state:CW) prio=10
      at java.lang.Object.wait(Native Method)
      at java.lang.Object.wait(Compiled Code)
      at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:209)
          "Signal dispatcher" (TID:0xebc982e8, sys_thread_t:0x36d40, state:CW) prio=10
          "main" (TID:0xebc98260, sys_thread_t:0x292f0, state:R) prio=5 *current thread*
      at sun.awt.font.NativeFontWrapper.getAdvance(Native Method)
      at sun.awt.font.FontDesignMetrics.charWidth(Compiled Code)
      at java.awt.FontMetrics.getWidths(Compiled Code)
      at Test.main(Compiled Code)
      Monitor Cache Dump:
          java.lang.Class@EBCB8158/EBD60E40: owner "main" (0x292f0, 1 entry)
          sun.awt.motif.MToolkit@EBCA8A18/EBD65A80: owner "AWT-Input" (0x230d30, 1 entry)
      Waiting to be notified:
      "AWT-Motif" (0x236cf0)
      Registered Monitor Dump:
          PCMap lock: <unowned>
          utf8 hash table: <unowned>
          JNI pinning lock: <unowned>
          JNI global reference lock: <unowned>
          BinClass lock: <unowned>
          Class linking lock: <unowned>
          System class loader lock: <unowned>
          Code rewrite lock: <unowned>
          Heap lock: <unowned>
          Dynamic loading lock: <unowned>
          Monitor IO lock: <unowned>
          User signal monitor: <unowned>
      Waiting to be notified:
      "Signal dispatcher" (0x36d40)
          Child death monitor: <unowned>
          I/O monitor: <unowned>
          Alarm monitor: <unowned>
      Waiting to be notified:
      Internal clock thread (ef7a0c38)
          Thread queue lock: <unowned>
          Monitor registry: owner "main" (0x292f0, 1 entry)
      Segmentation Fault (core dumped)

      (###@###.###): java -fullversion
      java full version "JDK-1.2beta4-K"


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

            dfeldsunw Dmitry Feld (Inactive)
            akuzminorcl Alexander Kuzmin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: