Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 4137 invoked from network); 7 Jan 2005 17:14:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 7 Jan 2005 17:14:46 -0000 Received: (qmail 83498 invoked by uid 500); 7 Jan 2005 17:14:44 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 83449 invoked by uid 500); 7 Jan 2005 17:14:44 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 83433 invoked by uid 500); 7 Jan 2005 17:14:44 -0000 Received: (qmail 83419 invoked by uid 99); 7 Jan 2005 17:14:43 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Fri, 07 Jan 2005 09:14:43 -0800 Received: (qmail 4084 invoked by uid 1818); 7 Jan 2005 17:14:42 -0000 Date: 7 Jan 2005 17:14:42 -0000 Message-ID: <20050107171442.4083.qmail@minotaur.apache.org> From: mbenson@apache.org To: ant-cvs@apache.org Subject: cvs commit: ant/src/main/org/apache/tools/ant DirectoryScanner.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N mbenson 2005/01/07 09:14:42 Modified: src/main/org/apache/tools/ant DirectoryScanner.java Log: Various inconsequentials Revision Changes Path 1.77 +35 -26 ant/src/main/org/apache/tools/ant/DirectoryScanner.java Index: DirectoryScanner.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/DirectoryScanner.java,v retrieving revision 1.76 retrieving revision 1.77 diff -u -r1.76 -r1.77 --- DirectoryScanner.java 6 Jan 2005 12:05:06 -0000 1.76 +++ DirectoryScanner.java 7 Jan 2005 17:14:42 -0000 1.77 @@ -944,9 +944,9 @@ } } /** - * process included file - * @param name path of the file relative to the directory of the fileset - * @param file included file + * Process included file. + * @param name path of the file relative to the directory of the FileSet. + * @param file included File. */ private void accountForIncludedFile(String name, File file) { if (!filesIncluded.contains(name) @@ -968,11 +968,11 @@ } /** - * + * Process included directory. * @param name path of the directory relative to the directory of - * the fileset - * @param file directory as file - * @param fast + * the FileSet. + * @param file directory as File. + * @param fast whether to perform fast scans. */ private void accountForIncludedDir(String name, File file, boolean fast) { if (!dirsIncluded.contains(name) @@ -1011,11 +1011,7 @@ * include pattern, or false otherwise. */ protected boolean isIncluded(String name) { - if (!areNonPatternSetsReady) { - includePatterns = fillNonPatternSet(includeNonPatterns, includes); - excludePatterns = fillNonPatternSet(excludeNonPatterns, excludes); - areNonPatternSetsReady = true; - } + ensureNonPatternSetsReady(); if ((isCaseSensitive() && includeNonPatterns.contains(name)) || @@ -1085,12 +1081,8 @@ * exclude pattern, or false otherwise. */ protected boolean isExcluded(String name) { - if (!areNonPatternSetsReady) { - includePatterns = fillNonPatternSet(includeNonPatterns, includes); - excludePatterns = fillNonPatternSet(excludeNonPatterns, excludes); - areNonPatternSetsReady = true; - } - + ensureNonPatternSetsReady(); + if ((isCaseSensitive() && excludeNonPatterns.contains(name)) || (!isCaseSensitive() @@ -1134,6 +1126,9 @@ * include patterns and none of the exclude patterns. */ public String[] getIncludedFiles() { + if (filesIncluded == null) { + throw new IllegalStateException(); + } String[] files = new String[filesIncluded.size()]; filesIncluded.copyInto(files); Arrays.sort(files); @@ -1214,6 +1209,9 @@ * include patterns and none of the exclude patterns. */ public String[] getIncludedDirectories() { + if (dirsIncluded == null) { + throw new IllegalStateException(); + } String[] directories = new String[dirsIncluded.size()]; dirsIncluded.copyInto(directories); Arrays.sort(directories); @@ -1498,7 +1496,7 @@ * * @since Ant 1.6 */ - private void clearCaches() { + private synchronized void clearCaches() { fileListMap.clear(); scannedDirs.clear(); includeNonPatterns.clear(); @@ -1508,7 +1506,21 @@ } /** - * Adds all patterns that are no real patterns (doesn't contain + * Ensure that the in|exclude "patterns" + * have been properly divided up. + * + * @since Ant 1.7 + */ + private synchronized void ensureNonPatternSetsReady() { + if (!areNonPatternSetsReady) { + includePatterns = fillNonPatternSet(includeNonPatterns, includes); + excludePatterns = fillNonPatternSet(excludeNonPatterns, excludes); + areNonPatternSetsReady = true; + } + } + + /** + * Adds all patterns that are not real patterns (do not contain * wildcards) to the set and returns the real patterns. * * @since Ant 1.7 @@ -1517,16 +1529,13 @@ ArrayList al = new ArrayList(patterns.length); for (int i = 0; i < patterns.length; i++) { if (!SelectorUtils.hasWildcards(patterns[i])) { - if (isCaseSensitive()) { - set.add(patterns[i]); - } else { - set.add(patterns[i].toUpperCase()); - } + set.add(isCaseSensitive() ? patterns[i] + : patterns[i].toUpperCase()); } else { al.add(patterns[i]); } } - return set.size() == 0 ? patterns + return set.size() == 0 ? patterns : (String[]) al.toArray(new String[al.size()]); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org