@Override public synchronized boolean isCaseSensitive() { if (!filesIncluded.isEmpty() || !dirsIncluded.isEmpty() || ticks++ > bound || System.currentTimeMillis() - start > 5000) { throw new Cancel(); } filesNotIncluded.clear(); dirsNotIncluded.clear(); // notFollowedSymlinks might be large, but probably unusual // scannedDirs will typically be largish, but seems to be needed return super.isCaseSensitive(); } };
/** * Test whether all contents of the specified directory must be excluded. * @param path the path to check. * @return whether all the specified directory's contents are excluded. */ /* package */ boolean contentsExcluded(final TokenizedPath path) { return Stream.of(excludePatterns) .filter(p -> p.endsWith(SelectorUtils.DEEP_TREE_MATCH)) .map(TokenizedPattern::withoutLastToken) .anyMatch(wlt -> wlt.matchPath(path, isCaseSensitive())); }
/** * Test whether or not a name matches against at least one include * pattern. * * @param path The tokenized path to match. Must not be <code>null</code>. * @return <code>true</code> when the name matches against at least one * include pattern, or <code>false</code> otherwise. */ private boolean isIncluded(final TokenizedPath path) { ensureNonPatternSetsReady(); String toMatch = path.toString(); if (!isCaseSensitive()) { toMatch = toMatch.toUpperCase(); } return includeNonPatterns.containsKey(toMatch) || Stream.of(includePatterns).anyMatch(p -> p.matchPath(path, isCaseSensitive())); }
/** * Test whether or not a name matches against at least one exclude * pattern. * * @param name The name to match. Must not be <code>null</code>. * @return <code>true</code> when the name matches against at least one * exclude pattern, or <code>false</code> otherwise. */ private boolean isExcluded(final TokenizedPath name) { ensureNonPatternSetsReady(); String toMatch = name.toString(); if (!isCaseSensitive()) { toMatch = toMatch.toUpperCase(); } return excludeNonPatterns.containsKey(toMatch) || Stream.of(excludePatterns).anyMatch(p -> p.matchPath(name, isCaseSensitive())); }
/** * true if the pattern specifies a relative path without basedir * or an absolute path not inside basedir. * * @since Ant 1.8.0 */ private boolean shouldSkipPattern(final String pattern) { if (FileUtils.isAbsolutePath(pattern)) { //skip abs. paths not under basedir, if set: return !(basedir == null || SelectorUtils.matchPatternStart(pattern, basedir.getAbsolutePath(), isCaseSensitive())); } return basedir == null; }
/** * Add all patterns that are not real patterns (do not contain * wildcards) to the set and returns the real patterns. * * @param map Map to populate. * @param patterns String[] of patterns. * @since Ant 1.8.0 */ private TokenizedPattern[] fillNonPatternSet(final Map<String, TokenizedPath> map, final String[] patterns) { final List<TokenizedPattern> al = new ArrayList<>(patterns.length); for (String pattern : patterns) { if (SelectorUtils.hasWildcards(pattern)) { al.add(new TokenizedPattern(pattern)); } else { final String s = isCaseSensitive() ? pattern : pattern.toUpperCase(); map.put(s, new TokenizedPath(s)); } } return al.toArray(new TokenizedPattern[al.size()]); }
/** * Test whether or not a name matches the start of the given * include pattern. * * @param tokenizedName The name to match. Must not be <code>null</code>. * @return <code>true</code> when the name matches against the start of the * include pattern, or <code>false</code> otherwise. */ private boolean couldHoldIncluded(final TokenizedPath tokenizedName, final TokenizedPattern tokenizedInclude) { return tokenizedInclude.matchStartOf(tokenizedName, isCaseSensitive()) && isMorePowerfulThanExcludes(tokenizedName.toString()) && isDeeper(tokenizedInclude, tokenizedName); }
if ((myfile == null || !myfile.exists()) && !isCaseSensitive()) { final File f = currentPath.findFile(basedir, false); if (f != null && f.exists()) { final boolean included = isCaseSensitive() ? originalpattern.equals(currentelement) : originalpattern.equalsIgnoreCase(currentelement);