From 9dfd03133bf2e960f2eedf76f8292e1c7ba6bdfb Mon Sep 17 00:00:00 2001 From: Peter Reilly Date: Thu, 16 Nov 2006 23:37:30 +0000 Subject: [PATCH] checkstyle git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@475983 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/tools/ant/util/ClasspathUtils.java | 2 ++ .../tools/ant/util/CollectionUtils.java | 2 ++ .../tools/ant/util/DOMElementWriter.java | 3 +- .../org/apache/tools/ant/util/DOMUtils.java | 2 ++ .../org/apache/tools/ant/util/FileUtils.java | 3 ++ .../org/apache/tools/ant/util/JAXPUtils.java | 2 ++ .../tools/ant/util/LazyFileOutputStream.java | 20 +++++++++++-- .../apache/tools/ant/util/LazyHashtable.java | 28 +++++++++++++++++++ .../tools/ant/util/LeadPipeInputStream.java | 5 ++++ .../apache/tools/ant/util/LoaderUtils.java | 2 ++ .../apache/tools/ant/util/ResourceUtils.java | 6 +++- .../org/apache/tools/ant/util/Retryable.java | 2 +- .../apache/tools/ant/util/XmlConstants.java | 7 ++++- .../tools/ant/util/regexp/RegexpFactory.java | 1 + .../tools/ant/util/regexp/RegexpUtil.java | 2 ++ 15 files changed, 81 insertions(+), 6 deletions(-) diff --git a/src/main/org/apache/tools/ant/util/ClasspathUtils.java b/src/main/org/apache/tools/ant/util/ClasspathUtils.java index 7d13f0467..3c2717d03 100644 --- a/src/main/org/apache/tools/ant/util/ClasspathUtils.java +++ b/src/main/org/apache/tools/ant/util/ClasspathUtils.java @@ -25,6 +25,8 @@ import org.apache.tools.ant.MagicNames; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Reference; +// CheckStyle:HideUtilityClassConstructorCheck OFF - bc + /** * Offers some helper methods on the Path structure in ant. * diff --git a/src/main/org/apache/tools/ant/util/CollectionUtils.java b/src/main/org/apache/tools/ant/util/CollectionUtils.java index b5bbedaeb..7a8cf1f68 100644 --- a/src/main/org/apache/tools/ant/util/CollectionUtils.java +++ b/src/main/org/apache/tools/ant/util/CollectionUtils.java @@ -23,6 +23,8 @@ import java.util.Dictionary; import java.util.Enumeration; import java.util.NoSuchElementException; +// CheckStyle:HideUtilityClassConstructorCheck OFF - bc + /** * A set of helper methods related to collection manipulation. * diff --git a/src/main/org/apache/tools/ant/util/DOMElementWriter.java b/src/main/org/apache/tools/ant/util/DOMElementWriter.java index 2aee62f80..c2b6ea720 100644 --- a/src/main/org/apache/tools/ant/util/DOMElementWriter.java +++ b/src/main/org/apache/tools/ant/util/DOMElementWriter.java @@ -453,7 +453,8 @@ public class DOMElementWriter { * ]]>.

* *

See XML 1.0 2.2 http://www.w3.org/TR/1998/REC-xml-19980210#charsets and + * href="http://www.w3.org/TR/1998/REC-xml-19980210#charsets"> + * http://www.w3.org/TR/1998/REC-xml-19980210#charsets and * 2.7 http://www.w3.org/TR/1998/REC-xml-19980210#sec-cdata-sect.

