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

Java 2D requires windows system fonts to be in a windows system directory

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P5 P5
    • None
    • 1.2.1, 1.3.0
    • client-libs
    • 2d
    • x86
    • windows_98, windows_nt



      Name: dbT83986 Date: 05/03/99


      I've submitted this bug once before, about a week ago. (id: 57417 - see original bug report below)
      I've been told, essentially, that "it's not a bug because it works on our system".
      It also works on my fellow coworkers' systems (NT and Solaris).
      I'm trying to find out what is different about my system/setup that causes this crash.

      It is reproduceable: Every time I run any swing app under 1.2 that displays (or attempts
      to display) a font, I get this crash. Any swing app (see Test.java I've attached) that
      displays text does this, including the SwingSet demo.
      The crash always occurs when a setVisible() or show() is called.
      In the SwingSet demo, the crash is when the progress JFrame's show() is called.
      In my Test.java, it's on the "t.setVisible(true);" line.

      The SwingSet demo works on my machine with jdk1.1.8 and swing 1.0.3.
      So does Test.java.
      The SwingSet demo and my Test also work on fellow coworkers' NT and Solaris machines under jdk 1.2.
      The only problem is my NT system with jdk 1.2.

      I've uninstalled/reinstalled countless times, always to encounter the same results.
      I'm using the MSVCRT.DLL that comes with the jvm/jre.

      I've downloaded the community source to the jvm, and have debugged it to the point
      of the exact line in the exact files where the problem occurs.

      To restate my problem again: (see original bug report at bottom)

      call stack given by MS VC++ 5.0 when I CANCEL/debug now with compiled debug version of the jvm:
      Strike::getGlyphAdvanceX(Strike * const 0x00000000, int 87674197) line 203 + 76 bytes
      Strike::getCharAdvanceX(Strike * const 0x00000000, unsigned short 43643) line 197
      Java_sun_awt_font_NativeFontWrapper_getAdvance(JNIEnv_ * 0x10046542, _jclass * 0x00000000, _jobject * 0x0012ecb4, unsigned short 29924, _jdoubleArray * 0x0000004c, unsigned char 236, unsigned char 0) line 247 + 12 bytes
      _sysInvokeNative() line 163
      @ILT+1830(_Java_sun_awt_font_NativeFontWrapper_getAdvance@28) address 0x0537172b

      Java_sun_awt_font_NativeFontWrapper_getAdvance( ... ) (lines 246-247 of share\native\sun\awt\font\FontWrapper.cpp):
          Strike& theStrike = fo->getStrike(tx, isAntiAliased, usesFractionalMetrics);
          retval = theStrike.getCharAdvanceX(theChar);

      After line 246 executes, the value of theStrike is null (0x00000000). When a method is called
      on the null pointer in line 247, the jvm crashes.

      The crash actually occurs in
      Strike::getGlyphAdvanceX( ...) (line 203 of share\native\sun\awt\font\Strike.cpp):
          theStrike = compositeStrikeForGlyph(glyphCode);


      Can you offer any assistance more than "it works here so it's not a bug" ?
      Uninstalling / reinstalling hasn't helped.

      =============================
      REVIEW NOTE 5/2/99 - User responded with additional information


      I can cause this crash with CLASSPATH empty, and with nothing in my path but the jdk.

      My partial directory structure:
        h:\jdk
          sun1.1.8 - installed from jdk1_1_8-win.exe
          sun1.2 - installed from jdk12-win32.exe, jdk1_2_1-win.exe (depending on whether my last install was 1.2 or 1.2.1. currently 1.2)
          swing-1.0.3 - unzipped from swing103.zip
      I'm also unable to run swing11-win32-install.exe -- I get a screen that has "Introduction" on the top right, then the virtual machine crashes in the same way all the other crashes happen.
      (I'm guessing InstallAnywhere uses 1.2 internally(?) -- it GPF's no matter what I set my path and CLASSPATH to.)

      Also, notice in my Test.java:
      // label = new JLabel(""); // this works in 1.1 and 1.2
          label = new JLabel("a"); // this works in 1.1, crashes in 1.2
      If I have no text for the label, my Test.java runs fine under 1.2.

      To answer your question:
      "When you mention things work with JDK1.1.8 and Swing 1.0.3 - are you trying to run 1.1.8w/1.0.3 demos under 1.2?"
      I get:
          Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/java/swing/JPanel
              at java.lang.ClassLoader.defineClass0(Native Method)
              ...
      which is to be expected.

      ----------
      case 1:
      PATH=h:\jdk\sun1.1.8\bin (that's it, no windows directories, windows/system directories, nothing else. I have tried it with winnt and winnt/system32 in the path, with same results.)
      CLASSPATH=.;h:\jdk\sun1.1.8\lib\classes.zip
      SWING_HOME=H:\jdk\swing-1.0.3

      SwingSet demo:
      cd H:\jdk\swing-1.0.3\examples\SwingSet
      runnit.bat
          result: all OK, everything runs fine

      my Test.java:
      cd \swingtest\1.1
      javac -classpath ".;h:\jdk\sun1.1.8\lib\classes.zip;h:\jdk\swing-1.0.3\swingall.jar" Test.java
          result: no compilation errors
      java -classpath ".;h:\jdk\sun1.1.8\lib\classes.zip;h:\jdk\swing-1.0.3\swingall.jar" Test
          result: all OK, everything runs fine

      ----------
      case 2:
      PATH=h:\jdk\sun1.2\bin (that's it, no windows directories, windows/system directories, nothing else. I have tried it with winnt and winnt/system32 in the path, with same results.)
      CLASSPATH=
      SWING_HOME=

      SwingSet demo:
      cd H:\jdk\sun1.2\demo\jfc\SwingSet
      java SwingSet
          result: virtual machine crashes (see original message)

      my Test.java:
      cd \swingtest\1.2
      javac Test.java
          result: no compilation errors
      java Test
          result: virtual machine crashes (see original message)


      ----------
      Thank you for your help thus far.


      ----------------- Test.java -------------------
      import java.awt.*;
      import java.awt.event.*;

      //1.1
      //import com.sun.java.swing.*;
      //1.2
      import javax.swing.*;

      class Test extends JFrame implements ActionListener
      {
        JLabel label;

        Test()
        {
          super("Test");
          setSize(400, 200);
          addWindowListener(new ExitMonitor());

          JPanel panel = new JPanel();
          panel.setLayout(new FlowLayout(FlowLayout.LEFT));

      // label = new JLabel(""); // this works in 1.1 and 1.2
          label = new JLabel("a"); // this works in 1.1, crashes in 1.2
          panel.add(label);

          getContentPane().add(panel, BorderLayout.NORTH);
        }

        public void actionPerformed(ActionEvent ae)
        {
        }

        public static void main(String args[])
        {
          System.out.println("start");
          Test t = new Test();
          System.out.println("Test t = new Test();");
          t.setVisible(true);
          System.out.println("t.setVisible(true);");
        }
      }

      class ExitMonitor extends WindowAdapter
      {
        public void windowClosing(WindowEvent e)
        {
          Window w = e.getWindow();
          w.setVisible(false);
          w.dispose();
          System.exit(0);
        }
      }



      ----------------- Original Bug Report-------------------

      id : 57417
      category : java
      subcategory : classes_swing
      type : bug
      synopsis : java.exe / fontmanager.dll crash when running SwingSet demo
      description : from a command prompt in the demo\jfc\SwingSet directory,
        type "java SwingSet"
      produces the dialog:
      --- java.exe - Application Error ---
      The instruction at "0x5021cdc4" reference memory at "0x0000000c".
      The memory could not be "read".
      Click on OK to terminate the application
      Click on CANCEL to debug the application

      call stack given by MS VC++ 5.0 when I CANCEL/debug:
      FONTMANAGER! 5021cdc4()
      FONTMANAGER! 5021cd55()
      FONTMANAGER! 5020aa7b()
      JVM! 50466542()
      FONTMANAGER! 501f172b()

      >java -version
      java version "1.2.1"
      Classic VM (build JDK-1.2.1-A, native threads)
      >java -fullversion
      java full version "JDK-1.2.1-A"

      I'm using NT workstation 4.0 Service Pack 4.0.
      I also have installed (in different directories):
      (h: is a local drive, not network)
        Java 2 - h:\jdk\sun1.2
        Java 2 runtime - h:\jre\sun1.2
        jdk 1.1.8 - h:\jdk\sun1.1.8
        IBM's jdk 1.1.7a - h:\jdk\ibm1.1.7
        IBM's Visual Age for Java 2.0

      None of these directories are in my environment "path"
      or CLASSPATH when I get this error.

      I've noticed these files in my \WINNT\SYSTEM32 directory,
      and have no idea what they are for or if they have any
      bearing on this:
        99.03.27 6:59p 24,064 java.exe
        96.10.15 5:40a 39,424 javacom.dll
        99.01.25 5:05a 192,784 javacypt.dll
        99.01.25 5:05a 139,536 javaee.dll
        99.01.25 4:15a 11,403 javaperm.hlp
        99.01.25 5:35a 34,576 javaprxy.dll
        99.01.25 6:30a 365,328 javart.dll
        99.01.25 4:15a 21,444 javasec.hlp
        99.01.25 4:47a 7,315 javasup.vxd
        99.03.27 6:59p 24,576 javaw.exe

      I have not tried recompiling the class files.

      If I run a class that is strictly AWT, all seems to be OK.

      I've searched the Bug Parade, and noticed there were a few
      somewhat related references. This is English, not Japanese, on
      NT, not win95, using jdk 1.2.1, not a beta.

      This same error occurred with jdk 1.2 (though I can't vouch for
      the exact same hex addresses in fontmanager.dll when it crashed),
      so I downloaded 1.2.1 hoping it might be fixed. But same result.
      comments : (company - PSI Technologies , email - ###@###.###)
      This bug causes application to crash.
      workaround :
      suggested_val :
      cust_name : Mitchell Ackermann
      cust_email : ###@###.###
      company : PSI Technologies
      release : 1.2.1
      hardware : x86
      OSversion : win_nt_4.0
      status : Deleted
      delReason : User Error
      priority : 4
      bugtraqID : 0
      dateCreated : 1999-04-23 10:39:16.0
      dateEvaluated : 1900-01-01 00:00:00.0
      (Review ID: 57707)
      ======================================================================

            prr Philip Race
            dblairsunw Dave Blair (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: