[Webfunds-commits] java/webfunds/client/utils FileUtils.java

Ian Grigg iang@cypherpunks.ai
Sun, 24 Sep 2000 17:48:41 -0400 (AST)


iang        00/09/24 17:48:41

  Modified:    webfunds/client/utils FileUtils.java
  Log:
  made the asserts a little more helpful, useful for debugging

Revision  Changes    Path
1.2       +11 -5     java/webfunds/client/utils/FileUtils.java

Index: FileUtils.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/client/utils/FileUtils.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FileUtils.java	2000/03/29 23:26:49	1.1
+++ FileUtils.java	2000/09/24 21:48:41	1.2
@@ -1,5 +1,5 @@
 /*
- * $Id: FileUtils.java,v 1.1 2000/03/29 23:26:49 iang Exp $
+ * $Id: FileUtils.java,v 1.2 2000/09/24 21:48:41 iang Exp $
  *
  * Copyright (C) 2000 Systemics Inc. on behalf of 
  * the WebFunds Development Team. All rights reserved.
@@ -16,7 +16,7 @@
 /**
  * Helper functions dealing with File objects.
  *
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
  * @author  Jeroen C. van Gelderen (gelderen@systemics.com)
  */
 public final class FileUtils
@@ -42,7 +42,8 @@
         throws IOException
     {
         if( !toDir.isDirectory() )
-            throw new InternalError("Assert");
+            throw new InternalError("Assert: " + toDir.getPath() +
+                                    " not a directory");
 
         if( subject.isFile() )
         {
@@ -82,8 +83,13 @@
     public static void copyFile(File srcFile, File dstDir)
         throws IOException
     {
-        if( !srcFile.isFile() || !dstDir.isDirectory() )
-            throw new InternalError("Assert");
+        if( !srcFile.isFile() )
+            throw new InternalError("Assert: " + srcFile.getPath() +
+                                    " not a file");
+
+        if( !dstDir.isDirectory() )
+            throw new InternalError("Assert: " + dstDir.getPath() +
+                                    " not a directory");
 
         System.out.println("copyFile " + srcFile + ", " + dstDir);
         String fileName = srcFile.getName();