Author: yoavs
Date: Fri Dec  2 07:50:10 2005
New Revision: 351756

URL: http://svn.apache.org/viewcvs?rev=351756&view=rev
Log:
Bugzilla 37746: http://issues.apache.org/bugzilla/show_bug.cgi?id=37746
And other minor enhancements, like using List interface for pages Vector (while 
retaining Vector impl for thread safety)

Modified:
    tomcat/jasper/tc5.5.x/jasper2/src/share/org/apache/jasper/JspC.java

Modified: tomcat/jasper/tc5.5.x/jasper2/src/share/org/apache/jasper/JspC.java
URL: 
http://svn.apache.org/viewcvs/tomcat/jasper/tc5.5.x/jasper2/src/share/org/apache/jasper/JspC.java?rev=351756&r1=351755&r2=351756&view=diff
==============================================================================
--- tomcat/jasper/tc5.5.x/jasper2/src/share/org/apache/jasper/JspC.java 
(original)
+++ tomcat/jasper/tc5.5.x/jasper2/src/share/org/apache/jasper/JspC.java Fri Dec 
 2 07:50:10 2005
@@ -31,7 +31,7 @@
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.ArrayList;
-import java.util.Enumeration;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.HashMap;
@@ -180,7 +180,15 @@
      */
     private List extensions;
 
-    private Vector pages = new Vector();
+    /**
+     * The pages.
+     */
+    private List pages = new Vector();
+
+    /**
+     * Needs better documentation, this data member does.
+     * True by default.
+     */
     private boolean errorOnUseBeanInvalidClassAttribute = true;
 
     /**
@@ -198,9 +206,15 @@
     private CharArrayWriter servletout;
     private CharArrayWriter mappingout;
 
+    /**
+     * The servlet context.
+     */
     private JspCServletContext context;
 
-    // Maintain a dummy JspRuntimeContext for compiling tag files
+    /**
+     * The runtime context.
+     * Maintain a dummy JspRuntimeContext for compiling tag files.
+     */
     private JspRuntimeContext rctxt;
 
     /**
@@ -339,8 +353,10 @@
         // Add all extra arguments to the list of files
         while( true ) {
             String file = nextFile();
-            if( file==null ) break;
-            pages.addElement( file );
+            if( file==null ) {
+                break;
+            }
+            pages.add( file );
         }
     }
 
@@ -673,26 +689,43 @@
         }
     }
 
-    /*
-     * Parses comma-separated list of JSP files to be processed.
+    /**
+     * Parses comma-separated list of JSP files to be processed.  If the 
argument
+     * is null, nothing is done.
      *
      * <p>Each file is interpreted relative to uriroot, unless it is absolute,
-     * in which case it must start with uriroot.
+     * in which case it must start with uriroot.</p>
      *
      * @param jspFiles Comma-separated list of JSP files to be processed
      */
-    public void setJspFiles(String jspFiles) {
-        StringTokenizer tok = new StringTokenizer(jspFiles, " ,");
+    public void setJspFiles(final String jspFiles) {
+        if(jspFiles == null) {
+            return;
+        }
+
+        StringTokenizer tok = new StringTokenizer(jspFiles, ",");
         while (tok.hasMoreTokens()) {
-            pages.addElement(tok.nextToken());
+            pages.add(tok.nextToken());
         }
     }
 
-    public void setCompile( boolean b ) {
-        compile=b;
+    /**
+     * Sets the compile flag.
+     *
+     * @param b Flag value
+     */
+    public void setCompile( final boolean b ) {
+        compile = b;
     }
 
-    public void setVerbose( int level ) {
+    /**
+     * Sets the verbosity level.  The actual number doesn't
+     * matter: if it's greater than zero, the verbose flag will
+     * be true.
+     *
+     * @param level Positive means verbose
+     */
+    public void setVerbose( final int level ) {
         if (level > 0) {
             verbose = true;
             showSuccess = true;
@@ -1021,7 +1054,7 @@
                         ext = files[i].substring(files[i].lastIndexOf('.') +1);
                         if (getExtensions().contains(ext) ||
                             jspConfig.isJspPage(uri)) {
-                            pages.addElement(path);
+                            pages.add(path);
                         }
                     }
                 }
@@ -1029,7 +1062,15 @@
         }
     }
 
+    /**
+     * Executes the compilation.
+     *
+     * @throws JasperException If an error occurs
+     */
     public void execute() throws JasperException {
+        if(log.isDebugEnabled()) {
+            log.debug("execute() starting for " + pages.size() + " pages.");
+        }
 
         try {
             if (uriRoot == null) {
@@ -1037,7 +1078,7 @@
                     throw new JasperException(
                         Localizer.getMessage("jsp.error.jspc.missingTarget"));
                 }
-                String firstJsp=(String)pages.elementAt( 0 );
+                String firstJsp = (String) pages.get( 0 );
                 File firstJspF = new File( firstJsp );
                 if (!firstJspF.exists()) {
                     throw new JasperException(
@@ -1069,9 +1110,9 @@
 
             initWebXml();
 
-            Enumeration e = pages.elements();
-            while (e.hasMoreElements()) {
-                String nextjsp = e.nextElement().toString();
+            Iterator iter = pages.iterator();
+            while (iter.hasNext()) {
+                String nextjsp = iter.next().toString();
                 File fjsp = new File(nextjsp);
                 if (!fjsp.isAbsolute()) {
                     fjsp = new File(uriRootF, nextjsp);



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to