[ 
http://issues.apache.org/jira/browse/BEEHIVE-1007?page=comments#action_12357797 
] 

Rich Feit commented on BEEHIVE-1007:
------------------------------------

Alex, the easiest way to repro this is to run a JSP that contains something 
like the following code:

     <% if (true) throw new InstantiationException("got it!"); %>

When the error page occurs, you should see a stacktrace that includes a 
ServletException *and* the "root cause", which is the InstantiationException.  
Something like this:

xception

javax.servlet.ServletException: got it!
        
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
        
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
        org.apache.jsp.baz.index_jsp._jspService(index_jsp.java:56)
        org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        
org.apache.beehive.netui.pageflow.PageFlowPageFilter.continueChainNoWrapper(PageFlowPageFilter.java:357)
        
org.apache.beehive.netui.pageflow.PageFlowPageFilter.runPage(PageFlowPageFilter.java:342)
        
org.apache.beehive.netui.pageflow.PageFlowPageFilter.doFilter(PageFlowPageFilter.java:215)

root cause

java.lang.InstantiationException: got it!
        org.apache.jsp.baz.index_jsp._jspService(index_jsp.java:46)
        org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        
org.apache.beehive.netui.pageflow.PageFlowPageFilter.continueChainNoWrapper(PageFlowPageFilter.java:357)
        
org.apache.beehive.netui.pageflow.PageFlowPageFilter.runPage(PageFlowPageFilter.java:342)
        
org.apache.beehive.netui.pageflow.PageFlowPageFilter.doFilter(PageFlowPageFilter.java:215)


> Propage exception causes while throwing ServletException
> --------------------------------------------------------
>
>          Key: BEEHIVE-1007
>          URL: http://issues.apache.org/jira/browse/BEEHIVE-1007
>      Project: Beehive
>         Type: Bug
>   Components: NetUI
>     Reporter: Subbu Allamaraju
>     Assignee: Alejandro Ramirez

>
> I have come across a usage of ServletException that drops out the original 
> cause of the exception. 
> PageFlowPageFilter.runPage methods has code snippet that looks like
> catch(Something s) {
>     throw new ServletException(s);
> }
> Since ServletException is pre-J2SE1.4, its constructor does not call 
> super(cause), thereby losing exception chaining.  For all pre-J2SE1.4 
> exception classes in J2EE, we need to initialize the cause explicitly via 
> initCause().
> To get exception chaining correctly, this code should be changed to
> catch(Something s) {
>     ServletException se = new ServletException(s);
>     s.initCause(s);
>     throw se;
> }
> I'm not sure if there are other places in netui throwing similar exceptions. 
> It would be good do a grep on the source.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to