From d589263f67e979e192d8fdc4293105dc591b0f3f Mon Sep 17 00:00:00 2001 From: Peter Reilly Date: Fri, 25 Jul 2003 09:01:39 +0000 Subject: [PATCH] checkstyle git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274945 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tools/ant/taskdefs/Antlib.java | 7 ++-- .../org/apache/tools/ant/taskdefs/Concat.java | 7 +++- .../org/apache/tools/ant/taskdefs/Delete.java | 37 +++++++++++++++++-- .../tools/ant/taskdefs/MatchingTask.java | 5 +++ .../apache/tools/ant/taskdefs/Parallel.java | 6 +-- .../org/apache/tools/ant/taskdefs/Patch.java | 13 +++++-- .../apache/tools/ant/taskdefs/Replace.java | 12 +++++- .../optional/dotnet/DotnetDefine.java | 4 +- 8 files changed, 73 insertions(+), 18 deletions(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/Antlib.java b/src/main/org/apache/tools/ant/taskdefs/Antlib.java index c96b31355..b32fe686f 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Antlib.java +++ b/src/main/org/apache/tools/ant/taskdefs/Antlib.java @@ -65,7 +65,6 @@ import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Location; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; -import org.apache.tools.ant.Target; import org.apache.tools.ant.helper.ProjectHelper2; import org.apache.tools.ant.UnknownElement; @@ -104,13 +103,13 @@ public class Antlib extends Task implements TaskContainer { // Should be safe to parse try { ProjectHelper2 parser = new ProjectHelper2(); - UnknownElement ue = + UnknownElement ue = parser.parseUnknownElement(project, antlibUrl); // Check name is "antlib" if (!(ue.getTag().equals(TAG))) { throw new BuildException( - "Unexpected tag " + ue.getTag() + " expecting " + - TAG, ue.getLocation()); + "Unexpected tag " + ue.getTag() + " expecting " + + TAG, ue.getLocation()); } Antlib antlib = new Antlib(); antlib.setProject(project); diff --git a/src/main/org/apache/tools/ant/taskdefs/Concat.java b/src/main/org/apache/tools/ant/taskdefs/Concat.java index ff4b2b342..8f8846756 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Concat.java +++ b/src/main/org/apache/tools/ant/taskdefs/Concat.java @@ -101,6 +101,9 @@ import org.apache.tools.ant.util.FileUtils; * @author Peter Reilly */ public class Concat extends Task { + + // The size of buffers to be used + private static final int BUFFER_SIZE = 8192; // Attributes. @@ -442,7 +445,7 @@ public class Concat extends Task { private void cat() { OutputStream os = null; Reader reader = null; - char[] buffer = new char[8192]; + char[] buffer = new char[BUFFER_SIZE]; try { @@ -535,7 +538,7 @@ public class Concat extends Task { throws IOException { if (filterChains != null) { ChainReaderHelper helper = new ChainReaderHelper(); - helper.setBufferSize(8192); + helper.setBufferSize(BUFFER_SIZE); helper.setPrimaryReader(in); helper.setFilterChains(filterChains); helper.setProject(getProject()); diff --git a/src/main/org/apache/tools/ant/taskdefs/Delete.java b/src/main/org/apache/tools/ant/taskdefs/Delete.java index 18bd79b10..7df405909 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Delete.java +++ b/src/main/org/apache/tools/ant/taskdefs/Delete.java @@ -100,6 +100,7 @@ import org.apache.tools.ant.types.selectors.FileSelector; * @ant.task category="filesystem" */ public class Delete extends MatchingTask { + private static final int DELETE_RETRY_SLEEP_MILLIS = 10; protected File file = null; protected File dir = null; protected Vector filesets = new Vector(); @@ -170,20 +171,24 @@ public class Delete extends MatchingTask { /** * If true, delete empty directories. + * @param includeEmpty if true delete empty directories (only + * for filesets). Default is false. */ public void setIncludeEmptyDirs(boolean includeEmpty) { this.includeEmpty = includeEmpty; } /** - * Adds a set of files to be deleted. - */ + * Adds a set of files to be deleted. + * @param set the set of files to be deleted + */ public void addFileset(FileSet set) { filesets.addElement(set); } /** * add a name entry on the include list + * @return a NameEntry object to be configured */ public PatternSet.NameEntry createInclude() { usedMatchingTask = true; @@ -192,6 +197,7 @@ public class Delete extends MatchingTask { /** * add a name entry on the include files list + * @return an NameEntry object to be configured */ public PatternSet.NameEntry createIncludesFile() { usedMatchingTask = true; @@ -200,6 +206,7 @@ public class Delete extends MatchingTask { /** * add a name entry on the exclude list + * @return an NameEntry object to be configured */ public PatternSet.NameEntry createExclude() { usedMatchingTask = true; @@ -208,6 +215,7 @@ public class Delete extends MatchingTask { /** * add a name entry on the include files list + * @return an NameEntry object to be configured */ public PatternSet.NameEntry createExcludesFile() { usedMatchingTask = true; @@ -216,6 +224,7 @@ public class Delete extends MatchingTask { /** * add a set of patterns + * @return PatternSet object to be configured */ public PatternSet createPatternSet() { usedMatchingTask = true; @@ -301,6 +310,7 @@ public class Delete extends MatchingTask { /** * add a "Select" selector entry on the selector list + * @param selector the selector to be added */ public void addSelector(SelectSelector selector) { usedMatchingTask = true; @@ -309,6 +319,7 @@ public class Delete extends MatchingTask { /** * add an "And" selector entry on the selector list + * @param selector the selector to be added */ public void addAnd(AndSelector selector) { usedMatchingTask = true; @@ -317,6 +328,7 @@ public class Delete extends MatchingTask { /** * add an "Or" selector entry on the selector list + * @param selector the selector to be added */ public void addOr(OrSelector selector) { usedMatchingTask = true; @@ -325,6 +337,7 @@ public class Delete extends MatchingTask { /** * add a "Not" selector entry on the selector list + * @param selector the selector to be added */ public void addNot(NotSelector selector) { usedMatchingTask = true; @@ -333,6 +346,7 @@ public class Delete extends MatchingTask { /** * add a "None" selector entry on the selector list + * @param selector the selector to be added */ public void addNone(NoneSelector selector) { usedMatchingTask = true; @@ -341,6 +355,7 @@ public class Delete extends MatchingTask { /** * add a majority selector entry on the selector list + * @param selector the selector to be added */ public void addMajority(MajoritySelector selector) { usedMatchingTask = true; @@ -349,6 +364,7 @@ public class Delete extends MatchingTask { /** * add a selector date entry on the selector list + * @param selector the selector to be added */ public void addDate(DateSelector selector) { usedMatchingTask = true; @@ -357,6 +373,7 @@ public class Delete extends MatchingTask { /** * add a selector size entry on the selector list + * @param selector the selector to be added */ public void addSize(SizeSelector selector) { usedMatchingTask = true; @@ -365,6 +382,7 @@ public class Delete extends MatchingTask { /** * add a selector filename entry on the selector list + * @param selector the selector to be added */ public void addFilename(FilenameSelector selector) { usedMatchingTask = true; @@ -373,6 +391,7 @@ public class Delete extends MatchingTask { /** * add an extended selector entry on the selector list + * @param selector the selector to be added */ public void addCustom(ExtendSelector selector) { usedMatchingTask = true; @@ -381,6 +400,7 @@ public class Delete extends MatchingTask { /** * add a contains selector entry on the selector list + * @param selector the selector to be added */ public void addContains(ContainsSelector selector) { usedMatchingTask = true; @@ -389,6 +409,7 @@ public class Delete extends MatchingTask { /** * add a present selector entry on the selector list + * @param selector the selector to be added */ public void addPresent(PresentSelector selector) { usedMatchingTask = true; @@ -397,6 +418,7 @@ public class Delete extends MatchingTask { /** * add a depth selector entry on the selector list + * @param selector the selector to be added */ public void addDepth(DepthSelector selector) { usedMatchingTask = true; @@ -405,6 +427,7 @@ public class Delete extends MatchingTask { /** * add a depends selector entry on the selector list + * @param selector the selector to be added */ public void addDepend(DependSelector selector) { usedMatchingTask = true; @@ -413,6 +436,7 @@ public class Delete extends MatchingTask { /** * add a regular expression selector entry on the selector list + * @param selector the selector to be added */ public void addContainsRegexp(ContainsRegexpSelector selector) { usedMatchingTask = true; @@ -421,6 +445,7 @@ public class Delete extends MatchingTask { /** * add an arbitary selector + * @param selector the selector to be added * @since Ant 1.6 */ public void add(FileSelector selector) { @@ -430,6 +455,7 @@ public class Delete extends MatchingTask { /** * Delete the file(s). + * @exception BuildException if an error occurs */ public void execute() throws BuildException { if (usedMatchingTask) { @@ -542,7 +568,7 @@ public class Delete extends MatchingTask { private boolean delete(File f) { if (!f.delete()) { try { - Thread.sleep(10); + Thread.sleep(DELETE_RETRY_SLEEP_MILLIS); return f.delete(); } catch (InterruptedException ex) { return f.delete(); @@ -551,6 +577,11 @@ public class Delete extends MatchingTask { return true; } + /** + * Delete a directory + * + * @param d the directory to delete + */ protected void removeDir(File d) { String[] list = d.list(); if (list == null) { diff --git a/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java b/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java index 389943b6b..6c2961b0e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/MatchingTask.java @@ -111,6 +111,7 @@ public abstract class MatchingTask extends Task implements SelectorContainer { /** * add a name entry on the include list + * @return a NameEntry object to be configured */ public PatternSet.NameEntry createInclude() { return fileset.createInclude(); @@ -118,6 +119,7 @@ public abstract class MatchingTask extends Task implements SelectorContainer { /** * add a name entry on the include files list + * @return an NameEntry object to be configured */ public PatternSet.NameEntry createIncludesFile() { return fileset.createIncludesFile(); @@ -125,6 +127,7 @@ public abstract class MatchingTask extends Task implements SelectorContainer { /** * add a name entry on the exclude list + * @return an NameEntry object to be configured */ public PatternSet.NameEntry createExclude() { return fileset.createExclude(); @@ -132,6 +135,7 @@ public abstract class MatchingTask extends Task implements SelectorContainer { /** * add a name entry on the include files list + * @return an NameEntry object to be configured */ public PatternSet.NameEntry createExcludesFile() { return fileset.createExcludesFile(); @@ -139,6 +143,7 @@ public abstract class MatchingTask extends Task implements SelectorContainer { /** * add a set of patterns + * @return PatternSet object to be configured */ public PatternSet createPatternSet() { return fileset.createPatternSet(); diff --git a/src/main/org/apache/tools/ant/taskdefs/Parallel.java b/src/main/org/apache/tools/ant/taskdefs/Parallel.java index 0284ccbff..cc4b86d0d 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Parallel.java +++ b/src/main/org/apache/tools/ant/taskdefs/Parallel.java @@ -250,7 +250,7 @@ public class Parallel extends Task public synchronized void run() { try { wait(timeout); - synchronized(semaphore) { + synchronized (semaphore) { stillRunning = false; timedOut = true; semaphore.notifyAll(); @@ -290,7 +290,7 @@ public class Parallel extends Task } } - synchronized(semaphore) { + synchronized (semaphore) { // are all threads finished outer2: while (stillRunning) { @@ -318,7 +318,7 @@ public class Parallel extends Task StringBuffer exceptionMessage = new StringBuffer(); int numExceptions = 0; Throwable firstException = null; - Location firstLocation = Location.UNKNOWN_LOCATION;; + Location firstLocation = Location.UNKNOWN_LOCATION; for (int i = 0; i < numTasks; ++i) { Throwable t = runnables[i].getException(); if (t != null) { diff --git a/src/main/org/apache/tools/ant/taskdefs/Patch.java b/src/main/org/apache/tools/ant/taskdefs/Patch.java index e5da07dcb..d45f88b39 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Patch.java +++ b/src/main/org/apache/tools/ant/taskdefs/Patch.java @@ -80,6 +80,7 @@ public class Patch extends Task { /** * The file to patch; optional if it can be inferred from * the diff file + * @param file the file to patch */ public void setOriginalfile(File file) { originalFile = file; @@ -88,7 +89,7 @@ public class Patch extends Task { /** * The name of a file to send the output to, instead of patching * the file(s) in place; optional. - * + * @param file the file to send the output to * @since Ant 1.6 */ public void setDestfile(File file) { @@ -100,6 +101,7 @@ public class Patch extends Task { /** * The file containing the diff output; required. + * @param file the file containing the diff output */ public void setPatchfile(File file) { if (!file.exists()) { @@ -113,6 +115,7 @@ public class Patch extends Task { /** * flag to create backups; optional, default=false + * @param backups if true create backups */ public void setBackups(boolean backups) { if (backups) { @@ -122,6 +125,7 @@ public class Patch extends Task { /** * flag to ignore whitespace differences; default=false + * @param ignore if true ignore whitespace differences */ public void setIgnorewhitespace(boolean ignore) { if (ignore) { @@ -135,6 +139,7 @@ public class Patch extends Task { * *

patch's -p option. * @param num number of lines to strip + * @exception BuildException if num is < 0, or other errors */ public void setStrip(int num) throws BuildException { if (num < 0) { @@ -145,6 +150,7 @@ public class Patch extends Task { /** * Work silently unless an error occurs; optional, default=false + * @param q if true supress set the -s option on the patch command */ public void setQuiet(boolean q) { if (q) { @@ -155,6 +161,7 @@ public class Patch extends Task { /** * Assume patch was created with old and new files swapped; optional, * default=false + * @param r if true set the -R option on the patch command */ public void setReverse(boolean r) { if (r) { @@ -165,10 +172,10 @@ public class Patch extends Task { /** * The directory to run the patch command in, defaults to the * project's base directory. - * + * @param directory the directory to run the patch command in * @since Ant 1.5 */ - public void setDir(File directory) throws BuildException { + public void setDir(File directory) { this.directory = directory; } diff --git a/src/main/org/apache/tools/ant/taskdefs/Replace.java b/src/main/org/apache/tools/ant/taskdefs/Replace.java index 9ba2d6ae6..29122a0e9 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Replace.java +++ b/src/main/org/apache/tools/ant/taskdefs/Replace.java @@ -119,10 +119,18 @@ public class Replace extends MatchingTask { private StringBuffer buf = new StringBuffer(); + /** + * the text of the element + * + * @param val the string to add + */ public void addText(String val) { buf.append(val); } + /** + * @return the text + */ public String getText() { return buf.substring(0); } @@ -183,6 +191,7 @@ public class Replace extends MatchingTask { /** * Get the replacement value for this filter token. + * @return the replacement value */ public String getReplaceValue() { if (property != null) { @@ -352,7 +361,7 @@ public class Replace extends MatchingTask { /** * helper method to load a properties file and throw a build exception * if it cannot be loaded - * @param propertyFile + * @param propertyFile the file to load the properties from * @return loaded properties collection * @throws BuildException if the file could not be found or read */ @@ -600,6 +609,7 @@ public class Replace extends MatchingTask { /** * Add a nested <replacefilter> element. + * @return a nested ReplaceFilter object to be configured */ public Replacefilter createReplacefilter() { Replacefilter filter = new Replacefilter(); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetDefine.java b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetDefine.java index 9977fd669..806b2d0e4 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetDefine.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetDefine.java @@ -71,7 +71,7 @@ public class DotnetDefine { /** * the name of a property which must be defined for * the definition to be set. Optional. - * @param condition + * @param condition the name of the property */ public void setIf(String condition) { this.ifCond = condition; @@ -80,7 +80,7 @@ public class DotnetDefine { /** * the name of a property which must be undefined for * the definition to be set. Optional. - * @param condition + * @param condition the name of the property */ public void setUnless(String condition) { this.unlessCond = condition;