Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
2.7
-
None
-
None
Description
A broken TTC on a customer's Windows 10 machine caused a NPE.
org.apache.fop.fonts.truetype.OpenFont.getTTCnames()
returns null (after logging SEVERE: Not a TTC!) and then
org.apache.fop.fonts.autodetect.FontInfoFinder.find()
doesn't check the result before iterating on it. But a quick null check on ttcNames fixes the issue. (diff attached.)
Here's the stack trace with the logging right before as well.
WARNING: Unable to load font file: file:/C:/Windows/servicing/LCU/Package_for_RollupFix~31bf3856ad364e35~amd64~~18362.1016.1.5/amd64_microsoft-windows-ecapp.appxmain_31bf3856ad364e35_10.0.18362.997_none_52b446c91de63187/r/ecmdl2.ttf. Reason: java.io.EOFException: Reached EOF, file size=52 Mar 10, 2021 5:08:12 PM org.apache.fop.fonts.truetype.OpenFont getTTCnames SEVERE: Not a TTC! java.lang.NullPointerException: Cannot invoke "java.util.List.iterator()" because "ttcNames" is null at org.apache.fop.fonts.autodetect.FontInfoFinder.find(FontInfoFinder.java:219) at org.apache.fop.fonts.FontAdder.add(FontAdder.java:63) at org.apache.fop.fonts.FontDetectorFactory$DefaultFontDetector.detect(FontDetectorFactory.java:97) at org.apache.fop.fonts.FontManager.autoDetectFonts(FontManager.java:229) at org.apache.fop.fonts.DefaultFontConfigurator.configure(DefaultFontConfigurator.java:82) at org.apache.fop.render.PrintRendererConfigurator.getCustomFontCollection(PrintRendererConfigurator.java:147) at org.apache.fop.render.PrintRendererConfigurator.setupFontInfo(PrintRendererConfigurator.java:127) at org.apache.fop.render.intermediate.IFUtil.setupFonts(IFUtil.java:170) at org.apache.fop.render.intermediate.IFRenderer.setupFontInfo(IFRenderer.java:187) at org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:75) at org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135) at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:105) at org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:363) at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:107) at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:104) at org.apache.fop.apps.Fop.<init>(Fop.java:78) at org.apache.fop.apps.FOUserAgent.newFop(FOUserAgent.java:184) at org.apache.fop.apps.FopFactory.newFop(FopFactory.java:242)