United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6752638 java.awt.GraphicsEnvironment.preferLocaleFonts() throws NPE on Linux
JDK-6752638 : java.awt.GraphicsEnvironment.preferLocaleFonts() throws NPE on Linux

Details
Type:
Bug
Submit Date:
2008-09-25
Status:
Closed
Updated Date:
2012-03-22
Project Name:
JDK
Resolved Date:
2011-03-08
Component:
client-libs
OS:
linux
Sub-Component:
2d
CPU:
x86
Priority:
P2
Resolution:
Fixed
Affected Versions:
7
Fixed Versions:

Related Reports

Sub Tasks

Description
Platform: Linux 2.6.25.11-60.fc8 (i386)
JDK: 7b34
JCK: 7 b05
Test: api/java_awt/GraphicsEnvironment/index2.html#PreferFonts[PreferFonts2001] (see attached source)

Here is the output:
java.lang.NullPointerException
	at sun.awt.FontConfiguration.getReorderSequence(FontConfiguration.java:752)
	at sun.awt.FontConfiguration.willReorderForStartupLocale(FontConfiguration.java:748)
	at sun.font.FontManager.preferLocaleFonts(FontManager.java:2805)
	at java.awt.GraphicsEnvironment.preferLocaleFonts(GraphicsEnvironment.java:359)
	at javasoft.sqe.tests.api.java.awt.GraphicsEnvironment.PreferFontsTests.PreferFonts2001(PreferFontsTests.java:42)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:623)
	at javasoft.sqe.javatest.lib.MultiTest.invokeTestCase(MultiTest.java:406)
	at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:195)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:623)
	at com.sun.jck.lib.ExecJCKTestSameJVMCmd$Version2Test.execute(ExecJCKTestSameJVMCmd.java:441)
	at com.sun.jck.lib.ExecJCKTestSameJVMCmd$StandardTest.run(ExecJCKTestSameJVMCmd.java:389)
	at com.sun.jck.lib.ExecJCKTestSameJVMCmd.execute(ExecJCKTestSameJVMCmd.java:257)
	at com.sun.jck.lib.ExecJCKTestSameJVMCmd.run(ExecJCKTestSameJVMCmd.java:162)
	at com.sun.javatest.agent.Agent$Task.executeCommand(Agent.java:841)
	at com.sun.javatest.agent.Agent$Task.execute(Agent.java:772)
	at com.sun.javatest.agent.Agent$Task.handleRequest(Agent.java:633)
	at com.sun.javatest.agent.Agent.handleRequestsUntilClosed(Agent.java:400)
	at com.sun.javatest.agent.Agent.access$000(Agent.java:60)
	at com.sun.javatest.agent.Agent$1.run(Agent.java:272)
	at java.lang.Thread.run(Thread.java:674)
PreferFonts2001: Failed. Test case throws exception: java.lang.NullPointerException


The following line causes NPE:


(new MyEnv()).preferLocaleFonts();

where

class MyEnv extends GraphicsEnvironment {
    public MyEnv() {
        super();
    }
    public Graphics2D createGraphics(BufferedImage image) {
        return null;
    }
    public String[] getAvailableFontFamilyNames(Locale locale) {
        return null;
    }
    public String[] getAvailableFontFamilyNames() {
        return null;
    }
    public Font[] getAllFonts() {
        return null;
    }
    public GraphicsDevice getDefaultScreenDevice() throws HeadlessException {
        return null;
    }
    public GraphicsDevice[] getScreenDevices() throws HeadlessException {
        return null;
    }
}

                                    

Comments
EVALUATION

This is a font issue, I'm transferring the bug to the Java2D team.
                                     
2008-09-29
EVALUATION

The fix for
6378099: RFE: Use libfontconfig to create/synthesise a fontconfig.properties
didn't initialise a static variable in the new class used to support this.
                                     
2008-12-24



Hardware and Software, Engineered to Work Together