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

Component.setFont fails in native code in headless mode - REGRESSION

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.4.0
    • 1.4.0
    • client-libs
    • beta
    • sparc
    • solaris_7, solaris_8
    • Verified

      This has only been tested on Solaris. It has been backtested on previous
      builds, it last worked in build 1.4.0beta-b36, but fails in the current
      build (b39 as of this writing). It happens only in headless mode, not
      in regular mode (-Djava.awt.headless=true versus not being set).

      In the following code, I get an error saying there was an unexpected exception
      in native code and the JVM aborts immediately. The class lwComponent is
      a simple subclass of Component with nothing special, and it does not implement
      a setFont method. The native exception happens on the first iteration
      of the loops.

      lwComponent lw = new lwComponent();
      String[] fontList = Toolkit.getDefaultToolkit().getFontList();
      for (int i = 0; i < fontList.length; i++) {
      for (int j = 8; j < 17; j++) {
         System.out.println("doFont " + fontList[i] + ":" + Integer.toString(j));
      Font f1 = new Font(fontList[i], Font.PLAIN, j);
      Font f2 = new Font(fontList[i], Font.BOLD, j);
      Font f3 = new Font(fontList[i], Font.ITALIC, j);
      Font f4 = new Font(fontList[i], Font.BOLD | Font.ITALIC, j);
      lw.setFont(f1);
      lw.setFont(f2);
      lw.setFont(f3);
      lw.setFont(f4);
      }
      }


      Error message is as follows:

           BEGIN: java.awt.Component: do_setFont_46
      doFont Dialog:8 <===== Printout from above code
      # # An unexpected exception has been detected in native code outside the VM.# Program counter=0xf59ab278
      #
      # Problematic Thread: prio=5 tid=0x169c68 nid=0xb runnable
      #
      Abort


      This message happens when -Djava.awt.headless=true. If not set then
      the error does not occur, and the code steps through all the fonts
      without problem printing each one in turn.

      Source code is in /home/dherron/bugs/headless-setFont, and a copy of
      the directory has been attached.

            mmartaksunw Michael Martak (Inactive)
            dherronsunw David Herron (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: