ggregory 2004/02/11 15:33:23 Modified: lang/src/java/org/apache/commons/lang Validate.java Log: PR: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26656 [lang][patch] Validate.java: fixes comment skew, removes unused loop counter. Submitted by: Janek Bogucki Reviewed by: Gary Gregory Revision Changes Path 1.8 +22 -14 jakarta-commons/lang/src/java/org/apache/commons/lang/Validate.java Index: Validate.java =================================================================== RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/Validate.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Validate.java 19 Jan 2004 23:24:07 -0000 1.7 +++ Validate.java 11 Feb 2004 23:33:23 -0000 1.8 @@ -124,7 +124,7 @@ * Validate.isTrue( i > 0, "The value must be greater than zero: ", i); * </pre> * - * <p>For performance reasons, the object is passed as a separate parameter and + * <p>For performance reasons, the long value is passed as a separate parameter and * appended to the message string only in the case of an error.</p> * * @param expression a boolean expression @@ -150,7 +150,7 @@ * Validate.isTrue( d > 0.0, "The value must be greater than zero: ", d); * </pre> * - * <p>For performance reasons, the object is passed as a separate parameter and + * <p>For performance reasons, the double value is passed as a separate parameter and * appended to the message string only in the case of an error.</p> * * @param expression a boolean expression @@ -345,7 +345,7 @@ * if the argument Map is empty (<code>null</code> or no elements).</p> * * <pre> - * Validate.notEmpty(myMap, "The collection must not be empty"); + * Validate.notEmpty(myMap, "The map must not be empty"); * </pre> * * @param map the map to check is not empty @@ -426,9 +426,11 @@ * <code>null</code>.</p> * * <pre> - * Validate.notEmpty(myArray, "The array must not contain null elements"); + * Validate.noNullElements(myArray, "The array must not contain null elements"); * </pre> * + * <p>If the array is null then the message in the exception is 'The validated object is null'.</p> + * * @param array the array to check * @param message the exception message if the array has * <code>null</code> elements @@ -450,10 +452,13 @@ * <code>null</code>.</p> * * <pre> - * Validate.notEmpty(myArray); + * Validate.noNullElements(myArray); * </pre> * - * <p>The message in the exception is 'The validated array contains null element at index: '.</p> + * <p>If the array has a null element the message in the exception is + * 'The validated array contains null element at index: '.</p> + * + * <p>If the array is null then the message in the exception is 'The validated object is null'.</p> * * @param array the array to check * @throws IllegalArgumentException if the array has <code>null</code> @@ -473,23 +478,24 @@ /** * <p>Validate an argument, throwing <code>IllegalArgumentException</code> - * if the argument collection has <code>null</code> elements or is + * if the argument Collection has <code>null</code> elements or is * <code>null</code>.</p> * * <pre> - * Validate.notEmpty(myCollection, "The collection must not contain null elements"); + * Validate.noNullElements(myCollection, "The collection must not contain null elements"); * </pre> + * + * <p>If the collection is null then the message in the exception is 'The validated object is null'.</p> * * @param collection the collection to check - * @param message the exception message if the array has + * @param message the exception message if the collection has * <code>null</code> elements * @throws IllegalArgumentException if the collection has * <code>null</code> elements or is <code>null</code> */ public static void noNullElements(Collection collection, String message) { Validate.notNull(collection); - int i = 0; - for (Iterator it = collection.iterator(); it.hasNext(); i++) { + for (Iterator it = collection.iterator(); it.hasNext();) { if (it.next() == null) { throw new IllegalArgumentException(message); } @@ -498,14 +504,16 @@ /** * <p>Validate an argument, throwing <code>IllegalArgumentException</code> - * if the argument collection has <code>null</code> elements or is + * if the argument Collection has <code>null</code> elements or is * <code>null</code>.</p> * * <pre> - * Validate.notEmpty(myCollection); + * Validate.noNullElements(myCollection); * </pre> * * <p>The message in the exception is 'The validated collection contains null element at index: '.</p> + * + * <p>If the collection is null then the message in the exception is 'The validated object is null'.</p> * * @param collection the collection to check * @throws IllegalArgumentException if the collection has
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]