I submitted a patch in bugzilla at:
  http://nagoya.apache.org/bugzilla/show_bug.cgi?id=9577

I've just added a patch which addresses the issues in this
report.  Note the following changes:

1. Only files that have been converted are displayed
   (speeds up build time on my local system)
2. Show number of files processed (and ignored)
3. Created a new constructor in FilesLister that takes
   in an "ignore" extension so that the filtering function
   could filter out files with extensions of the form:
       ignore + "." + extension

- Gidado

Index: FileLister.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-watchdog-4.0/src/tools/org/apache/watchdog/jspxml/FileLister.java,v
retrieving revision 1.1
diff -u -r1.1 FileLister.java
--- FileLister.java     2 Feb 2002 03:21:25 -0000       1.1
+++ FileLister.java     3 Jun 2002 15:26:12 -0000
@@ -63,10 +63,16 @@
 import java.io.*;
 import java.util.*;
 
+/**
+   When determining if a file should be listed, if
+   <code>ignore!=null</code>, then do not include files that end with
+   <code>ingore + "." + extension.
+*/
 public class FileLister {
     protected Vector file_list ;
     protected File start_dir ;
     protected String extension ;
+       protected String ignore ;
 
     public FileLister() {
         file_list = new Vector();
@@ -80,6 +86,13 @@
         this.extension = extension ;
     }
 
+    public FileLister(String absolute_path, String extension, String ignore) {
+        file_list = new Vector();
+        start_dir = new File(absolute_path);
+        this.extension = extension ;
+               this.ignore = ignore;
+    }
+
     public Object[] listFiles() {
         addFiles(start_dir);
         return file_list.toArray();
@@ -101,8 +114,12 @@
 
             String file_extension = file_name.substring(dot_index + 1, 
file_name.length());
 
-            if (file_extension.equals(extension))
-                file_list.add(start_dir.getAbsolutePath());
+            if (file_extension.equals(extension)) {
+                               if (ignore==null ||
+                                       ! file_name.endsWith(ignore + "." + extension))
+
+                                       file_list.add(start_dir.getAbsolutePath());
+                       }
             return ;
         }
         //we are here means we have a directory
Index: GetWorkspaceInXML.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-watchdog-4.0/src/tools/org/apache/watchdog/jspxml/GetWorkspaceInXML.java,v
retrieving revision 1.1
diff -u -r1.1 GetWorkspaceInXML.java
--- GetWorkspaceInXML.java      2 Feb 2002 03:21:25 -0000       1.1
+++ GetWorkspaceInXML.java      3 Jun 2002 15:26:12 -0000
@@ -89,19 +89,19 @@
         }
 
         String extension = "jsp" ; //files with extension .jsp
+               String jsp_root_file = new File(jsp_root_dir).toString();
+               int jsp_root_length = jsp_root_file==null ? 0 : jsp_root_file.length();
 
-        FileLister lister = new FileLister(jsp_root_dir , extension) ;
+        FileLister lister = new FileLister(jsp_root_dir , extension, "XML") ;
         Object[] files = lister.listFiles();
-        System.out.println("" + files.length + " files to process in " +
-                           jsp_root_dir);
+        System.out.println(files.length + " files to process in " + 
+                                                  jsp_root_dir);                      
+     
 
+               int already_converted = 0;
         for (int i = 0; i < files.length;i++) {
             jsp_file = (String)files[i];
             int index = jsp_file.lastIndexOf(".jsp");
 
-            if (index != -1)
-                if (jsp_file.endsWith("XML.jsp"))
-                    continue;
             xml_file = jsp_file.substring(0, index) + "XML" + ".jsp";
 
             //it should convert only if the jsp file is newer than the XML file
@@ -109,15 +109,25 @@
             File file_jsp = new File(jsp_file) ;
             File file_xml = new File(xml_file);
 
-            System.out.println("processing " + jsp_file);
             if (file_xml.exists()) {  
                 //there was already a conversion
-                if (file_xml.lastModified() > file_jsp.lastModified())
+                if (file_xml.lastModified() > file_jsp.lastModified()) {
+                                       already_converted++;
                     continue;
+                               }
             }
 
             //if we are here means we need to convert the jsp file to xml
-            System.out.println("*** converting to " + xml_file);
+                       String xml_file_name = xml_file.toString();
+                       int path_index = xml_file_name.indexOf(jsp_root_file);
+                       if (path_index > 0) {
+                               String relative_path =
+                                       xml_file_name.substring(path_index + 
+jsp_root_length + 1);
+                               System.out.println("  " + relative_path);
+                       }
+                       else
+                               System.out.println("  " + xml_file);
+
             jsp2XML jsp_converter = new jsp2XML(jsp_file);
             String xml = jsp_converter.ConvertJsp2XML();
 
@@ -130,6 +140,9 @@
             }
 
         }  //end for
+               if (already_converted > 0)
+                       System.out.println(already_converted +
+                                                          " files previously 
+converted");
 
         //we generated the workspace in XML...now we need to create the
         //jsp-gtest-xml file that has targets for running the tests against

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

Reply via email to