ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject cvs commit: jakarta-ant/src/main/org/apache/tools/ant/types AbstractFileSet.java
Date Mon, 23 Sep 2002 11:44:32 GMT
bodewig     2002/09/23 04:44:32

  Modified:    src/main/org/apache/tools/ant/types Tag: ANT_15_BRANCH
                        AbstractFileSet.java
  Log:
  AbstractFileSet should check whether it is a reference in a couple of places
  
  Triggered by PR: 12838
  
  Merge from HEAD.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.5.2.8   +57 -18    jakarta-ant/src/main/org/apache/tools/ant/types/AbstractFileSet.java
  
  Index: AbstractFileSet.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/types/AbstractFileSet.java,v
  retrieving revision 1.5.2.7
  retrieving revision 1.5.2.8
  diff -u -r1.5.2.7 -r1.5.2.8
  --- AbstractFileSet.java	2 Sep 2002 15:14:29 -0000	1.5.2.7
  +++ AbstractFileSet.java	23 Sep 2002 11:44:32 -0000	1.5.2.8
  @@ -53,18 +53,33 @@
    */
   package org.apache.tools.ant.types;
   
  +import java.io.File;
  +import java.util.Enumeration;
  +import java.util.Hashtable;
  +import java.util.Stack;
  +import java.util.Vector;
   import org.apache.tools.ant.BuildException;
  -import org.apache.tools.ant.FileScanner;
   import org.apache.tools.ant.DirectoryScanner;
  +import org.apache.tools.ant.FileScanner;
   import org.apache.tools.ant.Project;
  -import org.apache.tools.ant.types.selectors.*;
   import org.apache.tools.ant.util.FileUtils;
  -
  -import java.io.File;
  -import java.util.Stack;
  -import java.util.Vector;
  -import java.util.Hashtable;
  -import java.util.Enumeration;
  +import org.apache.tools.ant.types.selectors.AndSelector;
  +import org.apache.tools.ant.types.selectors.ContainsSelector;
  +import org.apache.tools.ant.types.selectors.DateSelector;
  +import org.apache.tools.ant.types.selectors.DependSelector;
  +import org.apache.tools.ant.types.selectors.DepthSelector;
  +import org.apache.tools.ant.types.selectors.ExtendSelector;
  +import org.apache.tools.ant.types.selectors.FileSelector;
  +import org.apache.tools.ant.types.selectors.FilenameSelector;
  +import org.apache.tools.ant.types.selectors.MajoritySelector;
  +import org.apache.tools.ant.types.selectors.NoneSelector;
  +import org.apache.tools.ant.types.selectors.NotSelector;
  +import org.apache.tools.ant.types.selectors.OrSelector;
  +import org.apache.tools.ant.types.selectors.PresentSelector;
  +import org.apache.tools.ant.types.selectors.SelectSelector;
  +import org.apache.tools.ant.types.selectors.SelectorContainer;
  +import org.apache.tools.ant.types.selectors.SelectorScanner;
  +import org.apache.tools.ant.types.selectors.SizeSelector;
   
   /**
    * Class that holds an implicit patternset and supports nested
  @@ -190,6 +205,16 @@
       }
   
       /**
  +     * add a name entry on the include files list
  +     */
  +    public PatternSet.NameEntry createExcludesFile() {
  +        if (isReference()) {
  +            throw noChildrenAllowed();
  +        }
  +        return defaultPatterns.createExcludesFile();
  +    }
  +
  +    /**
        * Creates a single file fileset.
        */
       public void setFile(File file) {
  @@ -202,16 +227,6 @@
           PatternSet.NameEntry include = createInclude();
           include.setName(file.getName());
       }
  -    
  -    /**
  -     * add a name entry on the include files list
  -     */
  -    public PatternSet.NameEntry createExcludesFile() {
  -        if (isReference()) {
  -            throw noChildrenAllowed();
  -        }
  -        return defaultPatterns.createExcludesFile();
  -    }
   
       /**
        * Appends <code>includes</code> to the current list of include
  @@ -293,6 +308,9 @@
        *                           sensitive, "false"|"off"|"no" when not.
        */
       public void setCaseSensitive(boolean isCaseSensitive) {
  +        if (isReference()) {
  +            throw tooManyAttributes();
  +        }
           this.isCaseSensitive = isCaseSensitive;
       }
   
  @@ -302,6 +320,9 @@
        * @param followSymlinks whether or not symbolic links should be followed
        */
       public void setFollowSymlinks(boolean followSymlinks) {
  +        if (isReference()) {
  +            throw tooManyAttributes();
  +        }
           this.followSymlinks = followSymlinks;
       }
   
  @@ -360,6 +381,11 @@
       }
   
       public void setupDirectoryScanner(FileScanner ds, Project p) {
  +        if (isReference()) {
  +            getRef(p).setupDirectoryScanner(ds, p);
  +            return;
  +        }
  +
           if (ds == null) {
               throw new IllegalArgumentException("ds cannot be null");
           }
  @@ -417,6 +443,9 @@
        * @return whether any selectors are in this container
        */
       public boolean hasSelectors() {
  +        if (isReference() && getProject() != null) {
  +            return getRef(getProject()).hasSelectors();
  +        }
           return !(selectors.isEmpty());
       }
   
  @@ -426,6 +455,10 @@
        * @return whether any patterns are in this container
        */
       public boolean hasPatterns() {
  +        if (isReference() && getProject() != null) {
  +            return getRef(getProject()).hasPatterns();
  +        }
  +
           if (defaultPatterns.hasPatterns(getProject())) {
               return true;
           }
  @@ -447,6 +480,9 @@
        * @return the number of selectors in this container
        */
       public int selectorCount() {
  +        if (isReference() && getProject() != null) {
  +            return getRef(getProject()).selectorCount();
  +        }
           return selectors.size();
       }
   
  @@ -471,6 +507,9 @@
        * @return an enumerator that goes through each of the selectors
        */
       public Enumeration selectorElements() {
  +        if (isReference() && getProject() != null) {
  +            return getRef(getProject()).selectorElements();
  +        }
           return selectors.elements();
       }
   
  
  
  

--
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