commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r905329 - /commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/Validate.java
Date Mon, 01 Feb 2010 16:33:28 GMT
Author: niallp
Date: Mon Feb  1 16:33:28 2010
New Revision: 905329

URL: http://svn.apache.org/viewvc?rev=905329&view=rev
Log:
Remove duplicated code - delegate to methods with message parameter

Modified:
    commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/Validate.java

Modified: commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/Validate.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/Validate.java?rev=905329&r1=905328&r2=905329&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/Validate.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/Validate.java
Mon Feb  1 16:33:28 2010
@@ -175,9 +175,7 @@
      * @throws IllegalArgumentException if the object is <code>null</code>
      */
     public static void notNull(Object object) {
-        if (object == null) {
-            throw new IllegalArgumentException("The validated object is null");
-        }
+        notNull(object, "The validated object is null");
     }
 
     /**
@@ -228,9 +226,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
@@ -266,9 +262,7 @@
      * @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");
-        }
+        notEmpty(collection, "The validated collection is empty");
     }
 
     // notEmpty map
@@ -305,9 +299,7 @@
      * @see #notEmpty(Map, String, Object...)
      */
     public static void notEmpty(Map map) {
-        if (map == null || map.size() == 0) {
-            throw new IllegalArgumentException("The validated map is empty");
-        }
+        notEmpty(map, "The validated map is empty");
     }
 
     // notEmpty string
@@ -344,9 +336,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



Mime
View raw message