Hi all,

A recent attempt to upgrade some 3.1.2 Pro servers broke them due to 
some changes in the
"include" handling of JSP's. The attempt was made to use 3.1.5, which 
failed.

The simplest case of what we are doing:

--------------------------------------------------
index.jsp:
<%@ include file='/header.jsp' %>
  <table width='100%' cellPadding='0' cellSpacing='0' border='0'>
    <tr>
      <td class='maintableleft' background='images/left-back.jpg'>
<%@ include file='/left.jsp' %>
      </td>
...
    </tr>
  </table>
<%@ include file='/footer.jsp' %>

--------------------------------------------------
header.jsp:
<%@ page import="java.util.*,
                 java.text.*,
                 ...%><%
    if (session != null) {
        try {
            if (request.getParameter("logout").equals("true")) {
                DbAuthenticator auth = (DbAuthenticator) 
application.getAttribute("caucho.authenticator");
                if (auth != null) {
                    auth.logout(request, response, application, 
request.getUserPrincipal());
                }
                session.invalidate();
                response.sendRedirect("index.jsp");
            }
        } catch (Exception e) {
        }
    }
    PageManager pm = new PageManager(pageContext.getOut());
    
pm.setName(request.getRequestURL().toString().substring(request.getRequestURL().toString().lastIndexOf('/')
 
+ 1));
    DbAuthenticator auth = (DbAuthenticator) 
application.getAttribute("caucho.authenticator");
    java.security.Principal user = request.getUserPrincipal();
%><html>

--------------------------------------------------
left.jsp:
<table  border='0' cellPadding='0' cellSpacing='0' width='130'>
<tr>
 <td width='10'>&nbsp;</td>
 <td width='120'>
<%

    if (auth.isUserInRole(request, response, getServletContext(), user, 
"MANAGER")) {
        out.print("<tr><td><hr></td></tr>");
        pm.writeSideEntry("summary.jsp", "Summary");
        ...
        pm.writeSideEntry("prices.jsp", "Prices");
    }
%>

DbAuthenticator is a custom child of 
com.caucho.http.security.JdbcAuthenticator. Its working fine.
The problem is, in 3.1.5 or later a visit to index.jsp results in:

java.lang.NullPointerException
    at _jsp._index__jsp._jspService(left.jsp:100)
    at com.caucho.jsp.JavaPage.service(JavaPage.java:61)
    at com.caucho.jsp.Page.pageservice(Page.java:578)
    at 
com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:192)
    at 
com.caucho.server.cache.CacheFilterChain.doFilter(CacheFilterChain.java:187)
    at 
com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:181)
    at 
com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:266)
    at 
com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:269)
    at com.caucho.server.port.TcpConnection.run(TcpConnection.java:603)
    at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:721)
    at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:643)
    at java.lang.Thread.run(Thread.java:619)

left.jsp line 100 is
    if (auth.isUserInRole(request, response, getServletContext(), user, 
"MANAGER")) {
    
If I trace auth and user they are both null at that point.

So, is there something else I should be doing, or should have been doing 
all along (possibly
related to declaring session scope etc of the variables) or is this 
really a bug?


_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to