kinman 2002/08/21 10:56:03 Modified: jasper2/src/share/org/apache/jasper JspC.java JspCompilationContext.java jasper2/src/share/org/apache/jasper/resources messages.properties Log: - Fixed 11891. Patched by John Trollinger <[EMAIL PROTECTED]> Revision Changes Path 1.14 +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.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- JspC.java 20 Aug 2002 15:50:22 -0000 1.13 +++ JspC.java 21 Aug 2002 17:56:03 -0000 1.14 @@ -132,6 +132,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; @@ -197,6 +199,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; @@ -387,11 +392,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(); @@ -520,6 +525,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 ); @@ -541,6 +548,7 @@ clctxt.setClassPath(classPath); Compiler clc = clctxt.createCompiler(); + this.setOutputDir( baseDir ); if( compile ) { // Generate both .class and .java @@ -557,7 +565,9 @@ // Generate mapping generateWebMapping( file, clctxt ); - + if ( showSuccess ) { + log.println( "Built File: " + file ); + } return true; } catch (FileNotFoundException fne) { Constants.message("jspc.error.fileDoesNotExist", @@ -566,7 +576,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 ); @@ -874,6 +887,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) { @@ -912,6 +929,14 @@ } 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.19 +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.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- JspCompilationContext.java 21 Aug 2002 17:05:52 -0000 1.18 +++ JspCompilationContext.java 21 Aug 2002 17:56:03 -0000 1.19 @@ -318,7 +318,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('_'); 1.29 +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.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- messages.properties 21 Aug 2002 17:05:52 -0000 1.28 +++ messages.properties 21 Aug 2002 17:56:03 -0000 1.29 @@ -178,6 +178,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]>