On Wed, 15 Mar 2023 16:02:36 GMT, Matthias Baesken <[email protected]> wrote:
> On Linux Alpine we were running in the jtreg awt tests into a lot of NPEs > like this : > > java.lang.InternalError: java.lang.reflect.InvocationTargetException > at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:87) > at > java.base/java.security.AccessController.doPrivileged(AccessController.java:318) > at > java.desktop/sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:75) > at java.desktop/java.awt.Font.getFont2D(Font.java:526) > at java.desktop/java.awt.Font$FontAccessImpl.getFont2D(Font.java:265) > at java.desktop/sun.font.FontUtilities.getFont2D(FontUtilities.java:148) > at java.desktop/sun.font.GlyphLayout$SDCache.<init>(GlyphLayout.java:254) > at java.desktop/sun.font.GlyphLayout$SDCache.get(GlyphLayout.java:328) > at java.desktop/sun.font.GlyphLayout.layout(GlyphLayout.java:375) > at java.desktop/java.awt.Font.layoutGlyphVector(Font.java:2858) > at FontLayoutStressTest.doLayout(FontLayoutStressTest.java:51) > at FontLayoutStressTest.main(FontLayoutStressTest.java:57) > at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native > Method) > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) > at > java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.base/java.lang.reflect.Method.invoke(Method.java:568) > at > com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127) > at java.base/java.lang.Thread.run(Thread.java:833) > Caused by: java.lang.reflect.InvocationTargetException > at > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native > Method) > at > java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) > at > java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > at > java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) > at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480) > at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:85) > ... 17 more > Caused by: java.lang.NullPointerException: Cannot load from short array > because "sun.awt.FontConfiguration.head" is null > at > java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264) > at > java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:224) > at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:106) > at > java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:706) > at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:358) > at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:315) > at > java.base/java.security.AccessController.doPrivileged(AccessController.java:318) > at java.desktop/sun.font.SunFontManager.<init>(SunFontManager.java:315) > at java.desktop/sun.awt.FcFontManager.<init>(FcFontManager.java:35) > at java.desktop/sun.awt.X11FontManager.<init>(X11FontManager.java:56) > ... 23 more > > Seems this was caused because no fonts were installed on the machine. > Probably 'head' in FontConfiguration.getVersion() should be checked for null > and a specific exception like "Check your fonts or fonts configuration" > should be throw. This pull request has now been integrated. Changeset: 3c7ab805 Author: Matthias Baesken <[email protected]> URL: https://git.openjdk.org/jdk/commit/3c7ab80501d7935d6f65b18c1eb2b47b207ffcf9 Stats: 9 lines in 1 file changed: 9 ins; 0 del; 0 mod 8304054: Linux: NullPointerException from FontConfiguration.getVersion in case no fonts are installed Reviewed-by: lucy, aivanov ------------- PR: https://git.openjdk.org/jdk/pull/13045
