You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Cornelis Hoeflake (JIRA)" <ji...@apache.org> on 2014/09/17 10:23:33 UTC

[jira] [Commented] (PDFBOX-2358) ExternalFonts uses classloader of class in font-box

    [ https://issues.apache.org/jira/browse/PDFBOX-2358?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14136940#comment-14136940 ] 

Cornelis Hoeflake commented on PDFBOX-2358:
-------------------------------------------

One solution is to pass a classloader to the ResourceLoader. But throwing around with classloaders can cause issues.

Another solution is to load the file directly without the ResourceLoader, as far as I can see the resourceloader does nothing extra in this case. Same for CMapParser which also uses the ResourceLoader.

Next is to remove ResourceLoader or to make very clear that the ResourceLoader cannot be used outside the fontbox. My personal opinion is that the ResourceLoader is a black class which does some magic tricks (for example, return a FileInputStream if the resource could not be found in the classloader, this is somewhat obscure and could be dangerous).

> ExternalFonts uses classloader of class in font-box
> ---------------------------------------------------
>
>                 Key: PDFBOX-2358
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2358
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.0
>            Reporter: Cornelis Hoeflake
>
> ExternalFonts loads some default fonts via the org.apache.fontbox.util.ResourceLoader. That resourceloader uses it's own classloader (ResourceLoader.class.getClassLoader()) for loading the given resource.
> The problem is that the resource is in the PDFBox project and the ResourceLoader in the FontBox. In an OSGI environment this is a problem.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)