diff --git a/check.xml b/check.xml
index bdadc62e9..91ccf4168 100755
--- a/check.xml
+++ b/check.xml
@@ -1,20 +1,20 @@
n
is negative.
* @exception IOException If an I/O error occurs
*/
- public final long skip(final long n) throws IOException {
+ public final long skip(final long n)
+ throws IOException, IllegalArgumentException {
if (n < 0L) {
throw new IllegalArgumentException("skip value is negative");
}
diff --git a/src/main/org/apache/tools/ant/filters/EscapeUnicode.java b/src/main/org/apache/tools/ant/filters/EscapeUnicode.java
index 3eea26a0e..2d6339774 100644
--- a/src/main/org/apache/tools/ant/filters/EscapeUnicode.java
+++ b/src/main/org/apache/tools/ant/filters/EscapeUnicode.java
@@ -66,8 +66,9 @@ import org.apache.tools.ant.types.Parameter;
*
* Or:
*
- *
<filterreader classname="org.apache.tools.ant.filters.EscapeUnicode"/> -*+ *
<filterreader + classname="org.apache.tools.ant.filters.EscapeUnicode"/> + ** * @author Antoine Levy-Lambert * @since Ant 1.6 @@ -107,7 +108,7 @@ public class EscapeUnicode * @return the next character in the resulting stream, or -1 * if the end of the resulting stream has been reached * - * @exception java.io.IOException if the underlying stream throws + * @exception IOException if the underlying stream throws * an IOException during reading */ public final int read() throws IOException { @@ -116,7 +117,7 @@ public class EscapeUnicode setInitialized(true); } - int ch= - 1; + int ch = -1; if (unicodeBuf.length() == 0) { ch = in.read(); if (ch != -1) { @@ -130,7 +131,7 @@ public class EscapeUnicode - s.length() + i, s.charAt(i)); } - ch='\\'; + ch = '\\'; } } } else { diff --git a/src/main/org/apache/tools/ant/filters/StripLineComments.java b/src/main/org/apache/tools/ant/filters/StripLineComments.java index f7ad7a746..1caf7dfe2 100644 --- a/src/main/org/apache/tools/ant/filters/StripLineComments.java +++ b/src/main/org/apache/tools/ant/filters/StripLineComments.java @@ -73,7 +73,8 @@ import org.apache.tools.ant.types.Parameter; * * Or: * - *
<filterreader classname="org.apache.tools.ant.filters.StripLineComments"> + *<filterreader + * classname="org.apache.tools.ant.filters.StripLineComments"> * <param type="comment" value="#"/> * <param type="comment" value="--"/> * <param type="comment" value="REM "/> diff --git a/src/main/org/apache/tools/ant/filters/util/ChainReaderHelper.java b/src/main/org/apache/tools/ant/filters/util/ChainReaderHelper.java index 0dd5037ab..b2d8802e7 100644 --- a/src/main/org/apache/tools/ant/filters/util/ChainReaderHelper.java +++ b/src/main/org/apache/tools/ant/filters/util/ChainReaderHelper.java @@ -161,7 +161,8 @@ public final class ChainReaderHelper { Object o = finalFilters.elementAt(i); if (o instanceof AntFilterReader) { - final AntFilterReader filter = (AntFilterReader) finalFilters.elementAt(i); + final AntFilterReader filter + = (AntFilterReader) finalFilters.elementAt(i); final String className = filter.getClassName(); final Path classpath = filter.getClasspath(); final Project project = filter.getProject(); diff --git a/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java b/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java index f42ff7f00..999257c0d 100644 --- a/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java +++ b/src/main/org/apache/tools/ant/helper/ProjectHelperImpl.java @@ -135,7 +135,8 @@ public class ProjectHelperImpl extends ProjectHelper { */ public void parse(Project project, Object source) throws BuildException { if (!(source instanceof File)) { - throw new BuildException("Only File source supported by default plugin"); + throw new BuildException("Only File source supported by " + + "default plugin"); } File buildFile = (File) source; FileInputStream inputStream = null; diff --git a/src/main/org/apache/tools/ant/taskdefs/Parallel.java b/src/main/org/apache/tools/ant/taskdefs/Parallel.java index 54f9613bb..f97729f11 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Parallel.java +++ b/src/main/org/apache/tools/ant/taskdefs/Parallel.java @@ -92,19 +92,19 @@ public class Parallel extends Task private final Object semaphore = new Object(); /** Total number of threads to run */ - int numThreads = 0; + private int numThreads = 0; /** Total number of threads per processor to run. */ - int numThreadsPerProcessor = 0; + private int numThreadsPerProcessor = 0; /** Interval (in ms) to poll for finished threads. */ - int pollInterval = 1000; // default is once a second + private int pollInterval = 1000; // default is once a second /** * Add a nested task to execute in parallel. * @param nestedTask Nested task to be executed in parallel */ - public void addTask(Task nestedTask) throws BuildException { + public void addTask(Task nestedTask) { nestedTasks.addElement(nestedTask); } @@ -128,7 +128,8 @@ public class Parallel extends Task * simultaneously. If there are less tasks than threads then all will be * executed at once, if there are more then onlythreadCount
* tasks will be executed at one time. IfthreadsPerProcessor
- * is set and the JVM is at least a 1.4 VM then this value is ignormed.; optional + * is set and the JVM is at least a 1.4 VM then this value is + * ignored.; optional * * @param numThreads total number of therads. * @@ -147,6 +148,11 @@ public class Parallel extends Task this.pollInterval = pollInterval; } + /** + * Execute the parallel tasks + * + * @exception BuildException if any of the threads failed. + */ public void execute() throws BuildException { updateThreadCounts(); if (numThreads == 0) { @@ -155,6 +161,9 @@ public class Parallel extends Task spinThreads(); } + /** + * Determine the number of threads based on the number of processors + */ private void updateThreadCounts() { if (numThreadsPerProcessor != 0) { int numProcessors = getNumProcessors(); @@ -165,7 +174,9 @@ public class Parallel extends Task } /** - * Spin up threadCount threads. + * Spin up required threads with a maximum number active at any given time. + * + * @exception BuildException if any of the threads failed. */ private void spinThreads() throws BuildException { final int numTasks = nestedTasks.size(); @@ -189,12 +200,13 @@ public class Parallel extends Task // now run them in limited numbers... outer: while (threadNumber < numTasks) { - synchronized(semaphore) { + synchronized (semaphore) { for (int i = 0; i < maxRunning; i++) { if (running[i] == null || !running[i].isAlive()) { running[i] = threads[threadNumber++]; running[i].start(); - // countinue on outer while loop in case we used our last thread + // countinue on outer while loop in case we + // used our last thread continue outer; } } @@ -252,7 +264,12 @@ public class Parallel extends Task firstLocation); } } - + + /** + * Determine the number of processors. Only effective on later VMs + * + * @return the number of processors available or 0 if not determinable. + */ private int getNumProcessors() { try { Class[] paramTypes = {};