You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2003/08/01 01:45:28 UTC

cvs commit: jakarta-commons/lang/src/java/org/apache/commons/lang/exception ExceptionUtils.java

scolebourne    2003/07/31 16:45:28

  Modified:    lang/src/java/org/apache/commons/lang StringEscapeUtils.java
                        ArrayUtils.java SerializationUtils.java
               lang/src/java/org/apache/commons/lang/math NumberUtils.java
               lang/src/java/org/apache/commons/lang/exception
                        ExceptionUtils.java
  Log:
  Unify exception handling re IAE
  
  Revision  Changes    Path
  1.22      +3 -3      jakarta-commons/lang/src/java/org/apache/commons/lang/StringEscapeUtils.java
  
  Index: StringEscapeUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/StringEscapeUtils.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- StringEscapeUtils.java	28 Jul 2003 16:17:57 -0000	1.21
  +++ StringEscapeUtils.java	31 Jul 2003 23:45:28 -0000	1.22
  @@ -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;
  
  
  
  1.20      +2 -2      jakarta-commons/lang/src/java/org/apache/commons/lang/ArrayUtils.java
  
  Index: ArrayUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/ArrayUtils.java,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- ArrayUtils.java	19 Jul 2003 20:17:12 -0000	1.19
  +++ ArrayUtils.java	31 Jul 2003 23:45:28 -0000	1.20
  @@ -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());
       }
  
  
  
  1.8       +4 -4      jakarta-commons/lang/src/java/org/apache/commons/lang/SerializationUtils.java
  
  Index: SerializationUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/SerializationUtils.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- SerializationUtils.java	19 Jul 2003 20:22:36 -0000	1.7
  +++ SerializationUtils.java	31 Jul 2003 23:45:28 -0000	1.8
  @@ -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);
  
  
  
  1.9       +21 -22    jakarta-commons/lang/src/java/org/apache/commons/lang/math/NumberUtils.java
  
  Index: NumberUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/math/NumberUtils.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- NumberUtils.java	28 Jul 2003 21:37:32 -0000	1.8
  +++ NumberUtils.java	31 Jul 2003 23:45:28 -0000	1.9
  @@ -56,7 +56,6 @@
   import java.math.BigDecimal;
   import java.math.BigInteger;
   
  -import org.apache.commons.lang.NullArgumentException;
   import org.apache.commons.lang.StringUtils;
   
   /**
  @@ -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.");
           }
  
  
  
  1.31      +4 -5      jakarta-commons/lang/src/java/org/apache/commons/lang/exception/ExceptionUtils.java
  
  Index: ExceptionUtils.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/lang/src/java/org/apache/commons/lang/exception/ExceptionUtils.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- ExceptionUtils.java	26 Jul 2003 14:22:21 -0000	1.30
  +++ ExceptionUtils.java	31 Jul 2003 23:45:28 -0000	1.31
  @@ -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;
   
  @@ -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;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org