ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/types FilterSet.java
Date Thu, 17 Jul 2003 14:17:01 GMT
conor       2003/07/17 07:17:01

  Modified:    src/main/org/apache/tools/ant DemuxOutputStream.java
               src/main/org/apache/tools/ant/taskdefs Javac.java
                        Javadoc.java
               src/main/org/apache/tools/ant/taskdefs/condition
                        ConditionBase.java
               src/main/org/apache/tools/ant/taskdefs/optional/jsp
                        WLJspc.java
               src/main/org/apache/tools/ant/types FilterSet.java
  Log:
  Style and remove one stray debug
  
  Revision  Changes    Path
  1.17      +0 -1      ant/src/main/org/apache/tools/ant/DemuxOutputStream.java
  
  Index: DemuxOutputStream.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/DemuxOutputStream.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -w -u -r1.16 -r1.17
  --- DemuxOutputStream.java	17 Jul 2003 13:02:56 -0000	1.16
  +++ DemuxOutputStream.java	17 Jul 2003 14:17:00 -0000	1.17
  @@ -257,7 +257,6 @@
               // either end of buffer or a line separator char
               int blockLength = offset - blockStartOffset;
               if (blockLength > 0) {
  -                project.log("Sending " + blockLength);
                   bufferInfo.buffer.write(b, blockStartOffset, blockLength);
               }
               while(remaining > 0 && (b[offset] == 0x0a || b[offset] == 0x0d))
{
  
  
  
  1.112     +11 -12    ant/src/main/org/apache/tools/ant/taskdefs/Javac.java
  
  Index: Javac.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Javac.java,v
  retrieving revision 1.111
  retrieving revision 1.112
  diff -u -w -u -r1.111 -r1.112
  --- Javac.java	15 May 2003 12:44:01 -0000	1.111
  +++ Javac.java	17 Jul 2003 14:17:00 -0000	1.112
  @@ -735,8 +735,8 @@
           File[] newFiles = sfs.restrictAsFiles(files, srcDir, destDir, m);
   
           if (newFiles.length > 0) {
  -            File[] newCompileList = new File[compileList.length +
  -                newFiles.length];
  +            File[] newCompileList
  +                = new File[compileList.length + newFiles.length];
               System.arraycopy(compileList, 0, newCompileList, 0,
                       compileList.length);
               System.arraycopy(newFiles, 0, newCompileList,
  @@ -751,12 +751,12 @@
       }
   
       protected boolean isJdkCompiler(String compilerImpl) {
  -        return "modern".equals(compilerImpl) ||
  -            "classic".equals(compilerImpl) ||
  -            "javac1.1".equals(compilerImpl) ||
  -            "javac1.2".equals(compilerImpl) ||
  -            "javac1.3".equals(compilerImpl) ||
  -            "javac1.4".equals(compilerImpl);
  +        return "modern".equals(compilerImpl)
  +            || "classic".equals(compilerImpl)
  +            || "javac1.1".equals(compilerImpl)
  +            || "javac1.2".equals(compilerImpl)
  +            || "javac1.3".equals(compilerImpl)
  +            || "javac1.4".equals(compilerImpl);
       }
   
       protected String getSystemJavac() {
  @@ -854,8 +854,7 @@
           String compilerImpl = getCompiler();
   
           if (compileList.length > 0) {
  -            log("Compiling " + compileList.length +
  -                " source file"
  +            log("Compiling " + compileList.length + " source file"
                   + (compileList.length == 1 ? "" : "s")
                   + (destDir != null ? " to " + destDir : ""));
   
  
  
  
  1.117     +75 -25    ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java
  
  Index: Javadoc.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Javadoc.java,v
  retrieving revision 1.116
  retrieving revision 1.117
  diff -u -w -u -r1.116 -r1.117
  --- Javadoc.java	6 Jul 2003 09:57:36 -0000	1.116
  +++ Javadoc.java	17 Jul 2003 14:17:00 -0000	1.117
  @@ -313,7 +313,17 @@
           /** The source file */
           private File file;
   
  -        public SourceFile() {}
  +        /**
  +         * Default constructor
  +         */
  +        public SourceFile() {
  +        }
  +
  +        /**
  +         * Constructor specifying the source file directly
  +         *
  +         * @param file the source file
  +         */
           public SourceFile(File file) {
               this.file = file;
           }
  @@ -390,9 +400,9 @@
   
       /** Flag which indicates if javadoc from JDK 1.4 is available */
       private static boolean javadoc4 =
  -        (!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1) &&
  -         !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2) &&
  -         !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3));
  +        !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)
  +            && !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2)
  +            && !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3);
   
       /**
        * Utility method to add an argument to the command line conditionally
  @@ -446,7 +456,7 @@
       private Path sourcePath = null;
       private File destDir = null;
       private Vector sourceFiles = new Vector();
  -    private Vector packageNames = new Vector(5);
  +    private Vector packageNames = new Vector();
       private Vector excludePackageNames = new Vector(1);
       private boolean author = true;
       private boolean version = true;
  @@ -455,9 +465,9 @@
       private Path bootclasspath = null;
       private String group = null;
       private String packageList = null;
  -    private Vector links = new Vector(2);
  -    private Vector groups = new Vector(2);
  -    private Vector tags = new Vector(5);
  +    private Vector links = new Vector();
  +    private Vector groups = new Vector();
  +    private Vector tags = new Vector();
       private boolean useDefaultExcludes = true;
       private Html doctitle = null;
       private Html header = null;
  @@ -1063,6 +1073,8 @@
       /**
        * Link to docs at "url" using package list at "url2"
        * - separate the URLs by using a space character.
  +     *
  +     * @param src the offline link specification (url and package list)
        */
       public void setLinkoffline(String src) {
           if (!javadoc1) {
  @@ -1086,6 +1098,10 @@
   
       /**
        * Group specified packages together in overview page.
  +     *
  +     * @param src the group packages - a command separated list of group specs,
  +     *        each one being a group name and package specification separated
  +     *        by a space.
        */
       public void setGroup(String src) {
           group = src;
  @@ -1101,49 +1117,63 @@
       }
   
       /**
  -     * If true, do not include @deprecated information.
  +     * Control deprecation infromation
  +     *
  +     * @param b If true, do not include deprecated information.
        */
       public void setNodeprecated(boolean b) {
           addArgIf(b, "-nodeprecated");
       }
   
       /**
  -     * If true, do not generate deprecated list.
  +     * Control deprecated list generation
  +     *
  +     * @param b if true, do not generate deprecated list.
        */
       public void setNodeprecatedlist(boolean b) {
           add12ArgIf(b, "-nodeprecatedlist");
       }
   
       /**
  -     * If true, do not generate class hierarchy.
  +     * Control class tree generation.
  +     *
  +     * @param b if true, do not generate class hierarchy.
        */
       public void setNotree(boolean b) {
           addArgIf(b, "-notree");
       }
   
       /**
  -     * If true, do not generate index.
  +     * Control generation of index.
  +     *
  +     * @param b if true, do not generate index.
        */
       public void setNoindex(boolean b) {
           addArgIf(b, "-noindex");
       }
   
       /**
  -     * If true, do not generate help link
  +     * Control generation of help link.
  +     *
  +     * @param b if true, do not generate help link
        */
       public void setNohelp(boolean b) {
           add12ArgIf(b, "-nohelp");
       }
   
       /**
  -     * If true, do not generate navigation bar.
  +     * Control generation of the navigation bar.
  +     *
  +     * @param b if true, do not generate navigation bar.
        */
       public void setNonavbar(boolean b) {
           add12ArgIf(b, "-nonavbar");
       }
   
       /**
  -     * If true, generate warning about @serial tag.
  +     * Control warnings about serial tag.
  +     *
  +     * @param b if true, generate warning aboutthe serial tag.
        */
       public void setSerialwarn(boolean b) {
           add12ArgIf(b, "-serialwarn");
  @@ -1151,6 +1181,8 @@
   
       /**
        * Specifies the CSS stylesheet file to use.
  +     *
  +     * @param f the file with the CSS to use.
        */
       public void setStylesheetfile(File f) {
           if (!javadoc1) {
  @@ -1161,6 +1193,8 @@
   
       /**
        * Specifies the HTML help file to use.
  +     *
  +     * @param f the file containing help content.
        */
       public void setHelpfile(File f) {
           if (!javadoc1) {
  @@ -1171,6 +1205,8 @@
   
       /**
        * Output file encoding name.
  +     *
  +     * @param enc name of the encoding to use.
        */
       public void setDocencoding(String enc) {
           cmd.createArgument().setValue("-docencoding");
  @@ -1179,6 +1215,8 @@
   
       /**
        * The name of a file containing the packages to process.
  +     *
  +     * @param src the file containing the package list.
        */
       public void setPackageList(String src) {
           if (!javadoc1) {
  @@ -1188,6 +1226,8 @@
   
       /**
        * Create link to javadoc output at the given URL.
  +     *
  +     * @param link argument to configure
        */
       public LinkArgument createLink() {
           LinkArgument la = new LinkArgument();
  @@ -1195,6 +1235,10 @@
           return la;
       }
   
  +    /**
  +     * Represents a link triplet (href, whether link is offline, location of the
  +     * package list if off line)
  +     */
       public class LinkArgument {
           private String href;
           private boolean offline = false;
  @@ -1334,9 +1378,10 @@
                   } else {
                       int i;
                       for (i = 0; i < SCOPE_ELEMENTS.length; i++) {
  -                        if (next.equals (SCOPE_ELEMENTS[i]))
  +                        if (next.equals (SCOPE_ELEMENTS[i])) {
                               break;
                       }
  +                    }
                       if (i == SCOPE_ELEMENTS.length) {
                           throw new BuildException ("Unrecognised scope element: "
                                                     + next);
  @@ -1412,7 +1457,7 @@
   
       public class GroupArgument {
           private Html title;
  -        private Vector packages = new Vector(3);
  +        private Vector packages = new Vector();
   
           public GroupArgument() {
           }
  @@ -1812,7 +1857,8 @@
                               for (int i = 0; i < files.length; i++) {
                                   File tagDefFile = new File( tagDir, files[i] );
                                   try {
  -                                    BufferedReader in = new BufferedReader( new FileReader(tagDefFile)
);
  +                                    BufferedReader in
  +                                        = new BufferedReader(new FileReader(tagDefFile));
                                       String line = null;
                                       while( (line = in.readLine()) != null ) {
                                           toExecute.createArgument().setValue ("-tag");
  @@ -1820,7 +1866,9 @@
                                       }
                                       in.close();
                                   } catch( IOException ioe ) {
  -                                    throw new BuildException( "Couldn't read tag file from
" + tagDefFile.getAbsolutePath(), ioe );
  +                                    throw new BuildException("Couldn't read "
  +                                        + " tag file from "
  +                                        + tagDefFile.getAbsolutePath(), ioe );
                                   }
                               }
                           }
  @@ -1952,7 +2000,9 @@
               try {
                   out.close();
                   err.close();
  -            } catch (IOException e) {}
  +            } catch (IOException e) {
  +                // ignore
  +            }
           }
       }
   
  
  
  
  1.20      +54 -21    ant/src/main/org/apache/tools/ant/taskdefs/condition/ConditionBase.java
  
  Index: ConditionBase.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/condition/ConditionBase.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -w -u -r1.19 -r1.20
  --- ConditionBase.java	28 May 2003 16:27:36 -0000	1.19
  +++ ConditionBase.java	17 Jul 2003 14:17:00 -0000	1.20
  @@ -96,117 +96,150 @@
        *
        * @since 1.1
        */
  -    public void addAvailable(Available a) {conditions.addElement(a);}
  +    public void addAvailable(Available a) {
  +        conditions.addElement(a);
  +    }
   
       /**
        * Add an &lt;checksum&gt; condition.
        *
        * @since 1.4, Ant 1.5
        */
  -    public void addChecksum(Checksum c) {conditions.addElement(c);}
  +    public void addChecksum(Checksum c) {
  +        conditions.addElement(c);
  +    }
   
       /**
        * Add an &lt;uptodate&gt; condition.
        *
        * @since 1.1
        */
  -    public void addUptodate(UpToDate u) {conditions.addElement(u);}
  +    public void addUptodate(UpToDate u) {
  +        conditions.addElement(u);
  +    }
   
       /**
        * Add an &lt;not&gt; condition "container".
        *
        * @since 1.1
        */
  -    public void addNot(Not n) {conditions.addElement(n);}
  +    public void addNot(Not n) {
  +        conditions.addElement(n);
  +    }
   
       /**
        * Add an &lt;and&gt; condition "container".
        *
        * @since 1.1
        */
  -    public void addAnd(And a) {conditions.addElement(a);}
  +    public void addAnd(And a) {
  +        conditions.addElement(a);
  +    }
   
       /**
        * Add an &lt;or&gt; condition "container".
        *
        * @since 1.1
        */
  -    public void addOr(Or o) {conditions.addElement(o);}
  +    public void addOr(Or o) {
  +        conditions.addElement(o);
  +    }
   
       /**
        * Add an &lt;equals&gt; condition.
        *
        * @since 1.1
        */
  -    public void addEquals(Equals e) {conditions.addElement(e);}
  +    public void addEquals(Equals e) {
  +        conditions.addElement(e);
  +    }
   
       /**
        * Add an &lt;os&gt; condition.
        *
        * @since 1.1
        */
  -    public void addOs(Os o) {conditions.addElement(o);}
  +    public void addOs(Os o) {
  +        conditions.addElement(o);
  +    }
   
       /**
        * Add an &lt;isset&gt; condition.
        *
        * @since Ant 1.5
        */
  -    public void addIsSet(IsSet i) {conditions.addElement(i);}
  +    public void addIsSet(IsSet i) {
  +        conditions.addElement(i);
  +    }
   
       /**
        * Add an &lt;http&gt; condition.
        *
        * @since Ant 1.5
        */
  -    public void addHttp(Http h) {conditions.addElement(h);}
  +    public void addHttp(Http h) {
  +        conditions.addElement(h);
  +    }
   
       /**
        * Add a &lt;socket&gt; condition.
        *
        * @since Ant 1.5
        */
  -    public void addSocket(Socket s) {conditions.addElement(s);}
  +    public void addSocket(Socket s) {
  +        conditions.addElement(s);
  +    }
   
       /**
        * Add a &lt;filesmatch&gt; condition.
        *
        * @since Ant 1.5
        */
  -    public void addFilesMatch(FilesMatch test) {conditions.addElement(test);}
  +    public void addFilesMatch(FilesMatch test) {
  +        conditions.addElement(test);
  +    }
       
       /**
        * Add a &lt;contains&gt; condition.
        *
        * @since Ant 1.5
        */
  -    public void addContains(Contains test) {conditions.addElement(test);}
  +    public void addContains(Contains test) {
  +        conditions.addElement(test);
  +    }
   
       /**
        * Add a &lt;istrue&gt; condition.
        *
        * @since Ant 1.5
        */
  -    public void addIsTrue(IsTrue test) {conditions.addElement(test);}
  +    public void addIsTrue(IsTrue test) {
  +        conditions.addElement(test);
  +    }
   
       /**
        * Add a &lt;isfalse&gt; condition.
        *
        * @since Ant 1.5
        */
  -    public void addIsFalse(IsFalse test) {conditions.addElement(test);}
  +    public void addIsFalse(IsFalse test) {
  +        conditions.addElement(test);
  +    }
         
       /**
        * Add an &lt;isreference&gt; condition.
        *
        * @since Ant 1.6
        */
  -    public void addIsReference(IsReference i) {conditions.addElement(i);}
  +    public void addIsReference(IsReference i) {
  +        conditions.addElement(i);
  +    }
   
       /**
        * Add an arbitary condition
        * @since Ant 1.6
        */
  -    public void add(Condition c) {conditions.addElement(c);}
  -    
  +    public void add(Condition c) {
  +        conditions.addElement(c);
  +    }
   }
  
  
  
  1.18      +81 -73    ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java
  
  Index: WLJspc.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -w -u -r1.17 -r1.18
  --- WLJspc.java	10 Feb 2003 14:14:12 -0000	1.17
  +++ WLJspc.java	17 Jul 2003 14:17:01 -0000	1.18
  @@ -115,10 +115,18 @@
       //TODO add more attributes to the task, to take care of all jspc options
       //TODO Test on Unix
       
  -    private File destinationDirectory; //root of compiled files tree
  -    private File sourceDirectory; // root of source files tree
  -    private String destinationPackage; //package under which resultant classes will reside
  -    private Path compileClasspath; //classpath used to compile the jsp files. 
  +    /** root of compiled files tree */
  +    private File destinationDirectory;
  +
  +    /** root of source files tree */
  +    private File sourceDirectory;
  +
  +    /** package under which resultant classes will reside */
  +    private String destinationPackage;
  +
  +    /** classpath used to compile the jsp files. */
  +    private Path compileClasspath;
  +
       //private String compilerPath; //fully qualified name for the compiler executable
       
       private String pathToPackage = "";
  @@ -126,17 +134,18 @@
       
       public void execute() throws BuildException {
           if (!destinationDirectory.isDirectory()) {
  -            throw new BuildException("destination directory " + destinationDirectory.getPath()
+ 
  -                                     " is not valid");
  +            throw new BuildException("destination directory "
  +                + destinationDirectory.getPath() + " is not valid");
           }
                                  
           if (!sourceDirectory.isDirectory()) {
  -            throw new BuildException("src directory " + sourceDirectory.getPath() + 
  -                                     " is not valid");
  +            throw new BuildException("src directory "
  +                + sourceDirectory.getPath() + " is not valid");
           }
   
           if (destinationPackage == null) {
  -            throw new BuildException("package attribute must be present.", getLocation());
  +            throw new BuildException("package attribute must be present.",
  +                                     getLocation());
           }
           
           
  @@ -155,8 +164,8 @@
           
           //Weblogic.jspc calls System.exit() ... have to fork
           // Therefore, takes loads of time 
  -        // Can pass directories at a time (*.jsp) but easily runs out of memory on hefty
dirs 
  -        // (even on  a Sun)
  +        // Can pass directories at a time (*.jsp) but easily runs out of
  +        // memory on hefty dirs (even on  a Sun)
           Java helperTask = (Java) getProject().createTask("java");
           helperTask.setFork(true);
           helperTask.setClassname("weblogic.jspc");
  @@ -283,8 +292,8 @@
           for (int i = 0; i < files.length; i++) {
               File srcFile = new File(this.sourceDirectory, files[i]);
               //XXX
  -            // All this to convert source to destination directory according to weblogic
standards
  -            // Can be written better... this is too hacky!
  +            // All this to convert source to destination directory according
  +            // to weblogic standards Can be written better... this is too hacky!
               jspFile = new File(files[i]);
               parents = jspFile.getParent();
   
  @@ -314,7 +323,6 @@
                       files[i], Project.MSG_WARN);
               }
               if (srcFile.lastModified() > classFile.lastModified()) {
  -               //log("Files are" + srcFile.getAbsolutePath()+" " +classFile.getAbsolutePath());
                   filesToDo.addElement(files[i]);
                   log("Recompiling File " + files[i], Project.MSG_VERBOSE);
               }
  
  
  
  1.22      +84 -52    ant/src/main/org/apache/tools/ant/types/FilterSet.java
  
  Index: FilterSet.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/FilterSet.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -w -u -r1.21 -r1.22
  --- FilterSet.java	24 Jun 2003 09:37:06 -0000	1.21
  +++ FilterSet.java	17 Jul 2003 14:17:01 -0000	1.22
  @@ -178,6 +178,9 @@
        */
       private Vector filters = new Vector();
       
  +    /**
  +     * Default constructor
  +     */
       public FilterSet() {
       }
       
  @@ -191,6 +194,11 @@
           this.filters = (Vector) filterset.getFilters().clone();
       }
   
  +    /**
  +     * Get the filters in the filter set
  +     *
  +     * @return a Vector of Filter instances
  +     */
       protected Vector getFilters() {
           if (isReference()) {
               return getRef().getFilters();
  @@ -198,6 +206,11 @@
           return filters;
       }
   
  +    /**
  +     * Get the referred filter set
  +     *
  +     * @return the filterset from the reference.
  +     */
       protected FilterSet getRef() {
           return (FilterSet) getCheckedRef(FilterSet.class, "filterset");
       }
  @@ -245,6 +258,11 @@
           this.startOfToken = startOfToken;
       }
   
  +    /**
  +     * Get the begin token for this filterset
  +     *
  +     * @return the filter set's begin token for filtering
  +     */
       public String getBeginToken() {
           if (isReference()) {
               return getRef().getBeginToken();
  @@ -268,6 +286,11 @@
           this.endOfToken = endOfToken;
       }
   
  +    /**
  +     * Get the end token for this filterset
  +     *
  +     * @return the filter set's end token for replacement delimiting
  +     */
       public String getEndToken() {
           if (isReference()) {
               return getRef().getEndToken();
  @@ -316,6 +339,7 @@
                    try {
                       in.close();
                    } catch (IOException ioex) {
  +                     // ignore
                    }
                 }
              }
  @@ -395,8 +419,7 @@
        * @param parent the parant token (= the token it was parsed from)
        */
       private String replaceTokens(String line, String parent)
  -    throws BuildException
  -    {
  +        throws BuildException {
           if (passedTokens == null) {
               passedTokens = new Vector();
           }
  @@ -405,8 +428,10 @@
               StringBuffer sb = new StringBuffer();
               sb.append("Inifinite loop in tokens. Currently known tokens : ");
               sb.append(passedTokens);
  -            sb.append("\nProblem token : "+getBeginToken()+parent+getEndToken());
  -            sb.append(" called from "+getBeginToken()+passedTokens.lastElement());
  +            sb.append("\nProblem token : " + getBeginToken() + parent
  +                + getEndToken());
  +            sb.append(" called from " + getBeginToken()
  +                + passedTokens.lastElement());
               sb.append(getEndToken());
               System.out.println(sb.toString());
               return parent;
  @@ -433,7 +458,7 @@
       /**
        * Create a new filter
        *
  -     * @param  the filter to be added
  +     * @param filter the filter to be added
        */
       public void addFilter(Filter filter) {
           if (isReference()) {
  @@ -490,6 +515,13 @@
           return getFilters().size() > 0;
       }
   
  +    /**
  +     * clone the filterset
  +     *
  +     * @return a deep clone of this filterset
  +     *
  +     * @throws BuildException if the clone cannot be performed.
  +     */
       public Object clone() throws BuildException {
           if (isReference()) {
               return ((FilterSet) getRef()).clone();
  
  
  

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


Mime
View raw message