{"action":"created","issue":{"url":"https://api.github.com/repos/danfickle/openhtmltopdf/issues/224","repository_url":"https://api.github.com/repos/danfickle/openhtmltopdf","labels_url":"https://api.github.com/repos/danfickle/openhtmltopdf/issues/224/labels{/name}","comments_url":"https://api.github.com/repos/danfickle/openhtmltopdf/issues/224/comments","events_url":"https://api.github.com/repos/danfickle/openhtmltopdf/issues/224/events","html_url":"https://github.com/danfickle/openhtmltopdf/issues/224","id":328495744,"node_id":"MDU6SXNzdWUzMjg0OTU3NDQ=","number":224,"title":"Exception in apache.pdfbox/fontbox - null font","user":{"login":"BbIKTOP","id":24525137,"node_id":"MDQ6VXNlcjI0NTI1MTM3","avatar_url":"https://avatars1.githubusercontent.com/u/24525137?v=4","gravatar_id":"","url":"https://api.github.com/users/BbIKTOP","html_url":"https://github.com/BbIKTOP","followers_url":"https://api.github.com/users/BbIKTOP/followers","following_url":"https://api.github.com/users/BbIKTOP/following{/other_user}","gists_url":"https://api.github.com/users/BbIKTOP/gists{/gist_id}","starred_url":"https://api.github.com/users/BbIKTOP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BbIKTOP/subscriptions","organizations_url":"https://api.github.com/users/BbIKTOP/orgs","repos_url":"https://api.github.com/users/BbIKTOP/repos","events_url":"https://api.github.com/users/BbIKTOP/events{/privacy}","received_events_url":"https://api.github.com/users/BbIKTOP/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":13,"created_at":"2018-06-01T12:09:13Z","updated_at":"2018-07-10T09:51:51Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nGot this, have no idea why:\r\n\r\n```\r\njava.io.IOException: The TrueType font null does not contain a 'cmap' table\r\n        at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapImpl(TrueTypeFont.java:548)\r\n        at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapLookup(TrueTypeFont.java:528)\r\n        at org.apache.fontbox.ttf.TrueTypeFont.getUnicodeCmapLookup(TrueTypeFont.java:514)\r\n        at org.apache.fontbox.ttf.TTFSubsetter.<init>(TTFSubsetter.java:91)\r\n        at org.apache.pdfbox.pdmodel.font.TrueTypeEmbedder.subset(TrueTypeEmbedder.java:321)\r\n        at org.apache.pdfbox.pdmodel.font.PDType0Font.subset(PDType0Font.java:239)\r\n        at com.openhtmltopdf.pdfboxout.PdfBoxFontResolver.close(PdfBoxFontResolver.java:86)\r\n        at com.openhtmltopdf.pdfboxout.PdfBoxRenderer.cleanup(PdfBoxRenderer.java:848)\r\n        at com.openhtmltopdf.pdfboxout.PdfBoxRenderer.close(PdfBoxRenderer.java:870)\r\n        at com.openhtmltopdf.pdfboxout.PdfRendererBuilder.run(PdfRendererBuilder.java:37)\r\n        at web.MakePdf.processRequest(MakePdf.java:97)\r\n        at web.MakePdf.doPost(MakePdf.java:116)\r\n        at javax.servlet.http.HttpServlet.service(HttpServlet.java:159)\r\n        at javax.servlet.http.HttpServlet.service(HttpServlet.java:97)\r\n        at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:109)\r\n        at web.ur.CheckAccess.doFilter(CheckAccess.java:49)\r\n        at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:89)\r\n        at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:156)\r\n        at com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:95)\r\n        at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:290)\r\n        at com.caucho.server.hmux.HmuxRequest.handleInvocation(HmuxRequest.java:476)\r\n        at com.caucho.server.hmux.HmuxRequest.handleRequestImpl(HmuxRequest.java:374)\r\n        at com.caucho.server.hmux.HmuxRequest.handleRequest(HmuxRequest.java:341)\r\n        at com.caucho.network.listen.TcpSocketLink.dispatchRequest(TcpSocketLink.java:1362)\r\n        at com.caucho.network.listen.TcpSocketLink.handleRequest(TcpSocketLink.java:1318)\r\n        at com.caucho.network.listen.TcpSocketLink.handleRequestsImpl(TcpSocketLink.java:1302)\r\n        at com.caucho.network.listen.TcpSocketLink.handleRequests(TcpSocketLink.java:1210)\r\n        at com.caucho.network.listen.TcpSocketLink.handleAcceptTaskImpl(TcpSocketLink.java:1006)\r\n        at com.caucho.network.listen.ConnectionTask.runThread(ConnectionTask.java:117)\r\n        at com.caucho.network.listen.ConnectionTask.run(ConnectionTask.java:93)\r\n        at com.caucho.network.listen.SocketLinkThreadLauncher.handleTasks(SocketLinkThreadLauncher.java:169)\r\n        at com.caucho.network.listen.TcpSocketAcceptThread.run(TcpSocketAcceptThread.java:61)\r\n        at com.caucho.env.thread2.ResinThread2.runTasks(ResinThread2.java:173)\r\n        at com.caucho.env.thread2.ResinThread2.run(ResinThread2.java:118)\r\n```\r\n\r\nProbably this Exception#printStackTrace call should be removed, although I don't understand how can font be null:\r\n\r\n```\r\npublic void close() {\r\n\t\tfor (FontDescription fontDescription : _fontCache.values()) {\r\n\t\t\t/*\r\n\t\t\t * If the font is not yet subset, we must subset it, otherwise we may leak a\r\n\t\t\t * file handle because the PDType0Font may still have the font file open.\r\n\t\t\t */\r\n\t\t\tif (fontDescription._font != null && fontDescription._font.willBeSubset()) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tfontDescription._font.subset();\r\n\t\t\t\t} catch (IOException e) {\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t_fontCache.clear();\r\n\r\n\t\t// Close all still open TrueTypeCollections\r\n\t\tfor (TrueTypeCollection collection : _collectionsToClose) {\r\n\t\t\ttry {\r\n\t\t\t\tcollection.close();\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\t\t_collectionsToClose.clear();\r\n\t}\r\n\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/danfickle/openhtmltopdf/issues/comments/403766783","html_url":"https://github.com/danfickle/openhtmltopdf/issues/224#issuecomment-403766783","issue_url":"https://api.github.com/repos/danfickle/openhtmltopdf/issues/224","id":403766783,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMzc2Njc4Mw==","user":{"login":"nullquery","id":5695364,"node_id":"MDQ6VXNlcjU2OTUzNjQ=","avatar_url":"https://avatars1.githubusercontent.com/u/5695364?v=4","gravatar_id":"","url":"https://api.github.com/users/nullquery","html_url":"https://github.com/nullquery","followers_url":"https://api.github.com/users/nullquery/followers","following_url":"https://api.github.com/users/nullquery/following{/other_user}","gists_url":"https://api.github.com/users/nullquery/gists{/gist_id}","starred_url":"https://api.github.com/users/nullquery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nullquery/subscriptions","organizations_url":"https://api.github.com/users/nullquery/orgs","repos_url":"https://api.github.com/users/nullquery/repos","events_url":"https://api.github.com/users/nullquery/events{/privacy}","received_events_url":"https://api.github.com/users/nullquery/received_events","type":"User","site_admin":false},"created_at":"2018-07-10T09:51:51Z","updated_at":"2018-07-10T09:51:51Z","author_association":"NONE","body":"It seems to me that the error can be ignored in my use case, because TrueType Collections are closed manually after the loop. See com.openhtmltopdf.pdfboxout.PdfBoxFontResolver#close\r\n\r\nIf this is the case, then the issue can be resolved (at least for me) by passing the error to the com.openhtmltopdf.util.XRLog class."}}
{"actor":{"display_login":"nullquery"}}