Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.5.2
-
None
-
Microsoft Windows 7
Oracle JDK 1.8.0_101
Apache Tomcat 8.0.20
Description
We recently upgraded to struts 2.5.2. Now we have the problem that tiles is trying to load any tiles*.xml resource on the classpath for definitions, which is actually great.
The problem occurs when the absolute path to the definitions contains spaces. For example C:/Program Files/.../webapps/context/WEB-INF/classes/tiles.xml.
This causes:
java.net.URISyntaxException: Illegal character in path at index 18: file:///C:/Program Files/.../webapps/context/WEB-INF/classes/tiles.xml at java.net.URI$Parser.fail(URI.java:2848) at java.net.URI$Parser.checkChars(URI.java:3021) at java.net.URI$Parser.parseHierarchical(URI.java:3105) at java.net.URI$Parser.parse(URI.java:3053) at java.net.URI.<init>(URI.java:588) at java.net.URI.create(URI.java:850) ... 84 more
This exception is thrown at
at java.net.URI.create(URI.java:852) at org.apache.struts2.tiles.StrutsWildcardServletApplicationContext.getResource(StrutsWildcardServletApplicationContext.java:105) at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadRawDefinitionsFromResources(CachingLocaleUrlDefinitionDAO.java:232) at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadRawDefinitionsFromResources(CachingLocaleUrlDefinitionDAO.java:225) at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadRawDefinitionsFromResources(CachingLocaleUrlDefinitionDAO.java:225) at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadDefinitionsFromResources(CachingLocaleUrlDefinitionDAO.java:203) at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadDefinitions(CachingLocaleUrlDefinitionDAO.java:192) at org.apache.tiles.definition.dao.ResolvingLocaleUrlDefinitionDAO.loadDefinitions(ResolvingLocaleUrlDefinitionDAO.java:68) at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.checkAndloadDefinitions(CachingLocaleUrlDefinitionDAO.java:174) at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinitions(CachingLocaleUrlDefinitionDAO.java:131) at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinition(CachingLocaleUrlDefinitionDAO.java:105) at org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinition(CachingLocaleUrlDefinitionDAO.java:49) at org.apache.tiles.definition.UnresolvingLocaleDefinitionsFactory.getDefinition(UnresolvingLocaleDefinitionsFactory.java:89) at org.apache.tiles.impl.BasicTilesContainer.getDefinition(BasicTilesContainer.java:286) at org.apache.tiles.impl.BasicTilesContainer.isValidDefinition(BasicTilesContainer.java:273) at org.apache.tiles.TilesContainerWrapper.isValidDefinition(TilesContainerWrapper.java:88) at org.apache.tiles.impl.mgmt.CachingTilesContainer.isValidDefinition(CachingTilesContainer.java:100) at org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:139) at org.apache.struts2.result.StrutsResultSupport.execute(StrutsResultSupport.java:208) at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:366) at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:270)
Looks like the spaces should be escaped with %20 maybe.