[
https://issues.apache.org/jira/browse/VELOCITY-590?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ales Dolecek updated VELOCITY-590:
----------------------------------
Description:
According to documentation of JarResourceLoader it accepts paths that conform
to rules given by java.net.JarUrlConnection. This is however not true as the
JarUrlConnection says that the URL has form
jar:<url>!/{entry}
The "!/" is mandatory part of the URL. JarResourceLoader however expects the
path whitout this suffix and automatically appends it. When conforming URL is
given JarResourceLoader makes it invalid
eg.
/directory/file.jar!/META-INF/templates/
is scrambled to
/directory/file.jar!/META-INF/templates/!/
which is invalid and no templates are found.
I try to package templates along with tools and other code. I put them into
/META-INF/templates/ and try to setup the loader so I do not have to prefix
template names with "/META-INF/templates/".
======
Ideally the JarResourceLoader should not append "!/" suffix at all. For
compatibility reasons it should do so only if the path does not contain it
already.
Simply change
if ( !path.endsWith("!/") )
{
path += "!/";
}
to
if ( !path.contains("!/") )
{
path += "!/";
}
was:
According to documentation of JarResourceLoader it accepts paths that conform
to rules given by java.net.JarUrlConnection. This is however not true as the
JarUrlConnection says that the URL has form
jar:<url>!/{entry}
The "!/" is mandatory part of the URL. JarResourceLoader however expects the
path whitout this suffix and automatically appends it. When conforming URL is
given JarResourceLoader makes it invalid
eg.
/directory/file.jar!/META-INF/templates/
is scrambled to
/directory/file.jar!/META-INF/templates/!/
which is invalid and no templates are found.
I try to package templates along with tools and other code. I put them into
/META-INF/templates/ and try to setup the loader so I do not have to prefix
template names with "/META-INF/templates/".
======
Ideally the JarResourceLoader should not append "!/" suffix at all. For
compatibility reasons it should do so only if the path does not contain it
already.
> JarResourceLoader does not accept paths inside JAR files
> --------------------------------------------------------
>
> Key: VELOCITY-590
> URL: https://issues.apache.org/jira/browse/VELOCITY-590
> Project: Velocity
> Issue Type: Bug
> Components: Engine
> Affects Versions: 1.5
> Reporter: Ales Dolecek
> Priority: Minor
>
> According to documentation of JarResourceLoader it accepts paths that conform
> to rules given by java.net.JarUrlConnection. This is however not true as the
> JarUrlConnection says that the URL has form
> jar:<url>!/{entry}
> The "!/" is mandatory part of the URL. JarResourceLoader however expects the
> path whitout this suffix and automatically appends it. When conforming URL is
> given JarResourceLoader makes it invalid
> eg.
> /directory/file.jar!/META-INF/templates/
> is scrambled to
> /directory/file.jar!/META-INF/templates/!/
> which is invalid and no templates are found.
> I try to package templates along with tools and other code. I put them into
> /META-INF/templates/ and try to setup the loader so I do not have to prefix
> template names with "/META-INF/templates/".
> ======
> Ideally the JarResourceLoader should not append "!/" suffix at all. For
> compatibility reasons it should do so only if the path does not contain it
> already.
> Simply change
> if ( !path.endsWith("!/") )
> {
> path += "!/";
> }
> to
> if ( !path.contains("!/") )
> {
> path += "!/";
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]