[
https://issues.apache.org/jira/browse/WW-4335?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Lukasz Lenart updated WW-4335:
------------------------------
Description:
When I create a theme named "foo/bar" which extends the default theme "simple"
and use the theme in a JSP file, an error saying "Error reading included file
template/~~~foo/bar/css.ftl" occurs and the web page cannot be rendered.
How to reproduce:
1. Create a theme folder "/themes/foo/bar" in a resource folder.
The point is there are more than two folders nested under /themes.
2. Create a property file theme.properties in "/themes/foo/bar", whose content
is like below.
parent = simple
3. In struts.xml, set constant "struts.ui.theme" as "foo/bar".
4. Access to any pages in the web application which contains a <s:textfield>
tag.
It worked with Struts 2.3.15.3, but no longer works with Struts 2.3.16.
New tag templates in Struts 2.3.16 contains codes like
{{/$\{parameters.templateDir\}/$\{parameters.expandTheme\}/css.ftl}}.
If the name of the theme is "foo/bar", this code is translated into
{{template/~~~foo/bar/css.ftl}}.
The translated string is passed to method
{{org.apache.struts2.views.freemarker.FreemarkerThemeTemplateLoader#findTemplateSource(String)}}
But this method cannot handle a theme name containing a slash like "foo/bar".
I am not sure whether such a theme is permitted or not by the Struts 2
specification, so I reported it as a bug.
A workaround is not to create such a theme when creating a new web application,
but if an existing one already uses a theme like this, it will be affected.
Another workaround is to replace the original FreemarkerThemeTemplateLoader
with a fixed one, but it is a little bit too complicated.
was:
When I create a theme named "foo/bar" which extends the default theme "simple"
and use the theme in a JSP file, an error saying "Error reading included file
template/~~~foo/bar/css.ftl" occurs and the web page cannot be rendered.
How to reproduce:
1. Create a theme folder "/themes/foo/bar" in a resource folder.
The point is there are more than two folders nested under /themes.
2. Create a property file theme.properties in "/themes/foo/bar", whose content
is like below.
parent = simple
3. In struts.xml, set constant "struts.ui.theme" as "foo/bar".
4. Access to any pages in the web application which contains a <s:textfield>
tag.
It worked with Struts 2.3.15.3, but no longer works with Struts 2.3.16.
New tag templates in Struts 2.3.16 contains codes like
"/${parameters.templateDir}/${parameters.expandTheme}/css.ftl".
If the name of the theme is "foo/bar", this code is translated into
"template/~~~foo/bar/css.ftl".
The translated string is passed to method
org.apache.struts2.views.freemarker.FreemarkerThemeTemplateLoader#findTemplateSource(String).
But this method cannot handle a theme name containing a slash like "foo/bar".
I am not sure whether such a theme is permitted or not by the Struts 2
specification, so I reported it as a bug.
A workaround is not to create such a theme when creating a new web application,
but if an existing one already uses a theme like this, it will be affected.
Another workaround is to replace the original FreemarkerThemeTemplateLoader
with a fixed one, but it is a little bit too complicated.
> Error while extending a theme if located in a deep hierarchy
> ------------------------------------------------------------
>
> Key: WW-4335
> URL: https://issues.apache.org/jira/browse/WW-4335
> Project: Struts 2
> Issue Type: Bug
> Components: Core Actions
> Affects Versions: 2.3.16, 2.3.16.1, 2.3.16.2
> Environment: Windows Vista, Java 7, Tomcat 7
> Reporter: recyclebin5385
> Priority: Minor
> Fix For: 2.3.18
>
>
> When I create a theme named "foo/bar" which extends the default theme
> "simple" and use the theme in a JSP file, an error saying "Error reading
> included file template/~~~foo/bar/css.ftl" occurs and the web page cannot be
> rendered.
> How to reproduce:
> 1. Create a theme folder "/themes/foo/bar" in a resource folder.
> The point is there are more than two folders nested under /themes.
> 2. Create a property file theme.properties in "/themes/foo/bar", whose
> content is like below.
> parent = simple
> 3. In struts.xml, set constant "struts.ui.theme" as "foo/bar".
> 4. Access to any pages in the web application which contains a <s:textfield>
> tag.
> It worked with Struts 2.3.15.3, but no longer works with Struts 2.3.16.
> New tag templates in Struts 2.3.16 contains codes like
> {{/$\{parameters.templateDir\}/$\{parameters.expandTheme\}/css.ftl}}.
> If the name of the theme is "foo/bar", this code is translated into
> {{template/~~~foo/bar/css.ftl}}.
> The translated string is passed to method
> {{org.apache.struts2.views.freemarker.FreemarkerThemeTemplateLoader#findTemplateSource(String)}}
> But this method cannot handle a theme name containing a slash like "foo/bar".
> I am not sure whether such a theme is permitted or not by the Struts 2
> specification, so I reported it as a bug.
> A workaround is not to create such a theme when creating a new web
> application, but if an existing one already uses a theme like this, it will
> be affected.
> Another workaround is to replace the original FreemarkerThemeTemplateLoader
> with a fixed one, but it is a little bit too complicated.
--
This message was sent by Atlassian JIRA
(v6.2#6252)