IO-77 revert to throwing NullPointerException rather than IllegalArgumentException

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/io/trunk@610810 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/java/org/apache/commons/io/FileUtils.java b/src/java/org/apache/commons/io/FileUtils.java
index 99bceda..f4d73b9 100644
--- a/src/java/org/apache/commons/io/FileUtils.java
+++ b/src/java/org/apache/commons/io/FileUtils.java
@@ -1717,17 +1717,17 @@
      *
      * @param srcDir the directory to be moved
      * @param destDir the destination directory
-     * @throws IllegalArgumentException if source or destination is <code>null</code>
+     * @throws NullPointerException if source or destination is <code>null</code>
      * @throws IOException if source or destination is invalid
      * @throws IOException if an IO error occurs moving the file
      * @since Commons IO 1.4
      */
     public static void moveDirectory(File srcDir, File destDir) throws IOException {
         if (srcDir == null) {
-            throw new IllegalArgumentException("Source must not be null");
+            throw new NullPointerException("Source must not be null");
         }
         if (destDir == null) {
-            throw new IllegalArgumentException("Destination must not be null");
+            throw new NullPointerException("Destination must not be null");
         }
         if (!srcDir.exists()) {
             throw new FileNotFoundException("Source '" + srcDir + "' does not exist");
@@ -1756,17 +1756,17 @@
      * @param destDir the destination file
      * @param createDestDir If <code>true</code> create the destination directory,
      * otherwise if <code>false</code> throw an IOException
-     * @throws IllegalArgumentException if source or destination is <code>null</code>
+     * @throws NullPointerException if source or destination is <code>null</code>
      * @throws IOException if source or destination is invalid
      * @throws IOException if an IO error occurs moving the file
      * @since Commons IO 1.4
      */
     public static void moveDirectoryToDirectory(File src, File destDir, boolean createDestDir) throws IOException {
         if (src == null) {
-            throw new IllegalArgumentException( "Source must not be null" );
+            throw new NullPointerException("Source must not be null");
         }
         if (destDir == null) {
-            throw new IllegalArgumentException("Destination directory must not be null");
+            throw new NullPointerException("Destination directory must not be null");
         }
         if (!destDir.exists() && createDestDir) {
             destDir.mkdirs();
@@ -1789,17 +1789,17 @@
      *
      * @param srcFile the file to be moved
      * @param destFile the destination file
-     * @throws IllegalArgumentException if source or destination is <code>null</code>
+     * @throws NullPointerException if source or destination is <code>null</code>
      * @throws IOException if source or destination is invalid
      * @throws IOException if an IO error occurs moving the file
      * @since Commons IO 1.4
      */
     public static void moveFile(File srcFile, File destFile) throws IOException {
         if (srcFile == null) {
-            throw new IllegalArgumentException( "Source must not be null" );
+            throw new NullPointerException("Source must not be null");
         }
         if (destFile == null) {
-            throw new IllegalArgumentException("Destination must not be null");
+            throw new NullPointerException("Destination must not be null");
         }
         if (!srcFile.exists()) {
             throw new FileNotFoundException("Source '" + srcFile + "' does not exist");
@@ -1831,17 +1831,17 @@
      * @param destDir the destination file
      * @param createDestDir If <code>true</code> create the destination directory,
      * otherwise if <code>false</code> throw an IOException
-     * @throws IllegalArgumentException if source or destination is <code>null</code>
+     * @throws NullPointerException if source or destination is <code>null</code>
      * @throws IOException if source or destination is invalid
      * @throws IOException if an IO error occurs moving the file
      * @since Commons IO 1.4
      */
     public static void moveFileToDirectory(File srcFile, File destDir, boolean createDestDir) throws IOException {
         if (srcFile == null) {
-            throw new IllegalArgumentException( "Source must not be null" );
+            throw new NullPointerException("Source must not be null");
         }
         if (destDir == null) {
-            throw new IllegalArgumentException("Destination directory must not be null");
+            throw new NullPointerException("Destination directory must not be null");
         }
         if (!destDir.exists() && createDestDir) {
             destDir.mkdirs();
@@ -1865,17 +1865,17 @@
      * @param destDir the destination directory 
      * @param createDestDir If <code>true</code> create the destination directory,
      * otherwise if <code>false</code> throw an IOException
-     * @throws IllegalArgumentException if source or destination is <code>null</code>
+     * @throws NullPointerException if source or destination is <code>null</code>
      * @throws IOException if source or destination is invalid
      * @throws IOException if an IO error occurs moving the file
      * @since Commons IO 1.4
      */
     public static void moveToDirectory(File src, File destDir, boolean createDestDir) throws IOException {
         if (src == null) {
-            throw new IllegalArgumentException( "Source must not be null" );
+            throw new NullPointerException("Source must not be null");
         }
         if (destDir == null) {
-            throw new IllegalArgumentException("Destination must not be null");
+            throw new NullPointerException("Destination must not be null");
         }
         if (!src.exists()) {
             throw new FileNotFoundException("Source '" + src + "' does not exist");
diff --git a/src/test/org/apache/commons/io/FileUtilsTestCase.java b/src/test/org/apache/commons/io/FileUtilsTestCase.java
index 19a0b12..93fedfd 100644
--- a/src/test/org/apache/commons/io/FileUtilsTestCase.java
+++ b/src/test/org/apache/commons/io/FileUtilsTestCase.java
@@ -1351,14 +1351,14 @@
     public void testMoveFile_Errors() throws Exception {
         try {
             FileUtils.moveFile(null, new File("foo"));
-            fail("Expected IllegalArgumentException when source is null");
-        } catch (IllegalArgumentException e) {
+            fail("Expected NullPointerException when source is null");
+        } catch (NullPointerException e) {
             // expected
         }
         try {
             FileUtils.moveFile(new File("foo"), null);
-            fail("Expected IllegalArgumentException when destination is null");
-        } catch (IllegalArgumentException e) {
+            fail("Expected NullPointerException when destination is null");
+        } catch (NullPointerException e) {
             // expected
         }
         try {
@@ -1400,14 +1400,14 @@
     public void testMoveFileToDirectory_Errors() throws Exception {
         try {
             FileUtils.moveFileToDirectory(null, new File("foo"), true);
-            fail("Expected IllegalArgumentException when source is null");
-        } catch (IllegalArgumentException e) {
+            fail("Expected NullPointerException when source is null");
+        } catch (NullPointerException e) {
             // expected
         }
         try {
             FileUtils.moveFileToDirectory(new File("foo"), null, true);
-            fail("Expected IllegalArgumentException when destination is null");
-        } catch (IllegalArgumentException e) {
+            fail("Expected NullPointerException when destination is null");
+        } catch (NullPointerException e) {
             // expected
         }
         File testFile1    = new File(getTestDirectory(), "testMoveFileFile1");
@@ -1485,14 +1485,14 @@
     public void testMoveDirectory_Errors() throws Exception {
         try {
             FileUtils.moveDirectory(null, new File("foo"));
-            fail("Expected IllegalArgumentException when source is null");
-        } catch (IllegalArgumentException e) {
+            fail("Expected NullPointerException when source is null");
+        } catch (NullPointerException e) {
             // expected
         }
         try {
             FileUtils.moveDirectory(new File("foo"), null);
-            fail("Expected IllegalArgumentException when destination is null");
-        } catch (IllegalArgumentException e) {
+            fail("Expected NullPointerException when destination is null");
+        } catch (NullPointerException e) {
             // expected
         }
         try {
@@ -1549,14 +1549,14 @@
     public void testMoveDirectoryToDirectory_Errors() throws Exception {
         try {
             FileUtils.moveDirectoryToDirectory(null, new File("foo"), true);
-            fail("Expected IllegalArgumentException when source is null");
-        } catch (IllegalArgumentException e) {
+            fail("Expected NullPointerException when source is null");
+        } catch (NullPointerException e) {
             // expected
         }
         try {
             FileUtils.moveDirectoryToDirectory(new File("foo"), null, true);
-            fail("Expected IllegalArgumentException when destination is null");
-        } catch (IllegalArgumentException e) {
+            fail("Expected NullPointerException when destination is null");
+        } catch (NullPointerException e) {
             // expected
         }
         File testFile1    = new File(getTestDirectory(), "testMoveFileFile1");
@@ -1604,14 +1604,14 @@
     public void testMoveToDirectory_Errors() throws Exception {
         try {
             FileUtils.moveDirectoryToDirectory(null, new File("foo"), true);
-            fail("Expected IllegalArgumentException when source is null");
-        } catch (IllegalArgumentException e) {
+            fail("Expected NullPointerException when source is null");
+        } catch (NullPointerException e) {
             // expected
         }
         try {
             FileUtils.moveDirectoryToDirectory(new File("foo"), null, true);
-            fail("Expected IllegalArgumentException when destination is null");
-        } catch (IllegalArgumentException e) {
+            fail("Expected NullPointerException when destination is null");
+        } catch (NullPointerException e) {
             // expected
         }
         File nonexistant    = new File(getTestDirectory(), "nonexistant");