cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
markt 2005/01/22 09:38:12 Modified:jasper2/src/share/org/apache/jasper/compiler Tag: tomcat_4_branch Compiler.java Log: Fix bug 27806. JspC creates blank files on failure and when cause of error is fixed does not always re-attempt .java generation. - Fixed by porting fix for 28603 from TC5 Revision ChangesPath No revision No revision 1.18.2.21 +61 -36 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.18.2.20 retrieving revision 1.18.2.21 diff -u -r1.18.2.20 -r1.18.2.21 --- Compiler.java 12 Sep 2004 20:43:48 - 1.18.2.20 +++ Compiler.java 22 Jan 2005 17:38:12 - 1.18.2.21 @@ -163,44 +163,69 @@ pageInfo = new PageInfo(new BeanRepository(ctxt.getClassLoader())); String javaFileName = ctxt.getServletJavaFileName(); - -// Setup the ServletWriter -String javaEncoding = ctxt.getOptions().getJavaEncoding(); - -OutputStreamWriter osw = null; +ServletWriter writer = null; + try { -osw = new OutputStreamWriter(new FileOutputStream(javaFileName), - javaEncoding); -} catch (UnsupportedEncodingException ex) { -errDispatcher.jspError(jsp.error.needAlternateJavaEncoding, javaEncoding); -} +// Setup the ServletWriter +String javaEncoding = ctxt.getOptions().getJavaEncoding(); -ServletWriter writer = new ServletWriter(new PrintWriter(osw)); -ctxt.setWriter(writer); - -// Parse the file -ParserController parserCtl = new ParserController(ctxt, this); -pageNodes = parserCtl.parse(ctxt.getJspFile()); - -// Validate and process attributes -Validator.validate(this, pageNodes); - -// Dump out the page (for debugging) -// Dumper.dump(pageNodes); - -// Collect page info -Collector.collect(this, pageNodes); - -// Determine which custom tag needs to declare which scripting vars -ScriptingVariabler.set(pageNodes); - -// generate servlet .java file -Generator.generate(writer, this, pageNodes); -writer.close(); -// The writer is only used during the compile, dereference -// it in the JspCompilationContext when done to allow it -// to be GC'd and save memory. -ctxt.setWriter(null); +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); + +// Parse the file +ParserController parserCtl = new ParserController(ctxt, this); +pageNodes = parserCtl.parse(ctxt.getJspFile()); + +// Validate and process attributes +Validator.validate(this, pageNodes); + +// Dump out the page (for debugging) +// Dumper.dump(pageNodes); + +// Collect page info +Collector.collect(this, pageNodes); + +// Determine which custom tag needs to declare which scripting vars +ScriptingVariabler.set(pageNodes); + +// generate servlet .java file +Generator.generate(writer, this, pageNodes); +writer.close(); +writer = null; + +// The writer is only used during the compile, dereference +// it in the JspCompilationContext when done to allow it +// to be GC'd and save memory. +ctxt.setWriter(null); +} catch (Exception e) { +if (writer != null) { +try { +writer.close(); +writer = null; +} catch (Exception e1) { +// Do nothing +} +} +// Remove the generated .java file +new File(javaFileName).delete(); +throw e; +} finally { +if (writer != null) { +try { +writer.close(); +} catch (Exception e2) { +// Do nothing +} +} +} }
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
yoavs 2004/10/22 09:51:23 Modified:webapps/docs Tag: TOMCAT_5_0 changelog.xml jasper-howto.xml jasper2/src/share/org/apache/jasper Tag: TOMCAT_5_0 EmbeddedServletOptions.java JspC.java Options.java jasper2/src/share/org/apache/jasper/compiler Tag: TOMCAT_5_0 Compiler.java Log: Committed patches from Jess Holle to add a compilerTargetVM option to Jasper, JspC, and make its default 1.3 to match the default 1.3 compilerSourceVM setting. Revision ChangesPath No revision No revision 1.70.2.54 +6 -0 jakarta-tomcat-catalina/webapps/docs/changelog.xml Index: changelog.xml === RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/changelog.xml,v retrieving revision 1.70.2.53 retrieving revision 1.70.2.54 diff -u -r1.70.2.53 -r1.70.2.54 --- changelog.xml 14 Oct 2004 17:33:30 - 1.70.2.53 +++ changelog.xml 22 Oct 2004 16:51:22 - 1.70.2.54 @@ -38,6 +38,12 @@ subsection name=Jasper changelog + fix +Fixed default compiler target VM setting (to 1.3) so that compilation on J2SE 5.0 works out of the box. (yoavs) + /fix + update +Exposed compilerSourceVM and compilerTargetVM options to JspC. (yoavs) + /update /changelog /subsection 1.13.2.1 +4 -0 jakarta-tomcat-catalina/webapps/docs/jasper-howto.xml Index: jasper-howto.xml === RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/jasper-howto.xml,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -u -r1.13 -r1.13.2.1 --- jasper-howto.xml 17 Mar 2004 00:09:22 - 1.13 +++ jasper-howto.xml 22 Oct 2004 16:51:22 - 1.13.2.1 @@ -85,6 +85,10 @@ generated servlets? By default the classpath is created dynamically based on the current web application./li +listrongcompilerSourceVM/strong - What JDK version is the source compatible with. By default this is 1.3./li + +listrongcompilerTargetVM/strong - What JDK version should the generated files be compatible with. By default this is also 1.3./li + listrongdevelopment/strong - Is Jasper used in development mode (will check for JSP modification on every access)? codetrue/code or codefalse/code, default codetrue/code./li No revision No revision 1.10.2.3 +17 -0 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbeddedServletOptions.java Index: EmbeddedServletOptions.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbeddedServletOptions.java,v retrieving revision 1.10.2.2 retrieving revision 1.10.2.3 diff -u -r1.10.2.2 -r1.10.2.3 --- EmbeddedServletOptions.java 2 Sep 2004 16:08:03 - 1.10.2.2 +++ EmbeddedServletOptions.java 22 Oct 2004 16:51:23 - 1.10.2.3 @@ -144,6 +144,11 @@ private String compilerTargetVM = 1.3; /** + * The compiler source VM (1.3 by default). + */ +private String compilerSourceVM = 1.3; + +/** * Cache for the TLD locations */ private TldLocationsCache tldLocationsCache = null; @@ -303,6 +308,13 @@ return compilerTargetVM; } +/** + * @see Options#getCompilerSourceVM + */ +public String getCompilerSourceVM() { +return compilerSourceVM; +} + public boolean getErrorOnUseBeanInvalidClassAttribute() { return errorOnUseBeanInvalidClassAttribute; } @@ -569,6 +581,11 @@ String compilerTargetVM = config.getInitParameter(compilerTargetVM); if(compilerTargetVM != null) { this.compilerTargetVM = compilerTargetVM; +} + +String compilerSourceVM = config.getInitParameter(compilerSourceVM); +if(compilerSourceVM != null) { + this.compilerSourceVM = compilerSourceVM; } String javaEncoding = config.getInitParameter(javaEncoding); 1.80.2.3 +22 -2 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java Index: JspC.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java,v retrieving revision 1.80.2.2 retrieving revision 1.80.2.3 diff -u -r1.80.2.2 -r1.80.2.3 --- JspC.java 2 Sep 2004 16:08:03 - 1.80.2.2 +++ JspC.java 22 Oct 2004 16:51:23 - 1.80.2.3 @@ -98,6 +98,8 @@ private static final String SWITCH_CLASS_NAME = -c; private static final String SWITCH_FULL_STOP = --;
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
luehe 2004/10/19 13:18:02 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: Update the JspServletWrapper's lastModificationTest timestamp at the right place in the code (the place where we used to set it was never reached if the JSP kept changing before each isOutDated() check, defeating the purpose of the modificationTestInterval init param) Revision ChangesPath 1.98 +10 -7 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.97 retrieving revision 1.98 diff -u -r1.97 -r1.98 --- Compiler.java 14 Oct 2004 23:54:00 - 1.97 +++ Compiler.java 19 Oct 2004 20:18:02 - 1.98 @@ -328,12 +328,16 @@ String jsp = ctxt.getJspFile(); -if ((jsw != null) - (ctxt.getOptions().getModificationTestInterval() 0) - ((jsw.getLastModificationTest() -+ (ctxt.getOptions().getModificationTestInterval() * 1000)) - System.currentTimeMillis())) { -return false; +if (jsw != null + (ctxt.getOptions().getModificationTestInterval() 0)) { + +if (jsw.getLastModificationTest() ++ (ctxt.getOptions().getModificationTestInterval() * 1000) + System.currentTimeMillis()) { +return false; +} else { +jsw.setLastModificationTest(System.currentTimeMillis()); +} } long jspRealLastModified = 0; @@ -381,7 +385,6 @@ if( jsw==null ) { return false; } -jsw.setLastModificationTest(System.currentTimeMillis()); List depends = jsw.getDependants(); if (depends == null) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
kinman 2004/10/14 16:54:01 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: - Fix bugzilla 31382: Stack overflow when compiling recursive tag files. Revision ChangesPath 1.97 +23 -30 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.96 retrieving revision 1.97 diff -u -r1.96 -r1.97 --- Compiler.java 5 Oct 2004 19:28:19 - 1.96 +++ Compiler.java 14 Oct 2004 23:54:00 - 1.97 @@ -326,7 +326,6 @@ */ public boolean isOutDated(boolean checkClass) { -boolean outDated = false; String jsp = ctxt.getJspFile(); if ((jsw != null) @@ -362,31 +361,31 @@ } if (!targetFile.exists()) { -outDated = true; -} else { -targetLastModified = targetFile.lastModified(); -if (checkClass jsw != null) { -jsw.setServletClassLastModifiedTime(targetLastModified); -} -if (targetLastModified jspRealLastModified) { -if( log.isDebugEnabled() ) { -log.debug(Compiler: outdated: + targetFile + + -targetLastModified ); -} -outDated = true; +return true; +} + +targetLastModified = targetFile.lastModified(); +if (checkClass jsw != null) { +jsw.setServletClassLastModifiedTime(targetLastModified); +} +if (targetLastModified jspRealLastModified) { +if( log.isDebugEnabled() ) { +log.debug(Compiler: outdated: + targetFile + + +targetLastModified ); } +return true; } // determine if source dependent files (e.g. includes using include // directives) have been changed. if( jsw==null ) { -return outDated; +return false; } jsw.setLastModificationTest(System.currentTimeMillis()); List depends = jsw.getDependants(); if (depends == null) { -return outDated; +return false; } Iterator it = depends.iterator(); @@ -395,29 +394,23 @@ try { URL includeUrl = ctxt.getResource(include); if (includeUrl == null) { -outDated = true; +return true; } -if (!outDated) { -URLConnection includeUconn = includeUrl.openConnection(); -long includeLastModified = includeUconn.getLastModified(); -includeUconn.getInputStream().close(); - -if (includeLastModified targetLastModified) { -outDated = true; -} -} -if (outDated) { -// Remove any potential Wrappers for tag files -ctxt.getRuntimeContext().removeWrapper(include); +URLConnection includeUconn = includeUrl.openConnection(); +long includeLastModified = includeUconn.getLastModified(); +includeUconn.getInputStream().close(); + +if (includeLastModified targetLastModified) { +return true; } } catch (Exception e) { e.printStackTrace(); -outDated = true; +return true; } } -return outDated; +return false; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
luehe 2004/10/05 12:28:20 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: Determine various JSP compilation time intervals only as needed Revision ChangesPath 1.96 +18 -10 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.95 retrieving revision 1.96 diff -u -r1.95 -r1.96 --- Compiler.java 5 Oct 2004 07:24:33 - 1.95 +++ Compiler.java 5 Oct 2004 19:28:19 - 1.96 @@ -86,7 +86,13 @@ String[] smapStr = null; -long t1=System.currentTimeMillis(); +long t1, t2, t3, t4; + +t1 = t2 = t3 = t4 = 0; + +if (log.isDebugEnabled()) { +t1 = System.currentTimeMillis(); +} // Setup page info area pageInfo = new PageInfo(new BeanRepository(ctxt.getClassLoader(), @@ -150,9 +156,9 @@ // Validate and process attributes Validator.validate(this, pageNodes); -long t2=System.currentTimeMillis(); -// Dump out the page (for debugging) -// Dumper.dump(pageNodes); +if (log.isDebugEnabled()) { +t2 = System.currentTimeMillis(); +} // Collect page info Collector.collect(this, pageNodes); @@ -162,7 +168,9 @@ tfp = new TagFileProcessor(); tfp.loadTagFiles(this, pageNodes); -long t3=System.currentTimeMillis(); +if (log.isDebugEnabled()) { +t3 = System.currentTimeMillis(); +} // Determine which custom tag needs to declare which scripting vars ScriptingVariabler.set(pageNodes, errDispatcher); @@ -187,11 +195,11 @@ // to be GC'd and save memory. ctxt.setWriter(null); -long t4=System.currentTimeMillis(); -if( t4-t1 500 ) { -log.debug(Generated + javaFileName + total= + - (t4-t1) + generate= + ( t4-t3 ) + validate= + - ( t2-t1 )); +if (log.isDebugEnabled()) { +t4 = System.currentTimeMillis(); +log.debug(Generated + javaFileName + total= + + (t4-t1) + generate= + (t4-t3) + + validate= + (t2-t1)); } } catch (Exception e) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
yoavs 2004/09/21 12:45:09 Modified:webapps/docs Tag: TOMCAT_5_0 changelog.xml jasper2/src/share/org/apache/jasper/compiler Tag: TOMCAT_5_0 Compiler.java Log: Bugzilla 31257: specification of endorsed dirs for compiler. Revision ChangesPath No revision No revision 1.70.2.39 +4 -1 jakarta-tomcat-catalina/webapps/docs/changelog.xml Index: changelog.xml === RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/changelog.xml,v retrieving revision 1.70.2.38 retrieving revision 1.70.2.39 diff -u -r1.70.2.38 -r1.70.2.39 --- changelog.xml 20 Sep 2004 18:29:05 - 1.70.2.38 +++ changelog.xml 21 Sep 2004 19:45:08 - 1.70.2.39 @@ -104,7 +104,10 @@ /fix fix bug31171/bug: Wrap to avoid ClassCastException in PageContextImpl. (yoavs) - /fix + /fix + fix +bug31257/bug: Added specification of endorsed dirs if forking. (yoavs) + /fix /changelog /subsection subsection name=Coyote No revision No revision 1.88.2.3 +14 -0 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.88.2.2 retrieving revision 1.88.2.3 diff -u -r1.88.2.2 -r1.88.2.3 --- Compiler.java 12 Sep 2004 20:46:23 - 1.88.2.2 +++ Compiler.java 21 Sep 2004 19:45:09 - 1.88.2.3 @@ -351,6 +351,20 @@ info.append(extension dir= + exts + \n); } +// Add endorsed directories if any are specified and we're forking +// See Bugzilla 31257 +if(ctxt.getOptions().getFork()) { +String endorsed = System.getProperty(java.endorsed.dirs); +if(endorsed != null) { + Javac.ImplementationSpecificArgument endorsedArg = + javac.createCompilerArg(); + endorsedArg.setLine(-J-Djava.endorsed.dirs=+endorsed); + info.append(endorsed dir= + endorsed + \n); +} else { +info.append(no endorsed dirs specified\n); +} +} + // Configure the compiler object javac.setEncoding(javaEncoding); javac.setClasspath(path); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
markt 2004/09/12 13:43:48 Modified:jasper2/src/share/org/apache/jasper/compiler Tag: tomcat_4_branch Compiler.java Log: Fix bug 29570. Ant javac task needs temp dir to create temp file if command line is too long. Revision ChangesPath No revision No revision 1.18.2.20 +1 -0 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.18.2.19 retrieving revision 1.18.2.20 diff -u -r1.18.2.19 -r1.18.2.20 --- Compiler.java 25 Aug 2004 20:53:29 - 1.18.2.19 +++ Compiler.java 12 Sep 2004 20:43:48 - 1.18.2.20 @@ -256,6 +256,7 @@ javac.setClasspath(path); javac.setDebug(ctxt.getOptions().getClassDebugInfo()); javac.setSrcdir(srcPath); +javac.setTempdir(options.getScratchDir()); javac.setOptimize(! ctxt.getOptions().getClassDebugInfo() ); javac.setFork(ctxt.getOptions().getFork()); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
markt 2004/09/12 13:46:23 Modified:jasper2/src/share/org/apache/jasper/compiler Tag: TOMCAT_5_0 Compiler.java Log: Fix bug 29570. Ant javac task needs temp dir to create temp file if command line is too long. - Ported from TC4 Revision ChangesPath No revision No revision 1.88.2.2 +1 -0 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.88.2.1 retrieving revision 1.88.2.2 diff -u -r1.88.2.1 -r1.88.2.2 --- Compiler.java 2 Sep 2004 15:19:26 - 1.88.2.1 +++ Compiler.java 12 Sep 2004 20:46:23 - 1.88.2.2 @@ -356,6 +356,7 @@ javac.setClasspath(path); javac.setDebug(ctxt.getOptions().getClassDebugInfo()); javac.setSrcdir(srcPath); +javac.setTempdir(options.getScratchDir()); javac.setOptimize(! ctxt.getOptions().getClassDebugInfo() ); javac.setFork(ctxt.getOptions().getFork()); info.append(srcDir= + srcPath + \n ); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
yoavs 2004/09/02 08:19:27 Modified:catalina/src/share/org/apache/catalina/startup Tag: TOMCAT_5_0 DigesterFactory.java webapps/docs Tag: TOMCAT_5_0 changelog.xml jasper2/src/share/org/apache/jasper Tag: TOMCAT_5_0 EmbeddedServletOptions.java JspC.java Options.java jasper2/src/share/org/apache/jasper/compiler Tag: TOMCAT_5_0 Compiler.java Log: Added compilerTargetVM option to allow passing javac a target (1.1, 1.2, 1.3, 1.4 etc.) argument. Revision ChangesPath No revision No revision 1.6.2.2 +1 -1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/DigesterFactory.java Index: DigesterFactory.java === RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/DigesterFactory.java,v retrieving revision 1.6.2.1 retrieving revision 1.6.2.2 diff -u -r1.6.2.1 -r1.6.2.2 --- DigesterFactory.java 2 Sep 2004 14:24:54 - 1.6.2.1 +++ DigesterFactory.java 2 Sep 2004 15:19:26 - 1.6.2.2 @@ -35,7 +35,7 @@ /** * Log for logging ;) */ -private static org.apache.commons.logging.Log = +private static org.apache.commons.logging.Log log = org.apache.commons.logging.LogFactory.getLog(DigesterFactory.class); /** No revision No revision 1.70.2.26 +7 -0 jakarta-tomcat-catalina/webapps/docs/changelog.xml Index: changelog.xml === RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/changelog.xml,v retrieving revision 1.70.2.25 retrieving revision 1.70.2.26 diff -u -r1.70.2.25 -r1.70.2.26 --- changelog.xml 2 Sep 2004 14:24:54 - 1.70.2.25 +++ changelog.xml 2 Sep 2004 15:19:26 - 1.70.2.26 @@ -66,6 +66,13 @@ /fix /changelog /subsection + subsection name=Jasper +changelog + fix +bug30984/bug: Added compilerTargetVM option to Jasper. (yoavs) + /fix +/changelog + /subsection /section section name=Tomcat 5.0.28 (yoavs) No revision No revision 1.10.2.1 +16 -0 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbeddedServletOptions.java Index: EmbeddedServletOptions.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbeddedServletOptions.java,v retrieving revision 1.10 retrieving revision 1.10.2.1 diff -u -r1.10 -r1.10.2.1 --- EmbeddedServletOptions.java 17 Mar 2004 19:23:03 - 1.10 +++ EmbeddedServletOptions.java 2 Sep 2004 15:19:26 - 1.10.2.1 @@ -139,6 +139,11 @@ private String compiler = null; /** + * The compiler target VM (1.2 by default). + */ +private String compilerTargetVM = 1.2; + +/** * Cache for the TLD locations */ private TldLocationsCache tldLocationsCache = null; @@ -291,6 +296,13 @@ return compiler; } +/** + * @see Options#getCompilerTargetVM + */ +public String getCompilerTargetVM() { +return compilerTargetVM; +} + public boolean getErrorOnUseBeanInvalidClassAttribute() { return errorOnUseBeanInvalidClassAttribute; } @@ -553,6 +565,10 @@ scratchDir.getAbsolutePath())); this.compiler = config.getInitParameter(compiler); +compilerTargetVM = config.getInitParameter(compilerTargetVM); +if(compilerTargetVM != null) { +this.compilerTargetVM = compilerTargetVM; +} String javaEncoding = config.getInitParameter(javaEncoding); if (javaEncoding != null) { 1.80.2.1 +17 -0 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java Index: JspC.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java,v retrieving revision 1.80 retrieving revision 1.80.2.1 diff -u -r1.80 -r1.80.2.1 --- JspC.java 16 Jun 2004 14:20:17 - 1.80 +++ JspC.java 2 Sep 2004 15:19:26 - 1.80.2.1 @@ -142,7 +142,10 @@ private int dieLevel; private boolean helpNeeded = false; private boolean compile = false; + private String compiler = null; +private String compilerTargetVM = 1.2; + private boolean classDebugInfo = true; private Vector extensions; private Vector
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
markt 2004/07/19 13:17:55 Modified:jasper2/src/share/org/apache/jasper/compiler Tag: tomcat_4_branch Compiler.java Log: Fix bug 26025. Close the stream to avoid FD leak . - Based on a patch provided by Wladimir Araujo Revision ChangesPath No revision No revision 1.18.2.18 +15 -6 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.18.2.17 retrieving revision 1.18.2.18 diff -u -r1.18.2.17 -r1.18.2.18 --- Compiler.java 22 May 2004 16:55:14 - 1.18.2.17 +++ Compiler.java 19 Jul 2004 20:17:55 - 1.18.2.18 @@ -63,6 +63,8 @@ import java.util.*; import java.io.*; import java.net.URL; +import java.net.URLConnection; + import javax.servlet.ServletException; import javax.servlet.Servlet; @@ -407,7 +409,10 @@ ctxt.incrementRemoved(); return false; } -jspRealLastModified = jspUrl.openConnection().getLastModified(); + +URLConnection conn = jspUrl.openConnection(); +jspRealLastModified = conn.getLastModified(); +conn.getInputStream().close(); } catch (Exception e) { e.printStackTrace(); return true; @@ -468,8 +473,12 @@ //System.out.println(Compiler: outdated, no includeUri + include ); return true; } -if (includeUrl.openConnection().getLastModified() -targetLastModified) { + +URLConnection includeUrlConn = includeUrl.openConnection(); +long includeLastModified = includeUrlConn.getLastModified(); +includeUrlConn.getInputStream().close(); + +if (includeLastModified targetLastModified) { //System.out.println(Compiler: outdated, include old + include ); return true; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java PageInfo.java
kinman 2004/07/13 15:47:23 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java PageInfo.java Log: -- Fix bugzilla 29887: Recursive tag file causes infinite recursion when checking for file dependencies. Revision ChangesPath 1.91 +2 -1 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.90 retrieving revision 1.91 diff -u -r1.90 -r1.91 --- Compiler.java 7 Jul 2004 16:29:10 - 1.90 +++ Compiler.java 13 Jul 2004 22:47:23 - 1.91 @@ -154,7 +154,8 @@ // Setup page info area pageInfo = new PageInfo(new BeanRepository(ctxt.getClassLoader(), - errDispatcher)); + errDispatcher), +ctxt.getJspFile()); JspConfig jspConfig = options.getJspConfig(); JspConfig.JspProperty jspProperty = 1.42 +9 -2 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageInfo.java Index: PageInfo.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageInfo.java,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- PageInfo.java 17 Mar 2004 19:23:03 - 1.41 +++ PageInfo.java 13 Jul 2004 22:47:23 - 1.42 @@ -37,6 +37,7 @@ private HashMap jspPrefixMapper; private HashMap xmlPrefixMapper; private HashMap nonCustomTagPrefixMap; +private String jspFile; private String defaultLanguage = java; private String language; private String defaultExtends = Constants.JSP_SERVLET_BASE; @@ -76,7 +77,9 @@ private Vector pluginDcls; // Id's for tagplugin declarations -PageInfo(BeanRepository beanRepository) { +PageInfo(BeanRepository beanRepository, String jspFile) { + +this.jspFile = jspFile; this.beanRepository = beanRepository; this.taglibsMap = new HashMap(); this.jspPrefixMapper = new HashMap(); @@ -118,8 +121,12 @@ return imports; } +public String getJspFile() { +return jspFile; +} + public void addDependant(String d) { - if (!dependants.contains(d)) + if (!dependants.contains(d) !jspFile.equals(d)) dependants.add(d); } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
remm2004/07/07 09:29:10 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: - Add an extra flag to make development mode (the default) faster, which could be useful (some are also dynamically generating JSPs). - Let me know if this causes problems. Revision ChangesPath 1.90 +7 -1 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.89 retrieving revision 1.90 diff -u -r1.89 -r1.90 --- Compiler.java 1 Jul 2004 09:44:27 - 1.89 +++ Compiler.java 7 Jul 2004 16:29:10 - 1.90 @@ -515,6 +515,11 @@ boolean outDated = false; String jsp = ctxt.getJspFile(); +if ((jsw != null) ((jsw.getLastModificationTest() + 2000) + System.currentTimeMillis())) { +return false; +} + long jspRealLastModified = 0; try { URL jspUrl = ctxt.getResource(jsp); @@ -560,7 +565,8 @@ if( jsw==null ) { return outDated; } - +jsw.setLastModificationTest(System.currentTimeMillis()); + List depends = jsw.getDependants(); if (depends == null) { return outDated; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
luehe 2004/06/15 14:30:35 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: Fixed Bugzilla 29561 (NullPointerException in Compiler.java:547) Revision ChangesPath 1.88 +1 -1 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.87 retrieving revision 1.88 diff -u -r1.87 -r1.88 --- Compiler.java 24 May 2004 21:33:48 - 1.87 +++ Compiler.java 15 Jun 2004 21:30:35 - 1.88 @@ -543,7 +543,7 @@ outDated = true; } else { targetLastModified = targetFile.lastModified(); -if (checkClass) { +if (checkClass jsw != null) { jsw.setServletClassLastModifiedTime(targetLastModified); } if (targetLastModified jspRealLastModified) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java [T2004061500C7]
Thank you for contacting Prometric, part of The Thomson Corporation. We appreciate your business and value your feedback. We will make every effort to respond within 2 business days. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
markt 2004/05/22 09:55:14 Modified:jasper2/src/share/org/apache/jasper/compiler Tag: tomcat_4_branch Compiler.java Log: Ensure spaces in tomcat install path (if any) are decoded before passing to javac. This was causing the admin app to fail when deployed in uncompiled form to a tomcat instance with a spcae in it's path. Revision ChangesPath No revision No revision 1.18.2.17 +6 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.18.2.16 retrieving revision 1.18.2.17 diff -u -r1.18.2.16 -r1.18.2.17 --- Compiler.java 5 May 2004 22:04:42 - 1.18.2.16 +++ Compiler.java 22 May 2004 16:55:14 - 1.18.2.17 @@ -80,6 +80,7 @@ import org.apache.jasper.logging.Logger; import org.apache.jasper.util.SystemLogHandler; import org.apache.jasper.runtime.HttpJspBase; +import org.apache.jasper.runtime.JspRuntimeLibrary; import org.apache.jasper.servlet.JspServletWrapper; /** @@ -280,7 +281,8 @@ path.setPath(System.getProperty(java.class.path)); StringTokenizer tokenizer = new StringTokenizer(classpath, sep); while (tokenizer.hasMoreElements()) { -String pathElement = tokenizer.nextToken(); +String pathElement = +JspRuntimeLibrary.decode(tokenizer.nextToken()); File repository = new File(pathElement); path.setLocation(repository); info.append( cp= + repository + \n); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java DefaultErrorHandler.java ErrorDispatcher.java ErrorHandler.java
luehe 2004/05/21 10:52:59 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java DefaultErrorHandler.java ErrorDispatcher.java ErrorHandler.java Log: Dispatch error report (in addition to BuildException) to error handler Revision ChangesPath 1.86 +4 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.85 retrieving revision 1.86 diff -u -r1.85 -r1.86 --- Compiler.java 21 May 2004 00:20:53 - 1.85 +++ Compiler.java 21 May 2004 17:52:59 - 1.86 @@ -403,14 +403,15 @@ } if (be != null) { +String errorReportString = errorReport.toString(); log.error(Error compiling file: + javaFileName + - + errorReport); + + errorReportString); JavacErrorDetail[] javacErrors = errDispatcher.parseJavacErrors( -errorReport.toString(), javaFileName, pageNodes); +errorReportString, javaFileName, pageNodes); if (javacErrors != null) { errDispatcher.javacError(javacErrors); } else { -errDispatcher.javacError(be); +errDispatcher.javacError(errorReportString, be); } } 1.11 +3 -2 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/DefaultErrorHandler.java Index: DefaultErrorHandler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/DefaultErrorHandler.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- DefaultErrorHandler.java 21 May 2004 00:20:53 - 1.10 +++ DefaultErrorHandler.java 21 May 2004 17:52:59 - 1.11 @@ -81,11 +81,12 @@ } /** - * Processes the given javac compilation exception. + * Processes the given javac error report and exception. * + * @param errorReport Compilation error report * @param exception Compilation exception */ -public void javacError(Exception exception) +public void javacError(String errorReport, Exception exception) throws JasperException { throw new JasperException( 1.19 +6 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ErrorDispatcher.java Index: ErrorDispatcher.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ErrorDispatcher.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- ErrorDispatcher.java 21 May 2004 00:20:53 - 1.18 +++ ErrorDispatcher.java 21 May 2004 17:52:59 - 1.19 @@ -334,14 +334,16 @@ /* - * Dispatches the given compilation exception to the configured error - * handler. + * Dispatches the given compilation error report and exception to the + * configured error handler. * + * @param errorReport Compilation error report * @param e Compilation exception */ -public void javacError(Exception e) throws JasperException { +public void javacError(String errorReport, Exception e) +throws JasperException { -errHandler.javacError(e); +errHandler.javacError(errorReport, e); } 1.6 +3 -2 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ErrorHandler.java Index: ErrorHandler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ErrorHandler.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- ErrorHandler.java 21 May 2004 00:20:53 - 1.5 +++ ErrorHandler.java 21 May 2004 17:52:59 - 1.6 @@ -62,10 +62,11 @@ throws JasperException; /** - * Processes the given javac compilation exception. + * Processes the given javac error report and exception. * + * @param errorReport Compilation error report * @param exception Compilation exception */ -public void javacError(Exception exception) +public void javacError(String errorReport, Exception exception) throws JasperException; } - To unsubscribe, e-mail:
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java ErrorDispatcher.java JspReader.java Mark.java
luehe 2004/05/12 10:45:37 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java ErrorDispatcher.java JspReader.java Mark.java Log: Fixed additional requirements from Bugzilla 28604: If compiling from JspC, the absolute (instead of context-relative) path of the JSP that caused the error is now printed (when compiling from JspServlet, we continue to print only the context-relative path of the JSP) Revision ChangesPath 1.84 +15 -1 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.83 retrieving revision 1.84 diff -u -r1.83 -r1.84 --- Compiler.java 10 May 2004 16:34:59 - 1.83 +++ Compiler.java 12 May 2004 17:45:37 - 1.84 @@ -439,8 +439,22 @@ public void compile(boolean compileClass) throws FileNotFoundException, JasperException, Exception { +compile(compileClass, false); +} + +/** + * Compile the jsp file from the current engine context. As an side- + * effect, tag files that are referenced by this page are also compiled. + * + * @param compileClass If true, generate both .java and .class file + * If false, generate only .java file + * @param jspcMode true if invoked from JspC, false otherwise + */ +public void compile(boolean compileClass, boolean jspcMode) +throws FileNotFoundException, JasperException, Exception +{ if (errDispatcher == null) { -this.errDispatcher = new ErrorDispatcher(); +this.errDispatcher = new ErrorDispatcher(jspcMode); } try { 1.17 +21 -2 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ErrorDispatcher.java Index: ErrorDispatcher.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ErrorDispatcher.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- ErrorDispatcher.java 17 Mar 2004 19:23:03 - 1.16 +++ ErrorDispatcher.java 12 May 2004 17:45:37 - 1.17 @@ -20,6 +20,7 @@ import java.io.StringReader; import java.util.ResourceBundle; import java.util.Vector; +import java.net.MalformedURLException; import org.apache.jasper.JasperException; import org.xml.sax.SAXException; @@ -46,12 +47,20 @@ // Custom error handler private ErrorHandler errHandler; +// Indicates whether the compilation was initiated by JspServlet or JspC +private boolean jspcMode = false; + + /* * Constructor. + * + * @param jspcMode true if compilation has been initiated by JspC, false + * otherwise */ -public ErrorDispatcher() { +public ErrorDispatcher(boolean jspcMode) { // XXX check web.xml for custom error handler errHandler = new DefaultErrorHandler(); +this.jspcMode = jspcMode; } /* @@ -340,7 +349,17 @@ // Get error location if (where != null) { - file = where.getFile(); +if (jspcMode) { +// Get the full URL of the resource that caused the error +try { +file = where.getURL().toString(); +} catch (MalformedURLException me) { +file = where.getFile(); +} +} else { +// Get the context-relative resource path +file = where.getFile(); +} line = where.getLineNumber(); column = where.getColumnNumber(); hasLocation = true; 1.20 +18 -0 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspReader.java Index: JspReader.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspReader.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- JspReader.java17 Mar 2004 19:23:03 - 1.19 +++ JspReader.java12 May 2004 17:45:37 - 1.20 @@ -22,6 +22,8 @@ import java.io.InputStreamReader; import java.util.Vector; import java.util.jar.JarFile; +import java.net.URL; +import java.net.MalformedURLException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -402,6 +404,22 @@ void setSingleFile(boolean val) { singleFile = val; } + + +/** +
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
luehe 2004/05/10 09:34:59 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: Fixed Bugzilla 28603 (JspC Ant task does not detect errors on a second compile) This fix complements the earlier fix by closing the ServletWriter *before* attempting to File.delete() Patch provided by: [EMAIL PROTECTED] Revision ChangesPath 1.83 +10 -2 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.82 retrieving revision 1.83 diff -u -r1.82 -r1.83 --- Compiler.java 29 Apr 2004 18:33:50 - 1.82 +++ Compiler.java 10 May 2004 16:34:59 - 1.83 @@ -258,14 +258,22 @@ } } catch (Exception e) { +if (writer != null) { +try { +writer.close(); +writer = null; +} catch (Exception e1) { +// do nothing +} +} // Remove the generated .java file -new File(javaFileName).delete(); +new File(javaFileName).delete(); throw e; } finally { if (writer != null) { try { writer.close(); -} catch (Exception e) { +} catch (Exception e2) { // do nothing } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
markt 2004/05/05 14:51:03 Modified:jasper2/src/share/org/apache/jasper/compiler Tag: tomcat_4_branch Compiler.java Log: Replace tabs with spaces prior to making other changes. Revision ChangesPath No revision No revision 1.18.2.15 +30 -30 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.18.2.14 retrieving revision 1.18.2.15 diff -u -r1.18.2.14 -r1.18.2.15 --- Compiler.java 5 Feb 2004 22:19:07 - 1.18.2.14 +++ Compiler.java 5 May 2004 21:51:03 - 1.18.2.15 @@ -155,7 +155,7 @@ logger.setMessageOutputLevel( Project.MSG_INFO ); } project.addBuildListener( logger ); - if (System.getProperty(catalina.home) != null) { +if (System.getProperty(catalina.home) != null) { project.setBasedir( System.getProperty(catalina.home)); } @@ -197,43 +197,43 @@ public void generateJava() throws FileNotFoundException, JasperException, Exception { - // Setup page info area - pageInfo = new PageInfo(new BeanRepository(ctxt.getClassLoader())); +// Setup page info area +pageInfo = new PageInfo(new BeanRepository(ctxt.getClassLoader())); String javaFileName = ctxt.getServletJavaFileName(); // 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); - } +OutputStreamWriter osw = null; +try { +osw = new OutputStreamWriter(new FileOutputStream(javaFileName), + javaEncoding); +} catch (UnsupportedEncodingException ex) { +errDispatcher.jspError(jsp.error.needAlternateJavaEncoding, javaEncoding); +} - ServletWriter writer = new ServletWriter(new PrintWriter(osw)); +ServletWriter writer = new ServletWriter(new PrintWriter(osw)); ctxt.setWriter(writer); - // Parse the file - ParserController parserCtl = new ParserController(ctxt, this); - pageNodes = parserCtl.parse(ctxt.getJspFile()); +// Parse the file +ParserController parserCtl = new ParserController(ctxt, this); +pageNodes = parserCtl.parse(ctxt.getJspFile()); - // Validate and process attributes - Validator.validate(this, pageNodes); +// Validate and process attributes +Validator.validate(this, pageNodes); - // Dump out the page (for debugging) - // Dumper.dump(pageNodes); +// Dump out the page (for debugging) +// Dumper.dump(pageNodes); - // Collect page info - Collector.collect(this, pageNodes); +// Collect page info +Collector.collect(this, pageNodes); - // Determine which custom tag needs to declare which scripting vars - ScriptingVariabler.set(pageNodes); +// Determine which custom tag needs to declare which scripting vars +ScriptingVariabler.set(pageNodes); - // generate servlet .java file - Generator.generate(writer, this, pageNodes); +// generate servlet .java file +Generator.generate(writer, this, pageNodes); writer.close(); // The writer is only used during the compile, dereference // it in the JspCompilationContext when done to allow it @@ -481,7 +481,7 @@ * Gets the error dispatcher. */ public ErrorDispatcher getErrorDispatcher() { - return errDispatcher; +return errDispatcher; } @@ -489,12 +489,12 @@ * Gets the info about the page under compilation */ public PageInfo getPageInfo() { - return pageInfo; +return pageInfo; } public JspCompilationContext getCompilationContext() { - return ctxt; +return ctxt; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
markt 2004/05/05 15:04:42 Modified:jasper2/src/share/org/apache/jasper/compiler Tag: tomcat_4_branch Compiler.java Log: Fix bug 20953. NPE when running in standalone mode and no useful error message. Revision ChangesPath No revision No revision 1.18.2.16 +11 -7 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.18.2.15 retrieving revision 1.18.2.16 diff -u -r1.18.2.15 -r1.18.2.16 --- Compiler.java 5 May 2004 21:51:03 - 1.18.2.15 +++ Compiler.java 5 May 2004 22:04:42 - 1.18.2.16 @@ -197,6 +197,10 @@ public void generateJava() throws FileNotFoundException, JasperException, Exception { +if (errDispatcher == null) { +this.errDispatcher = new ErrorDispatcher(); +} + // Setup page info area pageInfo = new PageInfo(new BeanRepository(ctxt.getClassLoader())); @@ -247,6 +251,10 @@ public void generateClass() throws FileNotFoundException, JasperException, Exception { +if (errDispatcher == null) { +this.errDispatcher = new ErrorDispatcher(); +} + String javaEncoding = ctxt.getOptions().getJavaEncoding(); String javaFileName = ctxt.getServletJavaFileName(); String classpath = ctxt.getClassPath(); @@ -355,10 +363,6 @@ public void compile() throws FileNotFoundException, JasperException, Exception { -if (errDispatcher == null) { -this.errDispatcher = new ErrorDispatcher(); -} - try { generateJava(); generateClass(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
luehe 2004/04/29 11:33:50 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: Fixed another incidence where URLConnection was not closed when checking for lastModified date of included resources Revision ChangesPath 1.82 +9 -5 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.81 retrieving revision 1.82 diff -u -r1.81 -r1.82 --- Compiler.java 27 Apr 2004 18:14:13 - 1.81 +++ Compiler.java 29 Apr 2004 18:33:50 - 1.82 @@ -538,13 +538,17 @@ try { URL includeUrl = ctxt.getResource(include); if (includeUrl == null) { -//System.out.println(Compiler: outdated, no includeUri + include ); outDated = true; } -if (!outDated includeUrl.openConnection().getLastModified() -targetLastModified) { -//System.out.println(Compiler: outdated, include old + include ); -outDated = true; +if (!outDated) { + +URLConnection includeUconn = includeUrl.openConnection(); +long includeLastModified = includeUconn.getLastModified(); +includeUconn.getInputStream().close(); + +if (includeLastModified targetLastModified) { +outDated = true; +} } if (outDated) { // Remove any potential Wrappers for tag files - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
luehe 2004/04/27 11:14:13 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: Fixed Bugzilla 28603 (JspC Ant task does not detect errors on a second compile): Remove empty .java file (that was generated by new FileOutputStream()) if parser/validator/generator throws exception. Also removed tabs. Revision ChangesPath 1.81 +109 -86 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.80 retrieving revision 1.81 diff -u -r1.80 -r1.81 --- Compiler.java 20 Apr 2004 20:05:19 - 1.80 +++ Compiler.java 27 Apr 2004 18:14:13 - 1.81 @@ -146,105 +146,129 @@ * @return a smap for the current JSP page, if one is generated, * null otherwise */ -private String[] generateJava() -throws Exception -{ - String[] smapStr = null; +private String[] generateJava() throws Exception { + +String[] smapStr = null; long t1=System.currentTimeMillis(); - // Setup page info area - pageInfo = new PageInfo(new BeanRepository(ctxt.getClassLoader(), -errDispatcher)); - - JspConfig jspConfig = options.getJspConfig(); - JspConfig.JspProperty jspProperty = - jspConfig.findJspProperty(ctxt.getJspFile()); +// Setup page info area +pageInfo = new PageInfo(new BeanRepository(ctxt.getClassLoader(), + errDispatcher)); + +JspConfig jspConfig = options.getJspConfig(); +JspConfig.JspProperty jspProperty = +jspConfig.findJspProperty(ctxt.getJspFile()); /* * If the current uri is matched by a pattern specified in * a jsp-property-group in web.xml, initialize pageInfo with * those properties. */ -pageInfo.setELIgnored(JspUtil.booleanValue(jspProperty.isELIgnored())); - pageInfo.setScriptingInvalid(JspUtil.booleanValue(jspProperty.isScriptingInvalid())); +pageInfo.setELIgnored(JspUtil.booleanValue( +jspProperty.isELIgnored())); +pageInfo.setScriptingInvalid(JspUtil.booleanValue( +jspProperty.isScriptingInvalid())); if (jspProperty.getIncludePrelude() != null) { pageInfo.setIncludePrelude(jspProperty.getIncludePrelude()); } - if (jspProperty.getIncludeCoda() != null) { +if (jspProperty.getIncludeCoda() != null) { pageInfo.setIncludeCoda(jspProperty.getIncludeCoda()); - } +} + String javaFileName = ctxt.getServletJavaFileName(); +ServletWriter writer = null; -// 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); - } - - ServletWriter writer = new ServletWriter(new PrintWriter(osw)); -ctxt.setWriter(writer); - -// Reset the temporary variable counter for the generator. -JspUtil.resetTemporaryVariableName(); - - // Parse the file - ParserController parserCtl = new ParserController(ctxt, this); - pageNodes = parserCtl.parse(ctxt.getJspFile()); - - if (ctxt.isPrototypeMode()) { - // generate prototype .java file for the tag file - Generator.generate(writer, this, pageNodes); -writer.close(); - return 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(); + + // Parse the
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
luehe 2004/04/20 13:05:19 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: Close URLConnection's InputStream after getting lastModified date. Patch provided by [EMAIL PROTECTED] Revision ChangesPath 1.80 +4 -1 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.79 retrieving revision 1.80 diff -u -r1.79 -r1.80 --- Compiler.java 17 Mar 2004 19:23:03 - 1.79 +++ Compiler.java 20 Apr 2004 20:05:19 - 1.80 @@ -24,6 +24,7 @@ import java.io.PrintWriter; import java.io.UnsupportedEncodingException; import java.net.URL; +import java.net.URLConnection; import java.util.Iterator; import java.util.List; import java.util.StringTokenizer; @@ -467,7 +468,9 @@ ctxt.incrementRemoved(); return false; } -jspRealLastModified = jspUrl.openConnection().getLastModified(); +URLConnection uc = jspUrl.openConnection(); +jspRealLastModified = uc.getLastModified(); +uc.getInputStream().close(); } catch (Exception e) { e.printStackTrace(); return true; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java Generator.java Node.java SmapUtil.java
kinman 2004/03/08 13:28:30 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Generator.java Node.java SmapUtil.java Log: - Currently, smap for inner classes are not generated to the correct class files. For inner class defined in servlet codes, there is nothing Jasper can do, since the servlet codes are not parsed. However, for inner classes generated by Jasper, such as the helper classes for handling fragments, the following changes are made to fix this problem: - Add a field in Node to indicate the name of a inner class. This field is set in Generator, and accessed in SmapUtil. - In SmapUtil.generateSamp(), when scanning the page nodes, if the codes are meant for a inner class, the smap is generated to a buffer. It now returns an array, pairing the class file names with their corresponding smaps. - SmapUtil.installSmap() takes the array as an augment, and install the smaps into the corresponding class files. Revision ChangesPath 1.78 +5 -5 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.77 retrieving revision 1.78 diff -u -r1.77 -r1.78 --- Compiler.java 23 Jan 2004 01:50:08 - 1.77 +++ Compiler.java 8 Mar 2004 21:28:28 - 1.78 @@ -186,10 +186,10 @@ * @return a smap for the current JSP page, if one is generated, * null otherwise */ -private String generateJava() +private String[] generateJava() throws Exception { - String smapStr = null; + String[] smapStr = null; long t1=System.currentTimeMillis(); @@ -306,7 +306,7 @@ /** * Compile the servlet from .java file to .class file */ -private void generateClass(String smap) +private void generateClass(String[] smap) throws FileNotFoundException, JasperException, Exception { long t1=System.currentTimeMillis(); @@ -426,7 +426,7 @@ // JSR45 Support if (! options.isSmapSuppressed()) { -SmapUtil.installSmap(ctxt.getClassFileName(), smap); +SmapUtil.installSmap(smap); } } @@ -453,7 +453,7 @@ } try { -String smap = generateJava(); +String[] smap = generateJava(); if (compileClass) { generateClass(smap); } 1.223 +6 -3 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.222 retrieving revision 1.223 diff -u -r1.222 -r1.223 --- Generator.java2 Mar 2004 19:39:12 - 1.222 +++ Generator.java8 Mar 2004 21:28:28 - 1.223 @@ -94,6 +94,8 @@ * @author Mandar Raje * @author Rajiv Mordani * @author Pierre Delisle + * + * Tomcat 4.1.x and Tomcat 5: * @author Kin-man Chung * @author Jan Luehe * @author Shawn Bayern @@ -3913,6 +3915,7 @@ Fragment result = new Fragment(fragments.size(), parent); fragments.add(result); this.used = true; +parent.setInnerClassName(className); ServletWriter out = result.getGenBuffer().getOut(); out.pushIndent(); 1.80 +18 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Node.java Index: Node.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Node.java,v retrieving revision 1.79 retrieving revision 1.80 diff -u -r1.79 -r1.80 --- Node.java 1 Mar 2004 22:51:34 - 1.79 +++ Node.java 8 Mar 2004 21:28:29 - 1.80 @@ -116,6 +116,13 @@ protected Nodes namedAttributeNodes; // cached for performance protected String qName; protected String localName; +/* + * The name of the inner class to which the codes for this node and + * its body are generated. For instance, for jsp:body in foo.jsp, + * this is foo_jspHelper. This is primarily used for communicating + * such info from Generator to Smap generator. + */ +protected String innerClassName; private boolean isDummy; @@ -398,6 +405,14 @@ n = n.getParent(); } return (Node.Root) n; +} + +public String
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
kinman 2004/01/22 11:35:07 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: - Fix 26276: Generated TLD inconsistent after tagfile changes. Need to remove compilation wrapper for tag files if its clients has been changed. Revision ChangesPath 1.76 +19 -16 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.75 retrieving revision 1.76 diff -u -r1.75 -r1.76 --- Compiler.java 6 Jan 2004 19:42:39 - 1.75 +++ Compiler.java 22 Jan 2004 19:35:07 - 1.76 @@ -498,6 +498,7 @@ */ public boolean isOutDated(boolean checkClass) { +boolean outDated = false; String jsp = ctxt.getJspFile(); long jspRealLastModified = 0; @@ -513,7 +514,7 @@ return true; } -long targetLastModified; +long targetLastModified = 0; File targetFile; if( checkClass ) { @@ -523,29 +524,30 @@ } if (!targetFile.exists()) { -return true; -} - -targetLastModified = targetFile.lastModified(); -if (targetLastModified jspRealLastModified) { -if( log.isDebugEnabled() ) -log.debug(Compiler: outdated: + targetFile + + targetLastModified ); -return true; +outDated = true; +} else { +targetLastModified = targetFile.lastModified(); +if (targetLastModified jspRealLastModified) { +if( log.isDebugEnabled() ) { +log.debug(Compiler: outdated: + targetFile + + +targetLastModified ); +} +outDated = true; +} } // determine if source dependent files (e.g. includes using include - // directives) have been changed. +// directives) have been changed. if( jsw==null ) { -return false; +return outDated; } List depends = jsw.getDependants(); if (depends == null) { -return false; +return outDated; } Iterator it = depends.iterator(); -boolean outDated = false; while (it.hasNext()) { String include = (String)it.next(); try { @@ -554,18 +556,19 @@ //System.out.println(Compiler: outdated, no includeUri + include ); outDated = true; } -if (includeUrl.openConnection().getLastModified() +if (!outDated includeUrl.openConnection().getLastModified() targetLastModified) { //System.out.println(Compiler: outdated, include old + include ); outDated = true; -// Remove any potential Wrappers for tag files -ctxt.getRuntimeContext().removeWrapper(include); } +// Remove any potential Wrappers for tag files +ctxt.getRuntimeContext().removeWrapper(include); } catch (Exception e) { e.printStackTrace(); outDated = true; } } + return outDated; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java TagFileProcessor.java
kinman 2004/01/22 17:50:08 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java TagFileProcessor.java Log: Fix 26335: Modification check for tagfiles does not work recursively. Get reliable dependency info from the tag instance. Revision ChangesPath 1.77 +4 -2 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.76 retrieving revision 1.77 diff -u -r1.76 -r1.77 --- Compiler.java 22 Jan 2004 19:35:07 - 1.76 +++ Compiler.java 23 Jan 2004 01:50:08 - 1.77 @@ -561,8 +561,10 @@ //System.out.println(Compiler: outdated, include old + include ); outDated = true; } -// Remove any potential Wrappers for tag files -ctxt.getRuntimeContext().removeWrapper(include); +if (outDated) { +// Remove any potential Wrappers for tag files +ctxt.getRuntimeContext().removeWrapper(include); +} } catch (Exception e) { e.printStackTrace(); outDated = true; 1.56 +15 -9 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java Index: TagFileProcessor.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/TagFileProcessor.java,v retrieving revision 1.55 retrieving revision 1.56 diff -u -r1.55 -r1.56 --- TagFileProcessor.java 10 Dec 2003 00:24:23 - 1.55 +++ TagFileProcessor.java 23 Jan 2004 01:50:08 - 1.56 @@ -81,6 +81,7 @@ import org.apache.jasper.JasperException; import org.apache.jasper.JspCompilationContext; import org.apache.jasper.servlet.JspServletWrapper; +import org.apache.jasper.runtime.JspSourceDependent; /** * 1. Processes and extracts the directive info in a tag file. @@ -556,14 +557,19 @@ } // Add the dependants for this tag file to its parent's -// dependant list. -PageInfo pageInfo = wrapper.getJspEngineContext().getCompiler(). -getPageInfo(); -if (pageInfo != null) { -Iterator iter = pageInfo.getDependants().iterator(); -if (iter.hasNext()) { -parentPageInfo.addDependant((String)iter.next()); +// dependant list. The only reliable dependency information +// can only be obtained from the tag instance. +try { +Object tagIns = tagClazz.newInstance(); +if (tagIns instanceof JspSourceDependent) { +Iterator iter = +((JspSourceDependent)tagIns).getDependants().iterator(); +while (iter.hasNext()) { +parentPageInfo.addDependant((String)iter.next()); +} } +} catch (Exception e) { +// ignore errors } return tagClazz; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
kinman 2004/01/06 11:42:40 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: - Fix 25787: Directives added to working tag files are not generated. Revision ChangesPath 1.75 +7 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.74 retrieving revision 1.75 diff -u -r1.74 -r1.75 --- Compiler.java 10 Nov 2003 22:26:20 - 1.74 +++ Compiler.java 6 Jan 2004 19:42:39 - 1.75 @@ -545,25 +545,28 @@ } Iterator it = depends.iterator(); +boolean outDated = false; while (it.hasNext()) { String include = (String)it.next(); try { URL includeUrl = ctxt.getResource(include); if (includeUrl == null) { //System.out.println(Compiler: outdated, no includeUri + include ); -return true; +outDated = true; } if (includeUrl.openConnection().getLastModified() targetLastModified) { //System.out.println(Compiler: outdated, include old + include ); -return true; +outDated = true; +// Remove any potential Wrappers for tag files +ctxt.getRuntimeContext().removeWrapper(include); } } catch (Exception e) { e.printStackTrace(); -return true; +outDated = true; } } -return false; +return outDated; } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java TextOptimizer.java
kinman 2003/11/10 14:26:21 Modified:jasper2/src/share/org/apache/jasper EmbeddedServletOptions.java JspC.java Options.java jasper2/src/share/org/apache/jasper/compiler Compiler.java TextOptimizer.java Log: - Provide an option to trim white spaces that appear in a template text between two actions/directives. This also fixes 24506. Since this is NOT spec conformant, the default is don't do. Revision ChangesPath 1.7 +15 -18 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbeddedServletOptions.java Index: EmbeddedServletOptions.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbeddedServletOptions.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- EmbeddedServletOptions.java 9 Sep 2003 21:46:22 - 1.6 +++ EmbeddedServletOptions.java 10 Nov 2003 22:26:20 - 1.7 @@ -105,12 +105,9 @@ private boolean keepGenerated = true; /** - * Do you want support for large files? What this essentially - * means is that we generated code so that the HTML data in a JSP - * file is stored separately as opposed to those constant string - * data being used literally in the generated servlet. + * Should white spaces between directives or actions be trimmed? */ -private boolean largeFile = false; +private boolean trimSpaces = false; /** * Determines whether tag handler pooling is enabled. @@ -228,10 +225,10 @@ } /** - * Are we supporting large files? + * Should white spaces between directives or actions be trimmed? */ -public boolean getLargeFile() { -return largeFile; +public boolean getTrimSpaces() { +return trimSpaces; } public boolean isPoolingEnabled() { @@ -394,15 +391,15 @@ } -String largeFile = config.getInitParameter(largefile); -if (largeFile != null) { -if (largeFile.equalsIgnoreCase(true)) { -this.largeFile = true; -} else if (largeFile.equalsIgnoreCase(false)) { -this.largeFile = false; +String trimsp = config.getInitParameter(trimSpaces); +if (trimsp != null) { +if (trimsp.equalsIgnoreCase(true)) { +trimSpaces = true; +} else if (trimsp.equalsIgnoreCase(false)) { +trimSpaces = false; } else { if (log.isWarnEnabled()) { - log.warn(Localizer.getMessage(jsp.warning.largeFile)); + log.warn(Localizer.getMessage(jsp.warning.trimspaces)); } } } 1.61 +10 -6 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java Index: JspC.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java,v retrieving revision 1.60 retrieving revision 1.61 diff -u -r1.60 -r1.61 --- JspC.java 9 Sep 2003 21:46:22 - 1.60 +++ JspC.java 10 Nov 2003 22:26:20 - 1.61 @@ -172,7 +172,7 @@ private static int die; private String classPath = null; private URLClassLoader loader = null; -private boolean largeFile = false; +private boolean trimSpaces = false; private boolean xpoweredBy; private boolean mappedFile = false; private File scratchDir; @@ -331,8 +331,12 @@ return true; } -public boolean getLargeFile() { -return largeFile; +public boolean getTrimSpaces() { +return trimSpaces; +} + +public void setTrimSpaces(boolean ts) { +this.trimSpaces = ts; } public boolean isPoolingEnabled() { 1.19 +8 -8 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Options.java Index: Options.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Options.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- Options.java 9 Sep 2003 21:46:22 - 1.18 +++ Options.java 10 Nov 2003 22:26:20 - 1.19 @@ -82,11 +82,6 @@ public boolean getKeepGenerated(); /** - * Are we supporting large files? - */ -public boolean getLargeFile(); - -/** * Returns true if tag handler pooling is enabled, false otherwise. */ public boolean isPoolingEnabled(); @@ -131,6 +126,11 @@ * Ignored is suppressSmap() is true */
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
kinman 2003/10/01 15:44:02 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: - Some Javadoc improvements. Revision ChangesPath 1.71 +15 -13 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.70 retrieving revision 1.71 diff -u -r1.70 -r1.71 --- Compiler.java 26 Sep 2003 23:19:32 - 1.70 +++ Compiler.java 1 Oct 2003 22:44:02 - 1.71 @@ -188,7 +188,7 @@ /** - * Compile the jsp file from the current engine context + * Compile the jsp file into equivalent servlet in .java file * @return a smap for the current JSP page, if one is generated, * null otherwise */ @@ -249,10 +249,6 @@ return null; } - // Generate FunctionMapper (used for validation of EL expressions and - // code generation) - // pageInfo.setFunctionMapper(new FunctionMapperImpl(this)); - // Validate and process attributes Validator.validate(this, pageNodes); @@ -294,7 +290,7 @@ (t4-t1) + generate= + ( t4-t3 ) + validate= + ( t2-t1 )); } -//JSR45 Support - note this needs to be checked by a JSR45 guru +// JSR45 Support if (! options.isSmapSuppressed()) { smapStr = SmapUtil.generateSmap(ctxt, pageNodes); } @@ -311,7 +307,7 @@ } /** - * Compile the jsp file from the current engine context + * Compile the servlet from .java file to .class file */ private void generateClass(String smap) throws FileNotFoundException, JasperException, Exception { @@ -431,7 +427,7 @@ return; } -//JSR45 Support - note this needs to be checked by a JSR45 guru +// JSR45 Support if (! options.isSmapSuppressed()) { SmapUtil.installSmap(ctxt.getClassFileName(), smap); } @@ -447,7 +443,10 @@ } /** - * Compile the jsp file from the current engine context + * Compile the jsp file from the current engine context. As an side- + * effect, tag files that are referenced by this page are also compiled. + * @param compileClass If true, generate both .java and .class file + * If false, generate only .java file */ public void compile(boolean compileClass) throws FileNotFoundException, JasperException, Exception @@ -492,10 +491,13 @@ } /** - * This is a protected method intended to be overridden by - * subclasses of Compiler. This is used by the compile method - * to do all the compilation. - * @param checkClass Verify the class file if true, only the .java file if false. + * Determine if a compilation is necessary by checking the time stamp + * of the JSP page with that of the corresponding .class or .java file. + * If the page has dependencies, the check is also extended to its + * dependeants, and so on. + * This method can by overidden by a subclasses of Compiler. + * @param checkClass If true, check against .class file, + * if false, check against .java file. */ public boolean isOutDated(boolean checkClass) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
kinman 2003/09/26 16:19:32 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: - Support java extension direcotries when invoking javac. Revision ChangesPath 1.70 +12 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.69 retrieving revision 1.70 diff -u -r1.69 -r1.70 --- Compiler.java 24 Aug 2003 01:18:44 - 1.69 +++ Compiler.java 26 Sep 2003 23:19:32 - 1.70 @@ -340,13 +340,13 @@ // Initializing classpath Path path = new Path(project); path.setPath(System.getProperty(java.class.path)); -info.append( cp= + System.getProperty(java.class.path) + \n); +info.append(cp= + System.getProperty(java.class.path) + \n); StringTokenizer tokenizer = new StringTokenizer(classpath, sep); while (tokenizer.hasMoreElements()) { String pathElement = tokenizer.nextToken(); File repository = new File(pathElement); path.setLocation(repository); -info.append( cp= + repository + \n); +info.append(cp= + repository + \n); } if( log.isDebugEnabled() ) @@ -357,7 +357,16 @@ Path srcPath = new Path(project); srcPath.setLocation(options.getScratchDir()); -info.append( work dir= + options.getScratchDir() + \n); +info.append(work dir= + options.getScratchDir() + \n); + +// Initialize and set java extensions +String exts = System.getProperty(java.ext.dirs); +if (exts != null) { +Path extdirs = new Path(project); +extdirs.setPath(exts); +javac.setExtdirs(extdirs); +info.append(extension dir= + exts + \n); +} // Configure the compiler object javac.setEncoding(javaEncoding); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
remm2003/08/04 08:09:41 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: - Release servlet writer after compilation (bug 22103). - Submitted by Gilles Scokart. Revision ChangesPath 1.67 +4 -0 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.66 retrieving revision 1.67 diff -u -r1.66 -r1.67 --- Compiler.java 28 Jul 2003 18:47:30 - 1.66 +++ Compiler.java 4 Aug 2003 15:09:41 - 1.67 @@ -469,6 +469,10 @@ project = null; pageInfo = null; pageNodes = null; +if (ctxt.getWriter() != null) { +ctxt.getWriter().close(); +ctxt.setWriter(null); +} } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java Validator.java PageInfo.java
luehe 2003/08/04 15:55:45 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Validator.java PageInfo.java Log: Have 'isELIgnored' page directive attribute take precendence over JSP config el-ignored. This is according to the spec. Revision ChangesPath 1.68 +10 -11 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.67 retrieving revision 1.68 diff -u -r1.67 -r1.68 --- Compiler.java 4 Aug 2003 15:09:41 - 1.67 +++ Compiler.java 4 Aug 2003 22:55:44 - 1.68 @@ -209,17 +209,16 @@ JspConfig.JspProperty jspProperty = jspConfig.findJspProperty(ctxt.getJspFile()); - // If the current uri is matched by a pattern specified in - // a jsp-property-group in web.xml, initialize pageInfo with - // those properties. - if (jspProperty.isELIgnored() != null) { - pageInfo.setELIgnoredSpecified(true); - } - pageInfo.setELIgnored(JspUtil.booleanValue(jspProperty.isELIgnored())); - pageInfo.setScriptingInvalid(JspUtil.booleanValue(jspProperty.isScriptingInvalid())); - if (jspProperty.getIncludePrelude() != null) { - pageInfo.setIncludePrelude(jspProperty.getIncludePrelude()); - } +/* + * If the current uri is matched by a pattern specified in + * a jsp-property-group in web.xml, initialize pageInfo with + * those properties. + */ +pageInfo.setELIgnored(JspUtil.booleanValue(jspProperty.isELIgnored())); + pageInfo.setScriptingInvalid(JspUtil.booleanValue(jspProperty.isScriptingInvalid())); +if (jspProperty.getIncludePrelude() != null) { +pageInfo.setIncludePrelude(jspProperty.getIncludePrelude()); +} if (jspProperty.getIncludeCoda() != null) { pageInfo.setIncludeCoda(jspProperty.getIncludeCoda()); } 1.112 +5 -11 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java Index: Validator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v retrieving revision 1.111 retrieving revision 1.112 diff -u -r1.111 -r1.112 --- Validator.java23 Jul 2003 20:37:24 - 1.111 +++ Validator.java4 Aug 2003 22:55:44 - 1.112 @@ -196,10 +196,7 @@ } } else if (isELIgnored.equals(attr)) { if (pageInfo.getIsELIgnored() == null) { - if (!pageInfo.isELIgnoredSpecified()) { - // If specified in jsp-config, use it - pageInfo.setIsELIgnored(value, n, err, true); - } +pageInfo.setIsELIgnored(value, n, err, true); } else if (!pageInfo.getIsELIgnored().equals(value)) { err.jspError(n, jsp.error.page.conflict.iselignored, pageInfo.getIsELIgnored(), value); @@ -268,10 +265,7 @@ } } else if (isELIgnored.equals(attr)) { if (pageInfo.getIsELIgnored() == null) { - if (!pageInfo.isELIgnoredSpecified()) { - // If specified in jsp-config, use it - pageInfo.setIsELIgnored(value, n, err, false); - } +pageInfo.setIsELIgnored(value, n, err, false); } else if (!pageInfo.getIsELIgnored().equals(value)) { err.jspError(n, jsp.error.tag.conflict.iselignored, pageInfo.getIsELIgnored(), value); 1.36 +3 -12 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageInfo.java Index: PageInfo.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageInfo.java,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- PageInfo.java 1 Aug 2003 17:10:10 - 1.35 +++ PageInfo.java 4 Aug 2003 22:55:44 - 1.36 @@ -104,7 +104,6 @@ private boolean scriptingInvalid = false; private String isELIgnoredValue; private boolean isELIgnored = false; -private boolean elIgnoredSpecified = false; private String omitXmlDecl = null; private boolean isJspPrefixHijacked; @@ -194,14 +193,6 @@ public boolean
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java PageInfo.java ParserController.java
luehe 2003/07/28 11:47:30 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java PageInfo.java ParserController.java Log: Fixed Bugzilla 21823 (Compiler uses invoking page's PageInfo for handling tag files) Patch provided by [EMAIL PROTECTED] Revision ChangesPath 1.66 +0 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.65 retrieving revision 1.66 diff -u -r1.65 -r1.66 --- Compiler.java 26 Apr 2003 01:15:25 - 1.65 +++ Compiler.java 28 Jul 2003 18:47:30 - 1.66 @@ -212,13 +212,9 @@ // If the current uri is matched by a pattern specified in // a jsp-property-group in web.xml, initialize pageInfo with // those properties. - if (jspProperty.isXml() != null) { - pageInfo.setIsXmlConfigSpecified(true); - } if (jspProperty.isELIgnored() != null) { pageInfo.setELIgnoredSpecified(true); } - pageInfo.setIsXmlConfig(JspUtil.booleanValue(jspProperty.isXml())); pageInfo.setELIgnored(JspUtil.booleanValue(jspProperty.isELIgnored())); pageInfo.setScriptingInvalid(JspUtil.booleanValue(jspProperty.isScriptingInvalid())); if (jspProperty.getIncludePrelude() != null) { 1.34 +3 -25 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageInfo.java Index: PageInfo.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageInfo.java,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- PageInfo.java 23 Jul 2003 20:37:24 - 1.33 +++ PageInfo.java 28 Jul 2003 18:47:30 - 1.34 @@ -107,12 +107,6 @@ private boolean elIgnoredSpecified = false; private String omitXmlDecl = null; -// true if there is an is-xml element in the jsp-config -private boolean isXmlConfigSpecified = false; - -// The value of the is-xml element in the jsp-config -private boolean isXmlConfig = false; - // A custom tag is a tag file private boolean hasTagFile = false; @@ -211,22 +205,6 @@ public boolean isELIgnoredSpecified() { return elIgnoredSpecified; -} - -public boolean isXmlConfig() { - return isXmlConfig; -} - -public void setIsXmlConfig(boolean xml) { - isXmlConfig = xml; -} - -public boolean isXmlConfigSpecified() { - return isXmlConfigSpecified; -} - -public void setIsXmlConfigSpecified(boolean xmlSpecified) { - isXmlConfigSpecified = xmlSpecified; } public List getIncludePrelude() { 1.43 +6 -13 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ParserController.java Index: ParserController.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ParserController.java,v retrieving revision 1.42 retrieving revision 1.43 diff -u -r1.42 -r1.43 --- ParserController.java 21 May 2003 18:09:33 - 1.42 +++ ParserController.java 28 Jul 2003 18:47:30 - 1.43 @@ -82,7 +82,6 @@ private JspCompilationContext ctxt; private Compiler compiler; -private PageInfo pageInfo; private ErrorDispatcher err; /* @@ -114,7 +113,6 @@ public ParserController(JspCompilationContext ctxt, Compiler compiler) { this.ctxt = ctxt; this.compiler = compiler; - this.pageInfo = compiler.getPageInfo(); this.err = compiler.getErrorDispatcher(); } @@ -299,13 +297,6 @@ * Determines the syntax (standard or XML) and page encoding properties * for the given file, and stores them in the 'isXml' and 'sourceEnc' * instance variables, respectively. - * - * The properties may already be specified in a JSP property group: Notice - * that while the 'isXml' property applies to an entire translation unit - * (and therefore needs to be checked only for the top-level file), the - * 'page-encoding' property must be checked separately for the top-level - * and each of its included files, unless they're in XML syntax (in which - * case the page encoding is determined according to the XML spec). */ private void determineSyntaxAndEncoding(String absFileName, JarFile jarFile, @@ -327,10 +318,12 @@ */ boolean revert = false; -
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java Generator.java TagFileProcessor.java
luehe 2003/03/28 15:15:46 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Generator.java TagFileProcessor.java Log: Implemented latest JSP 2.0 spec changes regarding dynamic attributes in Tag Files: - Dynamic attributes are exposed in a Map named for the value of the dynamic-attributes tag-directive attribute - The Map contains each dynamic attribute name as the key and the dynamic attribute value as the corresponding value. Only dynamic attributes with no uri are to be present in the Map; all other dynamic attributes are ignored. Revision ChangesPath 1.62 +1 -0 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.61 retrieving revision 1.62 diff -u -r1.61 -r1.62 --- Compiler.java 28 Mar 2003 02:13:02 - 1.61 +++ Compiler.java 28 Mar 2003 23:15:45 - 1.62 @@ -196,6 +196,7 @@ throws Exception { long t1=System.currentTimeMillis(); + // Setup page info area pageInfo = new PageInfo(new BeanRepository(ctxt.getClassLoader(), errDispatcher)); 1.177 +18 -22 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.176 retrieving revision 1.177 diff -u -r1.176 -r1.177 --- Generator.java24 Mar 2003 17:35:26 - 1.176 +++ Generator.java28 Mar 2003 23:15:45 - 1.177 @@ -2880,7 +2880,7 @@ gen.compileTagHandlerPoolList(page); } if (gen.ctxt.isTagFile()) { - TagInfo tagInfo = gen.ctxt.getTagInfo(); + JasperTagInfo tagInfo = (JasperTagInfo) gen.ctxt.getTagInfo(); gen.generateTagHandlerPreamble(tagInfo, page); if (gen.ctxt.isPrototypeMode()) { @@ -2913,7 +2913,8 @@ /* * Generates tag handler preamble. */ -private void generateTagHandlerPreamble(TagInfo tagInfo, Node.Nodes tag ) +private void generateTagHandlerPreamble(JasperTagInfo tagInfo, + Node.Nodes tag ) throws JasperException { @@ -3063,7 +3064,7 @@ throws JasperException { if (tagInfo.hasDynamicAttributes()) { - out.printil(private java.util.HashMap dynamicAttrs = new java.util.HashMap();); + out.printil(private java.util.HashMap _jspx_dynamic_attrs = new java.util.HashMap();); } // Declare attributes @@ -3218,15 +3219,13 @@ public void generateSetDynamicAttribute() { out.printil(public void setDynamicAttribute(String uri, String localName, Object value) throws javax.servlet.jsp.JspException {); out.pushIndent(); - out.printil(if (uri != null)); - out.pushIndent(); - // XXX Specification still needs to clarify what the variable name - // looks like. Assume uri_localName for now. - out.printil(dynamicAttrs.put(uri + \_\ + localName, value);); - out.popIndent(); - out.printil(else); + /* + * According to the spec, only dynamic attributes with no uri are to + * be present in the Map; all other dynamic attributes are ignored. + */ + out.printil(if (uri == null)); out.pushIndent(); - out.printil(dynamicAttrs.put(localName, value);); + out.printil(_jspx_dynamic_attrs.put(localName, value);); out.popIndent(); out.popIndent(); out.printil(}); @@ -3237,7 +3236,7 @@ * Also, if the tag accepts dynamic attributes, a page-scoped variable * is made available for each dynamic attribute that was passed in. */ -private void generatePageScopedVariables(TagInfo tagInfo) { +private void generatePageScopedVariables(JasperTagInfo tagInfo) { // normal attributes TagAttributeInfo[] attrInfos = tagInfo.getAttributes(); @@ -3253,14 +3252,11 @@ out.popIndent(); } - // dynamic attributes + // Expose the Map containing dynamic attributes as a page-scoped var if (tagInfo.hasDynamicAttributes()) { - out.printil(for (java.util.Iterator i = dynamicAttrs.entrySet().iterator(); i.hasNext(); ) {); - out.pushIndent(); - out.printil(java.util.Map.Entry e = (java.util.Map.Entry) i.next();); - out.printil(pageContext.setAttribute((String) e.getKey(), e.getValue());); -
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java ELFunctionMapper.java JspDocumentParser.java Node.java Parser.java TagFileProcessor.java
luehe 2003/03/27 18:13:03 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java ELFunctionMapper.java JspDocumentParser.java Node.java Parser.java TagFileProcessor.java Log: Implemented cleaner separation of custom node construction for custom actions implemented via tag handlers vs. custom actions implemented via tag files Revision ChangesPath 1.61 +1 -0 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.60 retrieving revision 1.61 diff -u -r1.60 -r1.61 --- Compiler.java 24 Mar 2003 21:36:05 - 1.60 +++ Compiler.java 28 Mar 2003 02:13:02 - 1.61 @@ -199,6 +199,7 @@ // Setup page info area pageInfo = new PageInfo(new BeanRepository(ctxt.getClassLoader(), errDispatcher)); + JspConfig jspConfig = options.getJspConfig(); JspConfig.JspProperty jspProperty = jspConfig.findJspProperty(ctxt.getJspFile()); 1.5 +1 -1 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ELFunctionMapper.java Index: ELFunctionMapper.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ELFunctionMapper.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- ELFunctionMapper.java 25 Mar 2003 01:49:29 - 1.4 +++ ELFunctionMapper.java 28 Mar 2003 02:13:02 - 1.5 @@ -205,7 +205,7 @@ if (k != 0) { ds.append(, ); } - ds.append(params[k] + .class); + ds.append(Class.forName(\ + params[k] + \)); } ds.append(});\n); // Put the current name in the global function map 1.49 +16 -10 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java Index: JspDocumentParser.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java,v retrieving revision 1.48 retrieving revision 1.49 diff -u -r1.48 -r1.49 --- JspDocumentParser.java25 Mar 2003 00:57:46 - 1.48 +++ JspDocumentParser.java28 Mar 2003 02:13:02 - 1.49 @@ -654,7 +654,7 @@ localName, uri)); } Class tagHandlerClass = null; - if (tagFileInfo == null) { + if (tagInfo != null) { String handlerClassName = tagInfo.getTagClassName(); try { tagHandlerClass = ctxt.getClassLoader().loadClass(handlerClassName); @@ -663,9 +663,7 @@ Localizer.getMessage(jsp.error.loadclass.taghandler, handlerClassName, qName)); } - } else { -tagInfo = tagFileInfo.getTagInfo(); -} + } String prefix = ; int colon = qName.indexOf(':'); @@ -673,9 +671,17 @@ prefix = qName.substring(0, colon); } - return new Node.CustomTag(qName, prefix, localName, uri, attrs, - xmlnsAttrs, start, parent, tagInfo, - tagFileInfo, tagHandlerClass); + Node.CustomTag ret = null; + if (tagInfo != null) { + ret = new Node.CustomTag(qName, prefix, localName, uri, attrs, + xmlnsAttrs, start, parent, tagInfo, + tagHandlerClass); + } else { + ret = new Node.CustomTag(qName, prefix, localName, uri, attrs, + xmlnsAttrs, start, parent, tagFileInfo); + } + + return ret; } /* 1.69 +55 -29 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Node.java Index: Node.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Node.java,v retrieving revision 1.68 retrieving revision 1.69 diff -u -r1.68 -r1.69 --- Node.java 25 Mar 2003 00:57:46 - 1.68 +++ Node.java 28 Mar 2003 02:13:02 - 1.69 @@ -1239,49 +1239,75 @@ private Nodes atSTag; private Nodes atETag; + /* + * Constructor for custom action implemented by tag handler. + */ public CustomTag(String
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java JspDocumentParser.java Node.java PageDataImpl.java PageInfo.java Parser.java ParserController.java Validator.java
luehe 2003/03/24 13:36:05 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java JspDocumentParser.java Node.java PageDataImpl.java PageInfo.java Parser.java ParserController.java Validator.java Log: Implemented JSP 2.0 i18n-related spec change: Determine page encoding of included resources in the same fashion as page encoding of top-level page. This means that any included resources are now parsed using their own page encoding, instead of leveraging the page encoding of the top-level page. This also means that the page-encoding subelement of jsp-property-group no longer applies to an entire translation unit, but individual pages (whose URIs match the property group's URL pattern). Revision ChangesPath 1.60 +0 -1 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.59 retrieving revision 1.60 diff -u -r1.59 -r1.60 --- Compiler.java 19 Mar 2003 20:51:34 - 1.59 +++ Compiler.java 24 Mar 2003 21:36:05 - 1.60 @@ -213,7 +213,6 @@ pageInfo.setELIgnoredSpecified(true); } pageInfo.setIsXmlConfig(JspUtil.booleanValue(jspProperty.isXml())); - pageInfo.setConfigEncoding(jspProperty.getPageEncoding()); pageInfo.setELIgnored(JspUtil.booleanValue(jspProperty.isELIgnored())); pageInfo.setScriptingInvalid(JspUtil.booleanValue(jspProperty.isScriptingInvalid())); if (jspProperty.getIncludePrelude() != null) { 1.47 +42 -37 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java Index: JspDocumentParser.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspDocumentParser.java,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- JspDocumentParser.java1 Mar 2003 02:07:52 - 1.46 +++ JspDocumentParser.java24 Mar 2003 21:36:05 - 1.47 @@ -144,34 +144,39 @@ InputStream inStream, Node parent, boolean isTagFile, -boolean directivesOnly) +boolean directivesOnly, +String pageEnc, +String jspConfigPageEnc) throws JasperException { - JspDocumentParser handler = new JspDocumentParser(pc, path, inStream, - isTagFile, - directivesOnly); + JspDocumentParser jspDocParser = new JspDocumentParser(pc, path, +inStream, +isTagFile, +directivesOnly); + // It's an error to have a prelude or a coda associated with // a JSP document - if (!handler.pageInfo.getIncludePrelude().isEmpty()) { - String file = (String) handler.pageInfo.getIncludePrelude().get(0); - handler.err.jspError(jsp.error.prelude.xml, path, file); - } - if (!handler.pageInfo.getIncludeCoda().isEmpty()) { - String file = (String) handler.pageInfo.getIncludeCoda().get(0); - handler.err.jspError(jsp.error.coda.xml, path, file); + if (!jspDocParser.pageInfo.getIncludePrelude().isEmpty()) { + String file = (String) jspDocParser.pageInfo.getIncludePrelude().get(0); + jspDocParser.err.jspError(jsp.error.prelude.xml, path, file); + } + if (!jspDocParser.pageInfo.getIncludeCoda().isEmpty()) { + String file = (String) jspDocParser.pageInfo.getIncludeCoda().get(0); + jspDocParser.err.jspError(jsp.error.coda.xml, path, file); } Node.Nodes pageNodes = null; - Node.Root jspRoot = null; try { - if (parent == null) { - // create dummy jsp:root element - jspRoot = new Node.Root(true); - handler.current = jspRoot; - } else { - handler.isTop = false; - handler.current = parent; + + // Create dummy root and initialize it with given page encodings + Node.Root dummyRoot = new Node.Root(null, parent, true); + dummyRoot.setPageEncoding(pageEnc); + dummyRoot.setJspConfigPageEncoding(jspConfigPageEnc); +
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
remm2003/03/17 01:16:32 Modified:jasper2/src/share/org/apache/jasper/compiler Tag: tomcat_4_branch Compiler.java Log: - Port patch from 5.x. - Avoid a NPE when JSPC is used with built-in compilation (which can be useful when working with individual JSPs). Revision ChangesPath No revision No revision 1.18.2.13 +6 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.18.2.12 retrieving revision 1.18.2.13 diff -u -r1.18.2.12 -r1.18.2.13 --- Compiler.java 17 Feb 2003 22:36:08 - 1.18.2.12 +++ Compiler.java 17 Mar 2003 09:16:32 - 1.18.2.13 @@ -161,7 +161,9 @@ logger.setMessageOutputLevel( Project.MSG_INFO ); } project.addBuildListener( logger ); -project.setBasedir( System.getProperty(catalina.home)); + if (System.getProperty(catalina.home) != null) { +project.setBasedir( System.getProperty(catalina.home)); +} if( options.getCompiler() != null ) { Constants.jasperLog.log(Compiler + options.getCompiler(), Logger.INFORMATION); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
remm2003/02/26 06:49:29 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: - Don't set the basedir if it's null. This can happen with JSPC. Revision ChangesPath 1.56 +3 -1 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.55 retrieving revision 1.56 diff -u -r1.55 -r1.56 --- Compiler.java 26 Feb 2003 00:11:37 - 1.55 +++ Compiler.java 26 Feb 2003 14:49:29 - 1.56 @@ -152,7 +152,9 @@ logger.setErrorPrintStream(System.err); logger.setMessageOutputLevel(Project.MSG_INFO); project.addBuildListener( logger); -project.setBasedir( System.getProperty(catalina.home)); +if (System.getProperty(catalina.home) != null) { +project.setBasedir( System.getProperty(catalina.home)); +} if( options.getCompiler() != null ) { if( log.isDebugEnabled() ) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java Generator.java Node.java PageDataImpl.java PageInfo.java ParserController.java Validator.java
luehe 2003/02/26 14:58:17 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Generator.java Node.java PageDataImpl.java PageInfo.java ParserController.java Validator.java Log: Fixed 17438: if omit-xml-decl is set to 'no' or 'false' no xml declaration is generated. Revision ChangesPath 1.57 +2 -2 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.56 retrieving revision 1.57 diff -u -r1.56 -r1.57 --- Compiler.java 26 Feb 2003 14:49:29 - 1.56 +++ Compiler.java 26 Feb 2003 22:58:15 - 1.57 @@ -207,12 +207,12 @@ // a jsp-property-group in web.xml, initialize pageInfo with // those properties. if (jspProperty.isXml() != null) { - pageInfo.setIsXmlSpecified(true); + pageInfo.setIsXmlConfigSpecified(true); } if (jspProperty.isELIgnored() != null) { pageInfo.setELIgnoredSpecified(true); } - pageInfo.setIsXml(JspUtil.booleanValue(jspProperty.isXml())); + pageInfo.setIsXmlConfig(JspUtil.booleanValue(jspProperty.isXml())); pageInfo.setConfigEncoding(jspProperty.getPageEncoding()); pageInfo.setELIgnored(JspUtil.booleanValue(jspProperty.isELIgnored())); pageInfo.setScriptingInvalid(JspUtil.booleanValue(jspProperty.isScriptingInvalid())); 1.169 +14 -8 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.168 retrieving revision 1.169 diff -u -r1.168 -r1.169 --- Generator.java26 Feb 2003 01:11:14 - 1.168 +++ Generator.java26 Feb 2003 22:58:15 - 1.169 @@ -594,16 +594,21 @@ } /** - * Generates a XML declaration + * Generates an XML declaration, under the following conditions: + * + * - 'omit-xml-declaration' attribute of jsp:output action is set to + * no or false + * - JSP document without a jsp:root */ private void generateXmlDeclaration(Node.Nodes page) { - if (page.getRoot().isXmlSyntax() ! pageInfo.hasJspRoot() - (pageInfo.getOmitXmlDecl() == null /* not specified */ || - ! JspUtil.booleanValue(pageInfo.getOmitXmlDecl( { + if (pageInfo.getOmitXmlDecl() != null + !JspUtil.booleanValue(pageInfo.getOmitXmlDecl()) + || (page.getRoot().isXmlSyntax() !pageInfo.hasJspRoot() + !ctxt.isTagFile())) { String cType = pageInfo.getContentType(); String charSet = cType.substring(cType.indexOf(charset=)+8); out.printil(out.write(\?xml version=\\\1.0\\\ encoding=\\\ + - charSet + \\\?\\n\);); + charSet + \\\?\\n\);); } } @@ -2969,6 +2974,7 @@ return; } + gen.generateXmlDeclaration(page); gen.fragmentHelperClass.generatePreamble(); page.visit(gen.new GenerateVisitor(gen.ctxt.isTagFile(), out, 1.64 +7 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Node.java Index: Node.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Node.java,v retrieving revision 1.63 retrieving revision 1.64 diff -u -r1.63 -r1.64 --- Node.java 26 Feb 2003 17:58:07 - 1.63 +++ Node.java 26 Feb 2003 22:58:15 - 1.64 @@ -400,6 +400,8 @@ */ Root(boolean isXmlSyntax) { this.isXmlSyntax = isXmlSyntax; + this.qName = JSP_ROOT_ACTION; + this.localName = ROOT_ACTION; } /* @@ -408,6 +410,8 @@ Root(Mark start, Node parent, boolean isXmlSyntax) { super(start, parent); this.isXmlSyntax = isXmlSyntax; + this.qName = JSP_ROOT_ACTION; + this.localName = ROOT_ACTION; // Figure out and set the parent root Node r = parent; 1.24 +11 -22 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageDataImpl.java Index: PageDataImpl.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/PageDataImpl.java,v retrieving revision 1.23
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
glenn 2003/02/17 14:36:00 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: An ant Project uses the current directory as its base directory by default. The base directory doesn't matter but ant always checks it. This can cause problems when using the SecurityManager with a strict policy. The Compiler now explicitely sets the ant Project base dir to catalina.home. Revision ChangesPath 1.53 +1 -0 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.52 retrieving revision 1.53 diff -u -r1.52 -r1.53 --- Compiler.java 12 Feb 2003 23:44:22 - 1.52 +++ Compiler.java 17 Feb 2003 22:36:00 - 1.53 @@ -152,6 +152,7 @@ logger.setErrorPrintStream(System.err); logger.setMessageOutputLevel(Project.MSG_INFO); project.addBuildListener( logger); +project.setBasedir( System.getProperty(catalina.home)); if( options.getCompiler() != null ) { if( log.isDebugEnabled() ) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
glenn 2003/02/17 14:36:08 Modified:jasper2/src/share/org/apache/jasper/compiler Tag: tomcat_4_branch Compiler.java Log: An ant Project uses the current directory as its base directory by default. The base directory doesn't matter but ant always checks it. This can cause problems when using the SecurityManager with a strict policy. The Compiler now explicitely sets the ant Project base dir to catalina.home. Revision ChangesPath No revision No revision 1.18.2.12 +5 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.18.2.11 retrieving revision 1.18.2.12 diff -u -r1.18.2.11 -r1.18.2.12 --- Compiler.java 10 Feb 2003 18:18:05 - 1.18.2.11 +++ Compiler.java 17 Feb 2003 22:36:08 - 1.18.2.12 @@ -161,7 +161,8 @@ logger.setMessageOutputLevel( Project.MSG_INFO ); } project.addBuildListener( logger ); - +project.setBasedir( System.getProperty(catalina.home)); + if( options.getCompiler() != null ) { Constants.jasperLog.log(Compiler + options.getCompiler(), Logger.INFORMATION); project.setProperty(build.compiler, options.getCompiler() ); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
luehe 2003/02/10 10:18:05 Modified:jasper2/src/share/org/apache/jasper/compiler Tag: tomcat_4_branch Compiler.java Log: Backport to TC 4.1.x: Fixed a NPE caused by nulling errorDispatcher: it is needed for Parser Revision ChangesPath No revision No revision 1.18.2.11 +7 -6 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.18.2.10 retrieving revision 1.18.2.11 diff -u -r1.18.2.10 -r1.18.2.11 --- Compiler.java 26 Jan 2003 18:55:51 - 1.18.2.10 +++ Compiler.java 10 Feb 2003 18:18:05 - 1.18.2.11 @@ -146,9 +146,6 @@ // Lazy eval - if we don't need to compile we probably don't need the project private Project getProject() { -if (errDispatcher == null) { -this.errDispatcher = new ErrorDispatcher(); -} if( project!=null ) return project; // Initializing project @@ -361,6 +358,10 @@ public void compile() throws FileNotFoundException, JasperException, Exception { +if (errDispatcher == null) { +this.errDispatcher = new ErrorDispatcher(); +} + try { generateJava(); generateClass(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
luehe 2003/02/07 11:19:26 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: fixed cause of NPE in JspDocumentParser Revision ChangesPath 1.50 +17 -15 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.49 retrieving revision 1.50 diff -u -r1.49 -r1.50 --- Compiler.java 30 Jan 2003 20:13:56 - 1.49 +++ Compiler.java 7 Feb 2003 19:19:25 - 1.50 @@ -199,24 +199,26 @@ JspConfig jspConfig = options.getJspConfig(); JspConfig.JspProperty jspProperty = jspConfig.findJspProperty(ctxt.getJspFile()); - if (jspProperty != null) { - // If the current uri is matched by a pattern specified in - // a jsp-property-group in web.xml, initialize pageInfo with - // those properties. - if (jspProperty.isXml() != null) { - pageInfo.setIsXmlSpecified(true); - } - if (jspProperty.isELIgnored() != null) { - pageInfo.setELIgnoredSpecified(true); - } - pageInfo.setIsXml(JspUtil.booleanValue(jspProperty.isXml())); - pageInfo.setPageEncoding(jspProperty.getPageEncoding()); - pageInfo.setELIgnored(JspUtil.booleanValue(jspProperty.isELIgnored())); - pageInfo.setScriptingInvalid(JspUtil.booleanValue(jspProperty.isScriptingInvalid())); + + // If the current uri is matched by a pattern specified in + // a jsp-property-group in web.xml, initialize pageInfo with + // those properties. + if (jspProperty.isXml() != null) { + pageInfo.setIsXmlSpecified(true); + } + if (jspProperty.isELIgnored() != null) { + pageInfo.setELIgnoredSpecified(true); + } + pageInfo.setIsXml(JspUtil.booleanValue(jspProperty.isXml())); + pageInfo.setPageEncoding(jspProperty.getPageEncoding()); + pageInfo.setELIgnored(JspUtil.booleanValue(jspProperty.isELIgnored())); + pageInfo.setScriptingInvalid(JspUtil.booleanValue(jspProperty.isScriptingInvalid())); + if (jspProperty.getIncludePrelude() != null) { pageInfo.setIncludePrelude(jspProperty.getIncludePrelude()); + } + if (jspProperty.getIncludeCoda() != null) { pageInfo.setIncludeCoda(jspProperty.getIncludeCoda()); } - String javaFileName = ctxt.getServletJavaFileName(); // Setup the ServletWriter - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
kinman 2003/01/30 12:13:56 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: - Fixed a NPE caused by nulling errorDispatcher: it is needed for Parser. Revision ChangesPath 1.49 +4 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.48 retrieving revision 1.49 diff -u -r1.48 -r1.49 --- Compiler.java 30 Jan 2003 03:22:01 - 1.48 +++ Compiler.java 30 Jan 2003 20:13:56 - 1.49 @@ -143,9 +143,6 @@ // Lazy eval - if we don't need to compile we probably don't need the project private Project getProject() { -if (errDispatcher == null) { -this.errDispatcher = new ErrorDispatcher(); -} if( project!=null ) return project; // Initializing project @@ -421,6 +418,10 @@ public void compile() throws FileNotFoundException, JasperException, Exception { +if (errDispatcher == null) { +this.errDispatcher = new ErrorDispatcher(); +} + try { generateJava(); generateClass(); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
luehe 2003/01/29 19:22:01 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: Capture javac error messages Revision ChangesPath 1.48 +1 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.47 retrieving revision 1.48 diff -u -r1.47 -r1.48 --- Compiler.java 26 Jan 2003 19:00:58 - 1.47 +++ Compiler.java 30 Jan 2003 03:22:01 - 1.48 @@ -153,10 +153,7 @@ logger = new JasperAntLogger(); logger.setOutputPrintStream(System.out); logger.setErrorPrintStream(System.err); - -if( log.isTraceEnabled() ) { -logger.setMessageOutputLevel( Project.MSG_VERBOSE ); -} + logger.setMessageOutputLevel(Project.MSG_INFO); project.addBuildListener( logger); if( options.getCompiler() != null ) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
glenn 2003/01/26 10:55:51 Modified:jasper2/src/share/org/apache/jasper/compiler Tag: tomcat_4_branch Compiler.java Log: Dereference those objects which are only used during the generation of the java class from the JSP source or used during the javac compile. This should reduce the memory footprint of Tomcat in production for those who use JSP and where JSP pages get compiled or recompiled on a production system. This should also improve performance by reducing the number of objects in the old generation, thus reducing GC overhead. Revision ChangesPath No revision No revision 1.18.2.10 +26 -6 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.18.2.9 retrieving revision 1.18.2.10 diff -u -r1.18.2.9 -r1.18.2.10 --- Compiler.java 31 Dec 2002 14:00:36 - 1.18.2.9 +++ Compiler.java 26 Jan 2003 18:55:51 - 1.18.2.10 @@ -140,13 +140,17 @@ public Compiler(JspCompilationContext ctxt, JspServletWrapper jsw) { this.jsw = jsw; this.ctxt = ctxt; - this.errDispatcher = new ErrorDispatcher(); this.options = ctxt.getOptions(); } // Lazy eval - if we don't need to compile we probably don't need the project private Project getProject() { + +if (errDispatcher == null) { +this.errDispatcher = new ErrorDispatcher(); +} if( project!=null ) return project; + // Initializing project project = new Project(); // XXX We should use a specialized logger to redirect to jasperlog @@ -237,6 +241,10 @@ // generate servlet .java file Generator.generate(writer, this, pageNodes); writer.close(); +// The writer is only used during the compile, dereference +// it in the JspCompilationContext when done to allow it +// to be GC'd and save memory. +ctxt.setWriter(null); } /** @@ -353,8 +361,20 @@ public void compile() throws FileNotFoundException, JasperException, Exception { -generateJava(); -generateClass(); +try { +generateJava(); +generateClass(); +} finally { +// Make sure these object which are only used during the +// generation and compilation of the JSP page get +// dereferenced so that they can be GC'd and reduce the +// memory footprint. +errDispatcher = null; +logger = null; +project = null; +pageInfo = null; +pageNodes = null; +} } /** -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
glenn 2003/01/26 11:00:58 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: Dereference those objects which are only used during the generation of the java class from the JSP source or used during the javac compile. This should reduce the memory footprint of Tomcat in production for those who use JSP and where JSP pages get compiled or recompiled on a production system. This should also improve performance by reducing the number of objects in the old generation, thus reducing GC overhead. Revision ChangesPath 1.47 +27 -6 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- Compiler.java 22 Jan 2003 20:39:28 - 1.46 +++ Compiler.java 26 Jan 2003 19:00:58 - 1.47 @@ -137,13 +137,17 @@ public Compiler(JspCompilationContext ctxt, JspServletWrapper jsw) { this.jsw = jsw; this.ctxt = ctxt; - this.errDispatcher = new ErrorDispatcher(); this.options = ctxt.getOptions(); } // Lazy eval - if we don't need to compile we probably don't need the project private Project getProject() { + +if (errDispatcher == null) { +this.errDispatcher = new ErrorDispatcher(); +} if( project!=null ) return project; + // Initializing project project = new Project(); logger = new JasperAntLogger(); @@ -275,6 +279,10 @@ // generate servlet .java file Generator.generate(writer, this, pageNodes); writer.close(); +// The writer is only used during the compile, dereference +// it in the JspCompilationContext when done to allow it +// to be GC'd and save memory. +ctxt.setWriter(null); long t4=System.currentTimeMillis(); if( t4-t1 500 ) { @@ -416,11 +424,24 @@ public void compile() throws FileNotFoundException, JasperException, Exception { -generateJava(); -generateClass(); - if (tfp != null) { - tfp.removeProtoTypeFiles(null); - } +try { +generateJava(); +generateClass(); +} finally { +if (tfp != null) { +tfp.removeProtoTypeFiles(null); +} +// Make sure these object which are only used during the +// generation and compilation of the JSP page get +// dereferenced so that they can be GC'd and reduce the +// memory footprint. +tfp = null; +errDispatcher = null; +logger = null; +project = null; +pageInfo = null; +pageNodes = null; +} } /** -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
glenn 2002/12/31 06:00:36 Modified:jasper2/src/share/org/apache/jasper Tag: tomcat_4_branch EmbededServletOptions.java JspC.java Options.java jasper2/src/share/org/apache/jasper/compiler Tag: tomcat_4_branch Compiler.java Log: Implement new Ant javac fork option. If set to true Ant forks a new process to compile JSP pages and does it without synchronization. Default is false. Revision ChangesPath No revision No revision 1.8.2.2 +21 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbededServletOptions.java Index: EmbededServletOptions.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbededServletOptions.java,v retrieving revision 1.8.2.1 retrieving revision 1.8.2.2 diff -u -r1.8.2.1 -r1.8.2.2 --- EmbededServletOptions.java8 Sep 2002 05:45:59 - 1.8.2.1 +++ EmbededServletOptions.java31 Dec 2002 14:00:36 - 1.8.2.2 @@ -89,6 +89,11 @@ public boolean development = true; /** + * Should Ant fork its java compiles of JSP pages. + */ +public boolean fork = false; + +/** * Do you want to keep the generated Java files around? */ public boolean keepGenerated = true; @@ -279,6 +284,10 @@ return javaEncoding; } +public boolean getFork() { +return fork; +} + /** * Create an EmbededServletOptions object using data available from * ServletConfig and ServletContext. @@ -428,6 +437,15 @@ String javaEncoding = config.getInitParameter(javaEncoding); if (javaEncoding != null) { this.javaEncoding = javaEncoding; +} + +String fork = config.getInitParameter(fork); +if (fork != null) { +if (fork.equalsIgnoreCase(true)) +this.fork = true; +else if (fork.equalsIgnoreCase(false)) +this.fork = false; +else Constants.message (jsp.warning.fork, Logger.WARNING); } // Setup the global Tag Libraries location cache for this 1.12.2.3 +7 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java Index: JspC.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java,v retrieving revision 1.12.2.2 retrieving revision 1.12.2.3 diff -u -r1.12.2.2 -r1.12.2.3 --- JspC.java 7 Nov 2002 08:46:53 - 1.12.2.2 +++ JspC.java 31 Dec 2002 14:00:36 - 1.12.2.3 @@ -303,6 +303,10 @@ return UTF-8; } +public boolean getFork() { +return false; +} + public String getClassPath() { if( classPath != null ) return classPath; 1.6.2.1 +8 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Options.java Index: Options.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Options.java,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -u -r1.6 -r1.6.2.1 --- Options.java 26 Jun 2002 16:50:38 - 1.6 +++ Options.java 31 Dec 2002 14:00:36 - 1.6.2.1 @@ -176,4 +176,9 @@ public String getJavaEncoding(); +/** + * boolean flag to tell Ant whether to fork JSP page compilations. + */ +public boolean getFork(); + } No revision No revision 1.18.2.9 +9 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.18.2.8 retrieving revision 1.18.2.9 diff -u -r1.18.2.8 -r1.18.2.9 --- Compiler.java 10 Dec 2002 21:29:59 - 1.18.2.8 +++ Compiler.java 31 Dec 2002 14:00:36 - 1.18.2.9 @@ -288,6 +288,7 @@ javac.setDebug(ctxt.getOptions().getClassDebugInfo()); javac.setSrcdir(srcPath); javac.setOptimize(! ctxt.getOptions().getClassDebugInfo() ); +javac.setFork(ctxt.getOptions().getFork()); info.append(srcDir= + srcPath + \n ); @@ -304,8 +305,12 @@ BuildException error=null; try { -synchronized(javacLock) { +if (ctxt.getOptions().getFork()) { javac.execute(); +} else { +synchronized(javacLock) {
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
glenn 2002/12/31 06:01:17 Modified:jasper2/src/share/org/apache/jasper EmbededServletOptions.java JspC.java Options.java jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: Implement new Ant javac fork option. If set to true Ant forks a new process to compile JSP pages and does it without synchronization. Default is false. Revision ChangesPath 1.16 +21 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbededServletOptions.java Index: EmbededServletOptions.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbededServletOptions.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- EmbededServletOptions.java8 Dec 2002 13:42:52 - 1.15 +++ EmbededServletOptions.java31 Dec 2002 14:01:17 - 1.16 @@ -91,6 +91,11 @@ private boolean development = true; /** + * Should Ant fork its java compiles of JSP pages. + */ +public boolean fork = false; + +/** * Do you want to keep the generated Java files around? */ private boolean keepGenerated = true; @@ -303,6 +308,10 @@ return javaEncoding; } +public boolean getFork() { +return fork; +} + public JspConfig getJspConfig() { return jspConfig; } @@ -479,6 +488,15 @@ String javaEncoding = config.getInitParameter(javaEncoding); if (javaEncoding != null) { this.javaEncoding = javaEncoding; +} + +String fork = config.getInitParameter(fork); +if (fork != null) { +if (fork.equalsIgnoreCase(true)) +this.fork = true; +else if (fork.equalsIgnoreCase(false)) +this.fork = false; +else Constants.message (jsp.warning.fork, Logger.WARNING); } // Setup the global Tag Libraries location cache for this 1.20 +7 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java Index: JspC.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- JspC.java 4 Dec 2002 00:48:42 - 1.19 +++ JspC.java 31 Dec 2002 14:01:17 - 1.20 @@ -311,6 +311,10 @@ return UTF-8; } +public boolean getFork() { +return false; +} + public String getClassPath() { if( classPath != null ) return classPath; 1.11 +8 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Options.java Index: Options.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Options.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- Options.java 4 Dec 2002 00:48:42 - 1.10 +++ Options.java 31 Dec 2002 14:01:17 - 1.11 @@ -170,6 +170,11 @@ public String getJavaEncoding(); /** + * boolean flag to tell Ant whether to fork JSP page compilations. + */ +public boolean getFork(); + +/** * Obtain JSP configuration informantion specified in web.xml. */ public JspConfig getJspConfig(); 1.45 +6 -1 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- Compiler.java 11 Dec 2002 07:51:20 - 1.44 +++ Compiler.java 31 Dec 2002 14:01:17 - 1.45 @@ -357,6 +357,7 @@ javac.setDebug(ctxt.getOptions().getClassDebugInfo()); javac.setSrcdir(srcPath); javac.setOptimize(! ctxt.getOptions().getClassDebugInfo() ); +javac.setFork(ctxt.getOptions().getFork()); info.append(srcDir= + srcPath + \n ); // Set the Java compiler to use @@ -372,8 +373,12 @@ info.append(include=+ ctxt.getJspPath() + \n ); try { -synchronized(javacLock) { +if (ctxt.getOptions().getFork()) { javac.execute(); +} else { +synchronized(javacLock) { +javac.execute(); +} } } catch (BuildException e) { log.error( Javac
Re: cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
Remy Maucherat wrote: [EMAIL PROTECTED] wrote: costin 2002/12/10 16:38:29 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: Remove getCanonicalPath. This may not be a good idea, and I think would break Jasper on Windows. I'll revert it, if you don't mind. I added it in my previous patch, it wasn't there before - and it broke something. ( I added it because the path looked strange on windows - with a \/file.java in it, but it works fine without getCanonicalPath and it seems it doesn't if getCP is added ) Costin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
costin 2002/12/10 13:29:59 Modified:jasper2/src/share/org/apache/jasper/compiler Tag: tomcat_4_branch Compiler.java Log: A small fix that may help resolving the ant test failures and debug the compile errors related with javac. In case of a compile error we'll log the config used for compilation ( classpath, etc ) as well as the full exception thrown by ant while compiling. Revision ChangesPath No revision No revision 1.18.2.8 +25 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.18.2.7 retrieving revision 1.18.2.8 diff -u -r1.18.2.7 -r1.18.2.8 --- Compiler.java 24 Oct 2002 11:55:57 - 1.18.2.7 +++ Compiler.java 10 Dec 2002 21:29:59 - 1.18.2.8 @@ -249,6 +249,10 @@ String javaFileName = ctxt.getServletJavaFileName(); String classpath = ctxt.getClassPath(); +StringBuffer info=new StringBuffer(); +info.append(Compile: javaFileName= + javaFileName + \n ); +info.append(classpath= + classpath + \n ); + String sep = System.getProperty(path.separator); StringBuffer errorReport = new StringBuffer(); @@ -269,12 +273,15 @@ String pathElement = tokenizer.nextToken(); File repository = new File(pathElement); path.setLocation(repository); +info.append( cp= + repository + \n); } // Initializing sourcepath Path srcPath = new Path(project); srcPath.setLocation(options.getScratchDir()); +info.append( work dir= + options.getScratchDir() + \n); + // Configure the compiler object javac.setEncoding(javaEncoding); javac.setClasspath(path); @@ -282,21 +289,28 @@ javac.setSrcdir(srcPath); javac.setOptimize(! ctxt.getOptions().getClassDebugInfo() ); +info.append(srcDir= + srcPath + \n ); + // Set the Java compiler to use if (options.getCompiler() != null) { javac.setCompiler(options.getCompiler()); +info.append(compiler= + options.getCompiler() + \n); } // Build includes path PatternSet.NameEntry includes = javac.createInclude(); includes.setName(ctxt.getJspPath()); +info.append(include=+ ctxt.getJspPath() + \n ); +BuildException error=null; try { synchronized(javacLock) { javac.execute(); } } catch (BuildException e) { success = false; +error=e; +info.append(Exception compiling + e.toString() + \n); } errorReport.append(logger.getReport()); @@ -316,8 +330,16 @@ if (!success) { Constants.jasperLog.log( Error compiling file: + javaFileName + + errorReport, Logger.ERROR); +Constants.jasperLog.log( Info: + info.toString(), + Logger.ERROR); +if( error != null ) { +Constants.jasperLog.log( Exception: , error ); +error.printStackTrace(); +} + errDispatcher.javacError(errorReport.toString(), javaFileName, pageNodes); } + } /** -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
costin 2002/12/10 13:38:01 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: Port the fixes to main. This adds more debug info on compiler errors. Revision ChangesPath 1.42 +16 -2 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.41 retrieving revision 1.42 diff -u -r1.41 -r1.42 --- Compiler.java 8 Dec 2002 13:42:53 - 1.41 +++ Compiler.java 10 Dec 2002 21:38:00 - 1.42 @@ -318,6 +318,10 @@ StringBuffer errorReport = new StringBuffer(); boolean success = true; +StringBuffer info=new StringBuffer(); +info.append(Compile: javaFileName= + javaFileName + \n ); +info.append(classpath= + classpath + \n ); + // Start capturing the System.err output for this thread SystemLogHandler.setThread(); @@ -328,11 +332,13 @@ // Initializing classpath Path path = new Path(project); path.setPath(System.getProperty(java.class.path)); +info.append( cp= + System.getProperty(java.class.path) + \n); StringTokenizer tokenizer = new StringTokenizer(classpath, sep); while (tokenizer.hasMoreElements()) { String pathElement = tokenizer.nextToken(); File repository = new File(pathElement); path.setLocation(repository); +info.append( cp= + repository + \n); } if( log.isDebugEnabled() ) @@ -343,28 +349,36 @@ Path srcPath = new Path(project); srcPath.setLocation(options.getScratchDir()); +info.append( work dir= + options.getScratchDir() + \n); + // Configure the compiler object javac.setEncoding(javaEncoding); javac.setClasspath(path); javac.setDebug(ctxt.getOptions().getClassDebugInfo()); javac.setSrcdir(srcPath); javac.setOptimize(! ctxt.getOptions().getClassDebugInfo() ); +info.append(srcDir= + srcPath + \n ); // Set the Java compiler to use if (options.getCompiler() != null) { javac.setCompiler(options.getCompiler()); +info.append(compiler= + options.getCompiler() + \n); } // Build includes path PatternSet.NameEntry includes = javac.createInclude(); -includes.setName(ctxt.getJspPath()); +File f=new File( ctxt.getJspPath()); + +includes.setName(f.getCanonicalPath()); +info.append(include=+ ctxt.getJspPath() + \n ); try { synchronized(javacLock) { javac.execute(); } } catch (BuildException e) { -log.error( Javac exception , e); +log.error( Javac execption , e); +log.error( Env: + info.toString()); success = false; } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
costin 2002/12/10 16:38:29 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: Remove getCanonicalPath. Revision ChangesPath 1.43 +1 -2 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.42 retrieving revision 1.43 diff -u -r1.42 -r1.43 --- Compiler.java 10 Dec 2002 21:38:00 - 1.42 +++ Compiler.java 11 Dec 2002 00:38:29 - 1.43 @@ -367,9 +367,8 @@ // Build includes path PatternSet.NameEntry includes = javac.createInclude(); -File f=new File( ctxt.getJspPath()); -includes.setName(f.getCanonicalPath()); +includes.setName( includes.setName(ctxt.getJspPath()); info.append(include=+ ctxt.getJspPath() + \n ); try { -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
remm2002/12/10 23:51:20 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: - Fix the build. - Not using a canonical path may be ok. I need more testing though (don't port that to 4.1.x ;-) ). Revision ChangesPath 1.44 +1 -1 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- Compiler.java 11 Dec 2002 00:38:29 - 1.43 +++ Compiler.java 11 Dec 2002 07:51:20 - 1.44 @@ -368,7 +368,7 @@ // Build includes path PatternSet.NameEntry includes = javac.createInclude(); -includes.setName( includes.setName(ctxt.getJspPath()); +includes.setName(ctxt.getJspPath()); info.append(include=+ ctxt.getJspPath() + \n ); try { -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
remm2002/10/24 04:55:57 Modified:jasper2/src/share/org/apache/jasper/compiler Tag: tomcat_4_branch Compiler.java Log: - Port javac syncing patch. Revision ChangesPath No revision No revision 1.18.2.7 +10 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.18.2.6 retrieving revision 1.18.2.7 diff -u -r1.18.2.6 -r1.18.2.7 --- Compiler.java 16 Sep 2002 13:39:20 - 1.18.2.6 +++ Compiler.java 24 Oct 2002 11:55:57 - 1.18.2.7 -109,6 +109,10 } +// Some javac are not thread safe; use a lock to serialize compilation, +static Object javacLock = new Object(); + + // - Instance Variables -288,7 +292,9 includes.setName(ctxt.getJspPath()); try { -javac.execute(); +synchronized(javacLock) { +javac.execute(); +} } catch (BuildException e) { success = false; } -- To unsubscribe, e-mail: mailto:tomcat-dev-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:tomcat-dev-help;jakarta.apache.org
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java Generator.java JspConfig.java PageInfo.java TagFileProcessor.java Validator.java
kinman 2002/10/09 10:41:13 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Generator.java JspConfig.java PageInfo.java TagFileProcessor.java Validator.java Log: - Modified because of spec changes syntax and semantic of turning on and off scripting and EL. Revision ChangesPath 1.36 +5 -2 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- Compiler.java 24 Sep 2002 21:24:58 - 1.35 +++ Compiler.java 9 Oct 2002 17:41:13 - 1.36 @@ -210,10 +210,13 @@ if (jspProperty.isXml() != null) { pageInfo.setIsXmlSpecified(true); } + if (jspProperty.isELIgnored() != null) { + pageInfo.setELIgnoredSpecified(true); + } pageInfo.setIsXml(JspUtil.booleanValue(jspProperty.isXml())); pageInfo.setPageEncoding(jspProperty.getPageEncoding()); - pageInfo.setELEnabled(JspUtil.booleanValue(jspProperty.isELEnabled())); - pageInfo.setScriptingEnabled(JspUtil.booleanValue(jspProperty.isScriptingEnabled())); + pageInfo.setELIgnored(JspUtil.booleanValue(jspProperty.isELIgnored())); + pageInfo.setScriptingInvalid(JspUtil.booleanValue(jspProperty.isScriptingInvalid())); pageInfo.setIncludePrelude(jspProperty.getIncludePrelude()); pageInfo.setIncludeCoda(jspProperty.getIncludeCoda()); } 1.109 +4 -4 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.108 retrieving revision 1.109 diff -u -r1.108 -r1.109 --- Generator.java8 Oct 2002 00:45:23 - 1.108 +++ Generator.java9 Oct 2002 17:41:13 - 1.109 @@ -826,7 +826,7 @@ public void visit(Node.ELExpression n) throws JasperException { n.setBeginJavaLine(out.getJavaLine()); -if ( pageInfo.isELEnabled() ) { +if ( !pageInfo.isELIgnored() ) { out.printil( out.write( + JspUtil.interpreterCall(this.isTagFile, 1.4 +51 -51 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspConfig.java Index: JspConfig.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspConfig.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- JspConfig.java24 Aug 2002 21:42:34 - 1.3 +++ JspConfig.java9 Oct 2002 17:41:13 - 1.4 @@ -90,8 +90,8 @@ private boolean initialized = false; private String defaultIsXml = null; // unspecified -private String defaultIsELEnabled = true; -private String defaultIsScriptingEnabled = true; +private String defaultIsELIgnored = null;// unspecified +private String defaultIsScriptingInvalid = false; public JspConfig(ServletContext ctxt) { this.ctxt = ctxt; @@ -109,7 +109,7 @@ ParserUtils pu = ParserUtils.createParserUtils(cl); TreeNode webApp = pu.parseXMLDocument(WEB_XML, is); if (webApp == null || !2.4.equals(webApp.findAttribute(version))) { - defaultIsELEnabled = false; + defaultIsELIgnored = true; return; } TreeNode jspConfig = webApp.findChild(jsp-config); @@ -126,8 +126,8 @@ Vector urlPatterns = new Vector(); String pageEncoding = null; - String scriptingEnabled = null; - String elEnabled = null; + String scriptingInvalid = null; + String elIgnored = null; String isXml = null; Vector includePrelude = new Vector(); Vector includeCoda = new Vector(); @@ -143,10 +143,10 @@ pageEncoding = element.getBody(); else if (is-xml.equals(tname)) isXml = element.getBody(); - else if (el-enabled.equals(tname)) - elEnabled = element.getBody(); - else if (scripting-enabled.equals(tname)) - scriptingEnabled = element.getBody(); + else if (el-ignored.equals(tname)) + elIgnored = element.getBody(); + else if
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
kinman 2002/09/11 14:07:53 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: - Applied Remy's fix from tomcat_4_branch. Revision ChangesPath 1.33 +13 -7 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- Compiler.java 11 Sep 2002 19:07:32 - 1.32 +++ Compiler.java 11 Sep 2002 21:07:53 - 1.33 @@ -74,6 +74,7 @@ import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Javac; import org.apache.tools.ant.types.Path; +import org.apache.tools.ant.types.PatternSet; import org.apache.jasper.JspCompilationContext; import org.apache.jasper.Constants; @@ -310,8 +311,8 @@ * Compile the jsp file from the current engine context */ public void generateClass() -throws FileNotFoundException, JasperException, Exception -{ +throws FileNotFoundException, JasperException, Exception { + long t1=System.currentTimeMillis(); String javaEncoding = UTF8; String javaFileName = ctxt.getServletJavaFileName(); @@ -331,8 +332,13 @@ // Initializing classpath Path path = new Path(project); -path.setPath(System.getProperty(java.class.path) + sep - + classpath); +path.setPath(System.getProperty(java.class.path)); +StringTokenizer tokenizer = new StringTokenizer(classpath, sep); +while (tokenizer.hasMoreElements()) { +String pathElement = tokenizer.nextToken(); +File repository = new File(pathElement); +path.setLocation(repository); +} if( log.isDebugEnabled() ) log.debug( Using classpath: + System.getProperty(java.class.path) + sep @@ -340,12 +346,11 @@ // Initializing sourcepath Path srcPath = new Path(project); -srcPath.setPath(options.getScratchDir().getAbsolutePath()); +srcPath.setLocation(options.getScratchDir()); // Configure the compiler object javac.setEncoding(javaEncoding); javac.setClasspath(path); -//javac.setDestdir(new File(options.getScratchDir().getAbsolutePath())); javac.setDebug(ctxt.getOptions().getClassDebugInfo()); javac.setSrcdir(srcPath); javac.setOptimize(! ctxt.getOptions().getClassDebugInfo() ); @@ -356,7 +361,8 @@ } // Build includes path -javac.setIncludes(ctxt.getJspPath()); +PatternSet.NameEntry includes = javac.createInclude(); +includes.setName(ctxt.getJspPath()); try { synchronized(javacLock) { -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
remm2002/09/09 03:57:50 Modified:jasper2/src/share/org/apache/jasper/compiler Tag: tomcat_4_branch Compiler.java Log: - Cleanup Ant path generation, as using Strings doesn't work correctly. This is more resources intensive than before, but at least it now works fine on Windows. - Provides a workaround for bug 12387. - Fixes problems if path contains spaces (may affect Unix also). Revision ChangesPath No revision No revision 1.18.2.5 +16 -10 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.18.2.4 retrieving revision 1.18.2.5 diff -u -r1.18.2.4 -r1.18.2.5 --- Compiler.java 8 Sep 2002 05:45:59 - 1.18.2.4 +++ Compiler.java 9 Sep 2002 10:57:50 - 1.18.2.5 @@ -77,6 +77,7 @@ import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Javac; import org.apache.tools.ant.types.Path; +import org.apache.tools.ant.types.PatternSet; import org.apache.jasper.JspCompilationContext; import org.apache.jasper.Constants; @@ -238,8 +239,8 @@ * Compile the jsp file from the current engine context */ public void generateClass() -throws FileNotFoundException, JasperException, Exception -{ +throws FileNotFoundException, JasperException, Exception { + String javaEncoding = ctxt.getOptions().getJavaEncoding(); String javaFileName = ctxt.getServletJavaFileName(); String classpath = ctxt.getClassPath(); @@ -258,17 +259,21 @@ // Initializing classpath Path path = new Path(project); -path.setPath(System.getProperty(java.class.path) + sep - + classpath); +path.setPath(System.getProperty(java.class.path)); +StringTokenizer tokenizer = new StringTokenizer(classpath, sep); +while (tokenizer.hasMoreElements()) { +String pathElement = tokenizer.nextToken(); +File repository = new File(pathElement); +path.setLocation(repository); +} // Initializing sourcepath Path srcPath = new Path(project); -srcPath.setPath(options.getScratchDir().getAbsolutePath()); +srcPath.setLocation(options.getScratchDir()); // Configure the compiler object javac.setEncoding(javaEncoding); javac.setClasspath(path); -//javac.setDestdir(new File(options.getScratchDir().getAbsolutePath())); javac.setDebug(ctxt.getOptions().getClassDebugInfo()); javac.setSrcdir(srcPath); javac.setOptimize(! ctxt.getOptions().getClassDebugInfo() ); @@ -279,7 +284,8 @@ } // Build includes path -javac.setIncludes(ctxt.getJspPath()); +PatternSet.NameEntry includes = javac.createInclude(); +includes.setName(ctxt.getJspPath()); try { javac.execute(); -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
glenn 2002/09/07 22:45:59 Modified:jasper2/src/share/org/apache/jasper Tag: tomcat_4_branch EmbededServletOptions.java jasper2/src/share/org/apache/jasper/compiler Tag: tomcat_4_branch Compiler.java Log: Update JSP compiles so that it works with both javac and jikes. The javaEncoding init parameter was only being used when generating the java source, and then only if UTF8 didn't work. Changed so that if a javaEncoding is configured it gets used both for generating the java source and for compiling. UTF8 is the default javaEncoding. Javac needed System.err captured but jikes needed the Ant DefaultLogger. Implement both so that error reporting works regardless of which compiler is used. In order to get jikes to work I had to do the following: Specify jikes using the init parameter compiler in conf/web.xml. On my Solaris system jikes would not work with UTF8 encoding so I set the javaEncoding init parameter to ISO-8859-1. In order to get reporting of the line number in the JSP page where the error occurred to work I had to define -Dbuild.compiler.emacs=true when starting Tomcat. There is one more twist if you use the Java SecurityManager. Ant's jikes compiler option executes jikes by using exec(jikes). This forces the current PATH to be searched for jikes. In order for this to work with the Java SecurityManager the following permission has to be granted. permission java.io.FilePermission ALL FILES, execute; This is not a permission you would want to grant. I had to modify the ant source so that I could specify the complete path to the jikes compiler using a property jikes.compiler.path so that only the following FilePermission was needed: permission java.io.FilePermission /usr/local/bin/jikes, execute; An enhancement request BUG 12038 has been filed for Ant requesting that the ability to specify a complete path be added. Revision ChangesPath No revision No revision 1.8.2.1 +8 -5 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbededServletOptions.java Index: EmbededServletOptions.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbededServletOptions.java,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -u -r1.8 -r1.8.2.1 --- EmbededServletOptions.java26 Jun 2002 16:50:37 - 1.8 +++ EmbededServletOptions.java8 Sep 2002 05:45:59 - 1.8.2.1 @@ -167,7 +167,7 @@ * Java platform encoding to generate the JSP * page servlet. */ -private String javaEncoding; +private String javaEncoding = UTF8; public String getProperty(String name ) { return settings.getProperty( name ); @@ -425,7 +425,10 @@ this.compiler = config.getInitParameter(compiler); -this.javaEncoding = config.getInitParameter(javaEncoding); +String javaEncoding = config.getInitParameter(javaEncoding); +if (javaEncoding != null) { +this.javaEncoding = javaEncoding; +} // Setup the global Tag Libraries location cache for this // web-application. No revision No revision 1.18.2.4 +38 -46 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.18.2.3 retrieving revision 1.18.2.4 diff -u -r1.18.2.3 -r1.18.2.4 --- Compiler.java 17 Aug 2002 00:14:23 - 1.18.2.3 +++ Compiler.java 8 Sep 2002 05:45:59 - 1.18.2.4 @@ -108,7 +108,6 @@ } - // - Instance Variables @@ -117,12 +116,14 @@ private ErrorDispatcher errDispatcher; private PageInfo pageInfo; private JspServletWrapper jsw; +private JasperAntLogger logger; protected Project project=null; protected Options options; protected Node.Nodes pageNodes; + // Constructor @@ -144,39 +145,44 @@ // Initializing project project = new Project(); // XXX We should use a specialized logger to redirect to jasperlog -//DefaultLogger bl=new JasperAntLogger(); -DefaultLogger bl=new DefaultLogger(); -bl.setOutputPrintStream(System.err); -bl.setErrorPrintStream(System.err); +logger = new
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
costin 2002/08/20 12:35:25 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: Switch to commons-logging instead of jasper's own logging. To enable debugging - use log4j.properties or the jdk1.4 config. Right now it uses the 'class name' convention - i.e. the name of the logger where you can enable debug is the class name. We could use a single logger for all jasper. I also added code to log the translation and compilation times - if they are more than 500ms. It can be removed before release ( or made configurable ), but for now it's good to know. Revision ChangesPath 1.29 +37 -12 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- Compiler.java 20 Aug 2002 03:52:18 - 1.28 +++ Compiler.java 20 Aug 2002 19:35:24 - 1.29 @@ -1,7 +1,4 @@ /* - * $Header$ - * $Revision$ - * $Date$ * * * @@ -98,7 +95,8 @@ * @author Mark Roth */ public class Compiler { - +private static org.apache.commons.logging.Log log= +org.apache.commons.logging.LogFactory.getLog( Compiler.class ); // - Static @@ -158,10 +156,14 @@ } else { bl.setMessageOutputLevel( Project.MSG_INFO ); } +if( log.isTraceEnabled() ) { +bl.setMessageOutputLevel( Project.MSG_VERBOSE ); +} project.addBuildListener( bl ); if( options.getCompiler() != null ) { -Constants.jasperLog.log(Compiler + options.getCompiler(), Logger.ERROR ); +if( log.isDebugEnabled() ) +log.debug(Compiler + options.getCompiler() ); project.setProperty(build.compiler, options.getCompiler() ); } project.init(); @@ -175,12 +177,13 @@ } static class JasperAntLogger extends DefaultLogger { +private static org.apache.commons.logging.Log log= +org.apache.commons.logging.LogFactory.getLog( Compiler.class ); protected void printMessage(final String message, final PrintStream stream, final int priority) { -Constants.jasperLog.log( message, Logger.INFORMATION ); +log.info( message ); } - } // - Public Methods @@ -192,6 +195,7 @@ public void generateJava() throws FileNotFoundException, JasperException, Exception { +long t1=System.currentTimeMillis(); // Setup page info area pageInfo = new PageInfo(new BeanRepository(ctxt.getClassLoader())); JspConfig jspConfig = options.getJspConfig(); @@ -255,6 +259,7 @@ // Validate and process attributes Validator.validate(this, pageNodes); +long t2=System.currentTimeMillis(); // Dump out the page (for debugging) // Dumper.dump(pageNodes); @@ -265,6 +270,8 @@ // this compilation unit. TagFileProcessor.loadTagFiles(this, pageNodes); +long t3=System.currentTimeMillis(); + // Determine which custom tag needs to declare which scripting vars ScriptingVariabler.set(pageNodes); @@ -272,6 +279,12 @@ Generator.generate(writer, this, pageNodes); writer.close(); +long t4=System.currentTimeMillis(); +if( t4-t1 500 ) { +log.info(Generated + javaFileName + total= + + (t4-t1) + generate= + ( t4-t3 ) + validate= + ( t2-t1 )); +} + //JSR45 Support - note this needs to be checked by a JSR45 guru SmapUtil.generateSmap(ctxt, pageNodes, true); } @@ -282,6 +295,7 @@ public void generateClass() throws FileNotFoundException, JasperException, Exception { +long t1=System.currentTimeMillis(); String javaEncoding = UTF8; String javaFileName = ctxt.getServletJavaFileName(); String classpath = ctxt.getClassPath(); @@ -303,6 +317,10 @@ path.setPath(System.getProperty(java.class.path) + sep + classpath); +if( log.isDebugEnabled() ) +log.debug( Using classpath: + System.getProperty(java.class.path) + sep + + classpath); + // Initializing sourcepath Path srcPath
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java ParserController.java TagFileProcessor.java TagLibraryInfoImpl.java
luehe 2002/08/20 16:35:31 Modified:jasper2/src/share/org/apache/jasper JspCompilationContext.java jasper2/src/share/org/apache/jasper/servlet JspServletWrapper.java jasper2/src/share/org/apache/jasper/compiler Compiler.java ParserController.java TagFileProcessor.java TagLibraryInfoImpl.java Log: Added support for tag files packaged in JARs. Revision ChangesPath 1.17 +27 -8 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java Index: JspCompilationContext.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspCompilationContext.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- JspCompilationContext.java20 Aug 2002 19:30:29 - 1.16 +++ JspCompilationContext.java20 Aug 2002 23:35:30 - 1.17 @@ -63,7 +63,7 @@ import java.io.*; import java.net.*; -import java.util.Set; +import java.util.*; import javax.servlet.ServletContext; import javax.servlet.jsp.tagext.TagInfo; @@ -89,6 +89,9 @@ */ public class JspCompilationContext { +private Hashtable tagFileJars; +private boolean isPackagedTagFile; + protected String servletClassName; protected String jspUri; private boolean isErrPage; @@ -148,6 +151,8 @@ baseURI += '/'; } this.rctxt=rctxt; + + this.tagFileJars = new Hashtable(); } public JspCompilationContext(String tagfile, @@ -155,12 +160,16 @@ Options options, ServletContext context, JspServletWrapper jsw, - JspRuntimeContext rctxt) { + JspRuntimeContext rctxt, + Hashtable tagFileJars) { this(tagfile, false, options, context, jsw, rctxt); this.isTagFile = true; this.tagInfo = tagInfo; -return; + this.tagFileJars = tagFileJars; + if (tagFileJars != null tagFileJars.get(tagfile) != null) { + isPackagedTagFile = true; + } } /* Methods to override */ @@ -268,7 +277,17 @@ } return path; } - + +/** + * Returns the tag-file-to-JAR-file mapping for tag files packaged in JARs. + * + * The mapping uses the tag file name as the key, and the JAR file + * containing the tag file as the value. + */ +public Hashtable getTagFileJars() { + return tagFileJars; +} + /* Common implementation */ /** @@ -521,7 +540,7 @@ public void compile() throws JasperException, FileNotFoundException { createCompiler(); - if (jspCompiler.isOutDated()) { + if (isPackagedTagFile || jspCompiler.isOutDated()) { try { jspCompiler.compile(); reload = true; 1.13 +7 -5 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServletWrapper.java Index: JspServletWrapper.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServletWrapper.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- JspServletWrapper.java6 Aug 2002 00:11:36 - 1.12 +++ JspServletWrapper.java20 Aug 2002 23:35:30 - 1.13 @@ -72,6 +72,7 @@ import java.io.IOException; import java.io.FileNotFoundException; +import java.util.Hashtable; import java.net.URL; import java.net.URLClassLoader; import java.net.MalformedURLException; @@ -134,14 +135,15 @@ */ public JspServletWrapper(ServletContext servletContext, Options options, String tagFilePath, TagInfo tagInfo, - JspRuntimeContext rctxt) + JspRuntimeContext rctxt, Hashtable tagFileJars) throws JasperException { this.config = null; // not used this.options = options; this.jspUri = tagFilePath; ctxt = new JspCompilationContext(jspUri, tagInfo, options, - servletContext, this, rctxt); + servletContext, this, rctxt, + tagFileJars); // Store tag file .java and .class files in standard location // (/tagfiles/org/apache/jsp/),
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java SmapUtil.java
kinman 2002/08/12 14:58:48 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java SmapUtil.java Log: - Turn on jsr045 support with bug fixes. Patch by Shawn Bayern [EMAIL PROTECTED] Revision ChangesPath 1.26 +5 -5 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- Compiler.java 6 Aug 2002 23:40:10 - 1.25 +++ Compiler.java 12 Aug 2002 21:58:48 - 1.26 @@ -253,7 +253,7 @@ writer.close(); //JSR45 Support - note this needs to be checked by a JSR45 guru - //XXX SmapUtil.generateSmap(ctxt, pageNodes, true); + SmapUtil.generateSmap(ctxt, pageNodes, true); } /** @@ -329,7 +329,7 @@ } //JSR45 Support - note this needs to be checked by a JSR45 guru - //XXX SmapUtil.installSmap(ctxt); + SmapUtil.installSmap(ctxt); } /** 1.4 +47 -46 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/SmapUtil.java Index: SmapUtil.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/SmapUtil.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- SmapUtil.java 16 Jul 2002 22:35:04 - 1.3 +++ SmapUtil.java 12 Aug 2002 21:58:48 - 1.4 @@ -73,7 +73,7 @@ */ public class SmapUtil { -static final boolean verbose = false; +private static final boolean verbose = false; //* // Constants @@ -139,10 +139,9 @@ File outSmap = new File(ctxt.getClassFileName() + .smap); File outServlet = new File(ctxt.getClassFileName()); SDEInstaller.install(outServlet, outSmap); -if( !ctxt.keepGenerated() ) { +//if( !ctxt.keepGenerated() ) { outSmap.delete(); -} - +//} } @@ -186,18 +185,19 @@ } else if (args.length == 3) { install(new File(args[0]), new File(args[1]), new File(args[2])); } else { -abort(Usage: command input class file + - attribute file output class file name\n + +System.err.println(Usage: command input class file + + attribute file output class file name\n + command input/output class file attribute file); } } static void install(File inClassFile, File attrFile, File outClassFile) -throws IOException { +throws IOException { new SDEInstaller(inClassFile, attrFile, outClassFile); } -static void install(File inOutClassFile, File attrFile) throws IOException { +static void install(File inOutClassFile, File attrFile) +throws IOException { File tmpFile = new File(inOutClassFile.getPath() + tmp); new SDEInstaller(inOutClassFile, attrFile, tmpFile); if (!inOutClassFile.delete()) { @@ -208,17 +208,13 @@ } } -static void abort(String msg) { -System.err.println(msg); -System.exit(1); -} - -SDEInstaller(File inClassFile, File attrFile, File outClassFile) throws IOException { +SDEInstaller(File inClassFile, File attrFile, File outClassFile) +throws IOException { if (!inClassFile.exists()) { -abort(no such file: + inClassFile); +throw new FileNotFoundException(no such file: + inClassFile); } if (!attrFile.exists()) { -abort(no such file: + attrFile); +throw new FileNotFoundException(no such file: + attrFile); } // get the bytes @@ -240,18 +236,22 @@ int len = (int)input.length(); byte[] bytes = new byte[len]; if (inStream.read(bytes, 0, len) != len) { -abort(expected size: + len); +throw new IOException(expected size: + len); } inStream.close(); return bytes; } -void addSDE() throws UnsupportedEncodingException { +void addSDE() throws UnsupportedEncodingException,
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
kinman 2002/07/16 16:40:06 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: - Generation of smap seems to cause the container to freeze occasionally. It is turned off for now; and will need to be debugged later. Revision ChangesPath 1.20 +5 -5 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- Compiler.java 16 Jul 2002 19:30:51 - 1.19 +++ Compiler.java 16 Jul 2002 23:40:06 - 1.20 @@ -245,7 +245,7 @@ writer.close(); //JSR45 Support - note this needs to be checked by a JSR45 guru - SmapUtil.generateSmap(ctxt, pageNodes, true); + //XXX SmapUtil.generateSmap(ctxt, pageNodes, true); } /** @@ -319,7 +319,7 @@ } //JSR45 Support - note this needs to be checked by a JSR45 guru - SmapUtil.installSmap(ctxt); + //XXX SmapUtil.installSmap(ctxt); } /** -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
costin 2002/06/20 19:28:47 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: Remove debug statements. Revision ChangesPath 1.18 +5 -5 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- Compiler.java 20 Jun 2002 22:55:12 - 1.17 +++ Compiler.java 21 Jun 2002 02:28:47 - 1.18 @@ -397,12 +397,12 @@ try { URL includeUrl = ctxt.getResource(include); if (includeUrl == null) { -System.out.println(Compiler: outdated, no includeUri + include ); +//System.out.println(Compiler: outdated, no includeUri + include ); return true; } if (includeUrl.openConnection().getLastModified() targetLastModified) { -System.out.println(Compiler: outdated, include old + include ); +//System.out.println(Compiler: outdated, include old + include ); return true; } } catch (Exception e) { -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
costin 2002/06/14 13:44:37 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: Split the compile() method in generateJava() and generateClass() - JspC only generates java, the compile is a separate step. Also split outdated check, so JspC can check the .java files and regenerate what changes. Revision ChangesPath 1.15 +56 -17 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- Compiler.java 12 Jun 2002 23:23:05 - 1.14 +++ Compiler.java 14 Jun 2002 20:44:37 - 1.15 @@ -79,7 +79,6 @@ import org.apache.jasper.JspCompilationContext; import org.apache.jasper.Constants; import org.apache.jasper.JasperException; -import org.apache.jasper.JspEngineContext; import org.apache.jasper.Options; import org.apache.jasper.logging.Logger; import org.apache.jasper.util.SystemLogHandler; @@ -121,7 +120,7 @@ protected Options options; - +protected Node.Nodes pageNodes; // Constructor @@ -175,9 +174,9 @@ /** * Compile the jsp file from the current engine context */ -public void compile() -throws FileNotFoundException, JasperException, Exception { - +public void generateJava() +throws FileNotFoundException, JasperException, Exception +{ // Setup page info area pageInfo = new PageInfo(new BeanRepository(ctxt.getClassLoader())); @@ -216,7 +215,7 @@ // Parse the file ParserController parserCtl = new ParserController(ctxt, this); - Node.Nodes pageNodes = parserCtl.parse(ctxt.getJspFile()); + pageNodes = parserCtl.parse(ctxt.getJspFile()); // Validate and process attributes Validator.validate(this, pageNodes); @@ -230,7 +229,16 @@ // generate servlet .java file Generator.generate(writer, this, pageNodes); writer.close(); +} +/** + * Compile the jsp file from the current engine context + */ +public void generateClass() +throws FileNotFoundException, JasperException, Exception +{ + String javaEncoding = UTF8; +String javaFileName = ctxt.getServletJavaFileName(); String classpath = ctxt.getClassPath(); String sep = System.getProperty(path.separator); @@ -292,6 +300,15 @@ } } +/** + * Compile the jsp file from the current engine context + */ +public void compile() +throws FileNotFoundException, JasperException, Exception +{ +generateJava(); +generateClass(); +} /** * This is a protected method intended to be overridden by @@ -299,6 +316,16 @@ * to do all the compilation. */ public boolean isOutDated() { +return isOutDated( true ); +} + +/** + * This is a protected method intended to be overridden by + * subclasses of Compiler. This is used by the compile method + * to do all the compilation. + * @param checkClass Verify the class file if true, only the .java file if false. + */ +public boolean isOutDated(boolean checkClass) { String jsp = ctxt.getJspFile(); @@ -306,7 +333,7 @@ try { URL jspUrl = ctxt.getResource(jsp); if (jspUrl == null) { -((JspEngineContext)ctxt).incrementRemoved(); +ctxt.incrementRemoved(); return false; } jspRealLastModified = jspUrl.openConnection().getLastModified(); @@ -315,19 +342,31 @@ return true; } -File classFile = new File(ctxt.getClassFileName()); -if (!classFile.exists()) { +long targetLastModified; +File targetFile; + +if( checkClass ) { +targetFile = new File(ctxt.getClassFileName()); +} else { +targetFile = new File( ctxt.getServletJavaFileName()); +} + +if (!targetFile.exists()) { return true; } -long classLastModified = classFile.lastModified(); -if (classLastModified jspRealLastModified) { +targetLastModified = targetFile.lastModified(); +if (targetLastModified jspRealLastModified) { return true; } -// Determine if compile time includes have been changed +// determine if compile time includes have been
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
remm2002/06/14 17:12:22 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: - Remove debug statement. Revision ChangesPath 1.16 +3 -4 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- Compiler.java 14 Jun 2002 20:44:37 - 1.15 +++ Compiler.java 15 Jun 2002 00:12:22 - 1.16 @@ -365,7 +365,6 @@ } HttpJspBase servlet = jsw.getServlet(); if (servlet == null) { -System.out.println(XXX No SERVLET, can't process includes); return true; } List includes = servlet.getIncludes(); -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java JspReader.java Parser.java ParserController.java CompileException.java ParseException.java
kinman 2002/06/07 13:04:28 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java JspReader.java Parser.java ParserController.java Removed: jasper2/src/share/org/apache/jasper/compiler CompileException.java ParseException.java Log: - Removed unused classes and methods. Revision ChangesPath 1.13 +3 -41 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- Compiler.java 5 Jun 2002 22:01:33 - 1.12 +++ Compiler.java 7 Jun 2002 20:04:27 - 1.13 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v 1.12 2002/06/05 22:01:33 kinman Exp $ - * $Revision: 1.12 $ - * $Date: 2002/06/05 22:01:33 $ + * $Header: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v 1.13 2002/06/07 20:04:27 kinman Exp $ + * $Revision: 1.13 $ + * $Date: 2002/06/07 20:04:27 $ * * * @@ -340,44 +340,6 @@ public JspCompilationContext getCompilationContext() { return ctxt; -} - - -/** - * Change the encoding for the reader if specified. - */ -public String changeEncodingIfNecessary(JspReader tmpReader) - throws JasperException { - - // A lot of code replicated from Parser.java - // Main aim is to get-it-to-work. - while (tmpReader.skipUntil(%@) != null) { - - tmpReader.skipSpaces(); - - // check if it is a page directive. - if (tmpReader.matches(page)) { - - tmpReader.advance(4); - tmpReader.skipSpaces(); - - try { - Attributes attrs = tmpReader.parseTagAttributes(); - String ct = attrs.getValue(contentType); - if (ct != null) { - int loc = ct.indexOf(charset=); - if (loc 0) { - String encoding = ct.substring(loc + 8); - return encoding; - } - } - } catch (ParseException ex) { - // Ignore the exception here, it will be caught later. - return null; - } - } - } - return null; } 1.5 +0 -217 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspReader.java Index: JspReader.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspReader.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- JspReader.java17 Apr 2002 01:42:54 - 1.4 +++ JspReader.java7 Jun 2002 20:04:27 - 1.5 @@ -457,223 +457,6 @@ } /** - * Parse an attribute/value pair, and store it in provided hash table. - * The attribute/value pair is defined by: - * pre - * av := spaces token spaces '=' spaces token spaces - * /pre - * Where emtoken/em is defined by codeparseToken/code and - * emspaces/em is defined by codeskipSpaces/code. - * The name is always considered case insensitive, hence stored in its - * lower case version. - * @param into The Hashtable instance to save the result to. - */ -private void parseAttributeValue(AttributesImpl into) - throws JasperException { - // Get the attribute name: - skipSpaces(); - String name = parseToken(false); - // Check for an equal sign: - skipSpaces(); - if (peekChar() != '=') { - err.jspError(mark(), jsp.error.attr.novalue, name); - } - char ch = (char) nextChar(); - // Get the attribute value: - skipSpaces(); - String value = parseToken(true); - skipSpaces(); - // Add the binding to the provided hashtable: -//TODO review if the empty namespace works, or if we should get another one -//TODO do we want to use typw to indicate rt expression/scripting vlaue? - into.addAttribute(, name, name, CDATA, value); - return; -} - -/** - * Parse some tag attributes for Beans. - * The stream is assumed to be positioned right after the tag name. The - * syntax recognized is: - * pre - * tag-attrs := empty | attr-list (gt; | --gt; | %gt;) - * attr-list := empty | av
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
remm2002/05/30 22:13:13 Modified:jasper2/src/share/org/apache/jasper EmbededServletOptions.java JspC.java Options.java jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: - Refactoring part 3. - Remove outdated compiler options. - Add new compiler option, which accepts the Ant name of the compiler. Revision ChangesPath 1.5 +11 -41 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbededServletOptions.java Index: EmbededServletOptions.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbededServletOptions.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- EmbededServletOptions.java11 May 2002 05:00:21 - 1.4 +++ EmbededServletOptions.java31 May 2002 05:13:13 - 1.5 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbededServletOptions.java,v 1.4 2002/05/11 05:00:21 remm Exp $ - * $Revision: 1.4 $ - * $Date: 2002/05/11 05:00:21 $ + * $Header: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbededServletOptions.java,v 1.5 2002/05/31 05:13:13 remm Exp $ + * $Revision: 1.5 $ + * $Date: 2002/05/31 05:13:13 $ * * * @@ -145,14 +145,9 @@ public String classpath = null; /** - * Plugin class to use to compile JSP pages. + * Compiler to use. */ -public Class jspCompilerPlugin = null; - -/** - * Path of the compiler to use for compiling JSP pages. - */ -public String jspCompilerPath = null; +public String compiler = null; /** * Cache for the TLD locations @@ -244,19 +239,12 @@ } /** - * What compiler plugin should I use to compile the servlets - * generated from JSP files? + * Compiler to use. */ -public Class getJspCompilerPlugin() { -return jspCompilerPlugin; +public String getCompiler() { +return compiler; } -/** - * Path of the compiler to use for compiling JSP pages. - */ -public String getJspCompilerPath() { -return jspCompilerPath; -} public TldLocationsCache getTldLocationsCache() { return tldLocationsCache; @@ -385,33 +373,15 @@ scratchDir.getAbsolutePath() }, Logger.FATAL); -String jspCompilerPath = config.getInitParameter(jspCompilerPath); -if (jspCompilerPath != null) { -if (new File(jspCompilerPath).exists()) { -this.jspCompilerPath = jspCompilerPath; -} else { -Constants.message(jsp.warning.compiler.path.notfound, - new Object[] { jspCompilerPath }, - Logger.FATAL); -} -} - -String jspCompilerPlugin = config.getInitParameter(jspCompilerPlugin); -if (jspCompilerPlugin != null) { -try { -this.jspCompilerPlugin = Class.forName(jspCompilerPlugin); -} catch (ClassNotFoundException cnfe) { -Constants.message(jsp.warning.compiler.class.notfound, - new Object[] { jspCompilerPlugin }, - Logger.FATAL); -} -} +this.compiler = config.getInitParameter(compiler); this.javaEncoding = config.getInitParameter(javaEncoding); // Setup the global Tag Libraries location cache for this // web-application. tldLocationsCache = new TldLocationsCache(context); + } + } 1.5 +11 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java Index: JspC.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- JspC.java 16 May 2002 00:43:15 - 1.4 +++ JspC.java 31 May 2002 05:13:13 - 1.5 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java,v 1.4 2002/05/16 00:43:15 kinman Exp $ - * $Revision: 1.4 $ - * $Date: 2002/05/16 00:43:15 $ + * $Header: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java,v 1.5 2002/05/31 05:13:13 remm Exp $ + * $Revision: 1.5 $ + * $Date: 2002/05/31 05:13:13 $ * *
Re: cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
But I have one question. When the dust settles will I still be able to configure and use jikes as an external JSP java source compiler? Looking at the source in Ant, I think if you put jikes as the compiler parameter, and put the Jikes executable in your path (Ant doesn't support specifying the compiler path), it should work. That's the theory; I don't know how well it works in practice ;-) Part 4 of the refactoring is removing the now useless classes and interfaces. Part 5 is making JspC work again :) Note: I noticed the Ant compiler only works with Ant 1.5, so be sure to use Ant 1.5 Beta 1. Remy -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
remm02/05/23 16:34:45 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: - Misc improvements (non static, no sync). Revision ChangesPath 1.6 +35 -95 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- Compiler.java 23 May 2002 06:53:23 - 1.5 +++ Compiler.java 23 May 2002 23:34:45 - 1.6 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v 1.5 2002/05/23 06:53:23 remm Exp $ - * $Revision: 1.5 $ - * $Date: 2002/05/23 06:53:23 $ + * $Header: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v 1.6 2002/05/23 23:34:45 remm Exp $ + * $Revision: 1.6 $ + * $Date: 2002/05/23 23:34:45 $ * * * @@ -94,32 +94,10 @@ // - Static -protected static Project project; -protected static Javac javac; -protected static Path path; -protected static Path srcPath; - -protected static CompilerBuildListener listener; - static { System.setErr(new SystemLogHandler(System.err)); -// Initializing project -project = new Project(); -project.init(); - -// Initializing javac task -javac = (Javac) project.createTask(javac); - -// Initializing paths -path = new Path(project); -srcPath = new Path(project); - -// Initializing listener -listener = new CompilerBuildListener(); -project.addBuildListener(listener); - } @@ -132,6 +110,8 @@ private ErrorDispatcher errDispatcher; private PageInfo pageInfo; +protected Project project; + // Constructor @@ -139,6 +119,9 @@ public Compiler(JspCompilationContext ctxt) { this.ctxt = ctxt; this.errDispatcher = new ErrorDispatcher(); +// Initializing project +project = new Project(); +project.init(); } @@ -212,43 +195,43 @@ String errorReport = null; boolean success = true; -// Call the actual Java compiler -synchronized (project) { - -path.setPath(System.getProperty(java.class.path) + sep - + classpath); -srcPath.setPath(ctxt.getOutputDir()); - -/* - * Configure the compiler object - */ -javac.setEncoding(javaEncoding); -javac.setClasspath(path); -if (ctxt.getJavacOutputDir() != null) { -javac.setDestdir(new File(ctxt.getJavacOutputDir())); -} -javac.setDebug(ctxt.getOptions().getClassDebugInfo()); -javac.setSrcdir(srcPath); - -listener.clear(); +// Initializing javac task +Javac javac = (Javac) project.createTask(javac); -SystemLogHandler.setThread(); +// Initializing paths +Path path = new Path(project); +Path srcPath = new Path(project); -try { -javac.execute(); -} catch (BuildException e) { -success = false; -} +path.setPath(System.getProperty(java.class.path) + sep + + classpath); +srcPath.setPath(ctxt.getOutputDir()); + +/* + * Configure the compiler object + */ +javac.setEncoding(javaEncoding); +javac.setClasspath(path); +if (ctxt.getJavacOutputDir() != null) { +javac.setDestdir(new File(ctxt.getJavacOutputDir())); +} +javac.setDebug(ctxt.getOptions().getClassDebugInfo()); +javac.setSrcdir(srcPath); -errorReport = SystemLogHandler.unsetThread(); +SystemLogHandler.setThread(); +try { +javac.execute(); +} catch (BuildException e) { +success = false; } +errorReport = SystemLogHandler.unsetThread(); + if (!ctxt.keepGenerated()) { File javaFile = new File(javaFileName); javaFile.delete(); } - + if (!success) { errDispatcher.javacError(errorReport, javaFileName, pageNodes); } @@ -363,49 +346,6 @@
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler Compiler.java
remm02/05/23 18:15:27 Modified:jasper2/src/share/org/apache/jasper/compiler Compiler.java Log: - Use Ant includes to only select one JSP file at a time for compilation. Revision ChangesPath 1.7 +31 -19 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java Index: Compiler.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- Compiler.java 23 May 2002 23:34:45 - 1.6 +++ Compiler.java 24 May 2002 01:15:27 - 1.7 @@ -1,7 +1,7 @@ /* - * $Header: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v 1.6 2002/05/23 23:34:45 remm Exp $ - * $Revision: 1.6 $ - * $Date: 2002/05/23 23:34:45 $ + * $Header: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Compiler.java,v 1.7 2002/05/24 01:15:27 remm Exp $ + * $Revision: 1.7 $ + * $Date: 2002/05/24 01:15:27 $ * * * @@ -76,6 +76,7 @@ import org.apache.jasper.JspCompilationContext; import org.apache.jasper.Constants; import org.apache.jasper.JasperException; +import org.apache.jasper.Options; import org.apache.jasper.logging.Logger; import org.apache.jasper.util.SystemLogHandler; @@ -112,6 +113,8 @@ protected Project project; +protected Options options; + // Constructor @@ -119,6 +122,7 @@ public Compiler(JspCompilationContext ctxt) { this.ctxt = ctxt; this.errDispatcher = new ErrorDispatcher(); +this.options = ctxt.getOptions(); // Initializing project project = new Project(); project.init(); @@ -139,10 +143,6 @@ String javaFileName = ctxt.getServletJavaFileName(); -Constants.message(jsp.message.java_file_name_is, - new Object[] { javaFileName }, - Logger.DEBUG); - // Setup the ServletWriter // We try UTF8 by default. If it fails, we use the java encoding // specified for JspServlet init parameter javaEncoding. @@ -158,8 +158,8 @@ javaEncoding = ctxt.getOptions().getJavaEncoding(); if (javaEncoding != null) { try { - osw = new OutputStreamWriter( - new FileOutputStream(javaFileName),javaEncoding); + osw = new OutputStreamWriter +(new FileOutputStream(javaFileName),javaEncoding); } catch (UnsupportedEncodingException ex2) { // no luck :-( errDispatcher.jspError(jsp.error.invalid.javaEncoding, @@ -198,25 +198,36 @@ // Initializing javac task Javac javac = (Javac) project.createTask(javac); -// Initializing paths +// Initializing classpath Path path = new Path(project); -Path srcPath = new Path(project); - path.setPath(System.getProperty(java.class.path) + sep + classpath); -srcPath.setPath(ctxt.getOutputDir()); -/* - * Configure the compiler object - */ +// Initializing sourcepath +Path srcPath = new Path(project); +srcPath.setPath(options.getScratchDir().getAbsolutePath()); + +// Configure the compiler object javac.setEncoding(javaEncoding); javac.setClasspath(path); -if (ctxt.getJavacOutputDir() != null) { -javac.setDestdir(new File(ctxt.getJavacOutputDir())); -} javac.setDebug(ctxt.getOptions().getClassDebugInfo()); javac.setSrcdir(srcPath); +// Build includes path +String dirName = ctxt.getJspFile(); +int pos = dirName.lastIndexOf('/'); +if (pos 0) { +dirName = dirName.substring(0, pos + 1); +} else { +dirName = ; +} +String includePath = dirName + ctxt.getServletClassName() + .java; +if (includePath.startsWith(/)) { +includePath = includePath.substring(1); +} +javac.setIncludes(includePath); + +// Start capturing the System.err output for this thread SystemLogHandler.setThread(); try { @@ -225,6 +236,7 @@ success = false; } +// Stop capturing the System.err output for this thread errorReport = SystemLogHandler.unsetThread(); if (!ctxt.keepGenerated()) { -- To unsubscribe, e-mail:
cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler .#Compiler.java.1.11 .#Compiler.java.1.6 .#Generator.java.1.10 .#Generator.java.1.17 .#Generator.java.1.4 .#Generator.java.1.8 .#JspDocumentParser.java.1.22 .#JspDocumentParser.java.1.9 .#Node.java.1.14 .#Node.java.1.23 .#Parser.java.1.18 .#Validator.java.1.2
kinman 02/03/28 10:57:36 Removed: jasper2/src/share/org/apache/jasper/compiler .#Compiler.java.1.11 .#Compiler.java.1.6 .#Generator.java.1.10 .#Generator.java.1.17 .#Generator.java.1.4 .#Generator.java.1.8 .#JspDocumentParser.java.1.22 .#JspDocumentParser.java.1.9 .#Node.java.1.14 .#Node.java.1.23 .#Parser.java.1.18 .#Validator.java.1.2 Log: - Removed useless files imported by mistake. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]