United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6463017 : Empty string "" as font name argument in Font constructor causes VM to crash

Details
Type:
Bug
Submit Date:
2006-08-23
Status:
Closed
Updated Date:
2011-02-16
Project Name:
JDK
Resolved Date:
2006-08-24
Component:
client-libs
OS:
linux
Sub-Component:
2d
CPU:
x86
Priority:
P3
Resolution:
Duplicate
Affected Versions:
6
Fixed Versions:

Related Reports

Sub Tasks

Description
FULL PRODUCT VERSION :
java version "1.6.0-beta2"
Java(TM) SE Runtime Environment (build 1.6.0-beta2-b86)
Java HotSpot(TM) Client VM (build 1.6.0-beta2-b86, mixed mode, sharing)

FULL OS VERSION :
Linux  2.6.15-26-386 #1 PREEMPT Thu Aug 3 02:52:00 UTC 2006 i686 GNU/Linux

A DESCRIPTION OF THE PROBLEM :
see steps to reproduce and java code

THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes

THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
create Font instance with "" as font name new Font("", Font.PLAIN, 10) and display a label using this font

EXPECTED VERSUS ACTUAL BEHAVIOR :
Expected: default font to be used
Actual result: crash of JVM
ERROR MESSAGES/STACK TRACES THAT OCCUR :
#
# An unexpected error has been detected by Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xb53bd511, pid=6163, tid=3085335472
#
# Java VM: Java HotSpot(TM) Client VM (1.6.0-beta2-b86 mixed mode, sharing)
# Problematic frame:
# C  [libfontmanager.so+0x2e511]
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.Container;
import java.awt.Font;
import javax.swing.JFrame;
import javax.swing.JLabel;

/**
 *
 * @author Igor Minar
 */
public class FontBug {
    
    public static void main(String[] args) {
        JFrame frame = new JFrame();
        Container container = frame.getContentPane();
        
        JLabel label = new JLabel("test");
        label.setFont(new Font("", Font.PLAIN, 10));
        container.add(label);
        
        frame.pack();
        frame.setVisible(true);
    }
    
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
don't use "" as font name, use null instead

                                    

Comments
EVALUATION

This problem was originally reported as 6376139.

Crash is not because "" name of font per se. 
It is because this name is mapped to some real font JDK could not handle well.

Original problem was later split into too parts:
   1) crash 
   2) poor quality of rasterization results

While 6376139 is still open crash part was fixed by fix for 6376296 and should not be reproducible since JDK 6.0 b92.
                                     
2006-08-24



Hardware and Software, Engineered to Work Together