From 7498cc00cba66fb695849e1c0d8cd34db1a15f7a Mon Sep 17 00:00:00 2001
From: Peter Reilly Follows the equals contract of Java 2's Map.ContainerMapper that chains the results of the first
diff --git a/src/main/org/apache/tools/ant/util/CollectionUtils.java b/src/main/org/apache/tools/ant/util/CollectionUtils.java
index 323669617..f2971c0b7 100644
--- a/src/main/org/apache/tools/ant/util/CollectionUtils.java
+++ b/src/main/org/apache/tools/ant/util/CollectionUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2004 The Apache Software Foundation
+ * Copyright 2002-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,8 +29,10 @@ import java.util.Vector;
public class CollectionUtils {
/**
- * Please use Vector.equals() or List.equals()
- *
+ * Please use Vector.equals() or List.equals().
+ * @param v1 the first vector.
+ * @param v2 the second vector.
+ * @return true if the vectors are equal.
* @since Ant 1.5
* @deprecated
*/
@@ -48,10 +50,12 @@ public class CollectionUtils {
/**
* Dictionary does not have an equals.
- * Please use Map.equals()
+ * Please use Map.equals().
*
*
See XML 1.0 2.2 * http://www.w3.org/TR/1998/REC-xml-19980210#charsets.
- * + * @param c the character to test. + * @return true if the character is allowed. * @since 1.10, Ant 1.5 */ public boolean isLegalCharacter(char c) { diff --git a/src/main/org/apache/tools/ant/util/DateUtils.java b/src/main/org/apache/tools/ant/util/DateUtils.java index 147576749..0e1b7b7d0 100644 --- a/src/main/org/apache/tools/ant/util/DateUtils.java +++ b/src/main/org/apache/tools/ant/util/DateUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2004 The Apache Software Foundation + * Copyright 2002-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -171,6 +171,8 @@ public final class DateUtils { * + 11/22 for rounding * * + * @param cal the calander. + * * @return The phase of the moon as a number between 0 and 7 with * 0 meaning new moon and 4 meaning full moon. * @@ -189,7 +191,7 @@ public final class DateUtils { /** * Returns the current Date in a format suitable for a SMTP date * header. - * + * @return the current date. * @since Ant 1.5.2 */ public static String getDateForHeader() { diff --git a/src/main/org/apache/tools/ant/util/FileNameMapper.java b/src/main/org/apache/tools/ant/util/FileNameMapper.java index 6a1be1121..fadbd5866 100644 --- a/src/main/org/apache/tools/ant/util/FileNameMapper.java +++ b/src/main/org/apache/tools/ant/util/FileNameMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000,2004 The Apache Software Foundation + * Copyright 2000,2004-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,11 +32,13 @@ public interface FileNameMapper { /** * Sets the from part of the transformation rule. + * @param from a string. */ void setFrom(String from); /** * Sets the to part of the transformation rule. + * @param to a string. */ void setTo(String to); @@ -50,6 +52,8 @@ public interface FileNameMapper { * * @param sourceFileName the name of the source file relative to * some given basedirectory. + * @return an array of strings if the ruld applies to the source file, or + * null if it does not. */ String[] mapFileName(String sourceFileName); } diff --git a/src/main/org/apache/tools/ant/util/FlatFileNameMapper.java b/src/main/org/apache/tools/ant/util/FlatFileNameMapper.java index 163f75749..79079bee1 100644 --- a/src/main/org/apache/tools/ant/util/FlatFileNameMapper.java +++ b/src/main/org/apache/tools/ant/util/FlatFileNameMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000,2004 The Apache Software Foundation + * Copyright 2000,2004-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,12 +29,14 @@ public class FlatFileNameMapper implements FileNameMapper { /** * Ignored. + * @param from ignored. */ public void setFrom(String from) { } /** * Ignored. + * @param to ignored. */ public void setTo(String to) { } @@ -42,6 +44,8 @@ public class FlatFileNameMapper implements FileNameMapper { /** * Returns an one-element array containing the source file name * without any leading directory information. + * @param sourceFileName the name to map. + * @return the file name in a one-element array. */ public String[] mapFileName(String sourceFileName) { return new String[] {new java.io.File(sourceFileName).getName()}; diff --git a/src/main/org/apache/tools/ant/util/GlobPatternMapper.java b/src/main/org/apache/tools/ant/util/GlobPatternMapper.java index b58c45a0e..8ba9e6d61 100644 --- a/src/main/org/apache/tools/ant/util/GlobPatternMapper.java +++ b/src/main/org/apache/tools/ant/util/GlobPatternMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000,2002,2004 The Apache Software Foundation + * Copyright 2000,2002,2004-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -147,7 +147,6 @@ public class GlobPatternMapper implements FileNameMapper { name.length() - postfixLength); } - /** * modify string based on dir char mapping and case sensitivity * @param name the name to convert diff --git a/src/main/org/apache/tools/ant/util/IdentityMapper.java b/src/main/org/apache/tools/ant/util/IdentityMapper.java index c4461b873..37fc492e0 100644 --- a/src/main/org/apache/tools/ant/util/IdentityMapper.java +++ b/src/main/org/apache/tools/ant/util/IdentityMapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000,2004 The Apache Software Foundation + * Copyright 2000,2004-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,18 +28,22 @@ public class IdentityMapper implements FileNameMapper { /** * Ignored. + * @param from ignored. */ public void setFrom(String from) { } /** * Ignored. + * @param to ignored. */ public void setTo(String to) { } /** * Returns an one-element array containing the source file name. + * @param sourceFileName the name to map. + * @return the source filename in a one-element array. */ public String[] mapFileName(String sourceFileName) { return new String[] {sourceFileName}; diff --git a/src/main/org/apache/tools/ant/util/JAXPUtils.java b/src/main/org/apache/tools/ant/util/JAXPUtils.java index 369b7e9cc..cffe52cf5 100644 --- a/src/main/org/apache/tools/ant/util/JAXPUtils.java +++ b/src/main/org/apache/tools/ant/util/JAXPUtils.java @@ -71,7 +71,8 @@ public class JAXPUtils { * Returns the parser factory to use. Only one parser factory is * ever created by this method and is then cached for future use. * - * @return a SAXParserFactory to use + * @return a SAXParserFactory to use. + * @throws BuildException on error. * * @since Ant 1.5 */ @@ -88,7 +89,8 @@ public class JAXPUtils { * Returns the parser factory to use to create namespace aware parsers. * * @return a SAXParserFactory to use which supports manufacture of - * namespace aware parsers + * namespace aware parsers. + * @throws BuildException on error. * * @since Ant 1.6 */ @@ -105,6 +107,8 @@ public class JAXPUtils { /** * Returns a new parser factory instance. * + * @return the parser factory. + * @throws BuildException on error. * @since Ant 1.5 */ public static SAXParserFactory newParserFactory() throws BuildException { @@ -123,6 +127,7 @@ public class JAXPUtils { * factory. * * @return a SAX 1 Parser. + * @throws BuildException on error. * @see #getParserFactory * @since Ant 1.5 */ @@ -139,6 +144,7 @@ public class JAXPUtils { * factory. * * @return a SAX 2 XMLReader. + * @throws BuildException on error. * @see #getParserFactory * @since Ant 1.5 */ @@ -154,6 +160,7 @@ public class JAXPUtils { * Returns a newly created SAX 2 XMLReader, which is namespace aware * * @return a SAX 2 XMLReader. + * @throws BuildException on error. * @see #getParserFactory * @since Ant 1.6 */ @@ -181,7 +188,8 @@ public class JAXPUtils { /** * Returns a newly created DocumentBuilder. * - * @return a DocumentBuilder + * @return a DocumentBuilder. + * @throws BuildException on error. * @since Ant 1.6 */ public static DocumentBuilder getDocumentBuilder() throws BuildException { diff --git a/src/main/org/apache/tools/ant/util/JavaEnvUtils.java b/src/main/org/apache/tools/ant/util/JavaEnvUtils.java index d4be68715..fbb0c9ed9 100644 --- a/src/main/org/apache/tools/ant/util/JavaEnvUtils.java +++ b/src/main/org/apache/tools/ant/util/JavaEnvUtils.java @@ -30,20 +30,20 @@ import org.apache.tools.ant.taskdefs.condition.Os; * * @since Ant 1.5 */ -public class JavaEnvUtils { +public final class JavaEnvUtils { private JavaEnvUtils() { } /** Are we on a DOS-based system */ - private static final boolean isDos = Os.isFamily("dos"); + private static final boolean IS_DOS = Os.isFamily("dos"); /** Are we on Novell NetWare */ - private static final boolean isNetware = Os.isName("netware"); + private static final boolean IS_NETWARE = Os.isName("netware"); /** Are we on AIX */ - private static final boolean isAix = Os.isName("aix"); + private static final boolean IS_AIX = Os.isName("aix"); /** shortcut for System.getProperty("java.home") */ - private static final String javaHome = System.getProperty("java.home"); + private static final String JAVA_HOME = System.getProperty("java.home"); /** FileUtils instance for path normalization */ private static final FileUtils FILE_UTILS = FileUtils.getFileUtils(); @@ -127,8 +127,8 @@ public class JavaEnvUtils { * Compares the current Java version to the passed in String - * assumes the argument is one of the constants defined in this * class. - * @return true if the version of Java is the same as the given - * version. + * @param version the version to check against the current version. + * @return true if the version of Java is the same as the given version. * @since Ant 1.5 */ public static boolean isJavaVersion(String version) { @@ -159,11 +159,12 @@ public class JavaEnvUtils { *JAVA_HOME points to your JDK installation. JDK
* < 1.2 has them in the same directory as the JDK
* executables.
- *
+ * @param command the java executable to find.
+ * @return the path to the command.
* @since Ant 1.5
*/
public static String getJreExecutable(String command) {
- if (isNetware) {
+ if (IS_NETWARE) {
// Extrapolating from:
// "NetWare may have a "java" in that directory, but 99% of
// the time, you don't want to execute it" -- Jeff Tulley
@@ -173,14 +174,14 @@ public class JavaEnvUtils {
File jExecutable = null;
- if (isAix) {
+ if (IS_AIX) {
// On IBM's JDK 1.2 the directory layout is different, 1.3 follows
// Sun's layout.
- jExecutable = findInDir(javaHome + "/sh", command);
+ jExecutable = findInDir(JAVA_HOME + "/sh", command);
}
if (jExecutable == null) {
- jExecutable = findInDir(javaHome + "/bin", command);
+ jExecutable = findInDir(JAVA_HOME + "/bin", command);
}
if (jExecutable != null) {
@@ -199,11 +200,12 @@ public class JavaEnvUtils {
*
* You typically find them in JAVA_HOME/bin if
* JAVA_HOME points to your JDK installation.
LeadPipeInputStream to pull
* from the specified PipedOutputStream.
* @param src the PipedOutputStream source.
+ * @throws IOException if unable to construct the stream.
*/
public LeadPipeInputStream(PipedOutputStream src) throws IOException {
super(src);
diff --git a/src/main/org/apache/tools/ant/util/MergingMapper.java b/src/main/org/apache/tools/ant/util/MergingMapper.java
index 4b7c41e7e..35bc19be0 100644
--- a/src/main/org/apache/tools/ant/util/MergingMapper.java
+++ b/src/main/org/apache/tools/ant/util/MergingMapper.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000,2004 The Apache Software Foundation
+ * Copyright 2000,2004-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,12 +30,14 @@ public class MergingMapper implements FileNameMapper {
/**
* Ignored.
+ * @param from ignored.
*/
public void setFrom(String from) {
}
/**
* Sets the name of the merged file.
+ * @param to the name of the merged file.
*/
public void setTo(String to) {
mergedFile = new String[] {to};
@@ -43,6 +45,8 @@ public class MergingMapper implements FileNameMapper {
/**
* Returns an one-element array containing the file name set via setTo.
+ * @param sourceFileName ignored.
+ * @return a one-element array containing the merged filename.
*/
public String[] mapFileName(String sourceFileName) {
return mergedFile;