bodewig 2003/06/23 07:56:32
Modified: . WHATSNEW
src/main/org/apache/tools/ant/taskdefs Expand.java
Log:
Make Expand behave like DirectoryScanner if a pattern ends with a
trailing slash or backslash.
PR: 20696
Revision Changes Path
1.441 +3 -0 ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/ant/WHATSNEW,v
retrieving revision 1.440
retrieving revision 1.441
diff -u -r1.440 -r1.441
--- WHATSNEW 20 Jun 2003 16:29:53 -0000 1.440
+++ WHATSNEW 23 Jun 2003 14:56:31 -0000 1.441
@@ -165,6 +165,9 @@
Prevent the task from being blocked by error messages coming from
java2iiop.
Bugzilla Report 19385.
+* <unzip>'s and <untar>'s nested patternsets didn't work as documented
+ when the pattern ended in a slash or backslash. Bugzilla Report 20969.
+
Other changes:
--------------
* Six new Clearcase tasks added.
1.43 +17 -3 ant/src/main/org/apache/tools/ant/taskdefs/Expand.java
Index: Expand.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Expand.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- Expand.java 24 Apr 2003 13:02:56 -0000 1.42
+++ Expand.java 23 Jun 2003 14:56:32 -0000 1.43
@@ -72,6 +72,7 @@
import org.apache.tools.ant.Task;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.PatternSet;
+import org.apache.tools.ant.types.selectors.SelectorUtils;
import org.apache.tools.ant.util.FileUtils;
/**
@@ -213,7 +214,8 @@
throws IOException {
if (patternsets != null && patternsets.size() > 0) {
- String name = entryName;
+ String name = entryName.replace('/', File.separatorChar)
+ .replace('\\', File.separatorChar);
boolean included = false;
for (int v = 0; v < patternsets.size(); v++) {
PatternSet p = (PatternSet) patternsets.elementAt(v);
@@ -224,7 +226,13 @@
}
for (int w = 0; w < incls.length; w++) {
- included = DirectoryScanner.match(incls[w], name);
+ String pattern = incls[w].replace('/',
File.separatorChar)
+ .replace('\\', File.separatorChar);
+ if (pattern.endsWith(File.separator)) {
+ pattern += "**";
+ }
+
+ included = SelectorUtils.matchPath(pattern, name);
if (included) {
break;
}
@@ -238,7 +246,13 @@
String[] excls = p.getExcludePatterns(getProject());
if (excls != null) {
for (int w = 0; w < excls.length; w++) {
- included = !(DirectoryScanner.match(excls[w], name));
+ String pattern = excls[w]
+ .replace('/', File.separatorChar)
+ .replace('\\', File.separatorChar);
+ if (pattern.endsWith(File.separator)) {
+ pattern += "**";
+ }
+ included = !(SelectorUtils.matchPath(pattern, name));
if (!included) {
break;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]