From 9e66320fa042c82cebde8ed6d9c3a16b23dabfa9 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Tue, 15 Jul 2003 14:18:07 +0000 Subject: [PATCH] Only whitespace changes git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274823 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tools/ant/DirectoryScanner.java | 95 +++++++++++-------- .../ant/types/selectors/SelectorUtils.java | 50 +++++----- 2 files changed, 79 insertions(+), 66 deletions(-) diff --git a/src/main/org/apache/tools/ant/DirectoryScanner.java b/src/main/org/apache/tools/ant/DirectoryScanner.java index 849a92390..ac26f6eb6 100644 --- a/src/main/org/apache/tools/ant/DirectoryScanner.java +++ b/src/main/org/apache/tools/ant/DirectoryScanner.java @@ -644,57 +644,66 @@ public class DirectoryScanner } checkIncludePatterns(); } + /** - * this routine is actually checking all the include patterns - * in order to avoid scanning everything under base dir - * @since ant1.6 + * this routine is actually checking all the include patterns in + * order to avoid scanning everything under base dir + * @since ant1.6 */ private void checkIncludePatterns() { - Hashtable newroots = new Hashtable(); - // put in the newroots vector the include patterns without wildcard tokens - for (int icounter=0; icounter0) { - accountForIncludedDir(currentelement,myfile,true); - } else { - if (currentelement.length() > 0) { - if (currentelement.charAt(currentelement.length()-1) != File.separatorChar) { - currentelement = currentelement + File.separatorChar; + + Enumeration enum2 = newroots.keys(); + while (enum2.hasMoreElements()) { + String currentelement = (String) enum2.nextElement(); + File myfile=new File(basedir, currentelement); + if (myfile.exists()) { + if (myfile.isDirectory()) { + if (isIncluded(currentelement) + && currentelement.length()>0) { + accountForIncludedDir(currentelement,myfile,true); + } else { + if (currentelement.length() > 0) { + if (currentelement.charAt(currentelement.length() + -1 ) + != File.separatorChar) { + currentelement = + currentelement + File.separatorChar; + } + } + scandir(myfile, currentelement, true); + } + } else { + String originalpattern= + (String) newroots.get(currentelement); + if (originalpattern.equals(currentelement)) { + accountForIncludedFile(currentelement,myfile); } } - scandir(myfile, currentelement, true); - } - } - else { - String originalpattern=(String)newroots.get(currentelement); - if (originalpattern.equals(currentelement)) { - accountForIncludedFile(currentelement,myfile); } - } } - } } + /** * Top level invocation for a slow scan. A slow scan builds up a full * list of excluded/included files/directories, whereas a fast scan @@ -838,9 +847,11 @@ public class DirectoryScanner } } + /** * - * @param name path of the directory relative to the directory of the fileset + * @param name path of the directory relative to the directory of + * the fileset * @param file directory as file * @param fast */ diff --git a/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java b/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java index 0ee81243d..8b23fca6f 100644 --- a/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java +++ b/src/main/org/apache/tools/ant/types/selectors/SelectorUtils.java @@ -526,29 +526,29 @@ public final class SelectorUtils { * * @param path Path to tokenize. Must not be null. * - * @return a Vector of path elements from the tokenized path - */ - public static Vector tokenizePath (String path) { - return tokenizePath(path, File.separator); - } - /** - * Breaks a path up into a Vector of path elements, tokenizing on - * - * @param path Path to tokenize. Must not be null. - * @param separator the separator against which to tokenize. - * - * @return a Vector of path elements from the tokenized path - * @since ant 1.6 - */ - public static Vector tokenizePath (String path, String separator) { - Vector ret = new Vector(); - StringTokenizer st = new StringTokenizer(path,separator); - while (st.hasMoreTokens()) { - ret.addElement(st.nextToken()); - } - return ret; - - } + * @return a Vector of path elements from the tokenized path + */ + public static Vector tokenizePath (String path) { + return tokenizePath(path, File.separator); + } + + /** + * Breaks a path up into a Vector of path elements, tokenizing on + * + * @param path Path to tokenize. Must not be null. + * @param separator the separator against which to tokenize. + * + * @return a Vector of path elements from the tokenized path + * @since Ant 1.6 + */ + public static Vector tokenizePath (String path, String separator) { + Vector ret = new Vector(); + StringTokenizer st = new StringTokenizer(path,separator); + while (st.hasMoreTokens()) { + ret.addElement(st.nextToken()); + } + return ret; + } /** * Same as {@link #tokenizePath tokenizePath} but hopefully faster. @@ -662,14 +662,16 @@ public final class SelectorUtils { } return result.toString(); } + /** * Tests if a string contains stars or question marks - * @param input a String which one wants to test for containing wildcard + * @param input a String which one wants to test for containing wildcard * @return true if the string contains at least a star or a question mark */ public static boolean hasWildcards(String input) { return (input.indexOf('*')!=-1 || input.indexOf('?')!=-1); } + /** * removes from a pattern all tokens to the right containing wildcards * @param input