* @param value the value to be encoded. diff --git a/src/main/org/apache/tools/ant/util/DOMUtils.java b/src/main/org/apache/tools/ant/util/DOMUtils.java index 18347fcda..4c3fabe9a 100644 --- a/src/main/org/apache/tools/ant/util/DOMUtils.java +++ b/src/main/org/apache/tools/ant/util/DOMUtils.java @@ -23,6 +23,8 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Text; +// CheckStyle:HideUtilityClassConstructorCheck OFF - bc + /** * Some utility methods for common tasks when building DOM trees in memory. * diff --git a/src/main/org/apache/tools/ant/util/FileUtils.java b/src/main/org/apache/tools/ant/util/FileUtils.java index 2aabcf47f..ac1c4f166 100644 --- a/src/main/org/apache/tools/ant/util/FileUtils.java +++ b/src/main/org/apache/tools/ant/util/FileUtils.java @@ -250,6 +250,7 @@ public class FileUtils { overwrite, preserveLastModified, encoding); } + // CheckStyle:ParameterNumberCheck OFF - bc /** * Convenience method to copy a file from a source to a * destination specifying if token filtering must be used, if @@ -510,6 +511,8 @@ public class FileUtils { inputEncoding, outputEncoding, project); } + // CheckStyle:ParameterNumberCheck ON + /** * Calls File.setLastModified(long time). Originally written to * to dynamically bind to that call on Java1.2+. diff --git a/src/main/org/apache/tools/ant/util/JAXPUtils.java b/src/main/org/apache/tools/ant/util/JAXPUtils.java index 01b773097..ca310fb77 100644 --- a/src/main/org/apache/tools/ant/util/JAXPUtils.java +++ b/src/main/org/apache/tools/ant/util/JAXPUtils.java @@ -29,6 +29,8 @@ import org.xml.sax.Parser; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; +// CheckStyle:HideUtilityClassConstructorCheck OFF - bc + /** * Collection of helper methods that retrieve a ParserFactory or * Parsers and Readers. diff --git a/src/main/org/apache/tools/ant/util/LazyFileOutputStream.java b/src/main/org/apache/tools/ant/util/LazyFileOutputStream.java index f3e360b3a..7d289b9c1 100644 --- a/src/main/org/apache/tools/ant/util/LazyFileOutputStream.java +++ b/src/main/org/apache/tools/ant/util/LazyFileOutputStream.java @@ -103,6 +103,10 @@ public class LazyFileOutputStream extends OutputStream { ensureOpened(); } + /** + * Close the file. + * @throws IOException if there is an error. + */ public synchronized void close() throws IOException { if (alwaysCreate && !closed) { ensureOpened(); @@ -115,19 +119,31 @@ public class LazyFileOutputStream extends OutputStream { /** * Delegates to the three-arg version. + * @param b the bytearray to write. + * @throws IOException if there is a problem. */ public void write(byte[] b) throws IOException { write(b, 0, b.length); } - //inherit doc + /** + * Write part of a byte array. + * @param b the byte array. + * @param offset write from this index. + * @param len the number of bytes to write. + * @throws IOException if there is a probem. + */ public synchronized void write(byte[] b, int offset, int len) throws IOException { ensureOpened(); fos.write(b, offset, len); } - //inherit doc + /** + * Write a byte. + * @param b the byte to write. + * @throws IOException if there is a problem. + */ public synchronized void write(int b) throws IOException { ensureOpened(); fos.write(b); diff --git a/src/main/org/apache/tools/ant/util/LazyHashtable.java b/src/main/org/apache/tools/ant/util/LazyHashtable.java index 766b1ba0c..98faf931f 100644 --- a/src/main/org/apache/tools/ant/util/LazyHashtable.java +++ b/src/main/org/apache/tools/ant/util/LazyHashtable.java @@ -50,26 +50,48 @@ public class LazyHashtable extends Hashtable { } + /** + * Get a enumeration over the elements. + * @return an enumeration. + */ public Enumeration elements() { initAll(); return super.elements(); } + /** + * Check if the table is empty. + * @return true if it is. + */ public boolean isEmpty() { initAll(); return super.isEmpty(); } + /** + * Get the size of the table. + * @return the size. + */ public int size() { initAll(); return super.size(); } + /** + * Check if the table contains a particular value. + * @param value the value to look for. + * @return true if the table contains the value. + */ public boolean contains(Object value) { initAll(); return super.contains(value); } + /** + * Check if the table contains a particular key. + * @param value the key to look for. + * @return true if the table contains key. + */ public boolean containsKey(Object value) { initAll(); return super.containsKey(value); @@ -77,11 +99,17 @@ public class LazyHashtable extends Hashtable { /** * Delegates to {@link #contains contains}. + * @param value the value to look for. + * @return true if the table contains the value. */ public boolean containsValue(Object value) { return contains(value); } + /** + * Get an enumeration over the keys. + * @return an enumeration. + */ public Enumeration keys() { initAll(); return super.keys(); diff --git a/src/main/org/apache/tools/ant/util/LeadPipeInputStream.java b/src/main/org/apache/tools/ant/util/LeadPipeInputStream.java index 8ca828836..d45412ed2 100755 --- a/src/main/org/apache/tools/ant/util/LeadPipeInputStream.java +++ b/src/main/org/apache/tools/ant/util/LeadPipeInputStream.java @@ -75,6 +75,11 @@ public class LeadPipeInputStream extends PipedInputStream { } //inherit doc + /** + * Read a byte from the stream. + * @return the byte (0 to 255) or -1 if there are no more. + * @throws IOException if there is an error. + */ public synchronized int read() throws IOException { int result = -1; try { diff --git a/src/main/org/apache/tools/ant/util/LoaderUtils.java b/src/main/org/apache/tools/ant/util/LoaderUtils.java index d2e7b356b..f0ad3237a 100644 --- a/src/main/org/apache/tools/ant/util/LoaderUtils.java +++ b/src/main/org/apache/tools/ant/util/LoaderUtils.java @@ -21,6 +21,8 @@ import java.io.File; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.launch.Locator; +// CheckStyle:HideUtilityClassConstructorCheck OFF - bc + /** * ClassLoader utility methods * diff --git a/src/main/org/apache/tools/ant/util/ResourceUtils.java b/src/main/org/apache/tools/ant/util/ResourceUtils.java index 5990433d9..a9f2fa368 100644 --- a/src/main/org/apache/tools/ant/util/ResourceUtils.java +++ b/src/main/org/apache/tools/ant/util/ResourceUtils.java @@ -52,6 +52,8 @@ import org.apache.tools.ant.types.resources.selectors.Exists; import org.apache.tools.ant.types.resources.selectors.ResourceSelector; import org.apache.tools.ant.types.selectors.SelectorUtils; +// CheckStyle:HideUtilityClassConstructorCheck OFF - bc + /** * This class provides utility methods to process Resources. * @@ -59,7 +61,7 @@ import org.apache.tools.ant.types.selectors.SelectorUtils; */ public class ResourceUtils { - private static class Outdated implements ResourceSelector { + private static final class Outdated implements ResourceSelector { private Resource control; private long granularity; private Outdated(Resource control, long granularity) { @@ -226,6 +228,7 @@ public class ResourceUtils { false, null, null, project); } + // CheckStyle:ParameterNumberCheck OFF - bc /** * Convenience method to copy content from one Resource to another * specifying whether token filtering must be used, whether filter chains @@ -383,6 +386,7 @@ public class ResourceUtils { setLastModified((Touchable) dest, source.getLastModified()); } } + // CheckStyle:ParameterNumberCheck ON /** * Set the last modified time of an object implementing diff --git a/src/main/org/apache/tools/ant/util/Retryable.java b/src/main/org/apache/tools/ant/util/Retryable.java index 067ea8584..537244a18 100644 --- a/src/main/org/apache/tools/ant/util/Retryable.java +++ b/src/main/org/apache/tools/ant/util/Retryable.java @@ -28,7 +28,7 @@ import java.io.IOException; */ public interface Retryable { /** The value to use to never give up. */ - public static final int RETRY_FOREVER = -1; + int RETRY_FOREVER = -1; /** * Called to execute the code. * @throws IOException if there is a problem. diff --git a/src/main/org/apache/tools/ant/util/XmlConstants.java b/src/main/org/apache/tools/ant/util/XmlConstants.java index f852c62d4..fdf0343cf 100644 --- a/src/main/org/apache/tools/ant/util/XmlConstants.java +++ b/src/main/org/apache/tools/ant/util/XmlConstants.java @@ -21,7 +21,9 @@ package org.apache.tools.ant.util; * XML Parser constants, all kept in one place for ease of reuse * @see Xerces features * @see Xerces properties - * @see SAX. + * @see SAX. */ public class XmlConstants { @@ -47,10 +49,13 @@ public class XmlConstants { /** property for schema source */ public static final String FEATURE_JAXP12_SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource"; + /** the namespace for XML schema */ public static final String URI_XSD = "http://www.w3.org/2001/XMLSchema"; + /** the sax external entities feature */ public static final String FEATURE_EXTERNAL_ENTITIES = "http://xml.org/sax/features/external-general-entities"; + /** the apache.org/xml disalllow doctype decl feature */ public static final String FEATURE_DISALLOW_DTD = "http://apache.org/xml/features/disallow-doctype-decl"; } diff --git a/src/main/org/apache/tools/ant/util/regexp/RegexpFactory.java b/src/main/org/apache/tools/ant/util/regexp/RegexpFactory.java index 6330bc145..be3ff5e98 100644 --- a/src/main/org/apache/tools/ant/util/regexp/RegexpFactory.java +++ b/src/main/org/apache/tools/ant/util/regexp/RegexpFactory.java @@ -94,6 +94,7 @@ public class RegexpFactory extends RegexpMatcherFactory { /** * Wrapper over RegexpMatcherFactory.createInstance that ensures that * we are dealing with a Regexp implementation. + * @param classname the name of the class to use. * @return the instance. * @throws BuildException if there is a problem. * @since 1.3 diff --git a/src/main/org/apache/tools/ant/util/regexp/RegexpUtil.java b/src/main/org/apache/tools/ant/util/regexp/RegexpUtil.java index 2e85b411e..544eac1d5 100644 --- a/src/main/org/apache/tools/ant/util/regexp/RegexpUtil.java +++ b/src/main/org/apache/tools/ant/util/regexp/RegexpUtil.java @@ -17,6 +17,8 @@ */ package org.apache.tools.ant.util.regexp; +// CheckStyle:HideUtilityClassConstructorCheck OFF - bc + /*** * Regular expression utilities class which handles flag operations. *