[OpenJDK 2D-Dev] NPE in X11FontManager.getDefaultPlatformFont

Volker Simonis volker.simonis at gmail.com
Wed Jun 5 08:27:42 UTC 2013


Hi,

I remember we had similar problems with a missing libfontconfig library an
AIX and Neil Richards fixed that issue:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7068471

As far as I remember it was still reasonable in that context to continue
even without libfontfonfig so please avoid linking against libfontconfig if
possible or otherwise check with the colleagues from IBM if that really
covers all use cases.

Thanks,
Volker



On Wed, Jun 5, 2013 at 12:29 AM, Phil Race <philip.race at oracle.com> wrote:

> Jeremy,
>
> Why didn't it return any fonts ? Is this because the libfontconfig library
> isn't installed ?
>
> We've been runtime loading that lib but these days could potentially
> switch to linking against it at compile time, in which case you won't
> even get this far. So in other words this could be a system config issue.
> The most common thing I've seen is that 64 bit Linux doesn't have
> all the libs to run a 32 bit JRE. You probably found and fixed all of those
> because it was Unsatisfiedlinkerror or similar but the runtime linking
> is disguising that its really the same problem.
>
> If you really don't have any fonts installed, then that's also
> a missing package and we perhaps should have a better diagnostic,
> but there isn't really any point in continuing anyway without any fonts.
> Even headless applications may require fonts.
>
> -phil.
>
>
> On 6/4/2013 2:50 PM, Jeremy Manson wrote:
>
>> Hi folks,
>>
>> I encountered a NullPointerException in the above method, when fontconfig
>> doesn't return any fonts:
>>
>> http://hg.openjdk.java.net/**jdk8/jdk8/jdk/file/**
>> 7eae7c89dab4/src/solaris/**classes/sun/awt/**X11FontManager.java<http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/7eae7c89dab4/src/solaris/classes/sun/awt/X11FontManager.java>
>>
>> Line 779.  The issue is that FontConfigManager sets fontConfigFonts to
>> null when Fontconfig doesn't return any fonts:
>>
>> http://hg.openjdk.java.net/**jdk8/jdk8/jdk/file/**
>> 7eae7c89dab4/src/solaris/**classes/sun/font/**FontConfigManager.java<http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/7eae7c89dab4/src/solaris/classes/sun/font/FontConfigManager.java>
>>
>> Line 218.
>>
>> The solution I came up with is to initialize fontConfigFonts with a
>> zero-element array in this case:
>>
>> diff --git a/src/solaris/classes/sun/**font/FontConfigManager.java
>> b/src/solaris/classes/sun/**font/FontConfigManager.java
>> --- a/src/solaris/classes/sun/**font/FontConfigManager.java
>> +++ b/src/solaris/classes/sun/**font/FontConfigManager.java
>> @@ -216,6 +216,7 @@
>> logger.info <http://logger.info>("**Fontconfig returned no fonts at
>> all.");
>>
>>              }
>>              fontConfigFailed = true;
>> +            fontConfigFonts = new FcCompFont[0];
>>              return;
>>          } else if (fontConfigFailed) {
>>              for (int i = 0; i< fontArr.length; i++) {
>>
>> Thanks for your attention!
>>
>> Jeremy
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20130605/8eebf000/attachment.html>


More information about the 2d-dev mailing list