Relative path for layout-render tag's name attrib causes exception
------------------------------------------------------------------
Key: STS-640
URL: http://www.stripesframework.org/jira/browse/STS-640
Project: Stripes
Issue Type: Bug
Components: Tag Library
Affects Versions: Release 1.5
Environment: Stripes 1.5, JDK1.5.0_13, Tomcat 6.0, Eclipse 3.4.1
Reporter: Rudolf Ingerl
There seems to be a problem in the layout-render taglib wrt the use of relative
paths.
I have found 1 other JIRA issue about this, but I don't think it described the
issue properly. http://www.stripesframework.org/jira/browse/STS-591
Also see relating issue on Nabble:
http://www.nabble.com/Problem-with-NullPointerException-using-layouts-td20285899.html#a20285899
Scenario 1:
Example:
<stripes:layout-render name="../layout/defaultlayout.jsp">
...........
</stripes:layout-render>
Causes an exception:
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
at
net.sourceforge.stripes.tag.layout.LayoutDefinitionTag.doStartTag(LayoutDefinitionTag.java:72)
at
org.apache.jsp.WEB_002dINF.jsp.layout.defaultlayout_jsp._jspx_meth_stripes_005flayout_002ddefinition_005f0(defaultlayout_jsp.java:87)
at
org.apache.jsp.WEB_002dINF.jsp.layout.defaultlayout_jsp._jspService(defaultlayout_jsp.java:63)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
...........
06:57:30,625 WARN DefaultExceptionHandler:90 - Unhandled exception caught by
the Stripes default exception handler.
org.apache.jasper.JasperException: javax.servlet.ServletException:
net.sourceforge.stripes.exception.StripesJspException: An exception was raised
while invoking a layout. The layout used was '../layout/defaultlayout.jsp'. The
following information was supplied to the render tag: LayoutContext{component
names=[contents], parameters={}}
at
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
...........
Caused by: javax.servlet.ServletException:
net.sourceforge.stripes.exception.StripesJspException: An exception was raised
while invoking a layout. The layout used was '../layout/defaultlayout.jsp'. The
following information was supplied to the render tag: LayoutContext{component
names=[contents], parameters={}}
at
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
at
org.apache.jsp.WEB_002dINF.jsp.secure.home_jsp._jspService(home_jsp.java:71)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
... 69 more
Caused by: org.apache.jasper.JasperException: java.lang.NullPointerException
at
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
net.sourceforge.stripes.controller.DynamicMappingFilter.doFilter(DynamicMappingFilter.java:345)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:535)
at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:472)
at
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968)
at
org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:640)
at
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:634)
at
net.sourceforge.stripes.tag.layout.LayoutRenderTag.doEndTag(LayoutRenderTag.java:113)
at
org.apache.jsp.WEB_002dINF.jsp.secure.home_jsp._jspx_meth_stripes_005flayout_002drender_005f0(home_jsp.java:110)
at
org.apache.jsp.WEB_002dINF.jsp.secure.home_jsp._jspService(home_jsp.java:62)
... 72 more
Caused by: java.lang.NullPointerException
at
net.sourceforge.stripes.tag.layout.LayoutDefinitionTag.doStartTag(LayoutDefinitionTag.java:72)
at
org.apache.jsp.WEB_002dINF.jsp.layout.defaultlayout_jsp._jspx_meth_stripes_005flayout_002ddefinition_005f0(defaultlayout_jsp.java:87)
at
org.apache.jsp.WEB_002dINF.jsp.layout.defaultlayout_jsp._jspService(defaultlayout_jsp.java:63)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
... 89 more
This issue occurs if running via Eclipse or straight on Tomcat. Cleaning build
and Tomcat cache has no effect.
Scenario 2:
Changing overriding JSP to use absolute path:
<stripes:layout-render name="/WEB-INF/jsp/layout/defaultlayout.jsp">
...........
</stripes:layout-render>
Solves the problem.
Placing a breakpoint on net.sourceforge.stripes.tag.layout.LayoutDefinitionTag
(line 70 - Stripes 1.5), will show that once you step over 70 & 71, that the
stack variable is NULL in scenario 1, but is correctly created in scenario 2.
LayoutDefinitionTag:
69: // Fetch the layout context containing parameters and component
overrides
70: Stack<LayoutContext> stack = (Stack<LayoutContext>)
71: getPageContext().getRequest().getAttribute(PREFIX + name);
72 this.context = stack.peek();
Evaluating the expression (PREFIX + name) in scenario 1 gives you:
stripes.layout./WEB-INF/jsp/layout/defaultlayout.jsp
Evaluating the expression (PREFIX + name) in scenario 2 also gives you:
stripes.layout./WEB-INF/jsp/layout/defaultlayout.jsp
Quite strange. The problem must be deeper...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://www.stripesframework.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development