This patch also changes the class file name stuff to eliminate
unnecessary char escaping.  
--- old/JspCompilationContext.java      2002-08-21 08:55:23.000000000 -0400
+++ new/JspCompilationContext.java      2002-08-21 08:35:26.000000000 -0400
@@ -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('_');
--- old/JspC.java       2002-08-21 08:55:31.000000000 -0400
+++ new/JspC.java       2002-08-21 09:19:51.000000000 -0400
@@ -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) {
@@ -912,6 +929,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;
+    }
 
 }
 
--- old/messages.properties     2002-07-18 19:25:05.000000000 -0400
+++ new/messages.properties     2002-08-21 08:43:37.000000000 -0400
@@ -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]>

Reply via email to