Hello Flamers, Here is a diff of JspC.java from the tomcat install I have vs CVS; sorry if it doesn't meet your spec, but since you guys were too busy flaming one another about ant vs. make to respond to my mail I just winged it. Also, I've included the simple NewerCompiler class.
The diff is huge and mostly non-significant. FWIW the relevant lines are at or around 448, 1156, and 1522 of the diff file. -----Original Message----- From: Alan Arvesen Sent: Wednesday, April 10, 2002 2:12 PM To: [EMAIL PROTECTED] Subject: jspc -compiler switch Hello Dev, <flame off> I've read the posting guidelines for the list, the submission guidelines for jakarta, and the archives for the tomcat-dev. I'm still not quite sure of sending in a diff for my change, etc. Please be kind :) </flame off> We've been using the jspc code shipped with tomcat for a few months now. Over time, our code base has grown large enough for it to be irritating to recompile from scratch each time (5 minutes on my old PII at home). One of the long processes was that jspc would recompile every jsp file each time. I grepped through the code and saw that Compiler was subclassable (in particular, the isOutDated method is what I was interested in), but that JspC was hard coded to always call the CommandLineCompiler class. To get around this, I've done two things: 1) added a -compiler switch to JspC that takes a class name as an argument 2) written a very simple NewerCompiler class that compares the last modified date (as reported by java.io.File) for the .jsp file and the resultant .java file. Results have been excellent: an incremental compile will now take 40 seconds on a machine that takes 3 minutes 4 seconds for a full compile. The new class does not try to anything sophisticated about dependency checking, etc. At worst, we just do a clean install to force all the .jsps to recompile. I read through the tomcat mailing lists and didn't see that anyone had addressed this (that is, plugging in a new compiler into jspc). I don't want to duplicate anything and I also don't want to bloat the code base with non-needed features :) What does the mailing list think? Is this is useful mod? Thanks for your time, Alan -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
1c1 < /* ========== > /* 2c2 < * $Header: /home/cvspublic/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java,v 1.1.1.1 2002/03/28 18:46:15 kinman Exp $ ========== > * $Header: /home/cvspublic/jakarta-tomcat/src/share/org/apache/jasper/JspC.java,v >1.15.2.3 2001/01/12 04:46:58 larryi Exp $ 3c3 < * $Revision: 1.1.1.1 $ ========== > * $Revision: 1.15.2.3 $ 4c4 < * $Date: 2002/03/28 18:46:15 $ ========== > * $Date: 2001/01/12 04:46:58 $ 5c5 < * ========== > * 6c6 < * ==================================================================== ========== > * ==================================================================== 7c7 < * ========== > * 8c8 < * The Apache Software License, Version 1.1 ========== > * The Apache Software License, Version 1.1 9c9 < * ========== > * 10c10 < * Copyright (c) 1999 The Apache Software Foundation. All rights ========== > * Copyright (c) 1999 The Apache Software Foundation. All rights 11c11 < * reserved. ========== > * reserved. 12c12 < * ========== > * 13c13 < * Redistribution and use in source and binary forms, with or without ========== > * Redistribution and use in source and binary forms, with or without 14c14 < * modification, are permitted provided that the following conditions ========== > * modification, are permitted provided that the following conditions 15c15 < * are met: ========== > * are met: 16c16 < * ========== > * 17c17 < * 1. Redistributions of source code must retain the above copyright ========== > * 1. Redistributions of source code must retain the above copyright 18c18 < * notice, this list of conditions and the following disclaimer. ========== > * notice, this list of conditions and the following disclaimer. 19c19 < * ========== > * 20c20 < * 2. Redistributions in binary form must reproduce the above copyright ========== > * 2. Redistributions in binary form must reproduce the above copyright 21c21 < * notice, this list of conditions and the following disclaimer in ========== > * notice, this list of conditions and the following disclaimer in 22c22 < * the documentation and/or other materials provided with the ========== > * the documentation and/or other materials provided with the 23c23 < * distribution. ========== > * distribution. 24c24 < * ========== > * 25c25 < * 3. The end-user documentation included with the redistribution, if ========== > * 3. The end-user documentation included with the redistribution, if 26c26 < * any, must include the following acknowlegement: ========== > * any, must include the following acknowlegement: 27c27 < * "This product includes software developed by the ========== > * "This product includes software developed by the 28c28 < * Apache Software Foundation (http://www.apache.org/)." ========== > * Apache Software Foundation (http://www.apache.org/)." 29c29 < * Alternately, this acknowlegement may appear in the software itself, ========== > * Alternately, this acknowlegement may appear in the software itself, 30c30 < * if and wherever such third-party acknowlegements normally appear. ========== > * if and wherever such third-party acknowlegements normally appear. 31c31 < * ========== > * 32c32 < * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software ========== > * 4. The names "The Jakarta Project", "Tomcat", and "Apache Software 33c33 < * Foundation" must not be used to endorse or promote products derived ========== > * Foundation" must not be used to endorse or promote products derived 34c34 < * from this software without prior written permission. For written ========== > * from this software without prior written permission. For written 35c35 < * permission, please contact [EMAIL PROTECTED] ========== > * permission, please contact [EMAIL PROTECTED] 36c36 < * ========== > * 37c37 < * 5. Products derived from this software may not be called "Apache" ========== > * 5. Products derived from this software may not be called "Apache" 38c38 < * nor may "Apache" appear in their names without prior written ========== > * nor may "Apache" appear in their names without prior written 39c39 < * permission of the Apache Group. ========== > * permission of the Apache Group. 40c40 < * ========== > * 41c41 < * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED ========== > * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 42c42 < * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES ========== > * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 43c43 < * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ========== > * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 44c44 < * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR ========== > * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 45c45 < * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ========== > * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 46c46 < * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ========== > * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 47c47 < * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF ========== > * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 48c48 < * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ========== > * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 49c49 < * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, ========== > * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 50c50 < * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT ========== > * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 51c51 < * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF ========== > * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 52c52 < * SUCH DAMAGE. ========== > * SUCH DAMAGE. 53,54d52 < * ==================================================================== < * 54a53,54 > * ==================================================================== > * 55c55 < * This software consists of voluntary contributions made by many ========== > * This software consists of voluntary contributions made by many 56c56 < * individuals on behalf of the Apache Software Foundation. For more ========== > * individuals on behalf of the Apache Software Foundation. For more 57c57 < * information on the Apache Software Foundation, please see ========== > * information on the Apache Software Foundation, please see 58c58 < * <http://www.apache.org/>. ========== > * <http://www.apache.org/>. 59c59 < * ========== > * 60c60 < */ ========== > */ 61c61 < ========== > 62c62 < package org.apache.jasper; ========== > package org.apache.jasper; 63c63 < ========== > 64c64 < import java.io.*; ========== > import java.io.*; 64a65 > import java.util.*; 65c66 < import java.net.*; ========== > import java.lang.reflect.Constructor; 66,67d66 < import java.util.*; < 67a67 > 68c68 < import org.apache.jasper.compiler.JspReader; ========== > import org.apache.jasper.compiler.JspReader; 69c69 < import org.apache.jasper.compiler.ServletWriter; ========== > import org.apache.jasper.compiler.ServletWriter; 69a70 > import org.apache.jasper.compiler.TagLibraries; 70c71 < import org.apache.jasper.compiler.Compiler; ========== > import org.apache.jasper.compiler.Compiler; 71c72 < import org.apache.jasper.compiler.CommandLineCompiler; ========== > import org.apache.jasper.compiler.CommandLineCompiler; 72,73d72 < import org.apache.jasper.compiler.TldLocationsCache; < 73a73,74 > > //import org.apache.jasper.runtime.JspLoader; 74c75 < import org.apache.jasper.servlet.JasperLoader; ========== > import org.apache.jasper.servlet.JasperLoader; 74a76 > 75c77 < import org.apache.jasper.servlet.JspCServletContext; ========== > import org.apache.tomcat.logging.Logger; 76,79d77 < < import org.apache.jasper.logging.Logger; < import org.apache.jasper.logging.JasperLogger; < 79a78,79 > import org.apache.tomcat.logging.TomcatLogger; > 80c80 < /** ========== > /** 81c81 < * Shell for the jspc compiler. Handles all options associated with the ========== > * Shell for the jspc compiler. Handles all options associated with the 82c82 < * command line and creates compilation contexts which it then compiles ========== > * command line and creates compilation contexts which it then compiles 83c83 < * according to the specified options. ========== > * according to the specified options. 84d83 < * 85c84 < * @author Danno Ferrin ========== > * @author Danno Ferrin 86,87d84 < * @author Pierre Delisle < */ 87a85 > */ 88c86 < public class JspC implements Options { //, JspCompilationContext { ========== > public class JspC implements Options { //, JspCompilationContext { 89c87 < ========== > 90c88 < public static final String DEFAULT_IE_CLASS_ID = ========== > public static final String DEFAULT_IE_CLASS_ID = 91c89 < "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"; ========== > "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"; 92c90 < ========== > 93c91 < public static final String SWITCH_VERBOSE = "-v"; ========== > public static final String SWITCH_VERBOSE = "-v"; 94c92 < public static final String SWITCH_QUIET = "-q"; ========== > public static final String SWITCH_QUIET = "-q"; 95c93 < public static final String SWITCH_OUTPUT_DIR = "-d"; ========== > public static final String SWITCH_OUTPUT_DIR = "-d"; 96c94 < public static final String SWITCH_OUTPUT_SIMPLE_DIR = "-dd"; ========== > public static final String SWITCH_OUTPUT_SIMPLE_DIR = "-dd"; 97c95 < public static final String SWITCH_IE_CLASS_ID = "-ieplugin"; ========== > public static final String SWITCH_IE_CLASS_ID = "-ieplugin"; 98c96 < public static final String SWITCH_PACKAGE_NAME = "-p"; ========== > public static final String SWITCH_PACKAGE_NAME = "-p"; 99c97 < public static final String SWITCH_CLASS_NAME = "-c"; ========== > public static final String SWITCH_CLASS_NAME = "-c"; 100c98 < public static final String SWITCH_FULL_STOP = "--"; ========== > public static final String SWITCH_FULL_STOP = "--"; 101c99 < public static final String SWITCH_URI_BASE = "-uribase"; ========== > public static final String SWITCH_URI_BASE = "-uribase"; 102c100 < public static final String SWITCH_URI_ROOT = "-uriroot"; ========== > public static final String SWITCH_URI_ROOT = "-uriroot"; 103c101 < public static final String SWITCH_FILE_WEBAPP = "-webapp"; ========== > public static final String SWITCH_FILE_WEBAPP = "-webapp"; 104c102 < public static final String SWITCH_WEBAPP_INC = "-webinc"; ========== > public static final String SWITCH_WEBAPP_INC = "-webinc"; 105c103 < public static final String SWITCH_WEBAPP_XML = "-webxml"; ========== > public static final String SWITCH_WEBAPP_XML = "-webxml"; 106c104 < public static final String SWITCH_MAPPED = "-mapped"; ========== > public static final String SWITCH_MAPPED = "-mapped"; 107c105 < public static final String SWITCH_DIE = "-die"; ========== > public static final String SWITCH_COMPILER = "-compiler"; 108d105 < 108a106,107 > public static final String SWITCH_DIE = "-die"; > 109c108 < public static final int NO_WEBXML = 0; ========== > public static final int NO_WEBXML = 0; 110c109 < public static final int INC_WEBXML = 10; ========== > public static final int INC_WEBXML = 10; 111c110 < public static final int ALL_WEBXML = 20; ========== > public static final int ALL_WEBXML = 20; 112c111 < ========== > 113c112 < public static final int DEFAULT_DIE_LEVEL = 1; ========== > public static final int DEFAULT_DIE_LEVEL = 1; 114c113 < public static final int NO_DIE_LEVEL = 0; ========== > public static final int NO_DIE_LEVEL = 0; 115d113 < 115a114,117 > > protected String compilerClass = null; > protected static final String DEFAULT_COMPILER = >"org.apache.jasper.compiler.CommandLineCompiler"; > 116c118 < // future direction ========== > // future direction 117c119 < //public static final String SWITCH_XML_OUTPUT = "-xml"; ========== > //public static final String SWITCH_XML_OUTPUT = "-xml"; 118,119d119 < < 119a120,121 > > 120c122 < boolean largeFile = false; ========== > boolean largeFile = false; 121c123 < boolean mappedFile = false; ========== > boolean mappedFile = false; 122c124 < ========== > 123c125 < int jspVerbosityLevel = Logger.INFORMATION; ========== > int jspVerbosityLevel = Logger.INFORMATION; 124c126 < ========== > 125c127 < File scratchDir; ========== > File scratchDir; 126c128 < ========== > 127c129 < String ieClassId = DEFAULT_IE_CLASS_ID; ========== > String ieClassId = DEFAULT_IE_CLASS_ID; 128c130 < ========== > 129c131 < //String classPath; ========== > //String classPath; 130c132 < ========== > 131c133 < String targetPackage; ========== > String targetPackage; 132c134 < ========== > 133c135 < String targetClassName; ========== > String targetClassName; 134c136 < ========== > 135c137 < String uriBase; ========== > String uriBase; 136c138 < ========== > 137c139 < String uriRoot; ========== > String uriRoot; 138c140 < ========== > 139c141 < String webxmlFile; ========== > String webxmlFile; 140c142 < ========== > 141c143 < int webxmlLevel; ========== > int webxmlLevel; 142c144 < ========== > 143c145 < int dieLevel; ========== > int dieLevel; 144c146 < boolean dieOnExit = false; ========== > boolean dieOnExit = false; 145c147 < static int die; // I realize it is duplication, but this is for ========== > static int die; // I realize it is duplication, but this is for 146c148 < // the static main catch ========== > // the static main catch 147d148 < 147a149,151 > > //JspLoader loader; > 148c152 < boolean dirset; ========== > boolean dirset; 149c153 < ========== > 150c154 < Vector extensions; ========== > Vector extensions; 151d154 < 151a155,164 > > public boolean getKeepGenerated() { > // isn't this why we are running jspc? > return true; > } > > public boolean getLargeFile() { > return largeFile; > } > 152c165 < /** ========== > /** 153,166d165 < * Cache for the TLD locations < */ < private TldLocationsCache tldLocationsCache = null; < < public boolean getKeepGenerated() { < // isn't this why we are running jspc? < return true; < } < < public boolean getLargeFile() { < return largeFile; < } < < /** 167c166 < * Are we supporting HTML mapped servlets? ========== > * Are we supporting HTML mapped servlets? 168c167 < */ ========== > */ 169c168 < public boolean getMappedFile() { ========== > public boolean getMappedFile() { 170c169 < return mappedFile; ========== > return mappedFile; 171c170 < } ========== > } 172c171 < ========== > 173c172 < // Off-line compiler, no need for security manager ========== > // Off-line compiler, no need for security manager 174c173 < public Object getProtectionDomain() { ========== > public Object getProtectionDomain() { 175c174 < return null; ========== > return null; 176,177d174 < } < 177a175,176 > } > 178c177 < public boolean getSendErrorToClient() { ========== > public boolean getSendErrorToClient() { 179c178 < // implied send to System.err ========== > // implied send to System.err 180,182d178 < return true; < } < 182a179,181 > return true; > } > 183c182 < public boolean getClassDebugInfo() { ========== > public boolean getClassDebugInfo() { 184c183 < // compile with debug info ========== > // compile with debug info 185c184 < return false; ========== > return false; 186,187d184 < } < 187a185,186 > } > 188c187 < public String getIeClassId() { ========== > public String getIeClassId() { 189c188 < return ieClassId; ========== > return ieClassId; 190,191d188 < } < 191a189,190 > } > 192c191 < public int getJspVerbosityLevel() { ========== > public int getJspVerbosityLevel() { 193c192 < return jspVerbosityLevel; ========== > return jspVerbosityLevel; 194,195d192 < } < 195a193,194 > } > 196c195 < public File getScratchDir() { ========== > public File getScratchDir() { 197c196 < return scratchDir; ========== > return scratchDir; 198,199d196 < } < 199a197,202 > } > > //public String getClassPath() { > // return classpath; > //} > 200c203 < public Class getJspCompilerPlugin() { ========== > public Class getJspCompilerPlugin() { 201c204 < // we don't compile, so this is meanlingless ========== > // we don't compile, so this is meanlingless 202c205 < return null; ========== > return null; 203,204d205 < } < 204a206,207 > } > 205c208 < public String getJspCompilerPath() { ========== > public String getJspCompilerPath() { 206,213d208 < // we don't compile, so this is meanlingless < return null; < } < < public TldLocationsCache getTldLocationsCache() { < return tldLocationsCache; < } < 213a209,212 > // we don't compile, so this is meanlingless > return null; > } > 214c213 < public String getJavaEncoding() { ========== > public String getJavaEncoding() { 215c214 < return "UTF-8"; ========== > return "UTF-8"; 216,217d214 < } < 217a215,216 > } > 218c217 < public String getClassPath() { ========== > public String getClassPath() { 219c218 < return System.getProperty("java.class.path"); ========== > return System.getProperty("java.class.path"); 220,221d218 < } < 221a219,220 > } > 222c221 < int argPos; ========== > int argPos; 223c222 < // value set by beutifully obsfucscated java ========== > // value set by beutifully obsfucscated java 224c223 < boolean fullstop = false; ========== > boolean fullstop = false; 225c224 < String args[]; ========== > String args[]; 226c225 < ========== > 227c226 < private void pushBackArg() { ========== > private void pushBackArg() { 228c227 < if (!fullstop) { ========== > if (!fullstop) { 229c228 < argPos--; ========== > argPos--; 230,232d228 < } < } < 232a229,231 > } > } > 233c232 < private String nextArg() { ========== > private String nextArg() { 234c233 < if ((argPos >= args.length) ========== > if ((argPos >= args.length) 235,236d233 < || (fullstop = SWITCH_FULL_STOP.equals(args[argPos]))) { < return null; 236a234,235 > || (fullstop = SWITCH_FULL_STOP.equals(args[argPos]))) { > return null; 237c236 < } else { ========== > } else { 238c237 < return args[argPos++]; ========== > return args[argPos++]; 239,241d237 < } < } < 241a238,240 > } > } > 242c241 < private String nextFile() { ========== > private String nextFile() { 243c242 < if (fullstop) argPos++; ========== > if (fullstop) argPos++; 244c243 < if (argPos >= args.length) { ========== > if (argPos >= args.length) { 245,250d243 < return null; < } else { < return args[argPos++]; < } < } < 250a244,249 > return null; > } else { > return args[argPos++]; > } > } > 251c250 < public JspC(String[] arg, PrintStream log) { ========== > public JspC(String[] arg, PrintStream log) { 252c251 < args = arg; ========== > args = arg; 253c252 < String tok; ========== > String tok; 254c253 < ========== > 255c254 < int verbosityLevel = Logger.WARNING; ========== > int verbosityLevel = Logger.WARNING; 256c255 < dieLevel = NO_DIE_LEVEL; ========== > dieLevel = NO_DIE_LEVEL; 257c256 < die = dieLevel; ========== > die = dieLevel; 258c257 < ========== > 259c258 < while ((tok = nextArg()) != null) { ========== > while ((tok = nextArg()) != null) { 260c259 < if (tok.equals(SWITCH_QUIET)) { ========== > if (tok.equals(SWITCH_QUIET)) { 261c260 < verbosityLevel = Logger.WARNING; ========== > verbosityLevel = Logger.WARNING; 262c261 < } else if (tok.equals(SWITCH_VERBOSE)) { ========== > } else if (tok.equals(SWITCH_VERBOSE)) { 263c262 < verbosityLevel = Logger.INFORMATION; ========== > verbosityLevel = Logger.INFORMATION; 264c263 < } else if (tok.startsWith(SWITCH_VERBOSE)) { ========== > } else if (tok.startsWith(SWITCH_VERBOSE)) { 265c264 < try { ========== > try { 266c265 < verbosityLevel ========== > verbosityLevel 267c266 < = Integer.parseInt(tok.substring(SWITCH_VERBOSE.length())); ========== > = Integer.parseInt(tok.substring(SWITCH_VERBOSE.length())); 268c267 < } catch (NumberFormatException nfe) { ========== > } catch (NumberFormatException nfe) { 269c268 < log.println( ========== > log.println( 270c269 < "Verbosity level " ========== > "Verbosity level " 271c270 < + tok.substring(SWITCH_VERBOSE.length()) ========== > + tok.substring(SWITCH_VERBOSE.length()) 272c271 < + " is not valid. Option ignored."); ========== > + " is not valid. Option ignored."); 273c272 < } ========== > } 274c273 < } else if (tok.equals(SWITCH_OUTPUT_DIR)) { ========== > } else if (tok.equals(SWITCH_OUTPUT_DIR)) { 275c274 < tok = nextArg(); ========== > tok = nextArg(); 276c275 < if (tok != null) { ========== > if (tok != null) { 277c276 < scratchDir = new File(new File(tok).getAbsolutePath()); ========== > scratchDir = new File(new File(tok).getAbsolutePath()); 278c277 < dirset = true; ========== > dirset = true; 279c278 < } else { ========== > } else { 280c279 < // either an in-java call with an explicit null ========== > // either an in-java call with an explicit null 281c280 < // or a "-d --" sequence should cause this, ========== > // or a "-d --" sequence should cause this, 282c281 < // which would mean default handling ========== > // which would mean default handling 283c282 < /* no-op */ ========== > /* no-op */ 284c283 < scratchDir = null; ========== > scratchDir = null; 285c284 < } ========== > } 286c285 < } else if (tok.equals(SWITCH_OUTPUT_SIMPLE_DIR)) { ========== > } else if (tok.equals(SWITCH_OUTPUT_SIMPLE_DIR)) { 287,288d285 < tok = nextArg(); < if (tok != null) { 288a286,293 > tok = nextArg(); > if (tok != null) { > scratchDir = new File(new File(tok).getAbsolutePath()); > } else { > // either an in-java call with an explicit null > // or a "-d --" sequence should cause this, > // which would mean default handling > /* no-op */ 289c294 < scratchDir = new File(new File(tok).getAbsolutePath()); ========== > scratchDir = null; 290,297d294 < dirset = false; < } else { < // either an in-java call with an explicit null < // or a "-d --" sequence should cause this, < // which would mean default handling < /* no-op */ < scratchDir = null; < } 297a295 > } 298c296 < } else if (tok.equals(SWITCH_PACKAGE_NAME)) { ========== > } else if (tok.equals(SWITCH_PACKAGE_NAME)) { 299,300d296 < targetPackage = nextArg(); < } else if (tok.equals(SWITCH_CLASS_NAME)) { 301c297 < targetClassName = nextArg(); ========== > targetPackage = nextArg(); 301a298,299 > } else if (tok.equals(SWITCH_CLASS_NAME)) { > targetClassName = nextArg(); 302c300 < } else if (tok.equals(SWITCH_URI_BASE)) { ========== > } else if (tok.equals(SWITCH_URI_BASE)) { 303c301 < uriBase = nextArg(); ========== > uriBase = nextArg(); 304c302 < } else if (tok.equals(SWITCH_URI_ROOT)) { ========== > } else if (tok.equals(SWITCH_URI_ROOT)) { 305c303 < uriRoot = nextArg(); ========== > uriRoot = nextArg(); 306c304 < } else if (tok.equals(SWITCH_WEBAPP_INC)) { ========== > } else if (tok.equals(SWITCH_WEBAPP_INC)) { 307c305 < webxmlFile = nextArg(); ========== > webxmlFile = nextArg(); 308c306 < if (webxmlFile != null) { ========== > if (webxmlFile != null) { 309c307 < webxmlLevel = INC_WEBXML; ========== > webxmlLevel = INC_WEBXML; 310c308 < } ========== > } 311c309 < } else if (tok.equals(SWITCH_WEBAPP_XML)) { ========== > } else if (tok.equals(SWITCH_WEBAPP_XML)) { 312,313d309 < webxmlFile = nextArg(); < if (webxmlFile != null) { 313a310,311 > webxmlFile = nextArg(); > if (webxmlFile != null) { 314c312 < webxmlLevel = ALL_WEBXML; ========== > webxmlLevel = ALL_WEBXML; 315c313 < } ========== > } 316c314 < } else if (tok.equals(SWITCH_MAPPED)) { ========== > } else if (tok.equals(SWITCH_MAPPED)) { 317c315 < mappedFile = true; ========== > mappedFile = true; 317a316,324 > } else if (tok.equals(SWITCH_COMPILER)) { > tok = nextArg(); > if (tok != null) { > compilerClass = tok; > } else { > log.println( > "bad parameter passed to compiler switch " > + SWITCH_COMPILER); > } 318c325 < } else if (tok.startsWith(SWITCH_DIE)) { ========== > } else if (tok.startsWith(SWITCH_DIE)) { 319c326 < try { ========== > try { 320c327 < dieLevel = Integer.parseInt( ========== > dieLevel = Integer.parseInt( 321c328 < tok.substring(SWITCH_DIE.length())); ========== > tok.substring(SWITCH_DIE.length())); 322c329 < } catch (NumberFormatException nfe) { ========== > } catch (NumberFormatException nfe) { 323c330 < dieLevel = DEFAULT_DIE_LEVEL; ========== > dieLevel = DEFAULT_DIE_LEVEL; 324,326d330 < } < die = dieLevel; < } else { 326a331,333 > } > die = dieLevel; > } else { 327c334 < pushBackArg(); ========== > pushBackArg(); 328c335 < // Not a recognized Option? Start treting them as JSP Pages ========== > // Not a recognized Option? Start treating them as JSP Pages 329c336 < break; ========== > break; 330,332d336 < } < } < 332a337,339 > } > } > 333c340 < Constants.jasperLog = new JasperLogger(); ========== > Constants.jasperLog = new TomcatLogger(); 334c341 < Constants.jasperLog.setVerbosityLevel(verbosityLevel); ========== > Constants.jasperLog.setVerbosityLevel(verbosityLevel); 335,337d341 < < } < 337a342,344 > > } > 338c345 < public boolean parseFile(PrintStream log, String file, Writer servletout, Writer mappingout) ========== > public boolean parseFile(PrintStream log, String file, Writer servletout, Writer >mappingout) 339c346 < { ========== > { 340d346 < try { 340a347,351 > try { > JasperLoader loader = > new JasperLoader(); > loader.setParentClassLoader(getClass().getClassLoader()); > loader.setOptions( this); 341c352 < CommandLineContext clctxt = new CommandLineContext( ========== > CommandLineContext clctxt = new CommandLineContext( 342,343d352 < getClassPath(), file.replace('\\','/'), uriBase, uriRoot, < false, this); 343a353,354 > loader, getClassPath(), file, uriBase, uriRoot, false, > this); 344c355 < if ((targetClassName != null) && (targetClassName.length() > 0)) { ========== > if ((targetClassName != null) && (targetClassName.length() > 0)) { 345c356 < clctxt.setServletClassName(targetClassName); ========== > clctxt.setServletClassName(targetClassName); 346,354d356 < } < if (targetPackage != null) { < clctxt.setServletPackageName(targetPackage); < } < if (dirset) { < clctxt.setOutputInDirs(true); < } < ArrayList urls = new ArrayList(); < 354a357,358 > clctxt.lockClassName(); > } 355c359 < if (new File(clctxt.getRealPath("/")).exists()) { ========== > if (targetPackage != null) { 356,360d359 < File classes = new File(clctxt.getRealPath("/WEB-INF/classes")); < try { < if (classes.exists()) { < urls.add(classes.getCanonicalFile().toURL()); < } 360a360,378 > clctxt.setServletPackageName(targetPackage); > clctxt.lockPackageName(); > } > if (dirset) { > clctxt.setOutputInDirs(true); > } > File uriDir = new File(clctxt.getRealPath("/")); > if (uriDir.exists()) { > if ((new File(uriDir, "WEB-INF/classes")).exists()) { > loader.addJar(clctxt.getRealPath("/WEB-INF/classes")); > } > File lib = new File(clctxt.getRealPath("WEB-INF/lib")); > if (lib.exists() && lib.isDirectory()) { > String[] libs = lib.list(); > for (int i = 0; i < libs.length; i++) { > try { > loader.addJar(lib.getCanonicalPath() > + File.separator > + libs[i]); 361c379 < } catch (IOException ioe) { ========== > } catch (IOException ioe) { 362c380 < // failing a toCanonicalPath on a file that ========== > // failing a toCanonicalPath on a file that 363c381 < // exists() should be a JVM regression test, ========== > // exists() should be a JVM regression test, 364c382 < // therefore we have permission to freak out ========== > // therefore we have permission to freak out 365c383 < throw new RuntimeException(ioe.toString()); ========== > throw new RuntimeException(ioe.toString()); 366,374d383 < } < File lib = new File(clctxt.getRealPath("/WEB-INF/lib")); < if (lib.exists() && lib.isDirectory()) { < String[] libs = lib.list(); < for (int i = 0; i < libs.length; i++) { < try { < File libFile = new File(lib.toString() < + File.separator < + libs[i]); 374a384,388 > } > } > } > } > CommandLineCompiler clc = null; 375c389 < urls.add(libFile.getCanonicalFile().toURL()); ========== > try { 376,548d389 < } catch (IOException ioe) { < // failing a toCanonicalPath on a file that < // exists() should be a JVM regression test, < // therefore we have permission to freak out < throw new RuntimeException(ioe.toString()); < } < } < } < } < StringTokenizer tokenizer = new StringTokenizer < (clctxt.getClassPath(), File.pathSeparator); < while (tokenizer.hasMoreTokens()) { < String path = tokenizer.nextToken(); < try { < File libFile = new File(path); < urls.add(libFile.toURL()); < } catch (IOException ioe) { < // Failing a toCanonicalPath on a file that < // exists() should be a JVM regression test, < // therefore we have permission to freak uot < throw new RuntimeException(ioe.toString()); < } < } < urls.add(new File < (clctxt.getRealPath("/")).getCanonicalFile().toURL()); < URLClassLoader loader = new URLClassLoader < ((URL[])(urls.toArray(new URL[urls.size()]))); < clctxt.setClassLoader(loader); < CommandLineCompiler clc = new CommandLineCompiler(clctxt); < < clc.compile(); < < targetClassName = null; < String thisServletName; < if (clc.getPackageName() == null) { < thisServletName = clc.getClassName(); < } else { < thisServletName = clc.getPackageName() < + '.' + clc.getClassName(); < } < if (servletout != null) { < servletout.write("\n\t<servlet>\n\t\t<servlet-name>"); < servletout.write(thisServletName); < servletout.write("</servlet-name>\n\t\t<servlet-class>"); < servletout.write(thisServletName); < servletout.write("</servlet-class>\n\t</servlet>\n"); < } < if (mappingout != null) { < mappingout.write("\n\t<servlet-mapping>\n\t\t<servlet-name>"); < mappingout.write(thisServletName); < mappingout.write("</servlet-name>\n\t\t<url-pattern>"); < mappingout.write(file.replace('\\', '/')); < mappingout.write("</url-pattern>\n\t</servlet-mapping>\n"); < < } < return true; < } catch (JasperException je) { < //je.printStackTrace(log); < Constants.message("jspc.error.jasperException", < new Object[] {file, je}, Logger.ERROR); < if (dieLevel != NO_DIE_LEVEL) { < dieOnExit = true; < } < } catch (FileNotFoundException fne) { < Constants.message("jspc.error.fileDoesNotExist", < new Object[] {fne.getMessage()}, Logger.WARNING); < } catch (Exception e) { < Constants.message("jspc.error.generalException", < new Object[] {file, e}, Logger.ERROR); < e.printStackTrace(); < if (dieLevel != NO_DIE_LEVEL) { < dieOnExit = true; < } < } < return false; < } < < < public void parseFiles(PrintStream log) throws JasperException { < < boolean scratchDirSet = (scratchDir != null); < boolean urirootSet = (uriRoot != null); < < // set up a scratch/output dir if none is provided < if (scratchDir == null) { < String temp = System.getProperty("java.io.tempdir"); < if (temp == null) { < temp = ""; < } < scratchDir = new File(new File(temp).getAbsolutePath()); < } < < < File f = new File(args[argPos]); < while (!f.exists()) { < boolean webApp = false; < if (SWITCH_FILE_WEBAPP.equals(args[argPos])) { < webApp = true; < if (args.length > argPos + 1) { < f = new File(args[argPos + 1]); < } else { < // end of arguments, nothing left to parse < Constants.message("jspc.error.emptyWebApp", < Logger.ERROR); < return; < } < } < if (!f.exists()) { < Constants.message("jspc.error.fileDoesNotExist", < new Object[] {f}, Logger.WARNING); < argPos++; < if (webApp) { < argPos++; < } < if (argPos >= args.length) { < // end of arguments, nothing left to parse < return; < } else { < f = new File(args[argPos]); < } < } < } < if (uriRoot == null) { < if (SWITCH_FILE_WEBAPP.equals(args[argPos])) { < if (args.length > argPos + 1) { < f = new File(args[argPos + 1]); < } else { < // end of arguments, nothing left to parse < return; < } < } < // set up the uri root if none is explicitly set < String tUriBase = uriBase; < if (tUriBase == null) { < tUriBase = "/"; < } < try { < if (f.exists()) { < f = new File(f.getCanonicalPath()); < while (f != null) { < File g = new File(f, "WEB-INF"); < if (g.exists() && g.isDirectory()) { < uriRoot = f.getCanonicalPath(); < uriBase = tUriBase; < Constants.message("jspc.implicit.uriRoot", < new Object[] { uriRoot }, < Logger.INFORMATION); < break; < } < if (f.exists() && f.isDirectory()) { < tUriBase = "/" + f.getName() + "/" + tUriBase; < } < < String fParent = f.getParent(); < if (fParent == null) { < f = new File(args[argPos]); < fParent = f.getParent(); < if (fParent == null) { < fParent = File.separator; < } < uriRoot = new File(fParent).getCanonicalPath(); < uriBase = "/"; < break; < } else { < f = new File(fParent); < } < < // If there is no acceptible candidate, uriRoot will < // remain null to indicate to the CompilerContext to < // use the current working/user dir. < } < } < } catch (IOException ioe) { 548a390,548 > if (compilerClass == null) { > compilerClass = DEFAULT_COMPILER; > } > > Class[] paramtypes = {clctxt.getClass()}; > Object[] paramvals = {clctxt}; > Class compiler = >this.getClass().getClassLoader().loadClass(compilerClass); > // both 'const' and 'struct' look bad in VIM :) > Constructor tructor = compiler.getConstructor(paramtypes); > clc = (CommandLineCompiler) >tructor.newInstance(paramvals); > > //com.elysium.util.compiler.Compiler clc = new >com.elysium.util.compiler.Compiler(clctxt); > } catch (java.lang.InstantiationException e) { > System.out.println(e); > croak(die); > } > > clc.compile(); > > > targetClassName = null; > String thisServletName; > if (clc.getPackageName() == null) { > thisServletName = clc.getClassName(); > } else { > thisServletName = clc.getPackageName() > + '.' + clc.getClassName(); > } > if (servletout != null) { > servletout.write("\n\t<servlet>\n\t\t<servlet-name>"); > servletout.write(thisServletName); > servletout.write("</servlet-name>\n\t\t<servlet-class>"); > servletout.write(thisServletName); > servletout.write("</servlet-class>\n\t</servlet>\n"); > } > if (mappingout != null) { > mappingout.write("\n\t<servlet-mapping>\n\t\t<url-pattern>"); > mappingout.write(file); > mappingout.write("</url-pattern>\n\t\t<servlet-name>"); > mappingout.write(thisServletName); > mappingout.write("</servlet-name>\n\t</servlet-mapping>\n"); > } > return true; > } catch (JasperException je) { > //je.printStackTrace(log); > Constants.message("jspc.error.jasperException", > new Object[] {file, je}, Logger.ERROR); > if (dieLevel != NO_DIE_LEVEL) { > dieOnExit = true; > } > } catch (FileNotFoundException fne) { > Constants.message("jspc.error.fileDoesNotExist", > new Object[] {fne.getMessage()}, Logger.WARNING); > } catch (Exception e) { > Constants.message("jspc.error.generalException", > new Object[] {file, e}, Logger.ERROR); > if (dieLevel != NO_DIE_LEVEL) { > dieOnExit = true; > } > } > return false; > } > > > public void parseFiles(PrintStream log) throws JasperException { > > boolean scratchDirSet = (scratchDir != null); > boolean urirootSet = (uriRoot != null); > > // set up a scratch/output dir if none is provided > if (scratchDir == null) { > String temp = System.getProperty("java.io.tempdir"); > if (temp == null) { > temp = ""; > } > scratchDir = new File(new File(temp).getAbsolutePath()); > } > > > File f = new File(args[argPos]); > while (!f.exists()) { > boolean webApp = false; > if (SWITCH_FILE_WEBAPP.equals(args[argPos])) { > webApp = true; > if (args.length > argPos + 1) { > f = new File(args[argPos + 1]); > } else { > // end of arguments, nothing left to parse > Constants.message("jspc.error.emptyWebApp", > Logger.ERROR); > return; > } > } > if (!f.exists()) { > Constants.message("jspc.error.fileDoesNotExist", > new Object[] {f}, Logger.WARNING); > argPos++; > if (webApp) { > argPos++; > } > if (argPos >= args.length) { > // end of arguments, nothing left to parse > return; > } else { > f = new File(args[argPos]); > } > } > } > if (uriRoot == null) { > if (SWITCH_FILE_WEBAPP.equals(args[argPos])) { > if (args.length > argPos + 1) { > f = new File(args[argPos + 1]); > } else { > // end of arguments, nothing left to parse > return; > } > } > // set up the uri root if none is explicitly set > String tUriBase = uriBase; > if (tUriBase == null) { > tUriBase = "/"; > } > try { > if (f.exists()) { > f = new File(f.getCanonicalPath()); > while (f != null) { > File g = new File(f, "WEB-INF"); > if (g.exists() && g.isDirectory()) { > uriRoot = f.getCanonicalPath(); > uriBase = tUriBase; > Constants.message("jspc.implicit.uriRoot", > new Object[] { uriRoot }, > Logger.INFORMATION); > break; > } > if (f.exists() && f.isDirectory()) { > tUriBase = "/" + f.getName() + "/" + tUriBase; > } > > String fParent = f.getParent(); > if (fParent == null) { > f = new File(args[argPos]); > fParent = f.getParent(); > if (fParent == null) { > fParent = File.separator; > } > uriRoot = new File(fParent).getCanonicalPath(); > uriBase = "/"; > break; > } else { > f = new File(fParent); > } > > // If there is no acceptible candidate, uriRoot will > // remain null to indicate to the CompilerContext to > // use the current working/user dir. > } > } > } catch (IOException ioe) { 549c549 < // since this is an optional default and a null value ========== > // since this is an optional default and a null value 550c550 < // for uriRoot has a non-error meaning, we can just ========== > // for uriRoot has a non-error meaning, we can just 551c551 < // pass straight through ========== > // pass straight through 552,555d551 < } < } < < 555a552,555 > } > } > > 556c556 < String file = nextFile(); ========== > String file = nextFile(); 557c557 < File froot = new File(uriRoot); ========== > File froot = new File(uriRoot); 558c558 < String ubase = null; ========== > String ubase = null; 559c559 < try { ========== > try { 560c560 < ubase = froot.getCanonicalPath(); ========== > ubase = froot.getCanonicalPath(); 561c561 < } catch (IOException ioe) { ========== > } catch (IOException ioe) { 562c562 < // if we cannot get the base, leave it null ========== > // if we cannot get the base, leave it null 563,564d562 < } < 564a563,564 > } > 565c565 < while (file != null) { ========== > while (file != null) { 566c566 < if (SWITCH_FILE_WEBAPP.equals(file)) { ========== > if (SWITCH_FILE_WEBAPP.equals(file)) { 567c567 < String base = nextFile(); ========== > String base = nextFile(); 568c568 < if (base == null) { ========== > if (base == null) { 569,571d568 < Constants.message("jspc.error.emptyWebApp", < Logger.ERROR); < return; 571a569,571 > Constants.message("jspc.error.emptyWebApp", > Logger.ERROR); > return; 572c572 < }// else if (".".equals(base)) { ========== > }// else if (".".equals(base)) { 573c573 < // base = ""; ========== > // base = ""; 574c574 < //} ========== > //} 575c575 < String oldRoot = uriRoot; ========== > String oldRoot = uriRoot; 576c576 < if (!urirootSet) { ========== > if (!urirootSet) { 577c577 < uriRoot = base; ========== > uriRoot = base; 578c578 < } ========== > } 579c579 < Vector pages = new Vector(); ========== > Vector pages = new Vector(); 580c580 < ========== > 581c581 < Stack dirs = new Stack(); ========== > Stack dirs = new Stack(); 582c582 < dirs.push(base); ========== > dirs.push(base); 583c583 < if (extensions == null) { ========== > if (extensions == null) { 584c584 < extensions = new Vector(); ========== > extensions = new Vector(); 585c585 < extensions.addElement("jsp"); ========== > extensions.addElement("jsp"); 586c586 < } ========== > } 587c587 < while (!dirs.isEmpty()) { ========== > while (!dirs.isEmpty()) { 588c588 < String s = dirs.pop().toString(); ========== > String s = dirs.pop().toString(); 589c589 < //System.out.println("--" + s); ========== > //System.out.println("--" + s); 590c590 < f = new File(s); ========== > f = new File(s); 591c591 < if (f.exists() && f.isDirectory()) { ========== > if (f.exists() && f.isDirectory()) { 592c592 < String[] files = f.list(); ========== > String[] files = f.list(); 593c593 < String ext; ========== > String ext; 594c594 < for (int i = 0; i < files.length; i++) { ========== > for (int i = 0; i < files.length; i++) { 595c595 < File f2 = new File(s, files[i]); ========== > File f2 = new File(s, files[i]); 596c596 < //System.out.println(":" + f2.getPath()); ========== > //System.out.println(":" + f2.getPath()); 597c597 < if (f2.isDirectory()) { ========== > if (f2.isDirectory()) { 598c598 < dirs.push(f2.getPath()); ========== > dirs.push(f2.getPath()); 599c599 < //System.out.println("++" + f2.getPath()); ========== > //System.out.println("++" + f2.getPath()); 600c600 < } else { ========== > } else { 601c601 < ext = files[i].substring( ========== > ext = files[i].substring( 602c602 < files[i].lastIndexOf('.') + 1); ========== > files[i].lastIndexOf('.') + 1); 603c603 < if (extensions.contains(ext)) { ========== > if (extensions.contains(ext)) { 604c604 < //System.out.println(s + "?" + files[i]); ========== > //System.out.println(s + "?" + files[i]); 605c605 < pages.addElement( ========== > pages.addElement( 606c606 < s + File.separatorChar + files[i]); ========== > s + File.separatorChar + files[i]); 607c607 < } else { ========== > } else { 608c608 < //System.out.println("not done:" + ext); ========== > //System.out.println("not done:" + ext); 609,614d608 < } < } < } < } < } < 614a609,614 > } > } > } > } > } > 615c615 < String ubaseOld = ubase; ========== > String ubaseOld = ubase; 616c616 < File frootOld = froot; ========== > File frootOld = froot; 617c617 < froot = new File(uriRoot); ========== > froot = new File(uriRoot); 618,624d617 < < try { < ubase = froot.getCanonicalPath(); < } catch (IOException ioe) { < // if we cannot get the base, leave it null < } < 624a618,624 > > try { > ubase = froot.getCanonicalPath(); > } catch (IOException ioe) { > // if we cannot get the base, leave it null > } > 625c625 < //System.out.println("==" + ubase); ========== > //System.out.println("==" + ubase); 626,627d625 < < 627a626,627 > > 628c628 < Writer mapout; ========== > Writer mapout; 629c629 < CharArrayWriter servletout, mappingout; ========== > CharArrayWriter servletout, mappingout; 630c630 < try { ========== > try { 631c631 < if (webxmlLevel >= INC_WEBXML) { ========== > if (webxmlLevel >= INC_WEBXML) { 632c632 < File fmapings = new File(webxmlFile); ========== > File fmapings = new File(webxmlFile); 633c633 < mapout = new FileWriter(fmapings); ========== > mapout = new FileWriter(fmapings); 634c634 < servletout = new CharArrayWriter(); ========== > servletout = new CharArrayWriter(); 635c635 < mappingout = new CharArrayWriter(); ========== > mappingout = new CharArrayWriter(); 636c636 < } else { ========== > } else { 637c637 < mapout = null; ========== > mapout = null; 638c638 < servletout = null; ========== > servletout = null; 639c639 < mappingout = null; ========== > mappingout = null; 640c640 < } ========== > } 641c641 < if (webxmlLevel >= ALL_WEBXML) { ========== > if (webxmlLevel >= ALL_WEBXML) { 642c642 < mapout.write(Constants.getString("jspc.webxml.header")); ========== > mapout.write(Constants.getString("jspc.webxml.header")); 643c643 < } else if (webxmlLevel>= INC_WEBXML) { ========== > } else if (webxmlLevel>= INC_WEBXML) { 644c644 < mapout.write(Constants.getString("jspc.webinc.header")); ========== > mapout.write(Constants.getString("jspc.webinc.header")); 645,661d644 < } < } catch (IOException ioe) { < mapout = null; < servletout = null; < mappingout = null; < } < < try { < JspCServletContext context = < new JspCServletContext < (new PrintWriter(System.out), < new URL("file:" + ubase.replace('\\','/') + "/")); < tldLocationsCache = new TldLocationsCache(context); < } catch (MalformedURLException me) { < System.out.println("**" + me); < } < 661a645,651 > } > } catch (IOException ioe) { > mapout = null; > servletout = null; > mappingout = null; > } > 662c652 < Enumeration e = pages.elements(); ========== > Enumeration e = pages.elements(); 663c653 < while (e.hasMoreElements()) ========== > while (e.hasMoreElements()) 664c654 < { ========== > { 665c655 < String nextjsp = e.nextElement().toString(); ========== > String nextjsp = e.nextElement().toString(); 666c656 < try { ========== > try { 667c657 < if (ubase != null) { ========== > if (ubase != null) { 668c658 < File fjsp = new File(nextjsp); ========== > File fjsp = new File(nextjsp); 669c659 < String s = fjsp.getCanonicalPath(); ========== > String s = fjsp.getCanonicalPath(); 670c660 < //System.out.println("**" + s); ========== > //System.out.println("**" + s); 671c661 < if (s.startsWith(ubase)) { ========== > if (s.startsWith(ubase)) { 672c662 < nextjsp = s.substring(ubase.length()); ========== > nextjsp = s.substring(ubase.length()); 673,675d662 < } < } < } catch (IOException ioe) { 675a663,665 > } > } > } catch (IOException ioe) { 676c666 < // if we got problems dont change the file name ========== > // if we got problems dont change the file name 677,678d666 < } < 678a667,668 > } > 679c669 < if (nextjsp.startsWith("." + File.separatorChar)) { ========== > if (nextjsp.startsWith("." + File.separatorChar)) { 680c670 < nextjsp = nextjsp.substring(2); ========== > nextjsp = nextjsp.substring(2); 681,682d670 < } < 682a671,672 > } > 683c673 < parseFile(log, nextjsp, servletout, mappingout); ========== > parseFile(log, nextjsp, servletout, mappingout); 684c674 < } ========== > } 685c675 < uriRoot = oldRoot; ========== > uriRoot = oldRoot; 686c676 < ubase = ubaseOld; ========== > ubase = ubaseOld; 687c677 < froot = frootOld; ========== > froot = frootOld; 688c678 < ========== > 689c679 < if (mapout != null) { ========== > if (mapout != null) { 690c680 < try { ========== > try { 691c681 < servletout.writeTo(mapout); ========== > servletout.writeTo(mapout); 692c682 < mappingout.writeTo(mapout); ========== > mappingout.writeTo(mapout); 693c683 < if (webxmlLevel >= ALL_WEBXML) { ========== > if (webxmlLevel >= ALL_WEBXML) { 694c684 < mapout.write(Constants.getString("jspc.webxml.footer")); ========== > mapout.write(Constants.getString("jspc.webxml.footer")); 695c685 < } else if (webxmlLevel >= INC_WEBXML) { ========== > } else if (webxmlLevel >= INC_WEBXML) { 696c686 < mapout.write(Constants.getString("jspc.webinc.footer")); ========== > mapout.write(Constants.getString("jspc.webinc.footer")); 697c687 < } ========== > } 698c688 < mapout.close(); ========== > mapout.close(); 699c689 < } catch (IOException ioe) { ========== > } catch (IOException ioe) { 700c690 < // noting to do if it fails since we are done with it ========== > // noting to do if it fails since we are done with it 701,715d690 < } < } < } else { < try { < if (ubase != null) { < try { < JspCServletContext context = < new JspCServletContext < (new PrintWriter(System.out), < new URL("file:" + ubase.replace('\\','/') + '/')); < tldLocationsCache = new < TldLocationsCache(context); < } catch (MalformedURLException me) { < System.out.println("**" + me); < } 715a691,695 > } > } > } else { > try { > if (ubase != null) { 716c696 < File fjsp = new File(file); ========== > File fjsp = new File(file); 717,718d696 < String s = fjsp.getCanonicalPath(); < if (s.startsWith(ubase)) { 718a697,698 > String s = fjsp.getCanonicalPath(); > if (s.startsWith(ubase)) { 719c699 < file = s.substring(ubase.length()); ========== > file = s.substring(ubase.length()); 720,725d699 < } < } < } catch (IOException ioe) { < // if we got problems dont change the file name < } < 725a700,705 > } > } > } catch (IOException ioe) { > // if we got problems dont change the file name > } > 726c706 < parseFile(log, file, null, null); ========== > parseFile(log, file, null, null); 727c707 < } ========== > } 728c708 < file = nextFile(); ========== > file = nextFile(); 729,734d708 < } < if (dieOnExit) { < System.exit(die); < } < } < 734a709,719 > } > if (dieOnExit) { > croak(die); > } > } > > // steal the Perl nomenclature > protected static void croak(int exitVal) { > System.exit(exitVal); > } > 735c720 < public static void main(String arg[]) { ========== > public static void main(String arg[]) { 736c721 < if (arg.length == 0) { ========== > if (arg.length == 0) { 737c722 < System.out.println(Constants.getString("jspc.usage")); ========== > System.out.println(Constants.getString("jspc.usage")); 738,739d722 < } else { < try { 739a723,724 > } else { > try { 740c725 < JspC jspc = new JspC(arg, System.out); ========== > JspC jspc = new JspC(arg, System.out); 741c726 < jspc.parseFiles(System.out); ========== > jspc.parseFiles(System.out); 742c727 < } catch (JasperException je) { ========== > } catch (JasperException je) { 743c728 < System.err.print("error:"); ========== > System.err.print("error:"); 744c729 < System.err.println(je.getMessage()); ========== > System.err.println(je.getMessage()); 745,751d729 < if (die != NO_DIE_LEVEL) { < System.exit(die); < } < } < } < } < 751a730,734 > croak(die); > } > } > } > 752c735 < } ========== > } 753d735 < 753a736 >
NewerCompiler.java
Description: NewerCompiler.java
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>