From f58d3967f08c8cc033ce0af114bb1ed87ca08664 Mon Sep 17 00:00:00 2001 From: Peter Reilly Date: Wed, 1 Nov 2006 23:00:52 +0000 Subject: [PATCH] checkstyle git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@470130 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/tools/ant/ProjectHelper.java | 6 +-- src/main/org/apache/tools/ant/Task.java | 2 +- .../org/apache/tools/ant/launch/Locator.java | 25 +++++----- .../tools/ant/listener/TimestampedLogger.java | 2 +- .../tools/ant/loader/AntClassLoader2.java | 2 +- .../ant/taskdefs/AbstractJarSignerTask.java | 27 ++++++----- .../org/apache/tools/ant/taskdefs/Ant.java | 6 +-- .../tools/ant/taskdefs/AntStructure.java | 24 ++++++---- .../org/apache/tools/ant/taskdefs/Apt.java | 4 +- .../apache/tools/ant/taskdefs/Available.java | 2 +- .../apache/tools/ant/taskdefs/BUnzip2.java | 2 +- .../org/apache/tools/ant/taskdefs/BZip2.java | 2 +- .../apache/tools/ant/taskdefs/Checksum.java | 14 +++--- .../org/apache/tools/ant/taskdefs/Concat.java | 6 ++- .../org/apache/tools/ant/taskdefs/Copy.java | 14 +++--- .../apache/tools/ant/taskdefs/CopyPath.java | 18 +++---- .../apache/tools/ant/taskdefs/DefBase.java | 2 +- .../apache/tools/ant/taskdefs/Definer.java | 15 +++--- .../org/apache/tools/ant/taskdefs/Delete.java | 14 +++--- .../tools/ant/taskdefs/DiagnosticsTask.java | 18 +++---- .../org/apache/tools/ant/taskdefs/Ear.java | 2 +- .../org/apache/tools/ant/taskdefs/Echo.java | 6 +-- .../org/apache/tools/ant/taskdefs/Exec.java | 2 +- .../apache/tools/ant/taskdefs/ExecTask.java | 4 +- .../apache/tools/ant/taskdefs/Execute.java | 13 +++-- .../tools/ant/taskdefs/ExecuteJava.java | 2 +- .../apache/tools/ant/taskdefs/ExecuteOn.java | 2 +- .../tools/ant/taskdefs/ExecuteWatchdog.java | 2 +- .../apache/tools/ant/taskdefs/FixCRLF.java | 6 +-- .../org/apache/tools/ant/taskdefs/GZip.java | 2 +- .../org/apache/tools/ant/taskdefs/Get.java | 4 +- .../apache/tools/ant/taskdefs/ImportTask.java | 4 +- .../org/apache/tools/ant/taskdefs/Jar.java | 14 +++--- .../org/apache/tools/ant/taskdefs/Java.java | 5 +- .../org/apache/tools/ant/taskdefs/Javac.java | 1 - .../tools/ant/taskdefs/JikesOutputParser.java | 2 +- .../tools/ant/taskdefs/LoadResource.java | 2 +- .../tools/ant/taskdefs/LogOutputStream.java | 3 +- .../apache/tools/ant/taskdefs/MacroDef.java | 8 ++-- .../apache/tools/ant/taskdefs/Manifest.java | 17 +++---- .../tools/ant/taskdefs/ManifestClassPath.java | 47 ++++++++++--------- .../org/apache/tools/ant/taskdefs/Mkdir.java | 3 +- .../org/apache/tools/ant/taskdefs/Pack.java | 4 +- .../apache/tools/ant/taskdefs/PreSetDef.java | 2 +- .../tools/ant/taskdefs/ProcessDestroyer.java | 3 +- .../apache/tools/ant/taskdefs/Property.java | 5 +- 46 files changed, 189 insertions(+), 181 deletions(-) diff --git a/src/main/org/apache/tools/ant/ProjectHelper.java b/src/main/org/apache/tools/ant/ProjectHelper.java index b04ab260e..7a384ee6c 100644 --- a/src/main/org/apache/tools/ant/ProjectHelper.java +++ b/src/main/org/apache/tools/ant/ProjectHelper.java @@ -267,7 +267,7 @@ public class ProjectHelper { * JDK1.1 compatible access to the context class loader. * Cut&paste from JAXP. * - * @deprecated since 1.6.x. + * @deprecated since 1.6.x. * Use LoaderUtils.getContextClassLoader() * * @return the current context class loader, or null @@ -293,7 +293,7 @@ public class ProjectHelper { * @param project The project containing the target. * Must not be null. * - * @deprecated since 1.6.x. + * @deprecated since 1.6.x. * Use IntrospectionHelper for each property. * * @exception BuildException if any of the attributes can't be handled by @@ -435,7 +435,7 @@ public class ProjectHelper { * } * @return the original string with the properties replaced, or * null if the original string is null. - * @deprecated since 1.6.x. + * @deprecated since 1.6.x. * Use PropertyHelper. */ public static String replaceProperties(Project project, String value, diff --git a/src/main/org/apache/tools/ant/Task.java b/src/main/org/apache/tools/ant/Task.java index 4d18c5e02..0d2be7fc3 100644 --- a/src/main/org/apache/tools/ant/Task.java +++ b/src/main/org/apache/tools/ant/Task.java @@ -72,7 +72,7 @@ public abstract class Task extends ProjectComponent { /** * Wrapper for this object, used to configure it at runtime. * - * @deprecated since 1.6.x. + * @deprecated since 1.6.x. * You should not be accessing this variable directly. * Please use the {@link #getWrapper()} method. */ diff --git a/src/main/org/apache/tools/ant/launch/Locator.java b/src/main/org/apache/tools/ant/launch/Locator.java index 48fe23d91..282b76a56 100644 --- a/src/main/org/apache/tools/ant/launch/Locator.java +++ b/src/main/org/apache/tools/ant/launch/Locator.java @@ -42,11 +42,11 @@ public final class Locator { // stolen from org.apache.xerces.impl.XMLEntityManager#getUserDir() // of the Xerces-J team // which ASCII characters need to be escaped - private static boolean gNeedEscaping[] = new boolean[128]; + private static boolean[] gNeedEscaping = new boolean[128]; // the first hex character if a character needs to be escaped - private static char gAfterEscaping1[] = new char[128]; + private static char[] gAfterEscaping1 = new char[128]; // the second hex character if a character needs to be escaped - private static char gAfterEscaping2[] = new char[128]; + private static char[] gAfterEscaping2 = new char[128]; private static char[] gHexChs = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; // initialize the above 3 arrays @@ -157,16 +157,18 @@ public final class Locator { // things when the path is not absolute, and fall back to the old parsing behavior. if (uriClazz != null && uri.startsWith("file:/")) { try { - java.lang.reflect.Method createMethod = uriClazz.getMethod("create", new Class[] {String.class}); + java.lang.reflect.Method createMethod + = uriClazz.getMethod("create", new Class[] {String.class}); Object uriObj = createMethod.invoke(null, new Object[] {uri}); - java.lang.reflect.Constructor fileConst = File.class.getConstructor(new Class[] {uriClazz}); - File f = (File)fileConst.newInstance(new Object[] {uriObj}); + java.lang.reflect.Constructor fileConst + = File.class.getConstructor(new Class[] {uriClazz}); + File f = (File) fileConst.newInstance(new Object[] {uriObj}); return f.getAbsolutePath(); } catch (java.lang.reflect.InvocationTargetException e) { Throwable e2 = e.getTargetException(); if (e2 instanceof IllegalArgumentException) { // Bad URI, pass this on. - throw (IllegalArgumentException)e2; + throw (IllegalArgumentException) e2; } else { // Unexpected target exception? Should not happen. e2.printStackTrace(); @@ -262,8 +264,9 @@ public final class Locator { for (; i < len; i++) { ch = path.charAt(i); // if it's not an ASCII character, break here, and use UTF-8 encoding - if (ch >= 128) + if (ch >= 128) { break; + } if (gNeedEscaping[ch]) { if (sb == null) { sb = new StringBuffer(path.substring(0, i)); @@ -272,8 +275,7 @@ public final class Locator { sb.append(gAfterEscaping1[ch]); sb.append(gAfterEscaping2[ch]); // record the fact that it's escaped - } - else if (sb != null) { + } else if (sb != null) { sb.append((char) ch); } } @@ -302,8 +304,7 @@ public final class Locator { sb.append('%'); sb.append(gAfterEscaping1[b]); sb.append(gAfterEscaping2[b]); - } - else { + } else { sb.append((char) b); } } diff --git a/src/main/org/apache/tools/ant/listener/TimestampedLogger.java b/src/main/org/apache/tools/ant/listener/TimestampedLogger.java index 2adb8b195..f664b3007 100644 --- a/src/main/org/apache/tools/ant/listener/TimestampedLogger.java +++ b/src/main/org/apache/tools/ant/listener/TimestampedLogger.java @@ -51,7 +51,7 @@ public class TimestampedLogger extends DefaultLogger { * @return The classic "BUILD SUCCESSFUL" */ protected String getBuildSuccessfulMessage() { - return super.getBuildSuccessfulMessage()+SPACER +getTimestamp(); + return super.getBuildSuccessfulMessage() + SPACER + getTimestamp(); } protected String getTimestamp() { diff --git a/src/main/org/apache/tools/ant/loader/AntClassLoader2.java b/src/main/org/apache/tools/ant/loader/AntClassLoader2.java index 054fc87f4..5e7277fb7 100644 --- a/src/main/org/apache/tools/ant/loader/AntClassLoader2.java +++ b/src/main/org/apache/tools/ant/loader/AntClassLoader2.java @@ -21,7 +21,7 @@ package org.apache.tools.ant.loader; import org.apache.tools.ant.AntClassLoader; /** - * @deprecated since 1.7 + * @deprecated since 1.7 * Just use {@link AntClassLoader} itself. */ public class AntClassLoader2 extends AntClassLoader { diff --git a/src/main/org/apache/tools/ant/taskdefs/AbstractJarSignerTask.java b/src/main/org/apache/tools/ant/taskdefs/AbstractJarSignerTask.java index f625eccff..531f69374 100644 --- a/src/main/org/apache/tools/ant/taskdefs/AbstractJarSignerTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/AbstractJarSignerTask.java @@ -22,7 +22,6 @@ import java.io.File; import java.util.Enumeration; import java.util.Vector; -import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.Environment; import org.apache.tools.ant.types.FileSet; @@ -84,7 +83,7 @@ public abstract class AbstractJarSignerTask extends Task { /** * Java declarations -J-Dname=value */ - private Environment sysProperties=new Environment(); + private Environment sysProperties = new Environment(); /** * error string for unit test verification: {@value} @@ -98,7 +97,7 @@ public abstract class AbstractJarSignerTask extends Task { * @since Ant 1.7 */ private Path path = null; - + /** * Set the maximum memory to be used by the jarsigner process * @@ -226,7 +225,7 @@ public abstract class AbstractJarSignerTask extends Task { */ private RedirectorElement createRedirector() { RedirectorElement result = new RedirectorElement(); - if(storepass!=null) { + if (storepass != null) { StringBuffer input = new StringBuffer(storepass).append('\n'); if (keypass != null) { input.append(keypass).append('\n'); @@ -252,19 +251,19 @@ public abstract class AbstractJarSignerTask extends Task { */ protected void setCommonOptions(final ExecTask cmd) { if (maxMemory != null) { - addValue(cmd,"-J-Xmx" + maxMemory); + addValue(cmd, "-J-Xmx" + maxMemory); } if (verbose) { - addValue(cmd,"-verbose"); + addValue(cmd, "-verbose"); } //now patch in all system properties - Vector props=sysProperties.getVariablesVector(); - Enumeration e=props.elements(); + Vector props = sysProperties.getVariablesVector(); + Enumeration e = props.elements(); while (e.hasMoreElements()) { Environment.Variable variable = (Environment.Variable) e.nextElement(); - declareSysProperty(cmd,variable); + declareSysProperty(cmd, variable); } } @@ -274,8 +273,9 @@ public abstract class AbstractJarSignerTask extends Task { * @param property property to set * @throws BuildException if the property is not correctly defined. */ - protected void declareSysProperty(ExecTask cmd,Environment.Variable property) { - addValue(cmd, "-J-D"+property.getContent()); + protected void declareSysProperty( + ExecTask cmd, Environment.Variable property) { + addValue(cmd, "-J-D" + property.getContent()); } @@ -286,7 +286,7 @@ public abstract class AbstractJarSignerTask extends Task { protected void bindToKeystore(final ExecTask cmd) { if (null != keystore) { // is the keystore a file - addValue(cmd,"-keystore"); + addValue(cmd, "-keystore"); String loc; File keystoreFile = getProject().resolveFile(keystore); if (keystoreFile.exists()) { @@ -323,7 +323,7 @@ public abstract class AbstractJarSignerTask extends Task { * @return a vector of FileSet instances */ protected Vector createUnifiedSources() { - Vector sources = (Vector)filesets.clone(); + Vector sources = (Vector) filesets.clone(); if (jar != null) { //we create a fileset with the source file. //this lets us combine our logic for handling output directories, @@ -356,6 +356,7 @@ public abstract class AbstractJarSignerTask extends Task { /** * Has either a path or a fileset been specified? + * @return true if a path or fileset has been specified. * @since Ant 1.7 */ protected boolean hasResources() { diff --git a/src/main/org/apache/tools/ant/taskdefs/Ant.java b/src/main/org/apache/tools/ant/taskdefs/Ant.java index 2eaa9db7e..25e55e6a2 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Ant.java +++ b/src/main/org/apache/tools/ant/taskdefs/Ant.java @@ -362,9 +362,9 @@ public class Ant extends Task { + "its own parent target."); } boolean circular = false; - for (Iterator it = locals.iterator(); + for (Iterator it = locals.iterator(); !circular && it.hasNext();) { - Target other = + Target other = (Target) (getProject().getTargets().get(it.next())); circular |= (other != null && other.dependsOn(owningTargetName)); @@ -381,7 +381,7 @@ public class Ant extends Task { addReferences(); - if (locals.size() > 0 && !(locals.size() == 1 + if (locals.size() > 0 && !(locals.size() == 1 && "".equals(locals.get(0)))) { BuildException be = null; try { diff --git a/src/main/org/apache/tools/ant/taskdefs/AntStructure.java b/src/main/org/apache/tools/ant/taskdefs/AntStructure.java index 0841eaf61..7bcc6a268 100644 --- a/src/main/org/apache/tools/ant/taskdefs/AntStructure.java +++ b/src/main/org/apache/tools/ant/taskdefs/AntStructure.java @@ -46,7 +46,8 @@ import org.apache.tools.ant.types.Reference; */ public class AntStructure extends Task { - private static final String lSep = System.getProperty("line.separator"); + private static final String LINE_SEP + = System.getProperty("line.separator"); private File output; private StructurePrinter printer = new DTDPrinter(); @@ -61,6 +62,7 @@ public class AntStructure extends Task { /** * The StructurePrinter to use. + * @param p the printer to use. * @since Ant 1.7 */ public void add(StructurePrinter p) { @@ -101,8 +103,9 @@ public class AntStructure extends Task { Enumeration dataTypes = getProject().getDataTypeDefinitions().keys(); while (dataTypes.hasMoreElements()) { String typeName = (String) dataTypes.nextElement(); - printer.printElementDecl(out, getProject(), typeName, - (Class) getProject().getDataTypeDefinitions().get(typeName)); + printer.printElementDecl( + out, getProject(), typeName, + (Class) getProject().getDataTypeDefinitions().get(typeName)); } Enumeration tasks = getProject().getTaskDefinitions().keys(); @@ -282,11 +285,11 @@ public class AntStructure extends Task { sb.append(name).append(" "); if (org.apache.tools.ant.types.Reference.class.equals(element)) { - sb.append("EMPTY>").append(lSep); + sb.append("EMPTY>").append(LINE_SEP); sb.append("").append(lSep); + sb.append(LINE_SEP).append(" id ID #IMPLIED"); + sb.append(LINE_SEP).append(" refid IDREF #IMPLIED"); + sb.append(">").append(LINE_SEP); out.println(sb); return; } @@ -326,7 +329,7 @@ public class AntStructure extends Task { sb = new StringBuffer("").append(lSep); + sb.append(">").append(LINE_SEP); out.println(sb); final int count = v.size(); diff --git a/src/main/org/apache/tools/ant/taskdefs/Apt.java b/src/main/org/apache/tools/ant/taskdefs/Apt.java index bf265cb6e..20c1d32e0 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Apt.java +++ b/src/main/org/apache/tools/ant/taskdefs/Apt.java @@ -51,7 +51,7 @@ public class Apt /** A warning message if used with java < 1.5. */ public static final String ERROR_WRONG_JAVA_VERSION = "Apt task requires Java 1.5+"; - + /** * exposed for debug messages */ @@ -140,7 +140,7 @@ public class Apt */ public void setFork(boolean fork) { if (!fork) { - log(WARNING_IGNORING_FORK,Project.MSG_WARN); + log(WARNING_IGNORING_FORK, Project.MSG_WARN); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Available.java b/src/main/org/apache/tools/ant/taskdefs/Available.java index dab6b925a..66c06787e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Available.java +++ b/src/main/org/apache/tools/ant/taskdefs/Available.java @@ -173,7 +173,7 @@ public class Available extends Task implements Condition { } /** - * @deprecated since 1.5.x. + * @deprecated since 1.5.x. * setType(String) is deprecated and is replaced with * setType(Available.FileDir) to make Ant's Introspection * mechanism do the work and also to encapsulate operations on diff --git a/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java b/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java index b34afc6a9..253e6898e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java +++ b/src/main/org/apache/tools/ant/taskdefs/BUnzip2.java @@ -100,7 +100,7 @@ public class BUnzip2 extends Unpack { * support non-file resources needs to override this method. We * need to do so for backwards compatibility reasons since we * can't expect subclasses to support resources.

- * + * @return true if this class supports non file resources. * @since Ant 1.7 */ protected boolean supportsNonFileResources() { diff --git a/src/main/org/apache/tools/ant/taskdefs/BZip2.java b/src/main/org/apache/tools/ant/taskdefs/BZip2.java index 5a6207395..0cefcff33 100644 --- a/src/main/org/apache/tools/ant/taskdefs/BZip2.java +++ b/src/main/org/apache/tools/ant/taskdefs/BZip2.java @@ -61,7 +61,7 @@ public class BZip2 extends Pack { * support non-file resources needs to override this method. We * need to do so for backwards compatibility reasons since we * can't expect subclasses to support resources.

- * + * @return true if this task support non file resources. * @since Ant 1.7 */ protected boolean supportsNonFileResources() { diff --git a/src/main/org/apache/tools/ant/taskdefs/Checksum.java b/src/main/org/apache/tools/ant/taskdefs/Checksum.java index 6a6364ea6..1dda3a9cd 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Checksum.java +++ b/src/main/org/apache/tools/ant/taskdefs/Checksum.java @@ -449,13 +449,13 @@ public class Checksum extends MatchingTask implements Condition { if (todir != null) { // A separate directory was explicitly declared String path = (String) relativeFilePaths.get(file); - if(path==null) { + if (path == null) { //bug 37386. this should not occur, but it has, once. - throw new BuildException("Internal error: " + - "relativeFilePaths could not match file"+ - file+ - "\n" + - "please file a bug report on this"); + throw new BuildException( + "Internal error: " + + "relativeFilePaths could not match file" + + file + "\n" + + "please file a bug report on this"); } directory = new File(todir, path).getParentFile(); // Create the directory, as it might not exist. @@ -631,7 +631,7 @@ public class Checksum extends MatchingTask implements Condition { } catch (ParseException e) { throw new BuildException("Couldn't read checksum file " + f, e); } finally { - FileUtils.close(diskChecksumReader); + FileUtils.close(diskChecksumReader); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Concat.java b/src/main/org/apache/tools/ant/taskdefs/Concat.java index c5f123737..a9580a849 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Concat.java +++ b/src/main/org/apache/tools/ant/taskdefs/Concat.java @@ -432,8 +432,9 @@ public class Concat extends Task { if (!outofdate) { for (Iterator i = existRc.iterator(); !outofdate && i.hasNext();) { Resource r = (Resource) i.next(); - outofdate = (r.getLastModified() == 0L || - r.getLastModified() > destinationFile.lastModified()); + outofdate = + (r.getLastModified() == 0L + || r.getLastModified() > destinationFile.lastModified()); } } if (!outofdate) { @@ -493,6 +494,7 @@ public class Concat extends Task { try { t.join(); } catch (InterruptedException ee) { + // Empty } } } finally { diff --git a/src/main/org/apache/tools/ant/taskdefs/Copy.java b/src/main/org/apache/tools/ant/taskdefs/Copy.java index 1f56747be..c6cd83fa4 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Copy.java +++ b/src/main/org/apache/tools/ant/taskdefs/Copy.java @@ -156,7 +156,7 @@ public class Copy extends Task { /** * Give the copied files the same last modified time as the original files. * @param preserve a boolean string. - * @deprecated since 1.5.x. + * @deprecated since 1.5.x. * setPreserveLastModified(String) has been deprecated and * replaced with setPreserveLastModified(boolean) to * consistently let the Introspection mechanism work. @@ -289,7 +289,7 @@ public class Copy extends Task { public void addFileset(FileSet set) { add(set); } - + /** * Add a collection of files to copy. * @param res a resource collection to copy. @@ -298,7 +298,7 @@ public class Copy extends Task { public void add(ResourceCollection res) { rcs.add(res); } - + /** * Define the mapper to map source to destination files. * @return a mapper to be configured. @@ -423,7 +423,7 @@ public class Copy extends Task { /* for historical and performance reasons we have to do things in a rather complex way. - + (1) Move is optimized to move directories if a fileset has been included completely, therefore FileSets need a special treatment. This is also required to support @@ -498,7 +498,7 @@ public class Copy extends Task { // files. if (r.isDirectory() || r instanceof FileResource) { add(baseDir, name, - r.isDirectory() ? dirsByBasedir + r.isDirectory() ? dirsByBasedir : filesByBasedir); baseDirs.add(baseDir); } else { // a not-directory file resource @@ -912,7 +912,7 @@ public class Copy extends Task { * support non-file resources needs to override this method. We * need to do so for backwards compatibility reasons since we * can't expect subclasses to support resources.

- * + * @return true if this task supports non file resources. * @since Ant 1.7 */ protected boolean supportsNonFileResources() { @@ -977,7 +977,7 @@ public class Copy extends Task { private String getMessage(Exception ex) { return ex.getMessage() == null ? ex.toString() : ex.getMessage(); } - + /** * Returns a reason for failure based on * the exception thrown. diff --git a/src/main/org/apache/tools/ant/taskdefs/CopyPath.java b/src/main/org/apache/tools/ant/taskdefs/CopyPath.java index 34eb77f4d..81e5d1588 100644 --- a/src/main/org/apache/tools/ant/taskdefs/CopyPath.java +++ b/src/main/org/apache/tools/ant/taskdefs/CopyPath.java @@ -31,9 +31,9 @@ import java.io.IOException; /** * Copy the contents of a path to a destination, using the mapper of choice - * + * * @since Ant 1.7 - * + * * @ant.task category="filesystem" */ @@ -69,8 +69,8 @@ public class CopyPath extends Task { /** * add a mapper - * - * @param newmapper + * + * @param newmapper the mapper to add. */ public void add(FileNameMapper newmapper) { if (mapper != null) { @@ -81,7 +81,7 @@ public class CopyPath extends Task { /** * Set the path to be used when running the Java class. - * + * * @param s * an Ant Path object containing the path. */ @@ -91,7 +91,7 @@ public class CopyPath extends Task { /** * Set the path to use by reference. - * + * * @param r * a reference to an existing path. */ @@ -101,7 +101,7 @@ public class CopyPath extends Task { /** * Create a path. - * + * * @return a path to be configured. */ public Path createPath() { @@ -122,7 +122,7 @@ public class CopyPath extends Task { /** * Ensure we have a consistent and legal set of attributes, and set any * internal flags necessary based on different combinations of attributes. - * + * * @throws BuildException * if an error occurs. */ @@ -140,7 +140,7 @@ public class CopyPath extends Task { /** * This is a very minimal derivative of the nomal copy logic. - * + * * @throws BuildException * if something goes wrong with the build. */ diff --git a/src/main/org/apache/tools/ant/taskdefs/DefBase.java b/src/main/org/apache/tools/ant/taskdefs/DefBase.java index d50f7f46d..3d48894c9 100644 --- a/src/main/org/apache/tools/ant/taskdefs/DefBase.java +++ b/src/main/org/apache/tools/ant/taskdefs/DefBase.java @@ -38,7 +38,7 @@ public abstract class DefBase extends AntlibDefinition { /** * @param reverseLoader if true a delegated loader will take precedence over * the parent - * @deprecated since 1.6.x. + * @deprecated since 1.6.x. * stop using this attribute * @ant.attribute ignore="true" */ diff --git a/src/main/org/apache/tools/ant/taskdefs/Definer.java b/src/main/org/apache/tools/ant/taskdefs/Definer.java index 6477b1742..d523ef8ed 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Definer.java +++ b/src/main/org/apache/tools/ant/taskdefs/Definer.java @@ -290,7 +290,8 @@ public abstract class Definer extends DefBase { /** * This is where the logic to map from a URI to an antlib resource - * is kept. + * is kept. + * @param uri the xml namespace uri that to convert. * @return the name of a resource. It may not exist */ @@ -298,8 +299,8 @@ public abstract class Definer extends DefBase { String path = uri.substring(MagicNames.ANTLIB_PREFIX.length()); String resource; if (path.startsWith("//")) { - //handle new style full paths to an antlib, in which - //all but the forward slashes are allowed. + //handle new style full paths to an antlib, in which + //all but the forward slashes are allowed. resource = path.substring("//".length()); if (!resource.endsWith(".xml")) { //if we haven't already named an XML file, it gets antlib.xml @@ -313,11 +314,11 @@ public abstract class Definer extends DefBase { } /** - * Convert a file to a file: URL. - * + * Convert a file to a file: URL. + * * @return the URL, or null if it isn't valid and the active error policy * is not to raise a fault - * @throws BuildException if the file is missing/not a file and the + * @throws BuildException if the file is missing/not a file and the * policy requires failure at this point. */ private URL fileToURL() { @@ -480,7 +481,7 @@ public abstract class Definer extends DefBase { "Invalid antlib attribute - it must start with antlib:"); } setURI(antlib); - this.resource = antlib.substring("antlib:".length()).replace('.','/') + this.resource = antlib.substring("antlib:".length()).replace('.', '/') + "/antlib.xml"; definerSet = true; } diff --git a/src/main/org/apache/tools/ant/taskdefs/Delete.java b/src/main/org/apache/tools/ant/taskdefs/Delete.java index 5e9f00eed..276ea92b9 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Delete.java +++ b/src/main/org/apache/tools/ant/taskdefs/Delete.java @@ -600,10 +600,10 @@ public class Delete extends MatchingTask { } catch (Exception e) { handle(e); } finally { - if (implicit != null) { - filesets.remove(implicit); - } - } + if (implicit != null) { + filesets.remove(implicit); + } + } } //************************************************************************ @@ -693,7 +693,7 @@ public class Delete extends MatchingTask { + d.getAbsolutePath(), quiet ? Project.MSG_VERBOSE : verbosity); for (int j = 0; j < files.length; j++) { File f = new File(d, files[j]); - log("Deleting " + f.getAbsolutePath(), + log("Deleting " + f.getAbsolutePath(), quiet ? Project.MSG_VERBOSE : verbosity); if (!delete(f)) { handle("Unable to delete file " + f.getAbsolutePath()); @@ -707,7 +707,7 @@ public class Delete extends MatchingTask { File currDir = new File(d, dirs[j]); String[] dirFiles = currDir.list(); if (dirFiles == null || dirFiles.length == 0) { - log("Deleting " + currDir.getAbsolutePath(), + log("Deleting " + currDir.getAbsolutePath(), quiet ? Project.MSG_VERBOSE : verbosity); if (!delete(currDir)) { handle("Unable to delete directory " @@ -722,7 +722,7 @@ public class Delete extends MatchingTask { log("Deleted " + dirCount + " director" + (dirCount == 1 ? "y" : "ies") - + " form " + d.getAbsolutePath(), + + " form " + d.getAbsolutePath(), quiet ? Project.MSG_VERBOSE : verbosity); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/DiagnosticsTask.java b/src/main/org/apache/tools/ant/taskdefs/DiagnosticsTask.java index 0d84fcb38..3ad33a3ee 100644 --- a/src/main/org/apache/tools/ant/taskdefs/DiagnosticsTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/DiagnosticsTask.java @@ -1,9 +1,3 @@ -package org.apache.tools.ant.taskdefs; - -import org.apache.tools.ant.Task; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Diagnostics; - /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -21,6 +15,12 @@ import org.apache.tools.ant.Diagnostics; * limitations under the License. * */ +package org.apache.tools.ant.taskdefs; + +import org.apache.tools.ant.Task; +import org.apache.tools.ant.BuildException; +import org.apache.tools.ant.Diagnostics; + /** * This is a task that hands off work to the Diagnostics module. @@ -28,10 +28,10 @@ import org.apache.tools.ant.Diagnostics; */ public class DiagnosticsTask extends Task { - private static final String[] args=new String[0]; - + private static final String[] ARGS = new String[0]; + public void execute() throws BuildException { - Diagnostics.main(args); + Diagnostics.main(ARGS); } diff --git a/src/main/org/apache/tools/ant/taskdefs/Ear.java b/src/main/org/apache/tools/ant/taskdefs/Ear.java index f3154081b..ea289899e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Ear.java +++ b/src/main/org/apache/tools/ant/taskdefs/Ear.java @@ -50,7 +50,7 @@ public class Ear extends Jar { /** * Set the destination file. * @param earFile the destination file - * @deprecated since 1.5.x. + * @deprecated since 1.5.x. * Use setDestFile(destfile) instead. */ public void setEarfile(File earFile) { diff --git a/src/main/org/apache/tools/ant/taskdefs/Echo.java b/src/main/org/apache/tools/ant/taskdefs/Echo.java index 9082cfc05..351766434 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Echo.java +++ b/src/main/org/apache/tools/ant/taskdefs/Echo.java @@ -61,12 +61,12 @@ public class Echo extends Task { Writer out = null; try { String filename = file.getAbsolutePath(); - if(encoding==null || encoding.length()==0) { + if(encoding == null || encoding.length() == 0) { out = new FileWriter(filename, append); } else { out = new BufferedWriter( new OutputStreamWriter( - new FileOutputStream(filename, append),encoding)); + new FileOutputStream(filename, append), encoding)); } out.write(message, 0, message.length()); } catch (IOException ioe) { @@ -132,7 +132,7 @@ public class Echo extends Task { /** * Declare the encoding to use when outputting to a file; * Use "" for the platform's default encoding. - * @param encoding + * @param encoding the character encoding to use. * @since 1.7 */ public void setEncoding(String encoding) { diff --git a/src/main/org/apache/tools/ant/taskdefs/Exec.java b/src/main/org/apache/tools/ant/taskdefs/Exec.java index 07c037564..e98ee4f0e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Exec.java +++ b/src/main/org/apache/tools/ant/taskdefs/Exec.java @@ -39,7 +39,7 @@ import org.apache.tools.ant.Task; * dead code by the Ant developers and is unmaintained. Don't use * it.

* - * @deprecated since 1.2. + * @deprecated since 1.2. * delegate to {@link org.apache.tools.ant.taskdefs.Execute Execute} * instead. */ diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecTask.java b/src/main/org/apache/tools/ant/taskdefs/ExecTask.java index 62c9a6115..847f740fc 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ExecTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/ExecTask.java @@ -388,7 +388,7 @@ public class ExecTask extends Task { /** * Restrict this execution to a single OS Family - * @param osFamily + * @param osFamily the family to restrict to. */ public void setOsFamily(String osFamily) { this.osFamily = osFamily.toLowerCase(Locale.US); @@ -543,7 +543,7 @@ public class ExecTask extends Task { */ protected boolean isValidOs() { //hand osfamily off to Os class, if set - if(osFamily!=null && !Os.isOs(osFamily,null,null,null)) { + if (osFamily != null && !Os.isOs(osFamily, null, null, null)) { return false; } //the Exec OS check is different from Os.isOs(), which diff --git a/src/main/org/apache/tools/ant/taskdefs/Execute.java b/src/main/org/apache/tools/ant/taskdefs/Execute.java index 1fb79bd3c..f77cec047 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Execute.java +++ b/src/main/org/apache/tools/ant/taskdefs/Execute.java @@ -49,7 +49,7 @@ import org.apache.tools.ant.util.StringUtils; */ public class Execute { - /** Invalid exit code. + /** Invalid exit code. * set to {@link Integer#MAX_VALUE} */ public static final int INVALID = Integer.MAX_VALUE; @@ -1033,8 +1033,8 @@ public class Execute { throw new IOException("Cannot locate antRun script: " + "Property '" + MagicNames.ANT_HOME + "' not found"); } - String antRun = - FILE_UTILS.resolveFile(project.getBaseDir(), + String antRun = + FILE_UTILS.resolveFile(project.getBaseDir(), antHome + File.separator + myScript).toString(); // Build the command @@ -1092,8 +1092,8 @@ public class Execute { throw new IOException("Cannot locate antRun script: " + "Property '" + MagicNames.ANT_HOME + "' not found"); } - String antRun = - FILE_UTILS.resolveFile(project.getBaseDir(), + String antRun = + FILE_UTILS.resolveFile(project.getBaseDir(), antHome + File.separator + myScript).toString(); // Build the command @@ -1210,8 +1210,7 @@ public class Execute { public void run() { try { p.waitFor(); - } - catch (InterruptedException e) { + } catch (InterruptedException e) { //ignore } FileUtils.delete(f); diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java b/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java index e0a4b5046..6803eb809 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java +++ b/src/main/org/apache/tools/ant/taskdefs/ExecuteJava.java @@ -92,7 +92,7 @@ public class ExecuteJava implements Runnable, TimeoutObserver { * Set the stream to which all output (System.out as well as System.err) * will be written. * @param out the PrintStream where output should be sent. - * @deprecated since 1.4.x. + * @deprecated since 1.4.x. * manage output at the task level. */ public void setOutput(PrintStream out) { diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java index 9d368cbe6..4f50907b4 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java +++ b/src/main/org/apache/tools/ant/taskdefs/ExecuteOn.java @@ -417,7 +417,7 @@ public class ExecuteOn extends ExecTask { baseDirs.removeAllElements(); } } - + if (resources != null) { Iterator iter = resources.iterator(); while (iter.hasNext()) { diff --git a/src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java b/src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java index 81c791d47..abc81919c 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java +++ b/src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java @@ -69,7 +69,7 @@ public class ExecuteWatchdog implements TimeoutObserver { /** * @see #ExecuteWatchdog(long) - * @deprecated since 1.5.x. + * @deprecated since 1.5.x. * Use constructor with a long type instead. * (1.4.x compatibility) */ diff --git a/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java b/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java index 437918e0b..8d7358e58 100644 --- a/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java +++ b/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java @@ -174,7 +174,7 @@ public class FixCRLF extends MatchingTask implements ChainableReader { *
  • remove: remove all CR characters * * - * @deprecated since 1.4.x. + * @deprecated since 1.4.x. * Use {@link #setEol setEol} instead. */ public void setCr(AddAsisRemove attr) { @@ -277,7 +277,7 @@ public class FixCRLF extends MatchingTask implements ChainableReader { public void execute() throws BuildException { // first off, make sure that we've got a srcdir and destdir validate(); - + // log options used String enc = encoding == null ? "default" : encoding; log("options:" @@ -326,7 +326,7 @@ public class FixCRLF extends MatchingTask implements ChainableReader { } } } - + private void processFile(String file) throws BuildException { File srcFile = new File(srcDir, file); long lastModified = srcFile.lastModified(); diff --git a/src/main/org/apache/tools/ant/taskdefs/GZip.java b/src/main/org/apache/tools/ant/taskdefs/GZip.java index 66c830c82..5d02b20a2 100644 --- a/src/main/org/apache/tools/ant/taskdefs/GZip.java +++ b/src/main/org/apache/tools/ant/taskdefs/GZip.java @@ -58,7 +58,7 @@ public class GZip extends Pack { * support non-file resources needs to override this method. We * need to do so for backwards compatibility reasons since we * can't expect subclasses to support resources.

    - * + * @return true if this case supports non file resources. * @since Ant 1.7 */ protected boolean supportsNonFileResources() { diff --git a/src/main/org/apache/tools/ant/taskdefs/Get.java b/src/main/org/apache/tools/ant/taskdefs/Get.java index 45971607c..4b7bf4112 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Get.java +++ b/src/main/org/apache/tools/ant/taskdefs/Get.java @@ -339,9 +339,9 @@ public class Get extends Task { /** * Provide this for Backward Compatibility. */ - protected static class Base64Converter - extends org.apache.tools.ant.util.Base64Converter {} + extends org.apache.tools.ant.util.Base64Converter { + } public interface DownloadProgress { /** diff --git a/src/main/org/apache/tools/ant/taskdefs/ImportTask.java b/src/main/org/apache/tools/ant/taskdefs/ImportTask.java index 431a32aeb..702a3ad78 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ImportTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/ImportTask.java @@ -94,12 +94,12 @@ public class ImportTask extends Task { ProjectHelper helper = (ProjectHelper) getProject(). getReference(ProjectHelper.PROJECTHELPER_REFERENCE); - + if (helper == null) { // this happens if the projecthelper was not registered with the project. throw new BuildException("import requires support in ProjectHelper"); } - + Vector importStack = helper.getImportStack(); if (importStack.size() == 0) { diff --git a/src/main/org/apache/tools/ant/taskdefs/Jar.java b/src/main/org/apache/tools/ant/taskdefs/Jar.java index 1ff4af1b0..c94cdc55e 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Jar.java +++ b/src/main/org/apache/tools/ant/taskdefs/Jar.java @@ -147,7 +147,7 @@ public class Jar extends Zip { private ZipExtraField[] JAR_MARKER = new ZipExtraField[] { JarMarker.getInstance() }; - + protected String emptyBehavior = "create"; /** constructor */ @@ -183,7 +183,6 @@ public class Jar extends Zip { emptyBehavior = we.getValue(); } - /** * Set the destination file. * @param jarFile the destination file @@ -390,12 +389,12 @@ public class Jar extends Zip { private void writeServices(ZipOutputStream zOut) throws IOException { Iterator serviceIterator; Service service; - + serviceIterator = serviceList.iterator(); - while(serviceIterator.hasNext()){ + while(serviceIterator.hasNext()) { service = (Service) serviceIterator.next(); //stolen from writeManifest - super.zipFile(service.getAsStream(), zOut, + super.zipFile(service.getAsStream(), zOut, "META-INF/service/" + service.getType(), System.currentTimeMillis(), null, ZipFileSet.DEFAULT_FILE_MODE); @@ -708,7 +707,8 @@ public class Jar extends Zip { } } } catch (Throwable t) { - log("error while reading original manifest in file: " + zipFile.toString() + t.getMessage(), + log("error while reading original manifest in file: " + + zipFile.toString() + t.getMessage(), Project.MSG_WARN); needsUpdate = true; } @@ -744,7 +744,7 @@ public class Jar extends Zip { + ": no files were included.", getLocation()); } - + ZipOutputStream zOut = null; try { log("Building MANIFEST-only jar: " diff --git a/src/main/org/apache/tools/ant/taskdefs/Java.java b/src/main/org/apache/tools/ant/taskdefs/Java.java index f48c1743b..a4e75bcb9 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Java.java +++ b/src/main/org/apache/tools/ant/taskdefs/Java.java @@ -138,7 +138,8 @@ public class Java extends Task { throw new BuildException("Cannot spawn a java process in non-forked mode." + " Please set fork='true'. "); } - if (getCommandLine().getClasspath()!=null && getCommandLine().getJar()!=null) { + if (getCommandLine().getClasspath() != null + && getCommandLine().getJar() != null) { log("When using 'jar' attribute classpath-settings are ignored. " + "See the manual for more information.", Project.MSG_VERBOSE); } @@ -933,4 +934,4 @@ public class Java extends Task { public CommandlineJava.SysProperties getSysProperties() { return getCommandLine().getSystemProperties(); } -} \ No newline at end of file +} diff --git a/src/main/org/apache/tools/ant/taskdefs/Javac.java b/src/main/org/apache/tools/ant/taskdefs/Javac.java index f1d34482a..89ce5c958 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Javac.java +++ b/src/main/org/apache/tools/ant/taskdefs/Javac.java @@ -28,7 +28,6 @@ import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter; import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Reference; -import org.apache.tools.ant.util.FileUtils; import org.apache.tools.ant.util.GlobPatternMapper; import org.apache.tools.ant.util.JavaEnvUtils; import org.apache.tools.ant.util.SourceFileScanner; diff --git a/src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java b/src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java index de198d510..0a6ed8557 100644 --- a/src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java +++ b/src/main/org/apache/tools/ant/taskdefs/JikesOutputParser.java @@ -34,7 +34,7 @@ import org.apache.tools.ant.Task; * by the Ant developers and is unmaintained. Don't use * it.

    * - * @deprecated since 1.2. + * @deprecated since 1.2. * Use Jikes' exit value to detect compilation failure. */ public class JikesOutputParser implements ExecuteStreamHandler { diff --git a/src/main/org/apache/tools/ant/taskdefs/LoadResource.java b/src/main/org/apache/tools/ant/taskdefs/LoadResource.java index 430b70403..dd2b68647 100755 --- a/src/main/org/apache/tools/ant/taskdefs/LoadResource.java +++ b/src/main/org/apache/tools/ant/taskdefs/LoadResource.java @@ -133,7 +133,7 @@ public class LoadResource extends Task { try { final long len = src.getSize(); log("resource size = " - + (len != Resource.UNKNOWN_SIZE ? String.valueOf(len) + + (len != Resource.UNKNOWN_SIZE ? String.valueOf(len) : "unknown"), Project.MSG_DEBUG); //discard most of really big resources final int size = (int) len; diff --git a/src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java b/src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java index dce398099..ec2fe836b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java +++ b/src/main/org/apache/tools/ant/taskdefs/LogOutputStream.java @@ -84,6 +84,7 @@ public class LogOutputStream extends LineOrientedOutputStream { * Logs a line to the log system of ant. * * @param line the line to log. + * @param level the logging level to use. */ protected void processLine(String line, int level) { pc.log(line, level); @@ -93,4 +94,4 @@ public class LogOutputStream extends LineOrientedOutputStream { return level; } -} \ No newline at end of file +} diff --git a/src/main/org/apache/tools/ant/taskdefs/MacroDef.java b/src/main/org/apache/tools/ant/taskdefs/MacroDef.java index 0d8719831..9ad820bd8 100644 --- a/src/main/org/apache/tools/ant/taskdefs/MacroDef.java +++ b/src/main/org/apache/tools/ant/taskdefs/MacroDef.java @@ -345,7 +345,7 @@ public class MacroDef extends AntlibDefinition { getProject()); helper.addDataTypeDefinition(def); - log("creating macro " + name,Project.MSG_VERBOSE); + log("creating macro " + name, Project.MSG_VERBOSE); } /** @@ -426,7 +426,7 @@ public class MacroDef extends AntlibDefinition { * @return a boolean value */ protected boolean equals(Member m) { - return (name == null)? m.name == null: name.equals(m.name); + return (name == null) ? m.name == null : name.equals(m.name); } /** @@ -576,7 +576,7 @@ public class MacroDef extends AntlibDefinition { * This is not allowed for the define nested element. * * @param defaultValue not used - * @throws BuildException, always + * @throws BuildException always */ public void setDefault(String defaultValue) { throw new BuildException( @@ -585,7 +585,7 @@ public class MacroDef extends AntlibDefinition { /** * Gets the default value for this attibute. - * + * * @return the generated unique name, of the form * "prefix#this classname#<aCounter>". */ diff --git a/src/main/org/apache/tools/ant/taskdefs/Manifest.java b/src/main/org/apache/tools/ant/taskdefs/Manifest.java index 326b87952..3ba2333a1 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Manifest.java +++ b/src/main/org/apache/tools/ant/taskdefs/Manifest.java @@ -86,7 +86,7 @@ public class Manifest { /** Encoding to be used for JAR files. */ public static final String JAR_ENCODING = "UTF-8"; - + /** * An attribute for the manifest. * Those attributes that are not nested into a section will be added to the "Main" section. @@ -105,7 +105,7 @@ public class Manifest { * In this case the first line will have 74 bytes total line length * (including CRLF). This conflicts with the 72 bytes total line length * max, but is the only possible conclusion from the manifest specification, if - * names with 70 bytes length are allowed, have to be on the first line, and + * names with 70 bytes length are allowed, have to be on the first line, and * have to be followed by ": ". */ private static final int MAX_NAME_LENGTH = 70; @@ -326,25 +326,20 @@ public class Manifest { throws IOException { String line = null; int nameLength = name.getBytes(JAR_ENCODING).length; - if (nameLength > MAX_NAME_VALUE_LENGTH) - { - if (nameLength > MAX_NAME_LENGTH) - { + if (nameLength > MAX_NAME_VALUE_LENGTH) { + if (nameLength > MAX_NAME_LENGTH) { throw new IOException("Unable to write manifest line " + name + ": " + value); } writer.print(name + ": " + EOL); line = " " + value; - } - else - { + } else { line = name + ": " + value; } while (line.getBytes(JAR_ENCODING).length > MAX_SECTION_LENGTH) { // try to find a MAX_LINE_LENGTH byte section int breakIndex = MAX_SECTION_LENGTH; - if (breakIndex >= line.length()) - { + if (breakIndex >= line.length()) { breakIndex = line.length() - 1; } String section = line.substring(0, breakIndex); diff --git a/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java b/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java index e844f6445..f980620b2 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java +++ b/src/main/org/apache/tools/ant/taskdefs/ManifestClassPath.java @@ -36,16 +36,16 @@ import org.apache.tools.ant.util.FileUtils; public class ManifestClassPath extends Task { /** The property name to hold the classpath value. */ - private String _name; + private String name; /** The directory the classpath will be relative from. */ - private File _dir; + private File dir; /** The maximum parent directory level to traverse. */ - private int _maxParentLevels = 2; + private int maxParentLevels = 2; /** The classpath to convert. */ - private Path _path; + private Path path; /** * Sets a property, which must not already exist, with a space @@ -53,37 +53,37 @@ public class ManifestClassPath extends Task { * file's parent directory. */ public void execute() { - if (_name == null) { + if (name == null) { throw new BuildException("Missing 'property' attribute!"); } - if (_dir == null) { + if (dir == null) { throw new BuildException("Missing 'jarfile' attribute!"); } - if (getProject().getProperty(_name) != null) { - throw new BuildException("Property '" + _name + "' already set!"); + if (getProject().getProperty(name) != null) { + throw new BuildException("Property '" + name + "' already set!"); } - if (_path == null) { + if (path == null) { throw new BuildException("Missing nested !"); } // Normalize the reference directory (containing the jar) final FileUtils fileUtils = FileUtils.getFileUtils(); - _dir = fileUtils.normalize(_dir.getAbsolutePath()); + dir = fileUtils.normalize(dir.getAbsolutePath()); // Create as many directory prefixes as parent levels to traverse, // in addition to the reference directory itself - File currDir = _dir; - String[] dirs = new String[_maxParentLevels + 1]; - for (int i = 0; i < _maxParentLevels + 1; ++i) { + File currDir = dir; + String[] dirs = new String[maxParentLevels + 1]; + for (int i = 0; i < maxParentLevels + 1; ++i) { dirs[i] = currDir.getAbsolutePath() + File.separatorChar; currDir = currDir.getParentFile(); if (currDir == null) { - _maxParentLevels = i + 1; + maxParentLevels = i + 1; break; } } - String[] elements = _path.list(); + String[] elements = path.list(); StringBuffer buffer = new StringBuffer(); StringBuffer element = new StringBuffer(); for (int i = 0; i < elements.length; ++i) { @@ -95,7 +95,7 @@ public class ManifestClassPath extends Task { // Find the longest prefix shared by the current file // and the reference directory. String relPath = null; - for (int j = 0; j <= _maxParentLevels; ++j) { + for (int j = 0; j <= maxParentLevels; ++j) { String dir = dirs[j]; if (!fullPath.startsWith(dir)) { continue; @@ -115,8 +115,9 @@ public class ManifestClassPath extends Task { // No match, so bail out! if (relPath == null) { - throw new BuildException("No suitable relative path from " + - _dir + " to " + fullPath); + throw new BuildException( + "No suitable relative path from " + + dir + " to " + fullPath); } // Manifest's ClassPath: attribute always uses forward @@ -138,7 +139,7 @@ public class ManifestClassPath extends Task { } // Finally assign the property with the manifest classpath - getProject().setNewProperty(_name, buffer.toString().trim()); + getProject().setNewProperty(name, buffer.toString().trim()); } /** @@ -147,7 +148,7 @@ public class ManifestClassPath extends Task { * @param name the property name */ public void setProperty(String name) { - _name = name; + this.name = name; } /** @@ -161,7 +162,7 @@ public class ManifestClassPath extends Task { if (!parent.isDirectory()) { throw new BuildException("Jar's directory not found: " + parent); } - _dir = parent; + this.dir = parent; } /** @@ -171,7 +172,7 @@ public class ManifestClassPath extends Task { * @param levels the max level. Defaults to 2. */ public void setMaxParentLevels(int levels) { - _maxParentLevels = levels; + this.maxParentLevels = levels; } /** @@ -180,7 +181,7 @@ public class ManifestClassPath extends Task { * @param path the classpath to convert. */ public void addClassPath(Path path) { - _path = path; + this.path = path; } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Mkdir.java b/src/main/org/apache/tools/ant/taskdefs/Mkdir.java index 9fc92ab38..6b0fe3857 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Mkdir.java +++ b/src/main/org/apache/tools/ant/taskdefs/Mkdir.java @@ -65,7 +65,8 @@ public class Mkdir extends Task { } log("Created dir: " + dir.getAbsolutePath()); } else { - log("Skipping " + dir.getAbsolutePath() + " because it already exists.", Project.MSG_VERBOSE); + log("Skipping " + dir.getAbsolutePath() + + " because it already exists.", Project.MSG_VERBOSE); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Pack.java b/src/main/org/apache/tools/ant/taskdefs/Pack.java index 2e99c9d29..234e384e0 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Pack.java +++ b/src/main/org/apache/tools/ant/taskdefs/Pack.java @@ -183,7 +183,7 @@ public abstract class Pack extends Task { /** * The source resource. - * + * @return the source. * @since Ant 1.7 */ public Resource getSrcResource() { @@ -194,7 +194,7 @@ public abstract class Pack extends Task { * Whether this task can deal with non-file resources. * *

    This implementation returns false.

    - * + * @return false. * @since Ant 1.7 */ protected boolean supportsNonFileResources() { diff --git a/src/main/org/apache/tools/ant/taskdefs/PreSetDef.java b/src/main/org/apache/tools/ant/taskdefs/PreSetDef.java index cadb66951..fe5770447 100644 --- a/src/main/org/apache/tools/ant/taskdefs/PreSetDef.java +++ b/src/main/org/apache/tools/ant/taskdefs/PreSetDef.java @@ -96,7 +96,7 @@ public class PreSetDef extends AntlibDefinition implements TaskContainer { newDef.setName(name); helper.addDataTypeDefinition(newDef); - log("defining preset "+name,Project.MSG_VERBOSE); + log("defining preset " + name, Project.MSG_VERBOSE); } /** diff --git a/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java b/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java index 3f895ccb0..56d13232f 100644 --- a/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java +++ b/src/main/org/apache/tools/ant/taskdefs/ProcessDestroyer.java @@ -144,7 +144,8 @@ class ProcessDestroyer implements Runnable { // Cf.: http://developer.java.sun.com/developer/bugParade/bugs/4533087.html destroyProcessThread.setShouldDestroy(false); if (!destroyProcessThread.getThreadGroup().isDestroyed()) { - // start() would throw IllegalThreadStateException from ThreadGroup.add if it were destroyed + // start() would throw IllegalThreadStateException from + // ThreadGroup.add if it were destroyed destroyProcessThread.start(); } // this should return quickly, since it basically is a NO-OP. diff --git a/src/main/org/apache/tools/ant/taskdefs/Property.java b/src/main/org/apache/tools/ant/taskdefs/Property.java index 46adcab11..ce93c91f1 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Property.java +++ b/src/main/org/apache/tools/ant/taskdefs/Property.java @@ -606,8 +606,9 @@ public class Property extends Task { String propertyValue = props.getProperty(name); Vector fragments = new Vector(); Vector propertyRefs = new Vector(); - PropertyHelper.getPropertyHelper(this.getProject()).parsePropertyString(propertyValue, fragments, - propertyRefs); + PropertyHelper.getPropertyHelper( + this.getProject()).parsePropertyString( + propertyValue, fragments, propertyRefs); if (propertyRefs.size() != 0) { referencesSeen.push(name);