Unify exception handling re IAE


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/lang/trunk@137544 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/java/org/apache/commons/lang/ArrayUtils.java b/src/java/org/apache/commons/lang/ArrayUtils.java
index da35980..724c6c6 100644
--- a/src/java/org/apache/commons/lang/ArrayUtils.java
+++ b/src/java/org/apache/commons/lang/ArrayUtils.java
@@ -75,7 +75,7 @@
  * @author Nikolay Metchev
  * @author Matthew Hawthorne
  * @since 2.0
- * @version $Id: ArrayUtils.java,v 1.19 2003/07/19 20:17:12 scolebourne Exp $
+ * @version $Id: ArrayUtils.java,v 1.20 2003/07/31 23:45:28 scolebourne Exp $
  */
 public class ArrayUtils {
 
@@ -607,7 +607,7 @@
      */    
     public static boolean isSameType(final Object array1, final Object array2) {
         if (array1 == null || array2 == null) {
-            throw new NullArgumentException("Array");
+            throw new IllegalArgumentException("The Array must not be null");
         }
         return array1.getClass().getName().equals(array2.getClass().getName());
     }
diff --git a/src/java/org/apache/commons/lang/SerializationUtils.java b/src/java/org/apache/commons/lang/SerializationUtils.java
index 7bf5d68..925bd68 100644
--- a/src/java/org/apache/commons/lang/SerializationUtils.java
+++ b/src/java/org/apache/commons/lang/SerializationUtils.java
@@ -81,7 +81,7 @@
  * @author Stephen Colebourne
  * @author Jeff Varszegi
  * @since 1.0
- * @version $Id: SerializationUtils.java,v 1.7 2003/07/19 20:22:36 scolebourne Exp $
+ * @version $Id: SerializationUtils.java,v 1.8 2003/07/31 23:45:28 scolebourne Exp $
  */
 public class SerializationUtils {
     
@@ -130,7 +130,7 @@
      */
     public static void serialize(Serializable obj, OutputStream outputStream) {
         if (outputStream == null) {
-            throw new NullArgumentException("OutputStream");
+            throw new IllegalArgumentException("The OutputStream must not be null");
         }
         ObjectOutputStream out = null;
         try {
@@ -182,7 +182,7 @@
      */
     public static Object deserialize(InputStream inputStream) {
         if (inputStream == null) {
-            throw new NullArgumentException("InputStream");
+            throw new IllegalArgumentException("The InputStream must not be null");
         }
         ObjectInputStream in = null;
         try {
@@ -215,7 +215,7 @@
      */
     public static Object deserialize(byte[] objectData) {
         if (objectData == null) {
-            throw new NullArgumentException("byte[]");
+            throw new IllegalArgumentException("The byte[] must not be null");
         }
         ByteArrayInputStream bais = new ByteArrayInputStream(objectData);
         return deserialize(bais);
diff --git a/src/java/org/apache/commons/lang/StringEscapeUtils.java b/src/java/org/apache/commons/lang/StringEscapeUtils.java
index 327398e..88e78cc 100644
--- a/src/java/org/apache/commons/lang/StringEscapeUtils.java
+++ b/src/java/org/apache/commons/lang/StringEscapeUtils.java
@@ -73,7 +73,7 @@
  * @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
  * @author Phil Steitz
  * @since 2.0
- * @version $Id: StringEscapeUtils.java,v 1.21 2003/07/28 16:17:57 ggregory Exp $
+ * @version $Id: StringEscapeUtils.java,v 1.22 2003/07/31 23:45:28 scolebourne Exp $
  */
 public class StringEscapeUtils {
 
@@ -191,7 +191,7 @@
 
     private static void escapeJavaStyleString(Writer out, String str, boolean escapeSingleQuote) throws IOException {
         if (out == null) {
-            throw new NullArgumentException("Writer");
+            throw new IllegalArgumentException("The Writer must not be null");
         }
         if (str == null) {
             return;
@@ -311,7 +311,7 @@
      */
     public static void unescapeJava(Writer out, String str) throws IOException {
         if (out == null) {
-            throw new NullArgumentException("Writer");
+            throw new IllegalArgumentException("The Writer must not be null");
         }
         if (str == null) {
             return;
diff --git a/src/java/org/apache/commons/lang/exception/ExceptionUtils.java b/src/java/org/apache/commons/lang/exception/ExceptionUtils.java
index 7a6b2fd..b53335e 100644
--- a/src/java/org/apache/commons/lang/exception/ExceptionUtils.java
+++ b/src/java/org/apache/commons/lang/exception/ExceptionUtils.java
@@ -67,7 +67,6 @@
 import java.util.StringTokenizer;
 
 import org.apache.commons.lang.ArrayUtils;
-import org.apache.commons.lang.NullArgumentException;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.SystemUtils;
 
@@ -80,7 +79,7 @@
  * @author Stephen Colebourne
  * @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
  * @since 1.0
- * @version $Id: ExceptionUtils.java,v 1.30 2003/07/26 14:22:21 scolebourne Exp $
+ * @version $Id: ExceptionUtils.java,v 1.31 2003/07/31 23:45:28 scolebourne Exp $
  */
 public class ExceptionUtils {
     
@@ -509,7 +508,7 @@
             return;
         }
         if (stream == null) {
-            throw new NullArgumentException("PrintStream");
+            throw new IllegalArgumentException("The PrintStream must not be null");
         }
         String trace[] = getRootCauseStackTrace(throwable);
         for (int i = 0; i < trace.length; i++) {
@@ -538,7 +537,7 @@
             return;
         }
         if (writer == null) {
-            throw new NullArgumentException("PrintWriter");
+            throw new IllegalArgumentException("The PrintWriter must not be null");
         }
         String trace[] = getRootCauseStackTrace(throwable);
         for (int i = 0; i < trace.length; i++) {
@@ -590,7 +589,7 @@
      */
     public static void removeCommonFrames(List causeFrames, List wrapperFrames) {
         if (causeFrames == null || wrapperFrames == null) {
-            throw new NullArgumentException("List");
+            throw new IllegalArgumentException("The List must not be null");
         }
         int causeFrameIndex = causeFrames.size() - 1;
         int wrapperFrameIndex = wrapperFrames.size() - 1;
diff --git a/src/java/org/apache/commons/lang/math/NumberUtils.java b/src/java/org/apache/commons/lang/math/NumberUtils.java
index f6e54c4..927cbf1 100644
--- a/src/java/org/apache/commons/lang/math/NumberUtils.java
+++ b/src/java/org/apache/commons/lang/math/NumberUtils.java
@@ -56,7 +56,6 @@
 import java.math.BigDecimal;
 import java.math.BigInteger;
 
-import org.apache.commons.lang.NullArgumentException;
 import org.apache.commons.lang.StringUtils;
 
 /**
@@ -71,7 +70,7 @@
  * @author Matthew Hawthorne
  * @author <a href="mailto:ggregory@seagullsw.com">Gary Gregory</a>
  * @since 2.0
- * @version $Id: NumberUtils.java,v 1.8 2003/07/28 21:37:32 scolebourne Exp $
+ * @version $Id: NumberUtils.java,v 1.9 2003/07/31 23:45:28 scolebourne Exp $
  */
 public class NumberUtils {
     
@@ -490,13 +489,13 @@
      * 
      * @param array  an array, must not be null or empty
      * @return the minimum value in the array
-     * @throws NullArgumentException if <code>array</code> is <code>null</code>
+     * @throws IllegalArgumentException if <code>array</code> is <code>null</code>
      * @throws IllegalArgumentException if <code>array</code> is empty
      */
     public static long min(long[] array) {
         // Validates input
         if (array == null) {
-            throw new NullArgumentException("Array");
+            throw new IllegalArgumentException("The Array must not be null");
         } else if (array.length == 0) {
             throw new IllegalArgumentException("Array cannot be empty.");
         }
@@ -517,13 +516,13 @@
      * 
      * @param array  an array, must not be null or empty
      * @return the minimum value in the array
-     * @throws NullArgumentException if <code>array</code> is <code>null</code>
+     * @throws IllegalArgumentException if <code>array</code> is <code>null</code>
      * @throws IllegalArgumentException if <code>array</code> is empty
      */
     public static int min(int[] array) {
         // Validates input
         if (array == null) {
-            throw new NullArgumentException("Array");
+            throw new IllegalArgumentException("The Array must not be null");
         } else if (array.length == 0) {
             throw new IllegalArgumentException("Array cannot be empty.");
         }
@@ -544,13 +543,13 @@
      * 
      * @param array  an array, must not be null or empty
      * @return the minimum value in the array
-     * @throws NullArgumentException if <code>array</code> is <code>null</code>
+     * @throws IllegalArgumentException if <code>array</code> is <code>null</code>
      * @throws IllegalArgumentException if <code>array</code> is empty
      */
     public static short min(short[] array) {
         // Validates input
         if (array == null) {
-            throw new NullArgumentException("Array");
+            throw new IllegalArgumentException("The Array must not be null");
         } else if (array.length == 0) {
             throw new IllegalArgumentException("Array cannot be empty.");
         }
@@ -571,13 +570,13 @@
      * 
      * @param array  an array, must not be null or empty
      * @return the minimum value in the array
-     * @throws NullArgumentException if <code>array</code> is <code>null</code>
+     * @throws IllegalArgumentException if <code>array</code> is <code>null</code>
      * @throws IllegalArgumentException if <code>array</code> is empty
      */
     public static double min(double[] array) {
         // Validates input
         if (array == null) {
-            throw new NullArgumentException("Array");
+            throw new IllegalArgumentException("The Array must not be null");
         } else if (array.length == 0) {
             throw new IllegalArgumentException("Array cannot be empty.");
         }
@@ -598,13 +597,13 @@
      * 
      * @param array  an array, must not be null or empty
      * @return the minimum value in the array
-     * @throws NullArgumentException if <code>array</code> is <code>null</code>
+     * @throws IllegalArgumentException if <code>array</code> is <code>null</code>
      * @throws IllegalArgumentException if <code>array</code> is empty
      */
     public static float min(float[] array) {
         // Validates input
         if (array == null) {
-            throw new NullArgumentException("Array");
+            throw new IllegalArgumentException("The Array must not be null");
         } else if (array.length == 0) {
             throw new IllegalArgumentException("Array cannot be empty.");
         }
@@ -627,13 +626,13 @@
      * 
      * @param array  an array, must not be null or empty
      * @return the minimum value in the array
-     * @throws NullArgumentException if <code>array</code> is <code>null</code>
+     * @throws IllegalArgumentException if <code>array</code> is <code>null</code>
      * @throws IllegalArgumentException if <code>array</code> is empty
      */
     public static long max(long[] array) {
         // Validates input
         if (array == null) {
-            throw new NullArgumentException("Array");
+            throw new IllegalArgumentException("The Array must not be null");
         } else if (array.length == 0) {
             throw new IllegalArgumentException("Array cannot be empty.");
         }
@@ -654,13 +653,13 @@
      * 
      * @param array  an array, must not be null or empty
      * @return the minimum value in the array
-     * @throws NullArgumentException if <code>array</code> is <code>null</code>
+     * @throws IllegalArgumentException if <code>array</code> is <code>null</code>
      * @throws IllegalArgumentException if <code>array</code> is empty
      */
     public static int max(int[] array) {
         // Validates input
         if (array == null) {
-            throw new NullArgumentException("Array");
+            throw new IllegalArgumentException("The Array must not be null");
         } else if (array.length == 0) {
             throw new IllegalArgumentException("Array cannot be empty.");
         }
@@ -681,13 +680,13 @@
      * 
      * @param array  an array, must not be null or empty
      * @return the minimum value in the array
-     * @throws NullArgumentException if <code>array</code> is <code>null</code>
+     * @throws IllegalArgumentException if <code>array</code> is <code>null</code>
      * @throws IllegalArgumentException if <code>array</code> is empty
      */
     public static short max(short[] array) {
         // Validates input
         if (array == null) {
-            throw new NullArgumentException("Array");
+            throw new IllegalArgumentException("The Array must not be null");
         } else if (array.length == 0) {
             throw new IllegalArgumentException("Array cannot be empty.");
         }
@@ -708,13 +707,13 @@
      * 
      * @param array  an array, must not be null or empty
      * @return the minimum value in the array
-     * @throws NullArgumentException if <code>array</code> is <code>null</code>
+     * @throws IllegalArgumentException if <code>array</code> is <code>null</code>
      * @throws IllegalArgumentException if <code>array</code> is empty
      */
     public static double max(double[] array) {
         // Validates input
         if (array== null) {
-            throw new NullArgumentException("Array");
+            throw new IllegalArgumentException("The Array must not be null");
         } else if (array.length == 0) {
             throw new IllegalArgumentException("Array cannot be empty.");
         }
@@ -735,13 +734,13 @@
      * 
      * @param array  an array, must not be null or empty
      * @return the minimum value in the array
-     * @throws NullArgumentException if <code>array</code> is <code>null</code>
+     * @throws IllegalArgumentException if <code>array</code> is <code>null</code>
      * @throws IllegalArgumentException if <code>array</code> is empty
      */
     public static float max(float[] array) {
         // Validates input
         if (array == null) {
-            throw new NullArgumentException("Array");
+            throw new IllegalArgumentException("The Array must not be null");
         } else if (array.length == 0) {
             throw new IllegalArgumentException("Array cannot be empty.");
         }