@@ -1,5 +1,5 @@
/*
/*
* Copyright 2000-2005 The Apache Software Foundation
* Copyright 2000-2006 The Apache Software Foundation
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
@@ -24,7 +24,9 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStream;
import java.util.Date;
import java.util.Date;
import java.util.Enumeration;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Iterator;
import java.util.Set;
import java.util.Vector;
import java.util.Vector;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.BuildException;
@@ -195,6 +197,8 @@ public class Expand extends Task {
String name = entryName.replace('/', File.separatorChar)
String name = entryName.replace('/', File.separatorChar)
.replace('\\', File.separatorChar);
.replace('\\', File.separatorChar);
boolean included = false;
boolean included = false;
Set includePatterns = new HashSet();
Set excludePatterns = new HashSet();
for (int v = 0, size = patternsets.size(); v < size; v++) {
for (int v = 0, size = patternsets.size(); v < size; v++) {
PatternSet p = (PatternSet) patternsets.elementAt(v);
PatternSet p = (PatternSet) patternsets.elementAt(v);
String[] incls = p.getIncludePatterns(getProject());
String[] incls = p.getIncludePatterns(getProject());
@@ -209,18 +213,9 @@ public class Expand extends Task {
if (pattern.endsWith(File.separator)) {
if (pattern.endsWith(File.separator)) {
pattern += "**";
pattern += "**";
}
}
included = SelectorUtils.matchPath(pattern, name);
if (included) {
break;
}
}
if (!included) {
break;
includePatterns.add(pattern);
}
}
String[] excls = p.getExcludePatterns(getProject());
String[] excls = p.getExcludePatterns(getProject());
if (excls != null) {
if (excls != null) {
for (int w = 0; w < excls.length; w++) {
for (int w = 0; w < excls.length; w++) {
@@ -230,13 +225,23 @@ public class Expand extends Task {
if (pattern.endsWith(File.separator)) {
if (pattern.endsWith(File.separator)) {
pattern += "**";
pattern += "**";
}
}
included = !(SelectorUtils.matchPath(pattern, name));
if (!included) {
break;
}
excludePatterns.add(pattern);
}
}
}
}
}
}
for (Iterator iter = includePatterns.iterator();
!included && iter.hasNext();) {
String pattern = (String) iter.next();
included = SelectorUtils.matchPath(pattern, name);
}
for (Iterator iter = excludePatterns.iterator();
included && iter.hasNext();) {
String pattern = (String) iter.next();
included = !SelectorUtils.matchPath(pattern, name);
}
if (!included) {
if (!included) {
//Do not process this file
//Do not process this file
return;
return;