Bug in resolving locale
-----------------------

                 Key: TILES-254
                 URL: https://issues.apache.org/struts/browse/TILES-254
             Project: Tiles
          Issue Type: Bug
          Components: tiles-core
    Affects Versions: 2.0.5
         Environment: Any
            Reporter: Saminda Wishwajith Abeyruwan
            Priority: Critical


Hi Devs,

I'm using Tiles2 2.0.5  on top of an environment written in Embedded Tomcat 
5.5.15.

I've a layout exactly as the samples are showing and in my index.jsp, i did the 
following,

<%@ taglib uri="http://tiles.apache.org/tags-tiles"; prefix="tiles" %>

<tiles:insertDefinition name="main.layout" />

which leads to following exception.
==================================================
ERROR [2008-02-20 20:44:20,564]  Error executing tag: I/O error processing 
configuration.
org.apache.tiles.definition.DefinitionsFactoryException: I/O error processing 
configuration.
        at 
org.apache.tiles.definition.UrlDefinitionsFactory.addDefinitions(UrlDefinitionsFactory.java:256)
        at 
org.apache.tiles.definition.UrlDefinitionsFactory.getDefinition(UrlDefinitionsFactory.java:167)
        at 
org.apache.tiles.impl.BasicTilesContainer.getDefinition(BasicTilesContainer.java:513)
        at 
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:387)
        at 
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:370)
        at 
org.apache.tiles.jsp.taglib.InsertDefinitionTag.render(InsertDefinitionTag.java:63)
        at 
org.apache.tiles.jsp.taglib.RenderTagSupport.execute(RenderTagSupport.java:171)
        at 
org.apache.tiles.jsp.taglib.RoleSecurityTagSupport.doEndTag(RoleSecurityTagSupport.java:75)
        at 
org.apache.tiles.jsp.taglib.ContainerTagSupport.doEndTag(ContainerTagSupport.java:80)
        at 
org.apache.jsp.main_jsp._jspx_meth_tiles_insertDefinition_0(org.apache.jsp.main_jsp:82)
        at org.apache.jsp.main_jsp._jspService(org.apache.jsp.main_jsp:53)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
        at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
===========================================

When  I debug the code, following problems are found in 
org.apache.tiles.definition.UrlDefinitionsFactory

[1]. Go to line 165, if (!isContextProcessed(tilesContext)) {...

      This line check if the locales are  resolved.  At the initial loading 
locales are not processed.

[2]. Thus, this will execute the line 167, addDefinitions(definitions, 
tilesContext), where the top part will add the locale to  processedLocales List.

[3]. After that it will load the "sources". Each will create an URL newUrl = 
new URL(newPath); and loads.  This sources are simply tiles_defs.xml s that 
I've listed in the web.xml. 

[4]. When I debug more I found out that "newPath" contains a URL as for 
example, "jndi:/localhost/WEB-INF/tiles_defs.xml". When protocols like jndi is 
used, URL object should be given with a URLStreamHandler. This caused the above 
exception.

So the above "jndi" cause the problem.  At the moment I've written a 
URLStreamHandler and tweak the 2.0.5 code to fix the bug.

I would love to send a patch for this.  But due to my lack of experience with 
Tiles 2 code, my tweak wouldn't be the optimum solution. Shall I create a JIRA 
for this issue.

Thank you

Saminda

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to