tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike" <Krautheim.Mih...@wanari.com>
Subject Jasper compiler BUG ???
Date Fri, 28 Sep 2001 15:53:32 GMT
Hello..

I have found a strange compiler behavior when I moved my project from
Servletexec engine to Jakarta-Tomcat-4.0, and I think it could be a BUG.

Here is my simplifed JSP source code:

<%session.invalidate();%>
<jsp:useBean id="oHashtable" class="java.util.Hashtable" scope="session"/>

The problem around the generated java code. Here is the Jasper generated
code:

                session.invalidate();
                java.util.Hashtable oHashtable = null;
                boolean _jspx_specialoHashtable  = false;
                 synchronized (session) {
                    oHashtable= (java.util.Hashtable)

pageContext.getAttribute("oHashtable",PageContext.SESSION_SCOPE);
                    if ( oHashtable == null ) {
                        _jspx_specialoHashtable = true;
                        try {
                            oHashtable = (java.util.Hashtable)
Beans.instantiate(this.getClass().getClassLoader(), "java.util.Hashtable");
                        } catch (Exception exc) {
                             throw new ServletException (" Cannot create
bean of class "+"java.util.Hashtable");
                        }
                        pageContext.setAttribute("oHashtable", oHashtable,
PageContext.SESSION_SCOPE);
                    }
                 }
                if(_jspx_specialoHashtable == true) {
                }

And here is the Servletexec generated code:

        session.invalidate();
        java.util.Hashtable oHashtable =
(java.util.Hashtable)session.getAttribute( "oHashtable" );
        if ( oHashtable == null )
        {
            synchronized ( session )
            {
                oHashtable =
java.util.Hashtable)session.getAttribute( "oHashtable " );
                if ( oHashtable == null )
                {
                    oHashtable = (java.util.Hashtable)new
java.util.Hashtable();
                    session.setAttribute( "oHashtable ", oHashtable );
                }
            }
        }

Oke, you can spot the difference. Check the getAttribute and setAttribute
functions.The Jasper version works with the pageContext object and the
Servletexec works with the session object, which one is the correct
implementation ???

The real problem is, the Jasper version throws an Exception on getAttribute
method, and with other engines (JRUN, Servletexec, Jaguar) it works
perfectly.

Any suggestion ??

Mike

Krautheim Mihály, Wanari Ltd.
www.wanari.com







Mime
View raw message