Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 8967 invoked from network); 2 May 2009 05:20:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 2 May 2009 05:20:58 -0000 Received: (qmail 70382 invoked by uid 500); 2 May 2009 05:20:58 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 70281 invoked by uid 500); 2 May 2009 05:20:57 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 70272 invoked by uid 99); 2 May 2009 05:20:57 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 May 2009 05:20:57 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 02 May 2009 05:20:56 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 782B32388A04; Sat, 2 May 2009 05:20:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r770891 - in /commons/proper/lang/trunk/src/java/org/apache/commons/lang: Entities.java Validate.java Date: Sat, 02 May 2009 05:20:36 -0000 To: commits@commons.apache.org From: bayard@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090502052036.782B32388A04@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: bayard Date: Sat May 2 05:20:35 2009 New Revision: 770891 URL: http://svn.apache.org/viewvc?rev=770891&view=rev Log: Applying Hendrik Maryns' generics changes for Entities + Validate from LANG-336 Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/Entities.java commons/proper/lang/trunk/src/java/org/apache/commons/lang/Validate.java Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/Entities.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/Entities.java?rev=770891&r1=770890&r2=770891&view=diff ============================================================================== --- commons/proper/lang/trunk/src/java/org/apache/commons/lang/Entities.java (original) +++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/Entities.java Sat May 2 05:20:35 2009 @@ -749,8 +749,8 @@ * array of entities to be added */ public void addEntities(String[][] entityArray) { - for (int i = 0; i < entityArray.length; ++i) { - addEntity(entityArray[i][0], Integer.parseInt(entityArray[i][1])); + for (String[] element : entityArray) { + addEntity(element[0], Integer.parseInt(element[1])); } } Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/Validate.java URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/Validate.java?rev=770891&r1=770890&r2=770891&view=diff ============================================================================== --- commons/proper/lang/trunk/src/java/org/apache/commons/lang/Validate.java (original) +++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/Validate.java Sat May 2 05:20:35 2009 @@ -258,9 +258,7 @@ * @throws IllegalArgumentException if the array is empty */ public static void notEmpty(Object[] array) { - if (array == null || array.length == 0) { - throw new IllegalArgumentException("The validated array is empty"); - } + notEmpty(array, "The validated array is empty"); } // notEmpty collection @@ -278,7 +276,7 @@ * @param message the exception message you would like to see if the collection is empty * @throws IllegalArgumentException if the collection is empty */ - public static void notEmpty(Collection collection, String message) { + public static void notEmpty(Collection collection, String message) { if (collection == null || collection.size() == 0) { throw new IllegalArgumentException(message); } @@ -297,10 +295,8 @@ * @param collection the collection to check is not empty * @throws IllegalArgumentException if the collection is empty */ - public static void notEmpty(Collection collection) { - if (collection == null || collection.size() == 0) { - throw new IllegalArgumentException("The validated collection is empty"); - } + public static void notEmpty(Collection collection) { + notEmpty(collection, "The validated collection is empty"); } // notEmpty map @@ -318,7 +314,7 @@ * @param message the exception message you would like to see if the map is empty * @throws IllegalArgumentException if the map is empty */ - public static void notEmpty(Map map, String message) { + public static void notEmpty(Map map, String message) { if (map == null || map.size() == 0) { throw new IllegalArgumentException(message); } @@ -337,10 +333,8 @@ * @param map the map to check is not empty * @throws IllegalArgumentException if the map is empty */ - public static void notEmpty(Map map) { - if (map == null || map.size() == 0) { - throw new IllegalArgumentException("The validated map is empty"); - } + public static void notEmpty(Map map) { + notEmpty(map, "The validated map is empty"); } // notEmpty string @@ -378,9 +372,7 @@ * @throws IllegalArgumentException if the string is empty */ public static void notEmpty(String string) { - if (string == null || string.length() == 0) { - throw new IllegalArgumentException("The validated string is empty"); - } + notEmpty(string, "The validated string is empty"); } // notNullElements array