JDK-5100455 : NPE on toLowerCase for fonts which have \uffff in their name
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-09-10
  • Updated: 2004-09-23
  • Resolved: 2004-09-23
Related Reports
Duplicate :  
Description
Name: gm110360			Date: 09/10/2004


FULL PRODUCT VERSION :
java version "1.5.0-rc"
Java(TM) 2 Runtime Environment,  Standard Edition (build 1.5.0-rc-b63)
Java HotSpot(TM) Client VM (build 1.5.0-rc-b63, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Windows XP Home Edition SP 1

A DESCRIPTION OF THE PROBLEM :
The following error appears when initializing a JDialog on one of our user computer:

java.lang.NullPointerException
	at java.lang.String.toLowerCase(Unknown Source)
	at sun.font.FontManager.addToFontList(Unknown Source)
	at sun.font.FontManager.registerFontFile(Unknown Source)
	at sun.font.FontManager.registerFonts(Unknown Source)
	at sun.java2d.SunGraphicsEnvironment.addDirFonts(Unknown Source)
	at sun.java2d.SunGraphicsEnvironment.registerFontsInDir(Unknown Source)
	at sun.java2d.SunGraphicsEnvironment.registerFontsOnPath(Unknown Source)
	at sun.java2d.SunGraphicsEnvironment.access+600(Unknown Source)
	at sun.java2d.SunGraphicsEnvironment+2.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.java2d.SunGraphicsEnvironment.loadFonts(Unknown Source)
	at sun.font.FontManager.findFont2D(Unknown Source)
	at sun.font.FontManager.findFont2D(Unknown Source)
	at java.awt.Font.getFont2D(Unknown Source)
	at sun.font.FontManager.getFont2D(Native Method)
	at sun.font.FontManager.fontSupportsDefaultEncoding(Unknown Source)
	at com.sun.java.swing.plaf.windows.WindowsLookAndFeel$WindowsFontProperty.configureValue(Unknown Source)
	at com.sun.java.swing.plaf.windows.DesktopProperty.createValue(Unknown Source)
	at javax.swing.UIDefaults.getFromHashtable(Unknown Source)
	at javax.swing.UIDefaults.get(Unknown Source)
	at javax.swing.MultiUIDefaults.get(Unknown Source)
	at javax.swing.UIDefaults.getFont(Unknown Source)
	at javax.swing.UIManager.getFont(Unknown Source)
	at javax.swing.LookAndFeel.installColorsAndFont(Unknown Source)
	at javax.swing.plaf.basic.BasicPanelUI.installDefaults(Unknown Source)
	at javax.swing.plaf.basic.BasicPanelUI.installUI(Unknown Source)
	at javax.swing.JComponent.setUI(Unknown Source)
	at javax.swing.JPanel.setUI(Unknown Source)
	at javax.swing.JPanel.updateUI(Unknown Source)
	at javax.swing.JPanel.<init>(Unknown Source)
	at javax.swing.JPanel.<init>(Unknown Source)
	at javax.swing.JPanel.<init>(Unknown Source)
	at javax.swing.JRootPane.createGlassPane(Unknown Source)
	at javax.swing.JRootPane.<init>(Unknown Source)
	at javax.swing.JDialog.createRootPane(Unknown Source)
	at javax.swing.JDialog.dialogInit(Unknown Source)
	at javax.swing.JDialog.<init>(Unknown Source)
	at javax.swing.JDialog.<init>(Unknown Source)
	at storm.gui.registration.Registration.<init>(Registration.java:74)
	at storm.gui.Gui.showRegistration(Gui.java:563)
	at storm.protect.ProtectedStartupCheck.exec(ProtectedStartupCheck.java:26)
	at storm.kernel.Kernel.start(Kernel.java:117)
	at storm.kernel.Main.start(Main.java:69)
	at storm.kernel.Main.main(Main.java:23)



The only work-around is to suppress the following fonts:

BGREIRR.TTF (????)
Edokan.ttc (????? & ??????)
BGPENKB.TTF (?????)
FUJIPOP.TTC (????? & ??????)
FgFumi.ttf (??????)
YOTHIC__.TTF (Yo?hic)
SENNA___.TTF (Sennin Alphabe?)
CLOVER.TTF (clo?er)
DORIK___.TTF (Dosirange Ka?akana)
ELEKB___.TTF (Eleki?e Bold)
FDWHITE_.TTF (FDwhi?e)
WALLPAIN.TTF (WALL pain?ing)

All of them appears with strange characters when looking into the C:\Windows\Font folder (I put some '?' character in the names where it was as strange square symbol like in screenshots joined). Maybe Java does not accept Font with Japanese characters inside... I have told that some of these characters (for the first five font of the list where Kanji characters).

These font seems to be Japanese Fonts. I am not sure that suppressing these fonts will not be a problem for this user.

It would be really nice if the Font was just ignored instead of making the whole application to crash... As it is a Candidate Release version, I am a little bit afraid that this problem will never be solved.


STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1/ Install one of these Fonts (e.mail me if you want to get them).
2/ Make a small Java Apps that creates a JDialog.


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No crash, bad font ignored.

ERROR MESSAGES/STACK TRACES THAT OCCUR :
java.lang.NullPointerException
	at java.lang.String.toLowerCase(Unknown Source)
	at sun.font.FontManager.addToFontList(Unknown Source)
	at sun.font.FontManager.registerFontFile(Unknown Source)
	at sun.font.FontManager.registerFonts(Unknown Source)
	at sun.java2d.SunGraphicsEnvironment.addDirFonts(Unknown Source)
	at sun.java2d.SunGraphicsEnvironment.registerFontsInDir(Unknown Source)
	at sun.java2d.SunGraphicsEnvironment.registerFontsOnPath(Unknown Source)
	at sun.java2d.SunGraphicsEnvironment.access+600(Unknown Source)
	at sun.java2d.SunGraphicsEnvironment+2.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.java2d.SunGraphicsEnvironment.loadFonts(Unknown Source)
	at sun.font.FontManager.findFont2D(Unknown Source)
	at sun.font.FontManager.findFont2D(Unknown Source)
	at java.awt.Font.getFont2D(Unknown Source)
	at sun.font.FontManager.getFont2D(Native Method)
	at sun.font.FontManager.fontSupportsDefaultEncoding(Unknown Source)
	at com.sun.java.swing.plaf.windows.WindowsLookAndFeel$WindowsFontProperty.configureValue(Unknown Source)
	at com.sun.java.swing.plaf.windows.DesktopProperty.createValue(Unknown Source)
	at javax.swing.UIDefaults.getFromHashtable(Unknown Source)
	at javax.swing.UIDefaults.get(Unknown Source)
	at javax.swing.MultiUIDefaults.get(Unknown Source)
	at javax.swing.UIDefaults.getFont(Unknown Source)
	at javax.swing.UIManager.getFont(Unknown Source)
	at javax.swing.LookAndFeel.installColorsAndFont(Unknown Source)
	at javax.swing.plaf.basic.BasicPanelUI.installDefaults(Unknown Source)
	at javax.swing.plaf.basic.BasicPanelUI.installUI(Unknown Source)
	at javax.swing.JComponent.setUI(Unknown Source)
	at javax.swing.JPanel.setUI(Unknown Source)
	at javax.swing.JPanel.updateUI(Unknown Source)
	at javax.swing.JPanel.<init>(Unknown Source)
	at javax.swing.JPanel.<init>(Unknown Source)
	at javax.swing.JPanel.<init>(Unknown Source)
	at javax.swing.JRootPane.createGlassPane(Unknown Source)
	at javax.swing.JRootPane.<init>(Unknown Source)
	at javax.swing.JDialog.createRootPane(Unknown Source)
	at javax.swing.JDialog.dialogInit(Unknown Source)
	at javax.swing.JDialog.<init>(Unknown Source)
	at javax.swing.JDialog.<init>(Unknown Source)
	at storm.gui.registration.Registration.<init>(Registration.java:74)
	at storm.gui.Gui.showRegistration(Gui.java:563)
	at storm.protect.ProtectedStartupCheck.exec(ProtectedStartupCheck.java:26)
	at storm.kernel.Kernel.start(Kernel.java:117)
	at storm.kernel.Main.start(Main.java:69)
	at storm.kernel.Main.main(Main.java:23)
  

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
See steps to reproduce...
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Remove the Fonts which are listed in the description
(Incident Review ID: 305568) 
======================================================================

Comments
EVALUATION Based on stack trace I think that this is a 2D problem (feel free to correct me:) ###@###.### 2004-09-13 I am able to reproduce this problem. It looks like to be caused by bug in String.toLowerCase() implementation. (see bug 5101626). ###@###.### 2004-09-14 6 of 7 fonts has same problem - \uffff in font names and consequent NPE in toLowerCase(). Last one (clover.ttf) actually is ok and this was confirmed by submitter. So, i am closing this as dup of 5101626. ###@###.### 2004-09-23
23-09-2004