tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu...@apache.org
Subject cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Generator.java
Date Fri, 01 Nov 2002 02:09:15 GMT
luehe       2002/10/31 18:09:15

  Modified:    jasper2/src/share/org/apache/jasper/compiler Generator.java
  Log:
  - All variable synchronization and restoration that
    occurs at the end of a tag file must occur regardless of whether
    an exception is thrown inside the tag file.
  
  - All variable synchronization that occurs after the invocation
    of a fragment must occur regardless of whether an exception
    occured while invoking the fragment.
  
  Revision  Changes    Path
  1.115     +30 -17    jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java
  
  Index: Generator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v
  retrieving revision 1.114
  retrieving revision 1.115
  diff -u -r1.114 -r1.115
  --- Generator.java	31 Oct 2002 02:11:40 -0000	1.114
  +++ Generator.java	1 Nov 2002 02:09:15 -0000	1.115
  @@ -1831,17 +1831,22 @@
   	    String varAttr = n.getTextAttribute("var");
   	    if (varReaderAttr != null || varAttr != null) {
   		out.printil("_jspx_sout = new java.io.StringWriter();");
  -		out.printin(toGetterMethod(n.getTextAttribute("fragment")));
  -		out.println(".invoke(_jspx_sout);");
   	    } else {
  -		out.printin(toGetterMethod(n.getTextAttribute("fragment")));
  -		out.println(".invoke(null);");
  +		out.printil("_jspx_sout = null;");
   	    }
  -
  +	    out.printil("try {");
  +	    out.pushIndent();
  +	    out.printin(toGetterMethod(n.getTextAttribute("fragment")));
  +	    out.println(".invoke(_jspx_sout);");
  +	    out.popIndent();
  +	    out.printil( "} finally {" );
  +	    out.pushIndent();
   	    // Copy page scope of invoking page back to virtual page scope of
   	    // tag file
   	    out.printil("((org.apache.jasper.runtime.JspContextWrapper) jspContext).copyPageToTagScope(javax.servlet.jsp.tagext.VariableInfo.NESTED);");
   	    out.printil("((org.apache.jasper.runtime.JspContextWrapper) jspContext).copyPageToTagScope(javax.servlet.jsp.tagext.VariableInfo.AT_BEGIN);");
  +	    out.popIndent();
  +	    out.printil("}");
   
   	    // Store varReader in appropriate scope
   	    if (varReaderAttr != null || varAttr != null) {
  @@ -1874,15 +1879,21 @@
   	    String varAttr = n.getTextAttribute("var");
   	    if (varReaderAttr != null || varAttr != null) {
   		out.printil("_jspx_sout = new java.io.StringWriter();");
  -		out.printil("getJspBody().invoke(_jspx_sout);");
   	    } else {
  -		out.printil("getJspBody().invoke(null);");
  +		out.printil("_jspx_sout = null;");
   	    }
  -
  +	    out.printil("try {");
  +	    out.pushIndent();
  +	    out.printil("getJspBody().invoke(_jspx_sout);");
  +	    out.popIndent();
  +	    out.printil( "} finally {" );
  +	    out.pushIndent();
   	    // Copy page scope of invoking page back to virtual page scope of
   	    // tag file
   	    out.printil("((org.apache.jasper.runtime.JspContextWrapper) jspContext).copyPageToTagScope(javax.servlet.jsp.tagext.VariableInfo.NESTED);");
   	    out.printil("((org.apache.jasper.runtime.JspContextWrapper) jspContext).copyPageToTagScope(javax.servlet.jsp.tagext.VariableInfo.AT_BEGIN);");
  +	    out.popIndent();
  +	    out.printil("}");
   
   	    // Store varReader in appropriate scope
   	    if (varReaderAttr != null || varAttr != null) {
  @@ -2941,11 +2952,7 @@
   	out.pushIndent();
       }
   
  -    private void generateTagHandlerPostamble( TagInfo tagInfo ) {
  -	out.printil("((org.apache.jasper.runtime.JspContextWrapper) jspContext).copyTagToPageScope(javax.servlet.jsp.tagext.VariableInfo.AT_BEGIN);");
  -	out.printil("((org.apache.jasper.runtime.JspContextWrapper) jspContext).copyTagToPageScope(javax.servlet.jsp.tagext.VariableInfo.AT_END);");
  -	out.printil("((org.apache.jasper.runtime.JspContextWrapper) jspContext).restoreNestedVariables();");
  -        
  +    private void generateTagHandlerPostamble( TagInfo tagInfo ) {        
           out.popIndent();
           
           // Have to catch Throwable because a classic tag handler
  @@ -2960,8 +2967,14 @@
           out.printil( "    throw (javax.servlet.jsp.JspException) t;" );
           out.printil("throw new javax.servlet.jsp.JspException(t);" );
           out.popIndent();
  +        out.printil( "} finally {" );
  +        out.pushIndent();
  +	out.printil("((org.apache.jasper.runtime.JspContextWrapper) jspContext).copyTagToPageScope(javax.servlet.jsp.tagext.VariableInfo.AT_BEGIN);");
  +	out.printil("((org.apache.jasper.runtime.JspContextWrapper) jspContext).copyTagToPageScope(javax.servlet.jsp.tagext.VariableInfo.AT_END);");
  +	out.printil("((org.apache.jasper.runtime.JspContextWrapper) jspContext).restoreNestedVariables();");
  +        out.popIndent();
           out.printil( "}" );
  -        
  +
           // Close the doTag method
           out.popIndent();
           out.printil("}");
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message