conor 2003/07/05 07:34:14 Modified: src/etc/checkstyle checkstyle-config checkstyle-frames.xsl checkstyle-xdoc.xsl src/main/org/apache/tools/ant PropertyHelper.java src/main/org/apache/tools/ant/listener CommonsLoggingListener.java src/main/org/apache/tools/ant/taskdefs Definer.java SubAnt.java src/main/org/apache/tools/ant/taskdefs/optional/ccm CCMCheckout.java src/main/org/apache/tools/ant/taskdefs/optional/depend AntAnalyzer.java src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool ConstantPoolEntry.java DoubleCPInfo.java StringCPInfo.java src/main/org/apache/tools/ant/taskdefs/optional/extension JarLibAvailableTask.java JarLibDisplayTask.java JarLibManifestTask.java JarLibResolveTask.java src/main/org/apache/tools/ant/taskdefs/optional/perforce P4Have.java src/main/org/apache/tools/ant/taskdefs/optional/unix Chgrp.java src/main/org/apache/tools/ant/taskdefs/optional/vss MSVSSCHECKIN.java MSVSSLABEL.java src/main/org/apache/tools/ant/types Parameterizable.java ResourceLocation.java src/main/org/apache/tools/ant/types/selectors AndSelector.java FileSelector.java NoneSelector.java NotSelector.java OrSelector.java src/main/org/apache/tools/ant/util FileUtils.java TimeoutObserver.java Log: More cleanup Revision Changes Path 1.4 +1 -1 ant/src/etc/checkstyle/checkstyle-config Index: checkstyle-config =================================================================== RCS file: /home/cvs/ant/src/etc/checkstyle/checkstyle-config,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -u -r1.3 -r1.4 --- checkstyle-config 4 Jul 2003 13:03:37 -0000 1.3 +++ checkstyle-config 5 Jul 2003 14:34:11 -0000 1.4 @@ -35,7 +35,7 @@ <!-- Import conventions --> <module name="AvoidStarImport"/> - <module name="IllegalImport"/> + <!-- <module name="IllegalImport"/> --> <module name="RedundantImport"/> <module name="UnusedImports"/> 1.2 +11 -8 ant/src/etc/checkstyle/checkstyle-frames.xsl Index: checkstyle-frames.xsl =================================================================== RCS file: /home/cvs/ant/src/etc/checkstyle/checkstyle-frames.xsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -u -r1.1 -r1.2 --- checkstyle-frames.xsl 3 Jul 2003 13:59:50 -0000 1.1 +++ checkstyle-frames.xsl 5 Jul 2003 14:34:11 -0000 1.2 @@ -152,10 +152,10 @@ background-color:#FFFFFF; color:#000000; } - .a td { + .oddrow td { background: #efefef; } - .b td { + .evenrow td { background: #fff; } th, td { @@ -305,14 +305,17 @@ <h3>Summary</h3> <xsl:variable name="fileCount" select="count(file)"/> <xsl:variable name="errorCount" select="count(file/error)"/> + <xsl:variable name="fileErrorCount" select="count(file[count(error) != 0])"/> <table class="log" border="0" cellpadding="5" cellspacing="2" width="100%"> <tr> - <th>Files</th> + <th>Total Files</th> + <th>Files With Errors</th> <th>Errors</th> </tr> <tr> <xsl:call-template name="alternated-row"/> <td><xsl:value-of select="$fileCount"/></td> + <td><xsl:value-of select="$fileErrorCount"/></td> <td><xsl:value-of select="$errorCount"/></td> </tr> </table> @@ -320,8 +323,8 @@ <xsl:template name="alternated-row"> <xsl:attribute name="class"> - <xsl:if test="position() mod 2 = 1">a</xsl:if> - <xsl:if test="position() mod 2 = 0">b</xsl:if> + <xsl:if test="position() mod 2 = 1">oddrow</xsl:if> + <xsl:if test="position() mod 2 = 0">evenrow</xsl:if> </xsl:attribute> </xsl:template> </xsl:stylesheet> 1.2 +4 -1 ant/src/etc/checkstyle/checkstyle-xdoc.xsl Index: checkstyle-xdoc.xsl =================================================================== RCS file: /home/cvs/ant/src/etc/checkstyle/checkstyle-xdoc.xsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -u -r1.1 -r1.2 --- checkstyle-xdoc.xsl 3 Jul 2003 13:59:50 -0000 1.1 +++ checkstyle-xdoc.xsl 5 Jul 2003 14:34:11 -0000 1.2 @@ -139,14 +139,17 @@ <section name="Summary"> <xsl:variable name="fileCount" select="count(file)"/> <xsl:variable name="errorCount" select="count(file/error)"/> + <xsl:variable name="fileErrorCount" select="count(file[count(error) != 0])"/> <table> <tr> <th>Files</th> + <th>Files With Errors</th> <th>Errors</th> </tr> <tr> <xsl:call-template name="alternated-row"/> <td><xsl:value-of select="$fileCount"/></td> + <td><xsl:value-of select="$fileErrorCount"/></td> <td><xsl:value-of select="$errorCount"/></td> </tr> </table> 1.6 +112 -93 ant/src/main/org/apache/tools/ant/PropertyHelper.java Index: PropertyHelper.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/PropertyHelper.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -u -r1.5 -r1.6 --- PropertyHelper.java 14 Apr 2003 14:47:41 -0000 1.5 +++ PropertyHelper.java 5 Jul 2003 14:34:11 -0000 1.6 @@ -84,31 +84,41 @@ */ public class PropertyHelper { - protected Project project; - protected PropertyHelper next; + private Project project; + private PropertyHelper next; /** Project properties map (usually String to String). */ - protected Hashtable properties = new Hashtable(); + private Hashtable properties = new Hashtable(); + /** * Map of "user" properties (as created in the Ant task, for example). * Note that these key/value pairs are also always put into the * project properties, so only the project properties need to be queried. * Mapping is String to String. */ - protected Hashtable userProperties = new Hashtable(); + private Hashtable userProperties = new Hashtable(); + /** * Map of inherited "user" properties - that are those "user" * properties that have been created by tasks and not been set * from the command line or a GUI tool. * Mapping is String to String. */ - protected Hashtable inheritedProperties = new Hashtable(); + private Hashtable inheritedProperties = new Hashtable(); + /** + * Default constructor. + */ protected PropertyHelper() { } // -------------------- Hook management -------------------- + /** + * Set the project for which this helper is performing property resolution + * + * @param p the projetc instance. + */ public void setProject(Project p ) { this.project=p; } @@ -121,29 +131,42 @@ * Again, you are required to respect the immutability semantics ( at * least for non-dynamic properties ) * - * @param next + * @param next the next property helper in the chain. */ public void setNext( PropertyHelper next ) { this.next=next; } + /** + * Get the next property helper in the chain. + * + * @return the next proprty helper. + */ public PropertyHelper getNext() { return next; } - /** Factory method to create a property processor. + /** + * Factory method to create a property processor. * Users can provide their own or replace it using "ant.PropertyHelper" * reference. User tasks can also add themself to the chain, and provide * dynamic properties. + * + * @param project the project fro which the property helper is required. + * + * @return the project's property helper. */ public static PropertyHelper getPropertyHelper(Project project) { - PropertyHelper ph=(PropertyHelper)project.getReference( "ant.PropertyHelper" ); - if( ph!=null ) return ph; - ph=new PropertyHelper(); - ph.setProject( project ); + PropertyHelper helper + = (PropertyHelper) project.getReference("ant.PropertyHelper"); + if (helper != null) { + return helper; + } + helper = new PropertyHelper(); + helper.setProject(project); - project.addReference( "ant.PropertyHelper",ph ); - return ph; + project.addReference("ant.PropertyHelper", helper); + return helper; } // -------------------- Methods to override -------------------- @@ -167,8 +190,7 @@ public boolean setPropertyHook(String ns, String name, Object value, boolean inherited, boolean user, - boolean isNew) - { + boolean isNew) { if( getNext()!=null ) { boolean subst=getNext().setPropertyHook(ns, name, value, inherited, user, isNew); @@ -191,13 +213,17 @@ public Object getPropertyHook(String ns, String name, boolean user) { if( getNext() != null ) { Object o=getNext().getPropertyHook(ns, name, user); - if( o!= null ) return o; + if (o != null) { + return o; + } } // Experimental/Testing, will be removed if( name.startsWith( "toString:" )) { name=name.substring( "toString:".length()); Object v=project.getReference( name ); - if( v==null ) return null; + if (v == null) { + return null; + } return v.toString(); } @@ -232,8 +258,7 @@ */ public void parsePropertyString(String value, Vector fragments, Vector propertyRefs) - throws BuildException - { + throws BuildException { parsePropertyStringDefault(value, fragments, propertyRefs); } @@ -256,8 +281,7 @@ */ public String replaceProperties(String ns, String value, Hashtable keys) - throws BuildException - { + throws BuildException { if (value == null) { return null; } @@ -309,8 +333,7 @@ * added. */ public synchronized boolean setProperty(String ns, String name, - Object value, boolean verbose) - { + Object value, boolean verbose) { // user ( CLI ) properties take precedence if (null != userProperties.get(name)) { if( verbose ) { @@ -320,7 +343,7 @@ return false; } - boolean done=this.setPropertyHook(ns, name, value, false, false, false); + boolean done = setPropertyHook(ns, name, value, false, false, false); if( done ) { return true; } @@ -331,8 +354,8 @@ } if( verbose ) { - project.log("Setting project property: " + name + " -> " + - value, Project.MSG_DEBUG); + project.log("Setting project property: " + name + " -> " + + value, Project.MSG_DEBUG); } properties.put(name, value); return true; @@ -350,21 +373,20 @@ * @since Ant 1.6 */ public synchronized void setNewProperty(String ns, String name, - Object value) - { + Object value) { if (null != properties.get(name)) { project.log("Override ignored for property " + name, Project.MSG_VERBOSE); return; } - boolean done=this.setPropertyHook(ns, name, value, false, true, false); + boolean done = setPropertyHook(ns, name, value, false, true, false); if( done ) { return; } - project.log("Setting project property: " + name + " -> " + - value, Project.MSG_DEBUG); + project.log("Setting project property: " + name + " -> " + + value, Project.MSG_DEBUG); if( name!= null && value!=null ) { properties.put(name, value); } @@ -379,13 +401,12 @@ * Must not be <code>null</code>. */ public synchronized void setUserProperty(String ns, String name, - Object value) - { - project.log("Setting ro project property: " + name + " -> " + - value, Project.MSG_DEBUG); + Object value) { + project.log("Setting ro project property: " + name + " -> " + + value, Project.MSG_DEBUG); userProperties.put(name, value); - boolean done=this.setPropertyHook(ns, name, value, false, false, true); + boolean done = setPropertyHook(ns, name, value, false, false, true); if( done ) { return; } @@ -404,15 +425,14 @@ * Must not be <code>null</code>. */ public synchronized void setInheritedProperty(String ns, String name, - Object value) - { + Object value) { inheritedProperties.put(name, value); - project.log("Setting ro project property: " + name + " -> " + - value, Project.MSG_DEBUG); + project.log("Setting ro project property: " + name + " -> " + + value, Project.MSG_DEBUG); userProperties.put(name, value); - boolean done=this.setPropertyHook(ns, name, value, true, false, false); + boolean done = setPropertyHook(ns, name, value, true, false, false); if( done ) { return; } @@ -567,8 +587,7 @@ */ static void parsePropertyStringDefault(String value, Vector fragments, Vector propertyRefs) - throws BuildException - { + throws BuildException { int prev = 0; int pos; //search for the next instance of $ from the 'prev' position 1.6 +73 -68 ant/src/main/org/apache/tools/ant/listener/CommonsLoggingListener.java Index: CommonsLoggingListener.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/listener/CommonsLoggingListener.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -u -r1.5 -r1.6 --- CommonsLoggingListener.java 10 Feb 2003 14:13:34 -0000 1.5 +++ CommonsLoggingListener.java 5 Jul 2003 14:34:12 -0000 1.6 @@ -57,7 +57,13 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogConfigurationException; import org.apache.commons.logging.LogFactory; -import org.apache.tools.ant.*; + +import org.apache.tools.ant.BuildListener; +import org.apache.tools.ant.BuildLogger; +import org.apache.tools.ant.BuildEvent; +import org.apache.tools.ant.Project; +import org.apache.tools.ant.Task; +import org.apache.tools.ant.UnknownElement; import java.io.PrintStream; @@ -270,8 +276,7 @@ } } - private void realLog( Log log, String message, int priority, Throwable t ) - { + private void realLog(Log log, String message, int priority, Throwable t) { PrintStream tmpOut=System.out; PrintStream tmpErr=System.err; System.setOut( out ); 1.35 +1 -0 ant/src/main/org/apache/tools/ant/taskdefs/Definer.java Index: Definer.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/Definer.java,v retrieving revision 1.34 retrieving revision 1.35 diff -u -w -u -r1.34 -r1.35 --- Definer.java 4 Jul 2003 09:53:08 -0000 1.34 +++ Definer.java 5 Jul 2003 14:34:12 -0000 1.35 @@ -353,6 +353,7 @@ try { is.close(); } catch (IOException e) { + // ignore } } } 1.6 +1 -1 ant/src/main/org/apache/tools/ant/taskdefs/SubAnt.java Index: SubAnt.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/SubAnt.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -u -r1.5 -r1.6 --- SubAnt.java 4 Jul 2003 14:04:54 -0000 1.5 +++ SubAnt.java 5 Jul 2003 14:34:12 -0000 1.6 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2000-2003 The Apache Software Foundation. All rights + * Copyright (c) 2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without 1.5 +4 -1 ant/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckout.java Index: CCMCheckout.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ccm/CCMCheckout.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -u -r1.4 -r1.5 --- CCMCheckout.java 10 Feb 2003 14:13:46 -0000 1.4 +++ CCMCheckout.java 5 Jul 2003 14:34:12 -0000 1.5 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2001-2002 The Apache Software Foundation. All rights + * Copyright (c) 2001-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -61,6 +61,9 @@ */ public class CCMCheckout extends CCMCheck { + /** + * default constructor + */ public CCMCheckout() { super(); setCcmAction(COMMAND_CHECKOUT); 1.7 +4 -1 ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/AntAnalyzer.java Index: AntAnalyzer.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/AntAnalyzer.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -u -r1.6 -r1.7 --- AntAnalyzer.java 10 Feb 2003 14:13:47 -0000 1.6 +++ AntAnalyzer.java 5 Jul 2003 14:34:12 -0000 1.7 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -71,6 +71,9 @@ * @author Conor MacNeill */ public class AntAnalyzer extends AbstractAnalyzer { + /** + * Default constructor + */ public AntAnalyzer() { } 1.9 +2 -2 ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPoolEntry.java Index: ConstantPoolEntry.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/ConstantPoolEntry.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -u -r1.8 -r1.9 --- ConstantPoolEntry.java 10 Feb 2003 14:13:47 -0000 1.8 +++ ConstantPoolEntry.java 5 Jul 2003 14:34:12 -0000 1.9 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2000-2002 The Apache Software Foundation. All rights + * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without 1.8 +2 -2 ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/DoubleCPInfo.java Index: DoubleCPInfo.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/DoubleCPInfo.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -u -r1.7 -r1.8 --- DoubleCPInfo.java 10 Feb 2003 14:13:47 -0000 1.7 +++ DoubleCPInfo.java 5 Jul 2003 14:34:12 -0000 1.8 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2000-2002 The Apache Software Foundation. All rights + * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without 1.9 +2 -2 ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/StringCPInfo.java Index: StringCPInfo.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/depend/constantpool/StringCPInfo.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -u -r1.8 -r1.9 --- StringCPInfo.java 10 Feb 2003 14:13:48 -0000 1.8 +++ StringCPInfo.java 5 Jul 2003 14:34:12 -0000 1.9 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2000-2002 The Apache Software Foundation. All rights + * Copyright (c) 2000-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without 1.5 +52 -69 ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibAvailableTask.java Index: JarLibAvailableTask.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibAvailableTask.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -u -r1.4 -r1.5 --- JarLibAvailableTask.java 10 Feb 2003 14:14:03 -0000 1.4 +++ JarLibAvailableTask.java 5 Jul 2003 14:34:12 -0000 1.5 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -66,38 +66,35 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a> * @ant.task name="jarlib-available" */ -public class JarLibAvailableTask - extends Task -{ +public class JarLibAvailableTask extends Task { /** * The library to display information about. */ - private File m_file; + private File libraryFile; /** * Filesets specifying all the librarys * to display information about. */ - private final Vector m_extensionSets = new Vector(); + private final Vector extensionFileSets = new Vector(); /** * The name of the property to set if extension is available. */ - private String m_property; + private String propertyName; /** * The extension that is required. */ - private ExtensionAdapter m_extension; + private ExtensionAdapter requiredExtension; /** * The name of property to set if extensions are available. * * @param property The name of property to set if extensions is available. */ - public void setProperty( final String property ) - { - m_property = property; + public void setProperty(final String property) { + this.propertyName = property; } /** @@ -105,9 +102,8 @@ * * @param file The jar library to check. */ - public void setFile( final File file ) - { - m_file = file; + public void setFile(final File file) { + this.libraryFile = file; } /** @@ -115,15 +111,13 @@ * * @param extension Set the Extension looking for. */ - public void addConfiguredExtension( final ExtensionAdapter extension ) - { - if( null != m_extension ) - { - final String message = "Can not specify extension to " + - "search for multiple times."; + public void addConfiguredExtension(final ExtensionAdapter extension) { + if (null != requiredExtension) { + final String message = "Can not specify extension to " + + "search for multiple times."; throw new BuildException( message ); } - m_extension = extension; + requiredExtension = extension; } /** @@ -131,47 +125,42 @@ * * @param extensionSet a set of extensions to search in. */ - public void addConfiguredExtensionSet( final ExtensionSet extensionSet ) - { - m_extensionSets.addElement( extensionSet ); + public void addConfiguredExtensionSet(final ExtensionSet extensionSet) { + extensionFileSets.addElement(extensionSet); } - public void execute() - throws BuildException - { + /** + * Execute the task. + * + * @throws BuildException if somethign goes wrong. + */ + public void execute() throws BuildException { validate(); - final Extension test = m_extension.toExtension(); + final Extension test = requiredExtension.toExtension(); // Check if list of files to check has been specified - if( !m_extensionSets.isEmpty() ) - { - final Iterator iterator = m_extensionSets.iterator(); - while( iterator.hasNext() ) - { - final ExtensionSet extensionSet = (ExtensionSet)iterator.next(); + if (!extensionFileSets.isEmpty()) { + final Iterator iterator = extensionFileSets.iterator(); + while (iterator.hasNext()) { + final ExtensionSet extensionSet + = (ExtensionSet) iterator.next(); final Extension[] extensions = extensionSet.toExtensions( getProject() ); - for( int i = 0; i < extensions.length; i++ ) - { + for (int i = 0; i < extensions.length; i++) { final Extension extension = extensions[ i ]; - if( extension.isCompatibleWith( test ) ) - { - getProject().setNewProperty( m_property, "true" ); - } + if (extension.isCompatibleWith(test)) { + getProject().setNewProperty(propertyName, "true"); } } } - else - { - final Manifest manifest = ExtensionUtil.getManifest( m_file ); + } else { + final Manifest manifest = ExtensionUtil.getManifest(libraryFile); final Extension[] extensions = Extension.getAvailable( manifest ); - for( int i = 0; i < extensions.length; i++ ) - { + for (int i = 0; i < extensions.length; i++) { final Extension extension = extensions[ i ]; - if( extension.isCompatibleWith( test ) ) - { - getProject().setNewProperty( m_property, "true" ); + if (extension.isCompatibleWith(test)) { + getProject().setNewProperty(propertyName, "true"); } } } @@ -182,28 +171,22 @@ * * @throws BuildException if invalid parameters found */ - private void validate() - throws BuildException - { - if( null == m_extension ) - { + private void validate() throws BuildException { + if (null == requiredExtension) { final String message = "Extension element must be specified."; throw new BuildException( message ); } - if( null == m_file && m_extensionSets.isEmpty() ) - { + if (null == libraryFile && extensionFileSets.isEmpty()) { final String message = "File attribute not specified."; throw new BuildException( message ); } - if( null != m_file && !m_file.exists() ) - { - final String message = "File '" + m_file + "' does not exist."; + if (null != libraryFile && !libraryFile.exists()) { + final String message = "File '" + libraryFile + "' does not exist."; throw new BuildException( message ); } - if( null != m_file && !m_file.isFile() ) - { - final String message = "\'" + m_file + "\' is not a file."; + if (null != libraryFile && !libraryFile.isFile()) { + final String message = "\'" + libraryFile + "\' is not a file."; throw new BuildException( message ); } } 1.4 +34 -44 ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibDisplayTask.java Index: JarLibDisplayTask.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibDisplayTask.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -u -r1.3 -r1.4 --- JarLibDisplayTask.java 10 Feb 2003 14:14:03 -0000 1.3 +++ JarLibDisplayTask.java 5 Jul 2003 14:34:12 -0000 1.4 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -75,28 +75,25 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a> * @ant.task name="jarlib-display" */ -public class JarLibDisplayTask - extends Task -{ +public class JarLibDisplayTask extends Task { /** * The library to display information about. */ - private File m_file; + private File libraryFile; /** * Filesets specifying all the librarys * to display information about. */ - private final Vector m_filesets = new Vector(); + private final Vector libraryFileSets = new Vector(); /** * The JAR library to display information for. * * @param file The jar library to display information for. */ - public void setFile( final File file ) - { - m_file = file; + public void setFile(final File file) { + this.libraryFile = file; } /** @@ -104,37 +101,35 @@ * * @param fileSet a set of files about which library data will be displayed. */ - public void addFileset( final FileSet fileSet ) - { - m_filesets.addElement( fileSet ); + public void addFileset(final FileSet fileSet) { + libraryFileSets.addElement(fileSet); } - public void execute() - throws BuildException - { + /** + * Execute the task. + * + * @throws BuildException if the task fails. + */ + public void execute() throws BuildException { validate(); final LibraryDisplayer displayer = new LibraryDisplayer(); // Check if list of files to check has been specified - if( !m_filesets.isEmpty() ) - { - final Iterator iterator = m_filesets.iterator(); - while( iterator.hasNext() ) - { + if (!libraryFileSets.isEmpty()) { + final Iterator iterator = libraryFileSets.iterator(); + while (iterator.hasNext()) { final FileSet fileSet = (FileSet)iterator.next(); - final DirectoryScanner scanner = fileSet.getDirectoryScanner( getProject() ); + final DirectoryScanner scanner + = fileSet.getDirectoryScanner(getProject()); final File basedir = scanner.getBasedir(); final String[] files = scanner.getIncludedFiles(); - for( int i = 0; i < files.length; i++ ) - { + for (int i = 0; i < files.length; i++) { final File file = new File( basedir, files[ i ] ); displayer.displayLibrary( file ); } } - } - else - { - displayer.displayLibrary( m_file ); + } else { + displayer.displayLibrary(libraryFile); } } @@ -143,22 +138,17 @@ * * @throws BuildException if invalid parameters found */ - private void validate() - throws BuildException - { - if( null == m_file && m_filesets.isEmpty() ) - { + private void validate() throws BuildException { + if (null == libraryFile && libraryFileSets.isEmpty()) { final String message = "File attribute not specified."; throw new BuildException( message ); } - if( null != m_file && !m_file.exists() ) - { - final String message = "File '" + m_file + "' does not exist."; + if (null != libraryFile && !libraryFile.exists()) { + final String message = "File '" + libraryFile + "' does not exist."; throw new BuildException( message ); } - if( null != m_file && !m_file.isFile() ) - { - final String message = "\'" + m_file + "\' is not a file."; + if (null != libraryFile && !libraryFile.isFile()) { + final String message = "\'" + libraryFile + "\' is not a file."; throw new BuildException( message ); } } 1.5 +94 -122 ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibManifestTask.java Index: JarLibManifestTask.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibManifestTask.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -u -r1.4 -r1.5 --- JarLibManifestTask.java 10 Feb 2003 14:14:03 -0000 1.4 +++ JarLibManifestTask.java 5 Jul 2003 14:34:12 -0000 1.5 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -80,9 +80,7 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a> * @ant.task name="jarlib-manifest" */ -public final class JarLibManifestTask - extends Task -{ +public final class JarLibManifestTask extends Task { /** * Version of manifest spec that task generates. */ @@ -96,58 +94,56 @@ /** * The library to display information about. */ - private File m_destfile; + private File destFile; /** * The extension supported by this library (if any). */ - private Extension m_extension; + private Extension extension; /** * ExtensionAdapter objects representing * dependencies required by library. */ - private final ArrayList m_dependencies = new ArrayList(); + private final ArrayList dependencies = new ArrayList(); /** * ExtensionAdapter objects representing optional * dependencies required by library. */ - private final ArrayList m_optionals = new ArrayList(); + private final ArrayList optionals = new ArrayList(); /** * Extra attributes the user specifies for main section * in manifest. */ - private final ArrayList m_extraAttributes = new ArrayList(); + private final ArrayList extraAttributes = new ArrayList(); /** * The location where generated manifest is placed. * - * @param destfile The location where generated manifest is placed. + * @param destFile The location where generated manifest is placed. */ - public void setDestfile( final File destfile ) - { - m_destfile = destfile; + public void setDestfile(final File destFile) { + this.destFile = destFile; } /** * Adds an extension that this library implements. * * @param extensionAdapter an extension that this library implements. + * + * @throws BuildException if there is multiple extensions detected + * in the library. */ public void addConfiguredExtension( final ExtensionAdapter extensionAdapter ) - throws BuildException - { - if( null != m_extension ) - { + throws BuildException { + if (null != extension) { final String message = "Can not have multiple extensions defined in one library."; throw new BuildException( message ); - } - else - { - m_extension = extensionAdapter.toExtension(); + } else { + extension = extensionAdapter.toExtension(); } } @@ -156,9 +152,8 @@ * * @param extensionSet a set of extensions that this library requires. */ - public void addConfiguredDepends( final ExtensionSet extensionSet ) - { - m_dependencies.add( extensionSet ); + public void addConfiguredDepends(final ExtensionSet extensionSet) { + dependencies.add(extensionSet); } /** @@ -166,9 +161,8 @@ * * @param extensionSet a set of extensions that this library optionally requires. */ - public void addConfiguredOptions( final ExtensionSet extensionSet ) - { - m_optionals.add( extensionSet ); + public void addConfiguredOptions(final ExtensionSet extensionSet) { + optionals.add(extensionSet); } /** @@ -176,14 +170,16 @@ * * @param attribute an attribute that is to be put in main section of manifest. */ - public void addConfiguredAttribute( final ExtraAttribute attribute ) - { - m_extraAttributes.add( attribute ); + public void addConfiguredAttribute(final ExtraAttribute attribute) { + extraAttributes.add(attribute); } - public void execute() - throws BuildException - { + /** + * Execute the task. + * + * @throws BuildException if the task fails. + */ + public void execute() throws BuildException { validate(); final Manifest manifest = new Manifest(); @@ -195,13 +191,12 @@ appendExtraAttributes( attributes ); - if( null != m_extension ) - { - Extension.addExtension( m_extension, attributes ); + if (null != extension) { + Extension.addExtension(extension, attributes); } //Add all the dependency data to manifest for dependencies - final ArrayList depends = toExtensions( m_dependencies ); + final ArrayList depends = toExtensions(dependencies); appendExtensionList( attributes, Extension.EXTENSION_LIST, "lib", @@ -210,21 +205,18 @@ //Add all the dependency data to manifest for "optional" //dependencies - final ArrayList option = toExtensions( m_optionals ); + final ArrayList option = toExtensions(optionals); appendExtensionList( attributes, Extension.OPTIONAL_EXTENSION_LIST, "opt", option.size() ); appendLibraryList( attributes, "opt", option ); - try - { - final String message = "Generating manifest " + m_destfile.getAbsoluteFile(); + try { + final String message = "Generating manifest " + destFile.getAbsoluteFile(); log( message, Project.MSG_INFO ); writeManifest( manifest ); - } - catch( final IOException ioe ) - { + } catch (final IOException ioe) { throw new BuildException( ioe.getMessage(), ioe ); } } @@ -234,17 +226,13 @@ * * @throws BuildException if invalid parameters found */ - private void validate() - throws BuildException - { - if( null == m_destfile ) - { + private void validate() throws BuildException { + if (null == destFile) { final String message = "Destfile attribute not specified."; throw new BuildException( message ); } - if( m_destfile.exists() && !m_destfile.isFile() ) - { - final String message = m_destfile + " is not a file."; + if (destFile.exists() && !destFile.isFile()) { + final String message = destFile + " is not a file."; throw new BuildException( message ); } } @@ -255,11 +243,9 @@ * @param attributes the manifest section to write * attributes to */ - private void appendExtraAttributes( final Attributes attributes ) - { - final Iterator iterator = m_extraAttributes.iterator(); - while( iterator.hasNext() ) - { + private void appendExtraAttributes(final Attributes attributes) { + final Iterator iterator = extraAttributes.iterator(); + while (iterator.hasNext()) { final ExtraAttribute attribute = (ExtraAttribute)iterator.next(); attributes.putValue( attribute.getName(), @@ -274,25 +260,18 @@ * @throws IOException if error writing file */ private void writeManifest( final Manifest manifest ) - throws IOException - { + throws IOException { FileOutputStream output = null; - try - { - output = new FileOutputStream( m_destfile ); + try { + output = new FileOutputStream(destFile); manifest.write( output ); output.flush(); - } - finally - { - if( null != output ) - { - try - { + } finally { + if (null != output) { + try { output.close(); - } - catch( IOException e ) - { + } catch (IOException e) { + // ignore } } } @@ -312,11 +291,9 @@ private void appendLibraryList( final Attributes attributes, final String listPrefix, final ArrayList extensions ) - throws BuildException - { + throws BuildException { final int size = extensions.size(); - for( int i = 0; i < size; i++ ) - { + for (int i = 0; i < size; i++) { final Extension extension = (Extension)extensions.get( i ); final String prefix = listPrefix + i + "-"; Extension.addExtension( extension, prefix, attributes ); @@ -337,11 +314,9 @@ private void appendExtensionList( final Attributes attributes, final Attributes.Name extensionKey, final String listPrefix, - final int size ) - { + final int size) { final StringBuffer sb = new StringBuffer(); - for( int i = 0; i < size; i++ ) - { + for (int i = 0; i < size; i++) { sb.append( listPrefix + i ); sb.append( ' ' ); } @@ -358,17 +333,14 @@ * @throws BuildException if an error occurs */ private ArrayList toExtensions( final ArrayList extensionSets ) - throws BuildException - { + throws BuildException { final ArrayList results = new ArrayList(); final int size = extensionSets.size(); - for( int i = 0; i < size; i++ ) - { + for (int i = 0; i < size; i++) { final ExtensionSet set = (ExtensionSet)extensionSets.get( i ); final Extension[] extensions = set.toExtensions( getProject() ); - for( int j = 0; j < extensions.length; j++ ) - { + for (int j = 0; j < extensions.length; j++) { results.add( extensions[ j ] ); } } 1.7 +105 -133 ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibResolveTask.java Index: JarLibResolveTask.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/extension/JarLibResolveTask.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -u -r1.6 -r1.7 --- JarLibResolveTask.java 10 Feb 2003 14:14:03 -0000 1.6 +++ JarLibResolveTask.java 5 Jul 2003 14:34:12 -0000 1.7 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -71,24 +71,22 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Jeff Turner</a> * @ant.task name="jarlib-resolve" */ -public class JarLibResolveTask - extends Task -{ +public class JarLibResolveTask extends Task { /** * The name of the property in which the location of * library is stored. */ - private String m_property; + private String propertyName; /** * The extension that is required. */ - private Extension m_extension; + private Extension requiredExtension; /** * The set of resolvers to use to attempt to locate library. */ - private final ArrayList m_resolvers = new ArrayList(); + private final ArrayList resolvers = new ArrayList(); /** * Flag to indicate that you should check that @@ -96,14 +94,14 @@ * extension and if they don't then raise * an exception. */ - private boolean m_checkExtension = true; + private boolean checkExtension = true; /** * Flag indicating whether or not you should * throw a BuildException if you cannot resolve * library. */ - private boolean m_failOnError = true; + private boolean failOnError = true; /** * The name of the property in which the location of @@ -112,52 +110,56 @@ * @param property The name of the property in which the location of * library is stored. */ - public void setProperty( final String property ) - { - m_property = property; + public void setProperty(final String property) { + this.propertyName = property; } /** - * If true, libraries returned by nested resolvers should be - * checked to see if they supply extension. + * Check nested libraries for extensions + * + * @param checkExtension if true, libraries returned by nested + * resolvers should be checked to see if they supply extension. */ - public void setCheckExtension( final boolean checkExtension ) - { - m_checkExtension = checkExtension; + public void setCheckExtension(final boolean checkExtension) { + this.checkExtension = checkExtension; } /** - * If true, failure to locate library should fail build. + * Set whether to fail if error. + * + * @param failOnError if true, failure to locate library should fail build. */ - public void setFailOnError( final boolean failOnError ) - { - m_failOnError = failOnError; + public void setFailOnError(final boolean failOnError) { + this.failOnError = failOnError; } /** * Adds location resolver to look for a library in a location * relative to project directory. + * + * @param location the resolver location to search. */ - public void addConfiguredLocation( final LocationResolver location ) - { - m_resolvers.add( location ); + public void addConfiguredLocation(final LocationResolver location) { + resolvers.add(location); } /** * Adds a URL resolver to download a library from a URL * to a local file. + * + * @param url the URL resolver from which to download the library */ - public void addConfiguredUrl( final URLResolver url ) - { - m_resolvers.add( url ); + public void addConfiguredUrl(final URLResolver url) { + resolvers.add(url); } /** * Adds Ant resolver to run an Ant build file to generate a library. + * + * @param ant the AntResolver to generate the library. */ - public void addConfiguredAnt( final AntResolver ant ) - { - m_resolvers.add( ant ); + public void addConfiguredAnt(final AntResolver ant) { + resolvers.add(ant); } /** @@ -165,73 +167,62 @@ * * @param extension Set the Extension looking for. */ - public void addConfiguredExtension( final ExtensionAdapter extension ) - { - if( null != m_extension ) - { - final String message = "Can not specify extension to " + - "resolve multiple times."; + public void addConfiguredExtension(final ExtensionAdapter extension) { + if (null != requiredExtension) { + final String message = "Can not specify extension to " + + "resolve multiple times."; throw new BuildException( message ); } - m_extension = extension.toExtension(); + requiredExtension = extension.toExtension(); } - public void execute() - throws BuildException - { + /** + * Execute the task. + * + * @throws BuildException if the task fails. + */ + public void execute() throws BuildException { validate(); - getProject().log( "Resolving extension: " + m_extension, + getProject().log("Resolving extension: " + requiredExtension, Project.MSG_VERBOSE ); String candidate = - getProject().getProperty( m_property ); + getProject().getProperty(propertyName); - if( null != candidate ) - { + if (null != candidate) { final String message = "Property Already set to: " + candidate; - if( m_failOnError ) - { + if (failOnError) { throw new BuildException( message ); - } - else - { + } else { getProject().log( message, Project.MSG_ERR ); return; } } - final int size = m_resolvers.size(); - for( int i = 0; i < size; i++ ) - { + final int size = resolvers.size(); + for (int i = 0; i < size; i++) { final ExtensionResolver resolver = - (ExtensionResolver)m_resolvers.get( i ); + (ExtensionResolver) resolvers.get(i); getProject().log( "Searching for extension using Resolver:" + resolver, Project.MSG_VERBOSE ); - try - { + try { final File file = - resolver.resolve( m_extension, getProject() ); - try - { + resolver.resolve(requiredExtension, getProject()); + try { checkExtension( file ); return; - } - catch( final BuildException be ) - { - final String message = - "File " + file + " returned by resolver failed " + - "to satisfy extension due to: " + be.getMessage(); + } catch (final BuildException be) { + final String message = "File " + file + " returned by " + + "resolver failed to satisfy extension due to: " + + be.getMessage(); getProject().log( message, Project.MSG_WARN ); } - } - catch( final BuildException be ) - { - final String message = - "Failed to resolve extension to file " + - "using resolver " + resolver + " due to: " + be; + } catch (final BuildException be) { + final String message = "Failed to resolve extension to file " + + "using resolver " + resolver + " due to: " + be; getProject().log( message, Project.MSG_WARN ); } } @@ -241,19 +232,15 @@ /** * Utility method that will throw a [EMAIL PROTECTED] BuildException} - * if [EMAIL PROTECTED] #m_failOnError} is true else it just displays + * if [EMAIL PROTECTED] #failOnError} is true else it just displays * a warning. */ - private void missingExtension() - { + private void missingExtension() { final String message = "Unable to resolve extension to a file"; - if( m_failOnError ) - { + if (failOnError) { throw new BuildException( message ); - } - else - { + } else { getProject().log( message, Project.MSG_ERR ); } } @@ -266,50 +253,40 @@ * @param file the candidate library * @throws BuildException if library does not satisfy extension */ - private void checkExtension( final File file ) - { - if( !file.exists() ) - { + private void checkExtension(final File file) { + if (!file.exists()) { final String message = "File " + file + " does not exist"; throw new BuildException( message ); } - if( !file.isFile() ) - { + if (!file.isFile()) { final String message = "File " + file + " is not a file"; throw new BuildException( message ); } - if( !m_checkExtension ) - { - final String message = "Setting property to " + - file + " without verifying library satisfies extension"; + if (!checkExtension) { + final String message = "Setting property to " + file + + " without verifying library satisfies extension"; getProject().log( message, Project.MSG_VERBOSE ); setLibraryProperty( file ); - } - else - { - getProject().log( "Checking file " + file + - " to see if it satisfies extension", - Project.MSG_VERBOSE ); + } else { + getProject().log("Checking file " + file + + " to see if it satisfies extension", Project.MSG_VERBOSE); final Manifest manifest = ExtensionUtil.getManifest( file ); final Extension[] extensions = Extension.getAvailable( manifest ); - for( int i = 0; i < extensions.length; i++ ) - { + for (int i = 0; i < extensions.length; i++) { final Extension extension = extensions[ i ]; - if( extension.isCompatibleWith( m_extension ) ) - { + if (extension.isCompatibleWith(requiredExtension)) { setLibraryProperty( file ); return; } } - getProject().log( "File " + file + " skipped as it " + - "does not satisfy extension", - Project.MSG_VERBOSE ); + getProject().log("File " + file + " skipped as it " + + "does not satisfy extension", Project.MSG_VERBOSE); final String message = "File " + file + " does not satisfy extension"; @@ -324,9 +301,8 @@ * * @param file the library */ - private void setLibraryProperty( final File file ) - { - getProject().setNewProperty( m_property, + private void setLibraryProperty(final File file) { + getProject().setNewProperty(propertyName, file.getAbsolutePath() ); } @@ -335,17 +311,13 @@ * * @throws BuildException if invalid parameters found */ - private void validate() - throws BuildException - { - if( null == m_property ) - { + private void validate() throws BuildException { + if (null == propertyName) { final String message = "Property attribute must be specified."; throw new BuildException( message ); } - if( null == m_extension ) - { + if (null == requiredExtension) { final String message = "Extension element must be specified."; throw new BuildException( message ); } 1.12 +5 -0 ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Have.java Index: P4Have.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/perforce/P4Have.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -u -r1.11 -r1.12 --- P4Have.java 10 Feb 2003 14:14:19 -0000 1.11 +++ P4Have.java 5 Jul 2003 14:34:12 -0000 1.12 @@ -72,6 +72,11 @@ */ public class P4Have extends P4Base { + /** + * Execute the Perforce <code>have</code> command. + * + * @throws BuildException if the command cannot be executed. + */ public void execute() throws BuildException { execP4Command("have " + P4CmdOpts + " " + P4View, new SimpleP4OutputHandler(this)); } 1.4 +2 -2 ant/src/main/org/apache/tools/ant/taskdefs/optional/unix/Chgrp.java Index: Chgrp.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/unix/Chgrp.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -u -r1.3 -r1.4 --- Chgrp.java 3 Jul 2003 20:56:15 -0000 1.3 +++ Chgrp.java 5 Jul 2003 14:34:13 -0000 1.4 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without 1.18 +1 -1 ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java Index: MSVSSCHECKIN.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSCHECKIN.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -w -u -r1.17 -r1.18 1.19 +1 -1 ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSLABEL.java Index: MSVSSLABEL.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/vss/MSVSSLABEL.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -w -u -r1.18 -r1.19 1.6 +6 -1 ant/src/main/org/apache/tools/ant/types/Parameterizable.java Index: Parameterizable.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/Parameterizable.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -u -r1.5 -r1.6 --- Parameterizable.java 10 Feb 2003 14:14:30 -0000 1.5 +++ Parameterizable.java 5 Jul 2003 14:34:13 -0000 1.6 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -59,5 +59,10 @@ * @author Magesh Umasankar */ public interface Parameterizable { + /** + * Set the parameters + * + * @param parameters an array of name/type/value parameters. + */ void setParameters(Parameter[] parameters); } 1.6 +3 -3 ant/src/main/org/apache/tools/ant/types/ResourceLocation.java Index: ResourceLocation.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/ResourceLocation.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -u -r1.5 -r1.6 --- ResourceLocation.java 4 Jul 2003 14:04:56 -0000 1.5 +++ ResourceLocation.java 5 Jul 2003 14:34:13 -0000 1.6 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -84,7 +84,7 @@ /** * name of the catalog entry type, as per OASIS spec. */ - protected String name = null; + private String name = null; /** publicId of the dtd/entity. */ private String publicId = null; 1.4 +4 -1 ant/src/main/org/apache/tools/ant/types/selectors/AndSelector.java Index: AndSelector.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/AndSelector.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -u -r1.3 -r1.4 --- AndSelector.java 4 Jul 2003 23:18:49 -0000 1.3 +++ AndSelector.java 5 Jul 2003 14:34:13 -0000 1.4 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -72,6 +72,9 @@ public AndSelector() { } + /** + * @return a string representation of the selector + */ public String toString() { StringBuffer buf = new StringBuffer(); if (hasSelectors()) { 1.5 +2 -2 ant/src/main/org/apache/tools/ant/types/selectors/FileSelector.java Index: FileSelector.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/FileSelector.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -u -r1.4 -r1.5 --- FileSelector.java 4 Jul 2003 23:18:49 -0000 1.4 +++ FileSelector.java 5 Jul 2003 14:34:13 -0000 1.5 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -78,7 +78,7 @@ * @return whether the file should be selected or not * @exception BuildException if the selector was not configured correctly */ - public boolean isSelected(File basedir, String filename, File file) + boolean isSelected(File basedir, String filename, File file) throws BuildException; } 1.4 +4 -1 ant/src/main/org/apache/tools/ant/types/selectors/NoneSelector.java Index: NoneSelector.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/NoneSelector.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -u -r1.3 -r1.4 --- NoneSelector.java 4 Jul 2003 23:18:49 -0000 1.3 +++ NoneSelector.java 5 Jul 2003 14:34:13 -0000 1.4 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -73,6 +73,9 @@ public NoneSelector() { } + /** + * @return a string representation of the selector + */ public String toString() { StringBuffer buf = new StringBuffer(); if (hasSelectors()) { 1.5 +6 -3 ant/src/main/org/apache/tools/ant/types/selectors/NotSelector.java Index: NotSelector.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/NotSelector.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -u -r1.4 -r1.5 --- NotSelector.java 4 Jul 2003 23:18:49 -0000 1.4 +++ NotSelector.java 5 Jul 2003 14:34:13 -0000 1.5 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -72,6 +72,9 @@ public NotSelector() { } + /** + * @return a string representation of the selector + */ public String toString() { StringBuffer buf = new StringBuffer(); if (hasSelectors()) { @@ -88,8 +91,8 @@ */ public void verifySettings() { if (selectorCount() != 1) { - setError("One and only one selector is allowed within the " + - "<not> tag"); + setError("One and only one selector is allowed within the " + + "<not> tag"); } } 1.4 +4 -1 ant/src/main/org/apache/tools/ant/types/selectors/OrSelector.java Index: OrSelector.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/types/selectors/OrSelector.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -u -r1.3 -r1.4 --- OrSelector.java 4 Jul 2003 23:18:49 -0000 1.3 +++ OrSelector.java 5 Jul 2003 14:34:13 -0000 1.4 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -72,6 +72,9 @@ public OrSelector() { } + /** + * @return a string representation of the selector + */ public String toString() { StringBuffer buf = new StringBuffer(); if (hasSelectors()) { 1.47 +242 -47 ant/src/main/org/apache/tools/ant/util/FileUtils.java Index: FileUtils.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/util/FileUtils.java,v retrieving revision 1.46 retrieving revision 1.47 diff -u -w -u -r1.46 -r1.47 --- FileUtils.java 4 Jul 2003 13:22:43 -0000 1.46 +++ FileUtils.java 5 Jul 2003 14:34:13 -0000 1.47 @@ -165,9 +165,15 @@ * Convienence method to copy a file from a source to a destination. * No filtering is performed. * - * @throws IOException + * @param sourceFile Name of file to copy from. + * Must not be <code>null</code>. + * @param destFile Name of file to copy to. + * Must not be <code>null</code>. + * + * @throws IOException if the copying fails */ - public void copyFile(String sourceFile, String destFile) throws IOException { + public void copyFile(String sourceFile, String destFile) + throws IOException { copyFile(new File(sourceFile), new File(destFile), null, false, false); } @@ -175,11 +181,19 @@ * Convienence method to copy a file from a source to a destination * specifying if token filtering must be used. * - * @throws IOException + * @param sourceFile Name of file to copy from. + * Must not be <code>null</code>. + * @param destFile Name of file to copy to. + * Must not be <code>null</code>. + * @param filters the collection of filters to apply to this copy + * + * @throws IOException if the copying fails */ - public void copyFile(String sourceFile, String destFile, FilterSetCollection filters) + public void copyFile(String sourceFile, String destFile, + FilterSetCollection filters) throws IOException { - copyFile(new File(sourceFile), new File(destFile), filters, false, false); + copyFile(new File(sourceFile), new File(destFile), filters, + false, false); } /** @@ -187,7 +201,15 @@ * destination specifying if token filtering must be used and if * source files may overwrite newer destination files. * - * @throws IOException + * @param sourceFile Name of file to copy from. + * Must not be <code>null</code>. + * @param destFile Name of file to copy to. + * Must not be <code>null</code>. + * @param filters the collection of filters to apply to this copy + * @param overwrite Whether or not the destination file should be + * overwritten if it already exists. + * + * @throws IOException if the copying fails */ public void copyFile(String sourceFile, String destFile, FilterSetCollection filters, boolean overwrite) throws IOException { @@ -202,7 +224,18 @@ * last modified time of <code>destFile</code> file should be made equal * to the last modified time of <code>sourceFile</code>. * - * @throws IOException + * @param sourceFile Name of file to copy from. + * Must not be <code>null</code>. + * @param destFile Name of file to copy to. + * Must not be <code>null</code>. + * @param filters the collection of filters to apply to this copy + * @param overwrite Whether or not the destination file should be + * overwritten if it already exists. + * @param preserveLastModified Whether or not the last modified time of + * the resulting file should be set to that + * of the source file. + * + * @throws IOException if the copying fails */ public void copyFile(String sourceFile, String destFile, FilterSetCollection filters, boolean overwrite, boolean preserveLastModified) @@ -218,9 +251,21 @@ * last modified time of <code>destFile</code> file should be made equal * to the last modified time of <code>sourceFile</code>. * - * @throws IOException + * @param sourceFile Name of file to copy from. + * Must not be <code>null</code>. + * @param destFile Name of file to copy to. + * Must not be <code>null</code>. + * @param filters the collection of filters to apply to this copy + * @param overwrite Whether or not the destination file should be + * overwritten if it already exists. + * @param preserveLastModified Whether or not the last modified time of + * the resulting file should be set to that + * of the source file. + * @param encoding the encoding used to read and write the files. + * + * @throws IOException if the copying fails * - * @since 1.14, Ant 1.5 + * @since Ant 1.5 */ public void copyFile(String sourceFile, String destFile, FilterSetCollection filters, boolean overwrite, @@ -238,9 +283,23 @@ * <code>destFile</code> file should be made equal * to the last modified time of <code>sourceFile</code>. * - * @throws IOException + * @param sourceFile Name of file to copy from. + * Must not be <code>null</code>. + * @param destFile Name of file to copy to. + * Must not be <code>null</code>. + * @param filters the collection of filters to apply to this copy + * @param filterChains filterChains to apply during the copy. + * @param overwrite Whether or not the destination file should be + * overwritten if it already exists. + * @param preserveLastModified Whether or not the last modified time of + * the resulting file should be set to that + * of the source file. + * @param encoding the encoding used to read and write the files. + * @param project the project instance * - * @since 1.15, Ant 1.5 + * @throws IOException if the copying fails + * + * @since Ant 1.5 */ public void copyFile(String sourceFile, String destFile, FilterSetCollection filters, Vector filterChains, @@ -260,7 +319,22 @@ * <code>destFile</code> file should be made equal * to the last modified time of <code>sourceFile</code>. * - * @throws IOException + * @param sourceFile Name of file to copy from. + * Must not be <code>null</code>. + * @param destFile Name of file to copy to. + * Must not be <code>null</code>. + * @param filters the collection of filters to apply to this copy + * @param filterChains filterChains to apply during the copy. + * @param overwrite Whether or not the destination file should be + * overwritten if it already exists. + * @param preserveLastModified Whether or not the last modified time of + * the resulting file should be set to that + * of the source file. + * @param inputEncoding the encoding used to read the files. + * @param outputEncoding the encoding used to write the files. + * @param project the project instance + * + * @throws IOException if the copying fails * * @since Ant 1.6 */ @@ -279,7 +353,12 @@ * Convienence method to copy a file from a source to a destination. * No filtering is performed. * - * @throws IOException + * @param sourceFile the file to copy from. + * Must not be <code>null</code>. + * @param destFile the file to copy to. + * Must not be <code>null</code>. + * + * @throws IOException if the copying fails */ public void copyFile(File sourceFile, File destFile) throws IOException { copyFile(sourceFile, destFile, null, false, false); @@ -289,7 +368,13 @@ * Convienence method to copy a file from a source to a destination * specifying if token filtering must be used. * - * @throws IOException + * @param sourceFile the file to copy from. + * Must not be <code>null</code>. + * @param destFile the file to copy to. + * Must not be <code>null</code>. + * @param filters the collection of filters to apply to this copy + * + * @throws IOException if the copying fails */ public void copyFile(File sourceFile, File destFile, FilterSetCollection filters) throws IOException { @@ -301,7 +386,15 @@ * destination specifying if token filtering must be used and if * source files may overwrite newer destination files. * - * @throws IOException + * @param sourceFile the file to copy from. + * Must not be <code>null</code>. + * @param destFile the file to copy to. + * Must not be <code>null</code>. + * @param filters the collection of filters to apply to this copy + * @param overwrite Whether or not the destination file should be + * overwritten if it already exists. + * + * @throws IOException if the copying fails */ public void copyFile(File sourceFile, File destFile, FilterSetCollection filters, boolean overwrite) throws IOException { @@ -315,7 +408,18 @@ * last modified time of <code>destFile</code> file should be made equal * to the last modified time of <code>sourceFile</code>. * - * @throws IOException + * @param sourceFile the file to copy from. + * Must not be <code>null</code>. + * @param destFile the file to copy to. + * Must not be <code>null</code>. + * @param filters the collection of filters to apply to this copy + * @param overwrite Whether or not the destination file should be + * overwritten if it already exists. + * @param preserveLastModified Whether or not the last modified time of + * the resulting file should be set to that + * of the source file. + * + * @throws IOException if the copying fails */ public void copyFile(File sourceFile, File destFile, FilterSetCollection filters, boolean overwrite, boolean preserveLastModified) @@ -332,9 +436,21 @@ * equal to the last modified time of <code>sourceFile</code> and * which character encoding to assume. * - * @throws IOException + * @param sourceFile the file to copy from. + * Must not be <code>null</code>. + * @param destFile the file to copy to. + * Must not be <code>null</code>. + * @param filters the collection of filters to apply to this copy + * @param overwrite Whether or not the destination file should be + * overwritten if it already exists. + * @param preserveLastModified Whether or not the last modified time of + * the resulting file should be set to that + * of the source file. + * @param encoding the encoding used to read and write the files. + * + * @throws IOException if the copying fails * - * @since 1.14, Ant 1.5 + * @since Ant 1.5 */ public void copyFile(File sourceFile, File destFile, FilterSetCollection filters, boolean overwrite, @@ -352,9 +468,23 @@ * <code>destFile</code> file should be made equal * to the last modified time of <code>sourceFile</code>. * - * @throws IOException + * @param sourceFile the file to copy from. + * Must not be <code>null</code>. + * @param destFile the file to copy to. + * Must not be <code>null</code>. + * @param filters the collection of filters to apply to this copy + * @param filterChains filterChains to apply during the copy. + * @param overwrite Whether or not the destination file should be + * overwritten if it already exists. + * @param preserveLastModified Whether or not the last modified time of + * the resulting file should be set to that + * of the source file. + * @param encoding the encoding used to read and write the files. + * @param project the project instance * - * @since 1.15, Ant 1.5 + * @throws IOException if the copying fails + * + * @since Ant 1.5 */ public void copyFile(File sourceFile, File destFile, FilterSetCollection filters, Vector filterChains, @@ -373,9 +503,25 @@ * <code>destFile</code> file should be made equal * to the last modified time of <code>sourceFile</code>. * - * @throws IOException + * @param sourceFile the file to copy from. + * Must not be <code>null</code>. + * @param destFile the file to copy to. + * Must not be <code>null</code>. + * @param filters the collection of filters to apply to this copy + * @param filterChains filterChains to apply during the copy. + * @param overwrite Whether or not the destination file should be + * overwritten if it already exists. + * @param preserveLastModified Whether or not the last modified time of + * the resulting file should be set to that + * of the source file. + * @param inputEncoding the encoding used to read the files. + * @param outputEncoding the encoding used to write the files. + * @param project the project instance + * * - * @since 1.15, Ant 1.6 + * @throws IOException if the copying fails + * + * @since Ant 1.6 */ public void copyFile(File sourceFile, File destFile, FilterSetCollection filters, Vector filterChains, @@ -384,8 +530,8 @@ Project project) throws IOException { - if (overwrite || !destFile.exists() || - destFile.lastModified() < sourceFile.lastModified()) { + if (overwrite || !destFile.exists() + || destFile.lastModified() < sourceFile.lastModified()) { if (destFile.exists() && destFile.isFile()) { destFile.delete(); @@ -411,19 +557,19 @@ if (inputEncoding == null) { in = new BufferedReader(new FileReader(sourceFile)); } else { - in = - new BufferedReader(new InputStreamReader( - new FileInputStream(sourceFile), - inputEncoding)); + InputStreamReader isr + = new InputStreamReader(new FileInputStream(sourceFile), + inputEncoding); + in = new BufferedReader(isr); } if (outputEncoding == null) { out = new BufferedWriter(new FileWriter(destFile)); } else { - out = - new BufferedWriter(new OutputStreamWriter( - new FileOutputStream(destFile), - outputEncoding)); + OutputStreamWriter osw + = new OutputStreamWriter(new FileOutputStream(destFile), + outputEncoding); + out = new BufferedWriter(osw); } if (filterChainsAvailable) { @@ -442,7 +588,8 @@ String line = lineTokenizer.getToken(in); while (line != null) { if (line.length() == 0) { - // this should not happen, because the lines are returned with the end of line delimiter + // this should not happen, because the lines are + // returned with the end of line delimiter out.newLine(); } else { newline = filters.replaceTokens(line); @@ -495,7 +642,7 @@ Reader rdr = crh.getAssembledReader(); in = new BufferedReader(rdr); } - char buffer[] = new char[1024*8]; + char[] buffer = new char[1024 * 8]; while (true) { int nRead = in.read(buffer, 0, buffer.length); if (nRead == -1) { @@ -542,6 +689,8 @@ /** * see whether we have a setLastModified method in File and return it. + * + * @return a method to setLastModified. */ protected final Method getSetLastModified() { if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) { @@ -564,8 +713,14 @@ /** * Calls File.setLastModified(long time) in a Java 1.1 compatible way. + * + * @param file the file whose modified time is to be set + * @param time the time to which the last modified time is to be set. + * + * @throws BuildException if the time cannot be set. */ - public void setFileLastModified(File file, long time) throws BuildException { + public void setFileLastModified(File file, long time) + throws BuildException { if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) { return; } @@ -665,6 +820,9 @@ * \ as the separator.</li> * </ul> * + * @param path the path to be normalized + * @param the normalized version of the path. + * * @throws java.lang.NullPointerException if the file path is * equal to null. */ @@ -678,10 +836,10 @@ int colon = path.indexOf(":"); if (!onNetWare) { - if (!path.startsWith(File.separator) && - !(path.length() >= 2 && - Character.isLetter(path.charAt(0)) && - colon == 1)) { + if (!path.startsWith(File.separator) + && !(path.length() >= 2 + && Character.isLetter(path.charAt(0)) + && colon == 1)) { String msg = path + " is not an absolute path"; throw new BuildException(msg); } @@ -696,11 +854,10 @@ boolean dosWithDrive = false; String root = null; // Eliminate consecutive slashes after the drive spec - if ((!onNetWare && - path.length() >= 2 && - Character.isLetter(path.charAt(0)) && - path.charAt(1) == ':') || - (onNetWare && colon > -1)) { + if ((!onNetWare && path.length() >= 2 + && Character.isLetter(path.charAt(0)) + && path.charAt(1) == ':') + || (onNetWare && colon > -1)) { dosWithDrive = true; @@ -792,6 +949,7 @@ * current working directory will be assumed if this parameter is * null. * + * @return a File reference to the new temporary file. * @since ant 1.5 */ public File createTempFile(String prefix, String suffix, File parentDir) { @@ -820,6 +978,13 @@ * buffers followed by long comparisions apart from the final 1-7 * bytes.</p> * + * @param f1 the file whose content is to be compared. + * @param f2 the other file whose content is to be compared. + * + * @return true if the content of the files is the same. + * + * @throws IOException if the files cannot be read. + * * @since 1.9 */ public boolean contentEquals(File f1, File f2) throws IOException { @@ -885,6 +1050,10 @@ /** * Emulation of File.getParentFile for JDK 1.1 * + * + * @param f the file whose parent is required. + * @return the given file's parent, or null if the file does not have a + * parent. * @since 1.10 */ public File getParentFile(File f) { @@ -899,6 +1068,11 @@ /** * Read from reader till EOF + * @param rdr the reader from which to read. + * @return the contents read out of the given reader + * + * @throws IOException if the contents could not be read out from the + * reader. */ public static final String readFully(Reader rdr) throws IOException { return readFully(rdr, 8192); @@ -906,8 +1080,17 @@ /** * Read from reader till EOF + * + * @param rdr the reader from which to read. + * @param bufferSize the buffer size to use when reading + * + * @return the contents read out of the given reader + * + * @throws IOException if the contents could not be read out from the + * reader. */ - public static final String readFully(Reader rdr, int bufferSize) throws IOException { + public static final String readFully(Reader rdr, int bufferSize) + throws IOException { if (bufferSize <= 0) { throw new IllegalArgumentException("Buffer size must be greater " + "than 0"); @@ -939,7 +1122,9 @@ * <p>This method does <strong>not</strong> guarantee that the * operation is atomic.</p> * - * @since 1.21, Ant 1.5 + * @param f the file to be created + * @return true if the file did not exist already. + * @since Ant 1.5 */ public boolean createNewFile(File f) throws IOException { if (f != null) { @@ -972,6 +1157,7 @@ * @param parent the parent directory of the file to test * @param name the name of the file to test. * + * @return true if the file is a symbolic link. * @since Ant 1.5 */ public boolean isSymbolicLink(File parent, String name) @@ -1018,6 +1204,8 @@ * * <p>This code doesn't handle non-ASCII characters properly.</p> * + * @param path the path in the local file system + * @return the URI version of the local path. * @since Ant 1.6 */ public String toURI(String path) { @@ -1065,6 +1253,8 @@ * <p>Swallows '%' that are not followed by two characters, * doesn't deal with non-ASCII characters.</p> * + * @param uri the URI designating a file in the local filesystem. + * @return the local file system path for the file. * @since Ant 1.6 */ public String fromURI(String uri) { @@ -1118,6 +1308,11 @@ * <p>Unlike java.io.File#equals this method will try to compare * the absolute paths and "normalize" the filenames * before comparing them.</p> + * + * @param f1 the file whose name is to be compared. + * @param f2 the other file whose name is to be compared. + * + * @return true if the file are for the same file. * * @since Ant 1.5.3 */ 1.5 +6 -2 ant/src/main/org/apache/tools/ant/util/TimeoutObserver.java Index: TimeoutObserver.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/util/TimeoutObserver.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -u -r1.4 -r1.5 --- TimeoutObserver.java 7 Mar 2003 11:23:08 -0000 1.4 +++ TimeoutObserver.java 5 Jul 2003 14:34:13 -0000 1.5 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -65,6 +65,10 @@ */ public interface TimeoutObserver { + /** + * Called when the watchdow times out. + * + * @param w the watchdog that timed out. + */ void timeoutOccured(Watchdog w); - }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]