Author: markt Date: Tue Oct 26 16:07:03 2010 New Revision: 1027615 URL: http://svn.apache.org/viewvc?rev=1027615&view=rev Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49935 Handle compilation of recursive tag files
Modified: tomcat/tc5.5.x/trunk/STATUS.txt tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml tomcat/tc5.5.x/trunk/jasper/src/share/org/apache/jasper/compiler/Compiler.java Modified: tomcat/tc5.5.x/trunk/STATUS.txt URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/STATUS.txt?rev=1027615&r1=1027614&r2=1027615&view=diff ============================================================================== --- tomcat/tc5.5.x/trunk/STATUS.txt (original) +++ tomcat/tc5.5.x/trunk/STATUS.txt Tue Oct 26 16:07:03 2010 @@ -70,12 +70,6 @@ PATCHES PROPOSED TO BACKPORT: , but moving to 6.0 is a decent soln. Probably not worth changing this late in the evolution of 5.5. -* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49935 - Handle compilation of recursive tag files. Port fix from tc6. - http://people.apache.org/~markt/patches/2010-09-27-bug49935-tc5.patch - +1: markt, kkolinko, timw - -1: - * Improve sending an access message in DeltaManager. maxInactiveInterval of not Manager but the session is used. If maxInactiveInterval is negative, an access message is not sending. Modified: tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml?rev=1027615&r1=1027614&r2=1027615&view=diff ============================================================================== --- tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml (original) +++ tomcat/tc5.5.x/trunk/container/webapps/docs/changelog.xml Tue Oct 26 16:07:03 2010 @@ -54,6 +54,13 @@ </fix> </changelog> </subsection> + <subsection name="Jasper"> + <changelog> + <fix> + <bug>49935</bug>: Handle compilation of recursive tag files. (markt) + </fix> + </changelog> + </subsection> </section> <section name="Tomcat 5.5.31 (jim)" rtext="released 2010-09-16"> <subsection name="General"> Modified: tomcat/tc5.5.x/trunk/jasper/src/share/org/apache/jasper/compiler/Compiler.java URL: http://svn.apache.org/viewvc/tomcat/tc5.5.x/trunk/jasper/src/share/org/apache/jasper/compiler/Compiler.java?rev=1027615&r1=1027614&r2=1027615&view=diff ============================================================================== --- tomcat/tc5.5.x/trunk/jasper/src/share/org/apache/jasper/compiler/Compiler.java (original) +++ tomcat/tc5.5.x/trunk/jasper/src/share/org/apache/jasper/compiler/Compiler.java Tue Oct 26 16:07:03 2010 @@ -133,21 +133,6 @@ public abstract class Compiler { ServletWriter writer = null; try { - // Setup the ServletWriter - String javaEncoding = ctxt.getOptions().getJavaEncoding(); - OutputStreamWriter osw = null; - - try { - osw = new OutputStreamWriter( - new FileOutputStream(javaFileName), javaEncoding); - } catch (UnsupportedEncodingException ex) { - errDispatcher.jspError("jsp.error.needAlternateJavaEncoding", - javaEncoding); - } - - writer = new ServletWriter(new PrintWriter(osw)); - ctxt.setWriter(writer); - // Reset the temporary variable counter for the generator. JspUtil.resetTemporaryVariableName(); @@ -177,6 +162,7 @@ public abstract class Compiler { if (ctxt.isPrototypeMode()) { // generate prototype .java file for the tag file + writer = setupContextWriter(javaFileName); Generator.generate(writer, this, pageNodes); writer.close(); writer = null; @@ -217,6 +203,7 @@ public abstract class Compiler { ELFunctionMapper.map(this, pageNodes); // generate servlet .java file + writer = setupContextWriter(javaFileName); Generator.generate(writer, this, pageNodes); writer.close(); writer = null; @@ -270,6 +257,28 @@ public abstract class Compiler { return smapStr; } + + private ServletWriter setupContextWriter(String javaFileName) + throws FileNotFoundException, JasperException { + ServletWriter writer; + // Setup the ServletWriter + String javaEncoding = ctxt.getOptions().getJavaEncoding(); + OutputStreamWriter osw = null; + + try { + osw = new OutputStreamWriter( + new FileOutputStream(javaFileName), javaEncoding); + } catch (UnsupportedEncodingException ex) { + errDispatcher.jspError("jsp.error.needAlternateJavaEncoding", + javaEncoding); + } + + writer = new ServletWriter(new PrintWriter(osw)); + ctxt.setWriter(writer); + return writer; + } + + /** * Compile the servlet from .java file to .class file */ @@ -328,7 +337,7 @@ public abstract class Compiler { } } } finally { - if (tfp != null) { + if (tfp != null && ctxt.isPrototypeMode()) { tfp.removeProtoTypeFiles(null); } // Make sure these object which are only used during the --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org