ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 1415] New - getIncludeDirectories() in DirectoryScanner does not work the same as in version 1.1
Date Thu, 19 Apr 2001 22:37:11 GMT
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1415

*** shadow/1415	Thu Apr 19 15:37:11 2001
--- shadow/1415.tmp.3480	Thu Apr 19 15:37:11 2001
***************
*** 0 ****
--- 1,98 ----
+ +============================================================================+
+ | getIncludeDirectories() in DirectoryScanner does not work the same as in v |
+ +----------------------------------------------------------------------------+
+ |        Bug #: 1415                        Product: Ant                     |
+ |       Status: NEW                         Version: 1.2                     |
+ |   Resolution:                            Platform: All                     |
+ |     Severity: Normal                   OS/Version: All                     |
+ |     Priority: Low                       Component: Core                    |
+ +----------------------------------------------------------------------------+
+ |  Assigned To: ant-dev@jakarta.apache.org                                   |
+ |  Reported By: James_Guido@homedepot.com                                    |
+ |      CC list: Cc:                                                          |
+ +----------------------------------------------------------------------------+
+ |          URL:                                                              |
+ +============================================================================+
+ |                              DESCRIPTION                                   |
+ BUG:
+ When scanning for child directories where the parent directory is excluded,
+ DirectoryScanner does not return child directories (versions 1.2 and 1.3).
+ This used to work in version 1.1.
+ Furthermore, if one calls getExcludedDirectories() or any of the methods
+ that calls slowScan(), a protected method, then getIncludeDirectories()
+ returns the child directories, so getIncludeDirectories() (versions 1.2 and 1.3)
+ has two possible different results/behaviors.
+ 
+ SUGGESTION:
+ 1) Replace scan()(fast scan) with slowScan(), and only have one type of scan,
+ or
+ 2) add method that explicitly sets type of scan (fast or slow),
+ or
+ 3) make slowScan() a public method, so user can choose which scan to run.
+ Just remember that if 2) or 3) is implemented, you should add a setter in
+ MatchingTask to choose what type of scan() to run, and that 
+ it should default to slow scan to be backwards compatible with version 1.1.
+ 
+ 
+ Here is a test program I wrote illustrating the problem:
+ 
+ import java.io.*;
+ import org.apache.tools.ant.*;
+ 
+ public class TestDirectoryScanner {
+ 
+ public static void main (String[] args){
+ 
+ 	// setup test
+ 	File dir = new File ("parent");
+ 	dir.mkdir();
+ 	dir = new File ("parent/child");
+ 	dir.mkdir();
+ 	dir = new File ("other");
+ 	dir.mkdir();
+ 
+ 	// create directory scanner
+ 	DirectoryScanner scanner = new DirectoryScanner();
+ 	scanner.setBasedir (new File("."));
+ 	scanner.setExcludes (new String[]{ "parent" });
+ 	scanner.scan();
+ 
+ 	System.out.println ("CALLING getIncludedDirectories()...");
+ 	String[] dirs = scanner.getIncludedDirectories();
+ 	for(int i = 0; i < dirs.length; i++) {
+ 		System.out.println ("    RETURNED DIR["+i+"]: " + dirs[i]);
+ 	}
+ 
+ 	scanner.getExcludedDirectories();
+ 
+ 	System.out.println ("CALLING getIncludedDirectories() AFTER CALLING 
+ getExcludedDirectories()...");
+ 	dirs = scanner.getIncludedDirectories();
+ 	for(int i = 0; i < dirs.length; i++) {
+ 		System.out.println ("    RETURNED DIR["+i+"]: " + dirs[i]);
+ 	}
+ }
+ 
+ }
+ 
+ Run it from an empty directory, as it creates the directories needed
+ for the test.
+ 
+ 
+ Here is the results for version 1.1:
+ 
+ CALLING getIncludedDirectories()...
+     RETURNED DIR[0]: other
+     RETURNED DIR[1]: parent\child
+ CALLING getIncludedDirectories() AFTER CALLING getExcludedDirectories()...
+     RETURNED DIR[0]: other
+     RETURNED DIR[1]: parent\child
+ 
+ 
+ Here is the results for versions 1.2 and 1.3:
+ 
+ CALLING getIncludedDirectories()...
+     RETURNED DIR[0]: other
+ CALLING getIncludedDirectories() AFTER CALLING getExcludedDirectories()...
+     RETURNED DIR[0]: other
+     RETURNED DIR[1]: parent\child

Mime
View raw message