Font NPE while generating report

1

We've recently seen a number of NPE's while generating reports, all of which occur in the TrueTypeFont class.

After enabling font logging, the tmp +~JF file seems to be getting removed at some point and then causing the NPE the next time the font is used. There is nothing external that is removing the files, so it might be the GC that is cleaning up and removing them. What's concerning is that as soon as the temp files get deleted, nothing will generate further until we've restarted the JBoss instance JR is running in.

Once the file has been deleted, the font is deregistered successfully, but then it tries to reopen the non-existent temp file and eventually fails.

Here's a sample stack trace:

2014-04-09 11:40:46,162 ERROR [STDERR] (GENERAL subreports #4)  Apr 09, 2014 11:40:46 AM sun.font.TrueTypeFont open
INFO: open TTF: /tmp/+~JF2800711352687459302.tmp
2014-04-09 11:40:46,167 ERROR [STDERR] (GENERAL subreports #4)  Apr 09, 2014 11:40:46 AM sun.font.TrueTypeFont readBlock
SEVERE: While reading /tmp/+~JF2800711352687459302.tmp
java.awt.FontFormatException: java.lang.NullPointerException
        at sun.font.TrueTypeFont.open(TrueTypeFont.java:310)
        at sun.font.TrueTypeFont.readBlock(TrueTypeFont.java:338)
        at sun.font.T2KFontScaler.initNativeScaler(Native Method)
        at sun.font.T2KFontScaler.<init>(T2KFontScaler.java:73)
        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:526)
        at sun.font.FontScaler.getScaler(FontScaler.java:128)
        at sun.font.TrueTypeFont.getScaler(TrueTypeFont.java:1251)
        at sun.font.FileFontStrike.<init>(FileFontStrike.java:177)
        at sun.font.FileFont.createStrike(FileFont.java:95)
        at sun.font.Font2D.getStrike(Font2D.java:344)
        at sun.font.Font2D.getStrike(Font2D.java:253)
        at sun.font.Font2D.getFontMetrics(Font2D.java:399)
        at java.awt.Font.defaultLineMetrics(Font.java:2175)
        at java.awt.Font.getLineMetrics(Font.java:2245)
        at net.sf.jasperreports.engine.fill.SimpleTextLineWrapper.determineLeading(SimpleTextLineWrapper.java:391)
        at net.sf.jasperreports.engine.fill.SimpleTextLineWrapper.getGeneralFontInfo(SimpleTextLineWrapper.java:343)
        at net.sf.jasperreports.engine.fill.SimpleTextLineWrapper.createFontInfo(SimpleTextLineWrapper.java:279)
        at net.sf.jasperreports.engine.fill.SimpleTextLineWrapper.start(SimpleTextLineWrapper.java:241)
        at net.sf.jasperreports.engine.fill.TextMeasurer.measure(TextMeasurer.java:411)
        at net.sf.jasperreports.engine.fill.JRFillTextElement.chopTextElement(JRFillTextElement.java:623)
        at net.sf.jasperreports.engine.fill.JRFillTextField.prepare(JRFillTextField.java:685)
        at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:331)
        at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:384)
        at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:358)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2059)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:778)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:288)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:151)
        at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:939)
        at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:871)
        at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:656)
        at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:59)
        at net.sf.jasperreports.engine.fill.AbstractThreadSubreportRunner.run(AbstractThreadSubreportRunner.java:203)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:744)
