kinman 2002/08/21 10:54:25 Modified: jasper2/src/share/org/apache/jasper Tag: tomcat_4_branch JspC.java JspCompilationContext.java jasper2/src/share/org/apache/jasper/resources Tag: tomcat_4_branch messages.properties Log: - Fixed 11891. Patched by John Trollinger <[EMAIL PROTECTED]> Revision Changes Path No revision No revision 1.12.2.1 +33 -8 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 retrieving revision 1.12.2.1 diff -u -r1.12 -r1.12.2.1 --- JspC.java 26 Jun 2002 16:50:38 -0000 1.12 +++ JspC.java 21 Aug 2002 17:54:24 -0000 1.12.2.1 @@ -131,6 +131,8 @@ public static final String SWITCH_WEBAPP_XML = "-webxml"; public static final String SWITCH_MAPPED = "-mapped"; public static final String SWITCH_DIE = "-die"; + public static final String SHOW_SUCCESS ="-s"; + public static final String LIST_ERRORS = "-l"; public static final int NO_WEBXML = 0; public static final int INC_WEBXML = 10; @@ -196,6 +198,9 @@ */ private TldLocationsCache tldLocationsCache = null; + private boolean listErrors = false; + private boolean showSuccess = false; + public boolean getKeepGenerated() { // isn't this why we are running jspc? return true; @@ -386,11 +391,11 @@ if (dirset) { int indexOfSlash = clctxt.getJspFile().lastIndexOf('/'); - String pathName = ""; + /* String pathName = ""; if (indexOfSlash != -1) { pathName = clctxt.getJspFile().substring(0, indexOfSlash); - } - String tmpDir = outputDir + File.separatorChar + pathName; + } */ + String tmpDir = outputDir + File.separatorChar; // + pathName; File f = new File(tmpDir); if (!f.exists()) { f.mkdirs(); @@ -519,6 +524,8 @@ { try { String jspUri=file.replace('\\','/'); + String baseDir = scratchDir.getCanonicalPath(); + this.setOutputDir( baseDir + jspUri.substring( 0, jspUri.lastIndexOf( '/' ) ) ); JspCompilationContext clctxt = new JspCompilationContext ( jspUri, false, this, context, null, null ); @@ -540,6 +547,7 @@ clctxt.setClassPath(classPath); Compiler clc = clctxt.createCompiler(); + this.setOutputDir( baseDir ); if( compile ) { // Generate both .class and .java @@ -556,7 +564,9 @@ // Generate mapping generateWebMapping( file, clctxt ); - + if ( showSuccess ) { + log.println( "Built File: " + file ); + } return true; } catch (FileNotFoundException fne) { Constants.message("jspc.error.fileDoesNotExist", @@ -565,7 +575,10 @@ } catch (Exception e) { Constants.message("jspc.error.generalException", new Object[] {file, e}, Logger.ERROR); - if (dieLevel != NO_DIE_LEVEL) { + if ( listErrors ) { + log.println( "Error in File: " + file ); + return true; + } else if (dieLevel != NO_DIE_LEVEL) { dieOnExit = true; } throw new JasperException( e ); @@ -873,6 +886,10 @@ setUriroot( nextArg()); } else if (tok.equals(SWITCH_FILE_WEBAPP)) { setUriroot( nextArg()); + } else if ( tok.equals( SHOW_SUCCESS ) ) { + showSuccess = true; + } else if ( tok.equals( LIST_ERRORS ) ) { + listErrors = true; } else if (tok.equals(SWITCH_WEBAPP_INC)) { webxmlFile = nextArg(); if (webxmlFile != null) { @@ -913,5 +930,13 @@ Constants.jasperLog.setVerbosityLevel(verbosityLevel); } + /** + * allows user to set where the log goes other than System.out + * @param log + */ + public static void setLog( PrintStream log ) { + JspC.log = log; + } + } 1.6.2.4 +4 -4 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.6.2.3 retrieving revision 1.6.2.4 diff -u -r1.6.2.3 -r1.6.2.4 --- JspCompilationContext.java 24 Jul 2002 09:08:36 -0000 1.6.2.3 +++ JspCompilationContext.java 21 Aug 2002 17:54:24 -0000 1.6.2.4 @@ -267,7 +267,7 @@ } for (int i = iSep; i < iEnd; i++) { char ch = jspUri.charAt(i); - if (Character.isLetterOrDigit(ch)) { + if (Character.isJavaIdentifierPart(ch)) { modifiedClassName.append(ch); } else if (ch == '.') { modifiedClassName.append('_'); No revision No revision 1.9.2.2 +3 -1 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties Index: messages.properties =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -u -r1.9.2.1 -r1.9.2.2 --- messages.properties 18 Jul 2002 23:25:05 -0000 1.9.2.1 +++ messages.properties 21 Aug 2002 17:54:24 -0000 1.9.2.2 @@ -173,6 +173,8 @@ \ -v[#] Verbose mode (optional number is level, default is 2)\n\ \ -d <dir> Output Directory\n\ \ -dd <dir> Literal Output Directory. (package dirs will not be made)\n\ +\ -l Outputs the name of the JSP page upon failure\n\ +\ -s Outputs the name of the JSP page upon success\n\ \ -p <name> Name of target package\n\ \ -c <name> Name of target class name\n\ \ (only applies to first JSP page)\n\
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>