[jira] [Comment Edited] (FOP-2861) Allow resource loading from jar: URI
[ https://issues.apache.org/jira/browse/FOP-2861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17498811#comment-17498811 ] Ole Sandum edited comment on FOP-2861 at 2/28/22, 11:20 AM: Yup, that seems to work just fine in our scenario as well. (y) Corresponding patch, thus: {code:bash} cd fop-core curl https://issues.apache.org/jira/secure/attachment/13040525/uri_resolve-1.diff | patch -p0{code} was (Author: osandum): Yup, that seems to work just fine in our scenario as well. (y) Corresponding patch, thus: {code:java} cd fop-core curl https://issues.apache.org/jira/secure/attachment/13040525/uri_resolve-1.diff | patch -p0{code} > Allow resource loading from jar: URI > > > Key: FOP-2861 > URL: https://issues.apache.org/jira/browse/FOP-2861 > Project: FOP > Issue Type: Improvement >Affects Versions: 2.0, 2.1, 2.2, 2.3, 2.4, 2.6, 2.7 >Reporter: Ole Sandum >Priority: Major > Attachments: FopResourceResolver.java, uri_resolve-1.diff, > uri_resolve.diff, uri_resolve_decoded.diff > > > We would like to load our FOP config.xml along with related fonts and > hyphenation files using the common classloader URL, e.g.: > {{ URL configXml = getClass().getResource("config.xml");}} > {{ FopConfParser confParser = }} > {{ new FopConfParser(configXml.openStream(), configXml.toURI());}} > This makes for easy deployment, and works nicely as long as classes and > resources are loaded from separate files, i.e. from > file:/some/path/config.xml URIs. However, it fails when classes and resources > are packaged and loaded directly from a jar, i.e. from > jar:file:/some/archive.jar!/path/config.xml URIs, as is the case when > deploying with JWS or running an all-in-one executable jar, as it will fail > to properly resolve the related font and hyphenation file URIs. > See [https://github.com/osandum/fop-test.git] for a test to illustrate. > This is a consequence of a long standing issue (reported in > [https://bugs.openjdk.java.net/browse/JDK-8020755)] that > URI.resolve(childUri) doesn't work as expected on jar:file: URIs. > In this case, it can be easily remedied by a work-around to the call in > InternalResourceResolver.resolveFromBase(URI uri). Patch attached. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Comment Edited] (FOP-2861) Allow resource loading from jar: URI
[ https://issues.apache.org/jira/browse/FOP-2861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17498811#comment-17498811 ] Ole Sandum edited comment on FOP-2861 at 2/28/22, 11:19 AM: Yup, that seems to work just fine in our scenario as well. (y) Corresponding patch, thus: {code:java} cd fop-core curl https://issues.apache.org/jira/secure/attachment/13040525/uri_resolve-1.diff | patch -p0{code} was (Author: osandum): Yup, that seems to work just fine in my scenario as well. (y) > Allow resource loading from jar: URI > > > Key: FOP-2861 > URL: https://issues.apache.org/jira/browse/FOP-2861 > Project: FOP > Issue Type: Improvement >Affects Versions: 2.0, 2.1, 2.2, 2.3, 2.4, 2.6, 2.7 >Reporter: Ole Sandum >Priority: Major > Attachments: FopResourceResolver.java, uri_resolve-1.diff, > uri_resolve.diff, uri_resolve_decoded.diff > > > We would like to load our FOP config.xml along with related fonts and > hyphenation files using the common classloader URL, e.g.: > {{ URL configXml = getClass().getResource("config.xml");}} > {{ FopConfParser confParser = }} > {{ new FopConfParser(configXml.openStream(), configXml.toURI());}} > This makes for easy deployment, and works nicely as long as classes and > resources are loaded from separate files, i.e. from > file:/some/path/config.xml URIs. However, it fails when classes and resources > are packaged and loaded directly from a jar, i.e. from > jar:file:/some/archive.jar!/path/config.xml URIs, as is the case when > deploying with JWS or running an all-in-one executable jar, as it will fail > to properly resolve the related font and hyphenation file URIs. > See [https://github.com/osandum/fop-test.git] for a test to illustrate. > This is a consequence of a long standing issue (reported in > [https://bugs.openjdk.java.net/browse/JDK-8020755)] that > URI.resolve(childUri) doesn't work as expected on jar:file: URIs. > In this case, it can be easily remedied by a work-around to the call in > InternalResourceResolver.resolveFromBase(URI uri). Patch attached. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (FOP-2861) Allow resource loading from jar: URI
[ https://issues.apache.org/jira/browse/FOP-2861?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ole Sandum updated FOP-2861: Attachment: uri_resolve-1.diff > Allow resource loading from jar: URI > > > Key: FOP-2861 > URL: https://issues.apache.org/jira/browse/FOP-2861 > Project: FOP > Issue Type: Improvement >Affects Versions: 2.0, 2.1, 2.2, 2.3, 2.4, 2.6, 2.7 >Reporter: Ole Sandum >Priority: Major > Attachments: FopResourceResolver.java, uri_resolve-1.diff, > uri_resolve.diff, uri_resolve_decoded.diff > > > We would like to load our FOP config.xml along with related fonts and > hyphenation files using the common classloader URL, e.g.: > {{ URL configXml = getClass().getResource("config.xml");}} > {{ FopConfParser confParser = }} > {{ new FopConfParser(configXml.openStream(), configXml.toURI());}} > This makes for easy deployment, and works nicely as long as classes and > resources are loaded from separate files, i.e. from > file:/some/path/config.xml URIs. However, it fails when classes and resources > are packaged and loaded directly from a jar, i.e. from > jar:file:/some/archive.jar!/path/config.xml URIs, as is the case when > deploying with JWS or running an all-in-one executable jar, as it will fail > to properly resolve the related font and hyphenation file URIs. > See [https://github.com/osandum/fop-test.git] for a test to illustrate. > This is a consequence of a long standing issue (reported in > [https://bugs.openjdk.java.net/browse/JDK-8020755)] that > URI.resolve(childUri) doesn't work as expected on jar:file: URIs. > In this case, it can be easily remedied by a work-around to the call in > InternalResourceResolver.resolveFromBase(URI uri). Patch attached. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Commented] (FOP-2861) Allow resource loading from jar: URI
[ https://issues.apache.org/jira/browse/FOP-2861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17498811#comment-17498811 ] Ole Sandum commented on FOP-2861: - Yup, that seems to work just fine in my scenario as well. (y) > Allow resource loading from jar: URI > > > Key: FOP-2861 > URL: https://issues.apache.org/jira/browse/FOP-2861 > Project: FOP > Issue Type: Improvement >Affects Versions: 2.0, 2.1, 2.2, 2.3, 2.4, 2.6, 2.7 >Reporter: Ole Sandum >Priority: Major > Attachments: FopResourceResolver.java, uri_resolve.diff, > uri_resolve_decoded.diff > > > We would like to load our FOP config.xml along with related fonts and > hyphenation files using the common classloader URL, e.g.: > {{ URL configXml = getClass().getResource("config.xml");}} > {{ FopConfParser confParser = }} > {{ new FopConfParser(configXml.openStream(), configXml.toURI());}} > This makes for easy deployment, and works nicely as long as classes and > resources are loaded from separate files, i.e. from > file:/some/path/config.xml URIs. However, it fails when classes and resources > are packaged and loaded directly from a jar, i.e. from > jar:file:/some/archive.jar!/path/config.xml URIs, as is the case when > deploying with JWS or running an all-in-one executable jar, as it will fail > to properly resolve the related font and hyphenation file URIs. > See [https://github.com/osandum/fop-test.git] for a test to illustrate. > This is a consequence of a long standing issue (reported in > [https://bugs.openjdk.java.net/browse/JDK-8020755)] that > URI.resolve(childUri) doesn't work as expected on jar:file: URIs. > In this case, it can be easily remedied by a work-around to the call in > InternalResourceResolver.resolveFromBase(URI uri). Patch attached. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Comment Edited] (FOP-2861) Allow resource loading from jar: URI
[ https://issues.apache.org/jira/browse/FOP-2861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17497298#comment-17497298 ] Ole Sandum edited comment on FOP-2861 at 2/24/22, 9:59 AM: --- Ah, that explains it. Thank you for elaborating and investigating. It appears, there are not that many of us loading config and resources from 'opaque' jar: sources, but it clearly causes a lot of grief for those who do. The patch above is still valid on the 2.7 sources (corrected to not use {{get{+}Raw{+}SchemeSpecificPart()}} as commented by [~david.shepherdson]) was (Author: osandum): Ah, that explains it. Thank you for elaborating and investigating. It appears, there are not that many of us loading config and resources from 'opaque' (jar:) sources, but it clearly causes a lot of grief for those who do. The patch above is still valid on the 2.7 sources (corrected to not use {{get{+}Raw{+}SchemeSpecificPart()}} as commented by [~david.shepherdson]) > Allow resource loading from jar: URI > > > Key: FOP-2861 > URL: https://issues.apache.org/jira/browse/FOP-2861 > Project: FOP > Issue Type: Improvement >Affects Versions: 2.0, 2.1, 2.2, 2.3, 2.4, 2.6, 2.7 >Reporter: Ole Sandum >Priority: Major > Attachments: FopResourceResolver.java, uri_resolve.diff, > uri_resolve_decoded.diff > > > We would like to load our FOP config.xml along with related fonts and > hyphenation files using the common classloader URL, e.g.: > {{ URL configXml = getClass().getResource("config.xml");}} > {{ FopConfParser confParser = }} > {{ new FopConfParser(configXml.openStream(), configXml.toURI());}} > This makes for easy deployment, and works nicely as long as classes and > resources are loaded from separate files, i.e. from > file:/some/path/config.xml URIs. However, it fails when classes and resources > are packaged and loaded directly from a jar, i.e. from > jar:file:/some/archive.jar!/path/config.xml URIs, as is the case when > deploying with JWS or running an all-in-one executable jar, as it will fail > to properly resolve the related font and hyphenation file URIs. > See [https://github.com/osandum/fop-test.git] for a test to illustrate. > This is a consequence of a long standing issue (reported in > [https://bugs.openjdk.java.net/browse/JDK-8020755)] that > URI.resolve(childUri) doesn't work as expected on jar:file: URIs. > In this case, it can be easily remedied by a work-around to the call in > InternalResourceResolver.resolveFromBase(URI uri). Patch attached. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Commented] (FOP-2861) Allow resource loading from jar: URI
[ https://issues.apache.org/jira/browse/FOP-2861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17497298#comment-17497298 ] Ole Sandum commented on FOP-2861: - Ah, that explains it. Thank you for elaborating and investigating. It appears, there are not that many of us loading config and resources from 'opaque' (jar:) sources, but it clearly causes a lot of grief for those who do. The patch above is still valid on the 2.7 sources (corrected to not use {{get{+}Raw{+}SchemeSpecificPart()}} as commented by [~david.shepherdson]) > Allow resource loading from jar: URI > > > Key: FOP-2861 > URL: https://issues.apache.org/jira/browse/FOP-2861 > Project: FOP > Issue Type: Improvement >Affects Versions: 2.0, 2.1, 2.2, 2.3, 2.4, 2.6, 2.7 >Reporter: Ole Sandum >Priority: Major > Attachments: FopResourceResolver.java, uri_resolve.diff, > uri_resolve_decoded.diff > > > We would like to load our FOP config.xml along with related fonts and > hyphenation files using the common classloader URL, e.g.: > {{ URL configXml = getClass().getResource("config.xml");}} > {{ FopConfParser confParser = }} > {{ new FopConfParser(configXml.openStream(), configXml.toURI());}} > This makes for easy deployment, and works nicely as long as classes and > resources are loaded from separate files, i.e. from > file:/some/path/config.xml URIs. However, it fails when classes and resources > are packaged and loaded directly from a jar, i.e. from > jar:file:/some/archive.jar!/path/config.xml URIs, as is the case when > deploying with JWS or running an all-in-one executable jar, as it will fail > to properly resolve the related font and hyphenation file URIs. > See [https://github.com/osandum/fop-test.git] for a test to illustrate. > This is a consequence of a long standing issue (reported in > [https://bugs.openjdk.java.net/browse/JDK-8020755)] that > URI.resolve(childUri) doesn't work as expected on jar:file: URIs. > In this case, it can be easily remedied by a work-around to the call in > InternalResourceResolver.resolveFromBase(URI uri). Patch attached. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (FOP-2861) Allow resource loading from jar: URI
[ https://issues.apache.org/jira/browse/FOP-2861?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ole Sandum updated FOP-2861: Affects Version/s: 2.7 > Allow resource loading from jar: URI > > > Key: FOP-2861 > URL: https://issues.apache.org/jira/browse/FOP-2861 > Project: FOP > Issue Type: Improvement >Affects Versions: 2.0, 2.1, 2.2, 2.3, 2.4, 2.6, 2.7 >Reporter: Ole Sandum >Priority: Major > Attachments: FopResourceResolver.java, uri_resolve.diff, > uri_resolve_decoded.diff > > > We would like to load our FOP config.xml along with related fonts and > hyphenation files using the common classloader URL, e.g.: > {{ URL configXml = getClass().getResource("config.xml");}} > {{ FopConfParser confParser = }} > {{ new FopConfParser(configXml.openStream(), configXml.toURI());}} > This makes for easy deployment, and works nicely as long as classes and > resources are loaded from separate files, i.e. from > file:/some/path/config.xml URIs. However, it fails when classes and resources > are packaged and loaded directly from a jar, i.e. from > jar:file:/some/archive.jar!/path/config.xml URIs, as is the case when > deploying with JWS or running an all-in-one executable jar, as it will fail > to properly resolve the related font and hyphenation file URIs. > See [https://github.com/osandum/fop-test.git] for a test to illustrate. > This is a consequence of a long standing issue (reported in > [https://bugs.openjdk.java.net/browse/JDK-8020755)] that > URI.resolve(childUri) doesn't work as expected on jar:file: URIs. > In this case, it can be easily remedied by a work-around to the call in > InternalResourceResolver.resolveFromBase(URI uri). Patch attached. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Commented] (FOP-2861) Allow resource loading from jar: URI
[ https://issues.apache.org/jira/browse/FOP-2861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17496696#comment-17496696 ] Ole Sandum commented on FOP-2861: - The tests mentioned in the desciption reliably illustrates the issue being present in all versions including 2.6 and now 2.7 (as pulled from repo.maven.apache.org). To reproduce: {code:java} git clone g...@github.com:osandum/fop-test.git cd fop-test/ mvn clean install{code} Are we looking at different issues, Beat? > Allow resource loading from jar: URI > > > Key: FOP-2861 > URL: https://issues.apache.org/jira/browse/FOP-2861 > Project: FOP > Issue Type: Improvement >Affects Versions: 2.0, 2.1, 2.2, 2.3, 2.4, 2.6 >Reporter: Ole Sandum >Priority: Major > Attachments: FopResourceResolver.java, uri_resolve.diff, > uri_resolve_decoded.diff > > > We would like to load our FOP config.xml along with related fonts and > hyphenation files using the common classloader URL, e.g.: > {{ URL configXml = getClass().getResource("config.xml");}} > {{ FopConfParser confParser = }} > {{ new FopConfParser(configXml.openStream(), configXml.toURI());}} > This makes for easy deployment, and works nicely as long as classes and > resources are loaded from separate files, i.e. from > file:/some/path/config.xml URIs. However, it fails when classes and resources > are packaged and loaded directly from a jar, i.e. from > jar:file:/some/archive.jar!/path/config.xml URIs, as is the case when > deploying with JWS or running an all-in-one executable jar, as it will fail > to properly resolve the related font and hyphenation file URIs. > See [https://github.com/osandum/fop-test.git] for a test to illustrate. > This is a consequence of a long standing issue (reported in > [https://bugs.openjdk.java.net/browse/JDK-8020755)] that > URI.resolve(childUri) doesn't work as expected on jar:file: URIs. > In this case, it can be easily remedied by a work-around to the call in > InternalResourceResolver.resolveFromBase(URI uri). Patch attached. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Commented] (FOP-2861) Allow resource loading from jar: URI
[ https://issues.apache.org/jira/browse/FOP-2861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17311365#comment-17311365 ] Ole Sandum commented on FOP-2861: - FYI: the above patch is valid still on the 2.6 sources. {code:bash} cd fop-core curl https://issues.apache.org/jira/secure/attachment/12967117/uri_resolve.diff | patch -p0{code} Issue is resolved and no tests are broken. > Allow resource loading from jar: URI > > > Key: FOP-2861 > URL: https://issues.apache.org/jira/browse/FOP-2861 > Project: FOP > Issue Type: Improvement >Affects Versions: 2.0, 2.1, 2.2, 2.3, 2.4, 2.6 >Reporter: Ole Sandum >Priority: Major > Attachments: FopResourceResolver.java, uri_resolve.diff > > > We would like to load our FOP config.xml along with related fonts and > hyphenation files using the common classloader URL, e.g.: > {{ URL configXml = getClass().getResource("config.xml");}} > {{ FopConfParser confParser = }} > {{ new FopConfParser(configXml.openStream(), configXml.toURI());}} > This makes for easy deployment, and works nicely as long as classes and > resources are loaded from separate files, i.e. from > file:/some/path/config.xml URIs. However, it fails when classes and resources > are packaged and loaded directly from a jar, i.e. from > jar:file:/some/archive.jar!/path/config.xml URIs, as is the case when > deploying with JWS or running an all-in-one executable jar, as it will fail > to properly resolve the related font and hyphenation file URIs. > See [https://github.com/osandum/fop-test.git] for a test to illustrate. > This is a consequence of a long standing issue (reported in > [https://bugs.openjdk.java.net/browse/JDK-8020755)] that > URI.resolve(childUri) doesn't work as expected on jar:file: URIs. > In this case, it can be easily remedied by a work-around to the call in > InternalResourceResolver.resolveFromBase(URI uri). Patch attached. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Updated] (FOP-2861) Allow resource loading from jar: URI
[ https://issues.apache.org/jira/browse/FOP-2861?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Ole Sandum updated FOP-2861: Affects Version/s: 2.4 2.6 > Allow resource loading from jar: URI > > > Key: FOP-2861 > URL: https://issues.apache.org/jira/browse/FOP-2861 > Project: FOP > Issue Type: Improvement >Affects Versions: 2.0, 2.1, 2.2, 2.3, 2.4, 2.6 >Reporter: Ole Sandum >Priority: Major > Attachments: FopResourceResolver.java, uri_resolve.diff > > > We would like to load our FOP config.xml along with related fonts and > hyphenation files using the common classloader URL, e.g.: > {{ URL configXml = getClass().getResource("config.xml");}} > {{ FopConfParser confParser = }} > {{ new FopConfParser(configXml.openStream(), configXml.toURI());}} > This makes for easy deployment, and works nicely as long as classes and > resources are loaded from separate files, i.e. from > file:/some/path/config.xml URIs. However, it fails when classes and resources > are packaged and loaded directly from a jar, i.e. from > jar:file:/some/archive.jar!/path/config.xml URIs, as is the case when > deploying with JWS or running an all-in-one executable jar, as it will fail > to properly resolve the related font and hyphenation file URIs. > See [https://github.com/osandum/fop-test.git] for a test to illustrate. > This is a consequence of a long standing issue (reported in > [https://bugs.openjdk.java.net/browse/JDK-8020755)] that > URI.resolve(childUri) doesn't work as expected on jar:file: URIs. > In this case, it can be easily remedied by a work-around to the call in > InternalResourceResolver.resolveFromBase(URI uri). Patch attached. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Comment Edited] (FOP-2861) Allow resource loading from jar: URI
[ https://issues.apache.org/jira/browse/FOP-2861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16826940#comment-16826940 ] Ole Sandum edited comment on FOP-2861 at 4/26/19 1:04 PM: -- I don't think so. I tried passing in a custom ResourceResover to apply the work-around, but it doesn't make its' way into InternalResourceResolver, so this still happens: {{Caused by: java.lang.IllegalArgumentException: URI is not absolute}} {{ at java.net.URI.toURL(URI.java:1088)}} {{ at org.apache.fop.apps.io.ResourceResolverFactory$NormalResourceResolver.getResource(ResourceResolverFactory.java:224)}} {{ at org.apache.fop.apps.io.ResourceResolverFactory$TempAwareResourceResolver.getResource(ResourceResolverFactory.java:152)}} {{ at org.apache.fop.apps.io.ResourceResolverFactory$DefaultResourceResolver.getResource(ResourceResolverFactory.java:121)}} {{ at org.apache.fop.apps.io.InternalResourceResolver.getResource(InternalResourceResolver.java:92)}} {{ at org.apache.fop.fonts.truetype.OFFontLoader.read(OFFontLoader.java:111)}} The "URI is not absolute" is the result of the relative font path not being resolved correctly against the jar:file:... base URI as mentioned above. I have not been able to break into FopFactoryBuilder enough to inject a custom ResourceResolver here. was (Author: osandum): I don't think so. I tried passing in a custom ResourceResover to apply the work-around, but it doesn't make its' way into InternalResourceResolver, so this still happens: {{Caused by: java.lang.IllegalArgumentException: URI is not absolute}} {{ at java.net.URI.toURL(URI.java:1088)}} {{ at org.apache.fop.apps.io.ResourceResolverFactory$NormalResourceResolver.getResource(ResourceResolverFactory.java:224)}} {{ at org.apache.fop.apps.io.ResourceResolverFactory$TempAwareResourceResolver.getResource(ResourceResolverFactory.java:152)}} {{ at org.apache.fop.apps.io.ResourceResolverFactory$DefaultResourceResolver.getResource(ResourceResolverFactory.java:121)}} {{ at org.apache.fop.apps.io.InternalResourceResolver.getResource(InternalResourceResolver.java:92)}} {{ at org.apache.fop.fonts.truetype.OFFontLoader.read(OFFontLoader.java:111)}} I have not been able to break into FopFactoryBuilder enough to inject a custom ResourceResolver here. > Allow resource loading from jar: URI > > > Key: FOP-2861 > URL: https://issues.apache.org/jira/browse/FOP-2861 > Project: FOP > Issue Type: Improvement >Affects Versions: 2.0, 2.1, 2.2, 2.3 >Reporter: Ole Sandum >Priority: Major > Attachments: uri_resolve.diff > > > We would like to load our FOP config.xml along with related fonts and > hyphenation files using the common classloader URL, e.g.: > {{ URL configXml = getClass().getResource("config.xml");}} > {{ FopConfParser confParser = }} > {{ new FopConfParser(configXml.openStream(), configXml.toURI());}} > This makes for easy deployment, and works nicely as long as classes and > resources are loaded from separate files, i.e. from > file:/some/path/config.xml URIs. However, it fails when classes and resources > are packaged and loaded directly from a jar, i.e. from > jar:file:/some/archive.jar!/path/config.xml URIs, as is the case when > deploying with JWS or running an all-in-one executable jar, as it will fail > to properly resolve the related font and hyphenation file URIs. > See [https://github.com/osandum/fop-test.git] for a test to illustrate. > This is a consequence of a long standing issue (reported in > [https://bugs.openjdk.java.net/browse/JDK-8020755)] that > URI.resolve(childUri) doesn't work as expected on jar:file: URIs. > In this case, it can be easily remedied by a work-around to the call in > InternalResourceResolver.resolveFromBase(URI uri). Patch attached. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (FOP-2861) Allow resource loading from jar: URI
[ https://issues.apache.org/jira/browse/FOP-2861?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16826940#comment-16826940 ] Ole Sandum commented on FOP-2861: - I don't think so. I tried passing in a custom ResourceResover to apply the work-around, but it doesn't make its' way into InternalResourceResolver, so this still happens: {{Caused by: java.lang.IllegalArgumentException: URI is not absolute}} {{ at java.net.URI.toURL(URI.java:1088)}} {{ at org.apache.fop.apps.io.ResourceResolverFactory$NormalResourceResolver.getResource(ResourceResolverFactory.java:224)}} {{ at org.apache.fop.apps.io.ResourceResolverFactory$TempAwareResourceResolver.getResource(ResourceResolverFactory.java:152)}} {{ at org.apache.fop.apps.io.ResourceResolverFactory$DefaultResourceResolver.getResource(ResourceResolverFactory.java:121)}} {{ at org.apache.fop.apps.io.InternalResourceResolver.getResource(InternalResourceResolver.java:92)}} {{ at org.apache.fop.fonts.truetype.OFFontLoader.read(OFFontLoader.java:111)}} I have not been able to break into FopFactoryBuilder enough to inject a custom ResourceResolver here. > Allow resource loading from jar: URI > > > Key: FOP-2861 > URL: https://issues.apache.org/jira/browse/FOP-2861 > Project: FOP > Issue Type: Improvement >Affects Versions: 2.0, 2.1, 2.2, 2.3 >Reporter: Ole Sandum >Priority: Major > Attachments: uri_resolve.diff > > > We would like to load our FOP config.xml along with related fonts and > hyphenation files using the common classloader URL, e.g.: > {{ URL configXml = getClass().getResource("config.xml");}} > {{ FopConfParser confParser = }} > {{ new FopConfParser(configXml.openStream(), configXml.toURI());}} > This makes for easy deployment, and works nicely as long as classes and > resources are loaded from separate files, i.e. from > file:/some/path/config.xml URIs. However, it fails when classes and resources > are packaged and loaded directly from a jar, i.e. from > jar:file:/some/archive.jar!/path/config.xml URIs, as is the case when > deploying with JWS or running an all-in-one executable jar, as it will fail > to properly resolve the related font and hyphenation file URIs. > See [https://github.com/osandum/fop-test.git] for a test to illustrate. > This is a consequence of a long standing issue (reported in > [https://bugs.openjdk.java.net/browse/JDK-8020755)] that > URI.resolve(childUri) doesn't work as expected on jar:file: URIs. > In this case, it can be easily remedied by a work-around to the call in > InternalResourceResolver.resolveFromBase(URI uri). Patch attached. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Created] (FOP-2861) Allow resource loading from jar: URI
Ole Sandum created FOP-2861: --- Summary: Allow resource loading from jar: URI Key: FOP-2861 URL: https://issues.apache.org/jira/browse/FOP-2861 Project: FOP Issue Type: Improvement Affects Versions: 2.3, 2.2, 2.1, 2.0 Reporter: Ole Sandum Attachments: uri_resolve.diff We would like to load our FOP config.xml along with related fonts and hyphenation files using the common classloader URL, e.g.: {{ URL configXml = getClass().getResource("config.xml");}} {{ FopConfParser confParser = }} {{ new FopConfParser(configXml.openStream(), configXml.toURI());}} This makes for easy deployment, and works nicely as long as classes and resources are loaded from separate files, i.e. from file:/some/path/config.xml URIs. However, it fails when classes and resources are packaged and loaded directly from a jar, i.e. from jar:file:/some/archive.jar!/path/config.xml URIs, as is the case when deploying with JWS or running an all-in-one executable jar, as it will fail to properly resolve the related font and hyphenation file URIs. See [https://github.com/osandum/fop-test.git] for a test to illustrate. This is a consequence of a long standing issue (reported in [https://bugs.openjdk.java.net/browse/JDK-8020755)] that URI.resolve(childUri) doesn't work as expected on jar:file: URIs. In this case, it can be easily remedied by a work-around to the call in InternalResourceResolver.resolveFromBase(URI uri). Patch attached. -- This message was sent by Atlassian JIRA (v7.6.3#76005)