ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 11100] New: - Expand tasks do not behave as expected with PatternSets.
Date Tue, 23 Jul 2002 20:37:30 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11100>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11100

Expand tasks do not behave as expected with PatternSets.

           Summary: Expand tasks do not behave as expected with PatternSets.
           Product: Ant
           Version: 1.5
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core tasks
        AssignedTo: ant-dev@jakarta.apache.org
        ReportedBy: gudnabrsam@yahoo.com


With the following scenario:

<untar src="test/test.tar.gz" compression="gzip" dest="test">
  <patternset>
    <exclude name="**/*.class" />
  </patternset>
</untar>

No files are extracted.  To obtain the desired behavior, I must add a nested 
<include>:

<untar src="test/test.tar.gz" compression="gzip" dest="test">
  <patternset>
    <include name="**/**" />
    <exclude name="**/*.class" />
  </patternset>
</untar>

The problem appears to be in Expand.extractFile().  Looks to me as though the 
simplest fix would be change the first part of the method to something like 
this:

if (patternsets != null && patternsets.size() > 0) {
  String name = entryName;
  boolean included;
  for (int v = 0; v < patternsets.size(); v++) {
    included = true;
    PatternSet p = (PatternSet) patternsets.elementAt(v);
    String[] incls = p.getIncludePatterns(project);
    if (incls != null) {
      for (int w = 0; w < incls.length; w++) {
        included = DirectoryScanner.match(incls[w], name);
        if (included) break;
      }
    }
    String[] excls = p.getExcludePatterns(project);
    if (excls != null) {
      for (int w = 0; w < excls.length; w++) {
        included = !(DirectoryScanner.match(excls[w], name));
        if (!included) break;
      }
    }
  }
  if (!included) {
    //Do not process this file
    return;
  }
}

--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message