pierred     00/12/21 15:25:28

  Modified:    src/share/org/apache/jasper/compiler Tag: tomcat_32
                        JspParseEventListener.java
  Log:
  Check for null value before invoking method.
  
  From email sent by Brian Bucknam:
  
  It's a long story, but I'm working on a project where Jasper 3.x is embedded
  inside a servlet, which can then be deployed to the container of our
  customer's choice.  The servlet uses JSP files as templates, which is where
  Jasper comes in.
  
  In this type of environment, sometimes thing can go really wrong, and the
  compiled JSP might, in some cases, fail to get a JspFactory, PageContext, or
  JspWriter.
  
  If any of _jspxFactory, pageContext, or out fail to be created, the catch{}
  and finally{} clauses just throw NPE's.
  
  Submitted by:  "Bucknam, Brian" <[EMAIL PROTECTED]>
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.17.2.2  +7 -7      
jakarta-tomcat/src/share/org/apache/jasper/compiler/JspParseEventListener.java
  
  Index: JspParseEventListener.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspParseEventListener.java,v
  retrieving revision 1.17.2.1
  retrieving revision 1.17.2.2
  diff -u -r1.17.2.1 -r1.17.2.2
  --- JspParseEventListener.java        2000/07/03 09:43:21     1.17.2.1
  +++ JspParseEventListener.java        2000/12/21 23:25:27     1.17.2.2
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspParseEventListener.java,v
 1.17.2.1 2000/07/03 09:43:21 bergsten Exp $
  - * $Revision: 1.17.2.1 $
  - * $Date: 2000/07/03 09:43:21 $
  + * $Header: 
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/compiler/JspParseEventListener.java,v
 1.17.2.2 2000/12/21 23:25:27 pierred Exp $
  + * $Revision: 1.17.2.2 $
  + * $Date: 2000/12/21 23:25:27 $
    *
    * ====================================================================
    *
  @@ -348,18 +348,18 @@
        //writer.println("} catch (Throwable t) {");
        writer.println("} catch (Exception ex) {");
        writer.pushIndent();
  -        writer.println("if (out.getBufferSize() != 0)");
  +        writer.println("if (out != null && out.getBufferSize() != 0)");
           writer.pushIndent();
        writer.println("out.clearBuffer();");
        writer.popIndent();
  -     writer.println("pageContext.handlePageException(ex);");
  +     writer.println("if (pageContext != null) 
pageContext.handlePageException(ex);");
        writer.popIndent();
        writer.println("} finally {");
        writer.pushIndent();
        /* Do stuff here for finally actions... */
           //writer.println("out.close();");
  -     writer.println("out.flush();");
  -     writer.println("_jspxFactory.releasePageContext(pageContext);");
  +     writer.println("if (out != null) out.flush();");
  +     writer.println("if (_jspxFactory != null) 
_jspxFactory.releasePageContext(pageContext);");
        writer.popIndent();
        writer.println("}");
        // Close the service method:
  
  
  

Reply via email to