commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r610810 - in /commons/proper/io/trunk/src: java/org/apache/commons/io/FileUtils.java test/org/apache/commons/io/FileUtilsTestCase.java
Date Thu, 10 Jan 2008 15:04:51 GMT
Author: niallp
Date: Thu Jan 10 07:04:49 2008
New Revision: 610810

URL: http://svn.apache.org/viewvc?rev=610810&view=rev
Log:
IO-77 revert to throwing NullPointerException rather than IllegalArgumentException

Modified:
    commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java
    commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java

Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java?rev=610810&r1=610809&r2=610810&view=diff
==============================================================================
--- commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java (original)
+++ commons/proper/io/trunk/src/java/org/apache/commons/io/FileUtils.java Thu Jan 10 07:04:49
2008
@@ -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");

Modified: commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java?rev=610810&r1=610809&r2=610810&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java (original)
+++ commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java Thu Jan
10 07:04:49 2008
@@ -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");



Mime
View raw message