Bug 173760 - java/openjdk7 needs dejavu fonts
Summary: java/openjdk7 needs dejavu fonts
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Greg Lewis
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-21 11:10 UTC by Palle Girgensohn
Modified: 2012-12-25 21:00 UTC (History)
1 user (show)

See Also:


Attachments
file.diff (547 bytes, patch)
2012-11-21 11:10 UTC, Palle Girgensohn
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Palle Girgensohn freebsd_committer 2012-11-21 11:10:00 UTC
openjdk6 depends on dejavu for fonts
openjdk7 does not. I think it should:

java.lang.NullPointerException
at
sun.awt.X11FontManager.getDefaultPlatformFont(X11FontManager.java:779)
at sun.font.SunFontManager$2.run(SunFontManager.java:432)
at java.security.AccessController.doPrivileged(Native Method)
at sun.font.SunFontManager.<init>(SunFontManager.java:375)
at sun.awt.X11FontManager.<init>(X11FontManager.java:32)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:83)
at java.security.AccessController.doPrivileged(Native Method)
at sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
at java.awt.Font.getFont2D(Font.java:490)
at java.awt.Font.getFamily(Font.java:1187)
at java.awt.Font.getFamily_NoClientCode(Font.java:1161)
at java.awt.Font.getFamily(Font.java:1153)

Fix: root:/usr/ports/java/openjdk7]# diff -u Makefile.orig Makefile
Comment 1 Tilman Keskinoz freebsd_committer 2012-11-21 17:16:26 UTC
Responsible Changed
From-To: freebsd-ports-bugs->glewis

over to maintainer
Comment 2 Greg Lewis freebsd_committer 2012-11-22 03:58:00 UTC
State Changed
From-To: open->feedback

Palle, can you please provide a test case that reproduces the stack trace you 
have in the PR and also comment on whether adding dejavu fonts fixes it?
Comment 3 Palle Girgensohn 2012-11-22 11:30:09 UTC
$ cat Main.java
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedImage image = new BufferedImage(100, 100,
BufferedImage.TYPE_4BYTE_ABGR);
        image.getGraphics().drawString("Hello", 10, 10);
        ImageIO.write(image, "png", new File("/tmp/image.png"));

    }
}
$ javac Main.java && /usr/local/openjdk7/bin/java Main
Exception in thread "main" java.lang.NullPointerException
at sun.awt.X11FontManager.getDefaultPlatformFont(X11FontManager.java:779)
at sun.font.SunFontManager$2.run(SunFontManager.java:432)
at java.security.AccessController.doPrivileged(Native Method)
at sun.font.SunFontManager.<init>(SunFontManager.java:375)
at sun.awt.X11FontManager.<init>(X11FontManager.java:32)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:83)
at java.security.AccessController.doPrivileged(Native Method)
at sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
at java.awt.Font.getFont2D(Font.java:490)
at java.awt.Font.access$000(Font.java:224)
at java.awt.Font$FontAccessImpl.getFont2D(Font.java:228)
at sun.font.FontUtilities.getFont2D(FontUtilities.java:187)
at sun.java2d.SunGraphics2D.checkFontInfo(SunGraphics2D.java:607)
at sun.java2d.SunGraphics2D.getFontInfo(SunGraphics2D.java:768)
at sun.java2d.pipe.GlyphListPipe.drawString(GlyphListPipe.java:50)
at sun.java2d.pipe.ValidatePipe.drawString(ValidatePipe.java:165)
at sun.java2d.SunGraphics2D.drawString(SunGraphics2D.java:2829)
at Main.main(Main.java:9)
Comment 4 Greg Lewis 2012-11-22 19:14:11 UTC
I tried that test case out and it works for me whether I have the dejavu
fonts installed or not.  Could you send me the output of xlsfonts?  I want
to compare that to the output on my machine.

-- 
Greg Lewis                          Email   : glewis@eyesbeyond.com
Eyes Beyond                         Web     : http://www.eyesbeyond.com
Information Technology              FreeBSD : glewis@FreeBSD.org
Comment 5 citrin 2012-12-19 16:38:08 UTC
I meet with same problem after switching to openjdk7 - exception in AWT and this 
problem fixed by installing
x11-fonts/dejavu

I can't provide xlsfonts output, because X-server is not installed on this host.

-- 
  Anton Yuzhaninov
Comment 6 dfilter service freebsd_committer 2012-12-25 20:50:08 UTC
Author: glewis
Date: Tue Dec 25 20:49:55 2012
New Revision: 309495
URL: http://svnweb.freebsd.org/changeset/ports/309495

Log:
  . Add a runtime dependency on dejavu fonts.  Several have reported problems
    with font related crashes without them.  I haven't been able to reproduce,
    but this should be relatively harmless, so I'm committing it anyway.
  
  PR:		173760
  Submitted by:	girgen@

Modified:
  head/java/openjdk7/Makefile

Modified: head/java/openjdk7/Makefile
==============================================================================
--- head/java/openjdk7/Makefile	Tue Dec 25 20:13:09 2012	(r309494)
+++ head/java/openjdk7/Makefile	Tue Dec 25 20:49:55 2012	(r309495)
@@ -7,7 +7,7 @@
 
 PORTNAME=	openjdk
 PORTVERSION=	${JDK_MAJOR_VERSION}.${PORT_MINOR_VERSION}.${PORT_BUILD_NUMBER}
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	java devel
 MASTER_SITES=	http://download.java.net/openjdk/jdk${JDK_MAJOR_VERSION}u${JDK_MINOR_VERSION}/promoted/b${JDK_BUILD_NUMBER}/ \
 		http://download.java.net/jaxp/1.4.5/:jaxp \
@@ -60,7 +60,8 @@ LIB_DEPENDS+=	freetype:${PORTSDIR}/print
 BUILD_DEPENDS+=	zip:${PORTSDIR}/archivers/zip \
 		unzip:${PORTSDIR}/archivers/unzip \
 		${LOCALBASE}/include/cups/cups.h:${PORTSDIR}/print/cups-client
-RUN_DEPENDS+=	javavm:${PORTSDIR}/java/javavmwrapper
+RUN_DEPENDS+=	javavm:${PORTSDIR}/java/javavmwrapper \
+		${LOCALBASE}/lib/X11/fonts/dejavu:${PORTSDIR}/x11-fonts/dejavu
 
 OPENJDK_OSARCH=	bsd-${ARCH:S/i386/i586/}
 INSTALLDIR=	${PREFIX}/${PORTNAME}${JDK_MAJOR_VERSION}
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 7 Greg Lewis freebsd_committer 2012-12-25 20:50:22 UTC
State Changed
From-To: feedback->closed

Committed. Thanks!