2014-04-09 11:40:46,168 ERROR [STDERR] (GENERAL subreports #4)  Apr 09, 2014 11:40:46 AM sun.font.SunFontManager deRegisterBadFont
SEVERE: Deregister bad font: ** TrueType Font: Family=Frutiger LT 55 Roman Name=Frutiger LT 55 Roman style=0 fileName=/tmp/+~JF2800711352687459302.tmp
2014-04-09 11:40:46,170 ERROR [STDERR] (GENERAL subreports #4)  Apr 09, 2014 11:40:46 AM sun.font.TrueTypeFont open
INFO: open TTF: /tmp/+~JF2800711352687459302.tmp

And eventually JRFillSubreport fails:

2014-04-09 11:40:46,198 ERROR [net.sf.jasperreports.engine.fill.JRFillSubreport] (GENERAL subreports #1)  Fill 2: exception
java.lang.NullPointerException
        at sun.font.TrueTypeGlyphMapper.<init>(TrueTypeGlyphMapper.java:62)
        at sun.font.TrueTypeFont.getMapper(TrueTypeFont.java:1529)
        at sun.font.FileFontStrike.<init>(FileFontStrike.java:187)
        at sun.font.FileFont.createStrike(FileFont.java:95)
        at sun.font.Font2D.getStrike(Font2D.java:344)
        at sun.font.Font2D.getStrike(Font2D.java:253)
        at sun.font.Font2D.getFontMetrics(Font2D.java:399)
        at java.awt.Font.defaultLineMetrics(Font.java:2175)
        at java.awt.Font.getLineMetrics(Font.java:2245)
...

We were running JR 4.0.1 and have just upgraded to 5.5.1, yet that didn't help.

We were also running JDK 6u45 and tried upgrading to JDK 7u51, but that caused the same problems and they seemed to have far sooner.

Any input will be appreciated as we're currently having to restart our system each morning and resubmit the reports that failed because of the font problem.

 

Malcolm

Malcolm McLean's picture
Joined: Apr 10 2014 - 4:05am
Last seen: 5 years 4 months ago

Hi;

Any solution found for this issue?

After setting jvm parameter,  -Dsun.java2d.debugfonts=true,  found the fonts creating problem in report execution.

Suggested at:
https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/java...

below is my stack trace:

INFO: open TTF: D:\Tomcat60\temp\+~JF518879230854443156.tmp
18 Dec, 2017 6:46:40 PM sun.font.TrueTypeFont readBlock
SEVERE: While reading D:\Tomcat60\temp\+~JF518879230854443156.tmp
java.awt.FontFormatException: java.lang.NullPointerException
    at sun.font.TrueTypeFont.open(TrueTypeFont.java:277)
    at sun.font.TrueTypeFont.readBlock(TrueTypeFont.java:305)
    at sun.font.FileFont.getGlyphOutlineBounds(Native Method)
    at sun.font.FileFontStrike.getGlyphOutlineBounds(FileFontStrike.java:883)
    at sun.font.StandardGlyphVector$GlyphStrike.getGlyphOutlineBounds(StandardGlyphVector.java:1773)
    at sun.font.StandardGlyphVector.getGlyphOutlineBounds(StandardGlyphVector.java:1156)
    at sun.font.StandardGlyphVector.getGlyphVisualBounds(StandardGlyphVector.java:568)
    at sun.font.StandardGlyphVector.getGlyphInfo(StandardGlyphVector.java:846)
    at sun.font.ExtendedTextSourceLabel.createCharinfo(ExtendedTextSourceLabel.java:566)
    at sun.font.ExtendedTextSourceLabel.getCharinfo(ExtendedTextSourceLabel.java:492)
    at sun.font.ExtendedTextSourceLabel.getLineBreakIndex(ExtendedTextSourceLabel.java:438)
    at java.awt.font.TextMeasurer.calcLineBreak(TextMeasurer.java:308)
    at java.awt.font.TextMeasurer.getLineBreakIndex(TextMeasurer.java:544)
    at java.awt.font.LineBreakMeasurer.nextOffset(LineBreakMeasurer.java:340)
    at net.sf.jasperreports.engine.fill.SimpleTextLineWrapper.measureExactLineBreakIndex(SimpleTextLineWrapper.java:565)
    at net.sf.jasperreports.engine.fill.SimpleTextLineWrapper.measureExactLine(SimpleTextLineWrapper.java:539)
    at net.sf.jasperreports.engine.fill.SimpleTextLineWrapper.nextLine(SimpleTextLineWrapper.java:521)
    at net.sf.jasperreports.engine.fill.TextMeasurer.renderNextLine(TextMeasurer.java:826)
    at net.sf.jasperreports.engine.fill.TextMeasurer.renderParagraph(TextMeasurer.java:629)
    at net.sf.jasperreports.engine.fill.TextMeasurer.measure(TextMeasurer.java:570)
    at net.sf.jasperreports.engine.fill.JRFillTextElement.chopTextElement(JRFillTextElement.java:671)
    at net.sf.jasperreports.engine.fill.JRFillTextField.prepare(JRFillTextField.java:763)
    at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:536)
    at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:411)
    at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:386)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2024)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:748)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:255)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:115)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:580)
    at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:396)
    at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:90)
    at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:286)
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:759)
    at com.applied.fincrm.utils.JasperReportBean.getJasperPrintObject(JasperReportBean.java:3154)
    at com.applied.fincrm.utils.JasperReportBean.generateReportWithoutScheduler(JasperReportBean.java:2191)
    at com.applied.fincrm.utils.JasperReportBean.generateReport(JasperReportBean.java:415)
    at com.applied.fincrm.reports.ReportOpenLotsAction.perform(ReportOpenLotsAction.java:618)
    at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1786)
    at com.applied.fincrm.utils.CustActionServlet.processActionPerform(CustActionServlet.java:77)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1585)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:509)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.securityfilter.filter.SecurityFilter.doFilter(SecurityFilter.java:188)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.applied.fincrm.utils.MDCUserServletFilter.doFilter(MDCUserServletFilter.java:72)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:291)
    at org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:444)
    at org.apache.coyote.ajp.AjpAprProtocol$AjpConnectionHandler.process(AjpAprProtocol.java:399)
    at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)
    at java.lang.Thread.run(Thread.java:662)
18 Dec, 2017 6:46:40 PM sun.font.FontManager deRegisterBadFont
SEVERE: Deregister bad font: ** TrueType Font: Family=Tahoma Name=Tahoma style=0 fileName=D:\Tomcat60\temp\+~JF518879230854443156.tmp
18 Dec, 2017 6:46:40 PM sun.font.TrueTypeFont open
INFO: open TTF: D:\Tomcat60\temp\+~JF518879230854443156.tmp

rajil - 1 year 8 months ago

0 Answers:

No answers yet
Feedback
randomness