--- old/src/java.desktop/windows/classes/sun/awt/windows/WComponentPeer.java 2020-07-29 10:06:56.552179217 +0900 +++ new/src/java.desktop/windows/classes/sun/awt/windows/WComponentPeer.java 2020-07-29 10:06:56.469180223 +0900 @@ -56,6 +56,7 @@ import java.awt.image.VolatileImage; import java.awt.peer.ComponentPeer; import java.awt.peer.ContainerPeer; +import java.util.Objects; import sun.awt.AWTAccessor; import sun.awt.PaintEventDispatcher; @@ -579,7 +580,12 @@ } // fallback default font object - static final Font defaultFont = new Font(Font.DIALOG, Font.PLAIN, 12); + static final Font defaultFont; + + static { + defaultFont = new Font(Font.DIALOG, Font.PLAIN, 12); + Objects.requireNonNull(defaultFont, "default font must not be null"); + } @Override public Graphics getGraphics() { --- old/src/java.desktop/windows/classes/sun/awt/windows/WFontConfiguration.java 2020-07-29 10:06:56.852175582 +0900 +++ new/src/java.desktop/windows/classes/sun/awt/windows/WFontConfiguration.java 2020-07-29 10:06:56.774176527 +0900 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -152,14 +152,18 @@ /** * Returns the component font name (face name plus charset) of the - * font that should be used for AWT text components. May return null. + * font that should be used for AWT text components. */ public String getTextComponentFontName(String familyName, int style) { FontDescriptor[] fontDescriptors = getFontDescriptors(familyName, style); String fontName = findFontWithCharset(fontDescriptors, textInputCharset); - if (fontName == null) { + if ((fontName == null) && !textInputCharset.equals("DEFAULT_CHARSET")) { fontName = findFontWithCharset(fontDescriptors, "DEFAULT_CHARSET"); } + if (fontName == null) { + fontName = (fontDescriptors.length > 0) ? fontDescriptors[0].getNativeName() + : "Arial.ANSI_CHARSET"; + } return fontName; }