6943487: NPE in makeMultiCharsetString while printing on linux
Reviewed-by: igor, jgodinez
--- a/jdk/src/share/classes/sun/awt/PlatformFont.java Fri Jun 18 11:00:14 2010 -0700
+++ b/jdk/src/share/classes/sun/awt/PlatformFont.java Tue Jun 29 09:48:15 2010 -0700
@@ -25,10 +25,10 @@
package sun.awt;
-import java.awt.GraphicsEnvironment;
import java.awt.peer.FontPeer;
import java.util.Locale;
import java.util.Vector;
+import sun.font.SunFontManager;
import sun.java2d.FontSupport;
import java.nio.CharBuffer;
import java.nio.ByteBuffer;
@@ -57,9 +57,9 @@
protected static String osVersion;
public PlatformFont(String name, int style){
- GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
- if (ge instanceof FontSupport) {
- fontConfig = ((FontSupport)ge).getFontConfiguration();
+ SunFontManager sfm = SunFontManager.getInstance();
+ if (sfm instanceof FontSupport) {
+ fontConfig = ((FontSupport)sfm).getFontConfiguration();
}
if (fontConfig == null) {
return;
--- a/jdk/src/share/classes/sun/java2d/HeadlessGraphicsEnvironment.java Fri Jun 18 11:00:14 2010 -0700
+++ b/jdk/src/share/classes/sun/java2d/HeadlessGraphicsEnvironment.java Tue Jun 29 09:48:15 2010 -0700
@@ -59,17 +59,12 @@
* Headless decorator implementation of a SunGraphicsEnvironment
*/
-public class HeadlessGraphicsEnvironment extends GraphicsEnvironment
- implements FontSupport {
+public class HeadlessGraphicsEnvironment extends GraphicsEnvironment {
private GraphicsEnvironment ge;
- private FontSupport fontSupport;
public HeadlessGraphicsEnvironment(GraphicsEnvironment ge) {
this.ge = ge;
- if (ge instanceof FontSupport) {
- fontSupport = (FontSupport)ge;
- }
}
public GraphicsDevice[] getScreenDevices()
@@ -101,13 +96,6 @@
public String[] getAvailableFontFamilyNames(Locale l) {
return ge.getAvailableFontFamilyNames(l); }
- public FontConfiguration getFontConfiguration() {
- if (fontSupport != null) {
- return fontSupport.getFontConfiguration();
- }
- return null;
- }
-
/* Used by FontManager : internal API */
public GraphicsEnvironment getSunGraphicsEnvironment() {
return ge;