ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mben...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/types Mapper.java RedirectorElement.java PatternSet.java RegularExpression.java Substitution.java XMLCatalog.java
Date Mon, 23 May 2005 19:30:38 GMT
mbenson     2005/05/23 12:30:38

  Modified:    src/main/org/apache/tools/ant/types Mapper.java
                        RedirectorElement.java PatternSet.java
                        RegularExpression.java Substitution.java
                        XMLCatalog.java
  Log:
  use DataType's (new) convenience methods
  
  Revision  Changes    Path
  1.32      +1 -13     ant/src/main/org/apache/tools/ant/types/Mapper.java
  
  Index: Mapper.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/Mapper.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- Mapper.java	28 Jan 2005 13:42:28 -0000	1.31
  +++ Mapper.java	23 May 2005 19:30:38 -0000	1.32
  @@ -247,19 +247,7 @@
        * @return the referenced Mapper
        */
       protected Mapper getRef() {
  -        if (!isChecked()) {
  -            Stack stk = new Stack();
  -            stk.push(this);
  -            dieOnCircularReference(stk, getProject());
  -        }
  -
  -        Object o = getRefid().getReferencedObject(getProject());
  -        if (!(o instanceof Mapper)) {
  -            String msg = getRefid().getRefId() + " doesn\'t denote a mapper";
  -            throw new BuildException(msg);
  -        } else {
  -            return (Mapper) o;
  -        }
  +        return (Mapper) getCheckedRef();
       }
   
       /**
  
  
  
  1.8       +40 -57    ant/src/main/org/apache/tools/ant/types/RedirectorElement.java
  
  Index: RedirectorElement.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/RedirectorElement.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RedirectorElement.java	15 Apr 2005 20:25:36 -0000	1.7
  +++ RedirectorElement.java	23 May 2005 19:30:38 -0000	1.8
  @@ -27,22 +27,23 @@
   import org.apache.tools.ant.taskdefs.Redirector;
   
   /**
  - * Element representation of a <CODE>Redirector</CODE>.
  + * Element representation of a <code>Redirector</code>.
  + * @since Ant 1.6.2
    */
   public class RedirectorElement extends DataType {
   
       /**
  -     * Whether the input mapper was set via <CODE>setOutput</CODE>.
  +     * Whether the input mapper was set via <code>setOutput</code>.
        */
       private boolean usingInput = false;
   
       /**
  -     * Whether the output mapper was set via <CODE>setOutput</CODE>.
  +     * Whether the output mapper was set via <code>setOutput</code>.
        */
       private boolean usingOutput = false;
   
       /**
  -     * Whether the error mapper was set via <CODE>setError</CODE>.
  +     * Whether the error mapper was set via <code>setError</code>.
        */
       private boolean usingError = false;
   
  @@ -103,7 +104,7 @@
   
       /**
        * Add the input file mapper.
  -     * @param inputMapper   <CODE>Mapper</CODE>.
  +     * @param inputMapper   <code>Mapper</code>.
        */
       public void addConfiguredInputMapper(Mapper inputMapper) {
           if (isReference()) {
  @@ -122,7 +123,7 @@
   
       /**
        * Add the output file mapper.
  -     * @param outputMapper   <CODE>Mapper</CODE>.
  +     * @param outputMapper   <code>Mapper</code>.
        */
       public void addConfiguredOutputMapper(Mapper outputMapper) {
           if (isReference()) {
  @@ -141,7 +142,7 @@
   
       /**
        * Add the error file mapper.
  -     * @param errorMapper   <CODE>Mapper</CODE>.
  +     * @param errorMapper   <code>Mapper</code>.
        */
       public void addConfiguredErrorMapper(Mapper errorMapper) {
           if (isReference()) {
  @@ -159,12 +160,12 @@
       }
   
       /**
  -     * Makes this instance in effect a reference to another instance.
  +     * Make this instance in effect a reference to another instance.
        *
        * <p>You must not set another attribute or nest elements inside
        * this element if you make it a reference.</p>
  -     * @param r the reference to use
  -     * @throws BuildException on error
  +     * @param r the reference to use.
  +     * @throws BuildException on error.
        */
       public void setRefid(Reference r) throws BuildException {
           if (usingInput
  @@ -178,14 +179,15 @@
               || outputEncoding != null
               || errorEncoding != null
               || outputProperty != null
  -            || errorProperty != null) {
  +            || errorProperty != null
  +            || logInputString != null) {
               throw tooManyAttributes();
           }
           super.setRefid(r);
       }
   
       /**
  -     * Set the input to use for the task
  +     * Set the input to use for the task.
        * @param input the file from which input is read.
        */
       public void setInput(File input) {
  @@ -230,9 +232,9 @@
   
       /**
        * File the output of the process is redirected to. If error is not
  -     * redirected, it too will appear in the output
  +     * redirected, it too will appear in the output.
        *
  -     * @param out the file to which output stream is written
  +     * @param out the file to which output stream is written.
        */
       public void setOutput(File out) {
           if (isReference()) {
  @@ -247,7 +249,7 @@
   
       /**
        * Set the output encoding.
  -     * @param outputEncoding   <CODE>String</CODE>.
  +     * @param outputEncoding   <code>String</code>.
        */
       public void setOutputEncoding(String outputEncoding) {
           if (isReference()) {
  @@ -259,7 +261,7 @@
       /**
        * Set the error encoding.
        *
  -     * @param errorEncoding   <CODE>String</CODE>.
  +     * @param errorEncoding   <code>String</code>.
        */
       public void setErrorEncoding(String errorEncoding) {
           if (isReference()) {
  @@ -270,7 +272,7 @@
   
       /**
        * Set the input encoding.
  -     * @param inputEncoding   <CODE>String</CODE>.
  +     * @param inputEncoding   <code>String</code>.
        */
       public void setInputEncoding(String inputEncoding) {
           if (isReference()) {
  @@ -282,7 +284,7 @@
       /**
        * Controls whether error output of exec is logged. This is only useful
        * when output is being redirected and error output is desired in the
  -     * Ant log
  +     * Ant log.
        * @param logError if true the standard error is sent to the Ant log system
        *        and not sent to output.
        */
  @@ -295,7 +297,7 @@
   
       /**
        * Set the file to which standard error is to be redirected.
  -     * @param error the file to which error is to be written
  +     * @param error the file to which error is to be written.
        */
       public void setError(File error) {
           if (isReference()) {
  @@ -351,7 +353,7 @@
       /**
        * Whether output and error files should be created even when empty.
        * Defaults to true.
  -     * @param createEmptyFiles <CODE>boolean</CODE>.
  +     * @param createEmptyFiles <code>boolean</code>.
        */
       public void setCreateEmptyFiles(boolean createEmptyFiles) {
           if (isReference()) {
  @@ -375,8 +377,8 @@
       }
   
       /**
  -     * Create a nested input <CODE>FilterChain</CODE>.
  -     * @return <CODE>FilterChain</CODE>.
  +     * Create a nested input <code>FilterChain</code>.
  +     * @return <code>FilterChain</code>.
        */
       public FilterChain createInputFilterChain() {
           if (isReference()) {
  @@ -389,8 +391,8 @@
       }
   
       /**
  -     * Create a nested output <CODE>FilterChain</CODE>.
  -     * @return <CODE>FilterChain</CODE>.
  +     * Create a nested output <code>FilterChain</code>.
  +     * @return <code>FilterChain</code>.
        */
       public FilterChain createOutputFilterChain() {
           if (isReference()) {
  @@ -403,8 +405,8 @@
       }
   
       /**
  -     * Create a nested error <CODE>FilterChain</CODE>.
  -     * @return <CODE>FilterChain</CODE>.
  +     * Create a nested error <code>FilterChain</code>.
  +     * @return <code>FilterChain</code>.
        */
       public FilterChain createErrorFilterChain() {
           if (isReference()) {
  @@ -417,18 +419,18 @@
       }
   
       /**
  -     * Configure the specified <CODE>Redirector</CODE>.
  -     * @param redirector   <CODE>Redirector</CODE>.
  +     * Configure the specified <code>Redirector</code>.
  +     * @param redirector   <code>Redirector</code>.
        */
       public void configure(Redirector redirector) {
           configure(redirector, null);
       }
   
       /**
  -     * Configure the specified <CODE>Redirector</CODE>
  +     * Configure the specified <code>Redirector</code>
        * for the specified sourcefile.
  -     * @param redirector   <CODE>Redirector</CODE>.
  -     * @param sourcefile   <CODE>String</CODE>.
  +     * @param redirector   <code>Redirector</code>.
  +     * @param sourcefile   <code>String</code>.
        */
       public void configure(Redirector redirector, String sourcefile) {
           if (isReference()) {
  @@ -523,8 +525,8 @@
   
       /**
        * Create a merge mapper pointing to the specified destination file.
  -     * @param destfile   <CODE>File</CODE>
  -     * @return <CODE>Mapper</CODE>.
  +     * @param destfile   <code>File</code>
  +     * @return <code>Mapper</code>.
        */
       protected Mapper createMergeMapper(File destfile) {
           Mapper result = new Mapper(getProject());
  @@ -535,9 +537,9 @@
       }
   
       /**
  -     * Return a <CODE>File[]</CODE> from the specified set of filenames.
  -     * @param name   <CODE>String[]</CODE>
  -     * @return <CODE>File[]</CODE>.
  +     * Return a <code>File[]</code> from the specified set of filenames.
  +     * @param name   <code>String[]</code>
  +     * @return <code>File[]</code>.
        */
       protected File[] toFileArray(String[] name) {
           if (name == null) {
  @@ -554,19 +556,6 @@
       }
   
       /**
  -     * Convenience method.
  -     * @throws BuildException on error.
  -     */
  -    protected void dieOnCircularReference() throws BuildException {
  -        if (isChecked()) {
  -            return;
  -        }
  -        Stack s = new Stack();
  -        s.push(this);
  -        dieOnCircularReference(s, getProject());
  -    }
  -
  -    /**
        * Overrides the version of DataType to recurse on all DataType
        * child elements that may have been added.
        * @param stk the stack of data types to use (recursively).
  @@ -607,17 +596,11 @@
   
       /**
        * Perform the check for circular references, returning the
  -     * referenced RedirectorElement
  +     * referenced RedirectorElement.
        * @return the referenced RedirectorElement.
        */
       private RedirectorElement getRef() {
  -        dieOnCircularReference();
  -        Object o = getRefid().getReferencedObject(getProject());
  -        if (!(o instanceof RedirectorElement)) {
  -            throw new BuildException(getRefid().getRefId()
  -                + " doesn\'t denote a RedirectorElement");
  -        }
  -        return (RedirectorElement) o;
  +        return (RedirectorElement) getCheckedRef();
       }
   
   }
  
  
  
  1.42      +1 -13     ant/src/main/org/apache/tools/ant/types/PatternSet.java
  
  Index: PatternSet.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/PatternSet.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- PatternSet.java	9 Nov 2004 10:19:51 -0000	1.41
  +++ PatternSet.java	23 May 2005 19:30:38 -0000	1.42
  @@ -414,19 +414,7 @@
        * referenced PatternSet.
        */
       private PatternSet getRef(Project p) {
  -        if (!isChecked()) {
  -            Stack stk = new Stack();
  -            stk.push(this);
  -            dieOnCircularReference(stk, p);
  -        }
  -
  -        Object o = getRefid().getReferencedObject(p);
  -        if (!(o instanceof PatternSet)) {
  -            String msg = getRefid().getRefId() + " doesn\'t denote a patternset";
  -            throw new BuildException(msg);
  -        } else {
  -            return (PatternSet) o;
  -        }
  +        return (PatternSet) getCheckedRef(p);
       }
   
       /**
  
  
  
  1.21      +1 -15     ant/src/main/org/apache/tools/ant/types/RegularExpression.java
  
  Index: RegularExpression.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/RegularExpression.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- RegularExpression.java	9 Mar 2004 16:48:41 -0000	1.20
  +++ RegularExpression.java	23 May 2005 19:30:38 -0000	1.21
  @@ -138,20 +138,6 @@
        * @return resolved RegularExpression instance
        */
       public RegularExpression getRef(Project p) {
  -        if (!isChecked()) {
  -            Stack stk = new Stack();
  -            stk.push(this);
  -            dieOnCircularReference(stk, p);
  -        }
  -
  -
  -        Object o = getRefid().getReferencedObject(p);
  -        if (!(o instanceof RegularExpression)) {
  -            String msg = getRefid().getRefId() + " doesn\'t denote a "
  -                    + DATA_TYPE_NAME;
  -            throw new BuildException(msg);
  -        } else {
  -            return (RegularExpression) o;
  -        }
  +        return (RegularExpression) getCheckedRef(p);
       }
   }
  
  
  
  1.20      +1 -14     ant/src/main/org/apache/tools/ant/types/Substitution.java
  
  Index: Substitution.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/Substitution.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- Substitution.java	14 Mar 2005 17:47:01 -0000	1.19
  +++ Substitution.java	23 May 2005 19:30:38 -0000	1.20
  @@ -73,19 +73,6 @@
        * @return the resolved reference
        */
       public Substitution getRef(Project p) {
  -        if (!isChecked()) {
  -            Stack stk = new Stack();
  -            stk.push(this);
  -            dieOnCircularReference(stk, p);
  -        }
  -
  -
  -        Object o = getRefid().getReferencedObject(p);
  -        if (!(o instanceof Substitution)) {
  -            String msg = getRefid().getRefId() + " doesn\'t denote a substitution";
  -            throw new BuildException(msg);
  -        } else {
  -            return (Substitution) o;
  -        }
  +        return (Substitution) getCheckedRef(p);
       }
   }
  
  
  
  1.45      +2 -12     ant/src/main/org/apache/tools/ant/types/XMLCatalog.java
  
  Index: XMLCatalog.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/XMLCatalog.java,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- XMLCatalog.java	14 Mar 2005 17:39:29 -0000	1.44
  +++ XMLCatalog.java	23 May 2005 19:30:38 -0000	1.45
  @@ -394,12 +394,7 @@
               return getRef().resolveEntity(publicId, systemId);
           }
   
  -        if (!isChecked()) {
  -            // make sure we don't have a circular reference here
  -            Stack stk = new Stack();
  -            stk.push(this);
  -            dieOnCircularReference(stk, getProject());
  -        }
  +        dieOnCircularReference();
   
           log("resolveEntity: '" + publicId + "': '" + systemId + "'",
               Project.MSG_DEBUG);
  @@ -427,12 +422,7 @@
               return getRef().resolve(href, base);
           }
   
  -        if (!isChecked()) {
  -            // make sure we don't have a circular reference here
  -            Stack stk = new Stack();
  -            stk.push(this);
  -            dieOnCircularReference(stk, getProject());
  -        }
  +        dieOnCircularReference();
   
           SAXSource source = null;
   
  
  
  

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


Mime
View raw message