[Webfunds-commits] java/webfunds/utils VersionNumbers.java

Ian Grigg iang@cypherpunks.ai
Fri, 6 Oct 2000 21:17:05 -0400 (AST)


iang        00/10/06 21:17:05

  Modified:    webfunds/utils VersionNumbers.java
  Log:
  extra debugging to see why Macs can't see the directory

Revision  Changes    Path
1.5       +49 -3     java/webfunds/utils/VersionNumbers.java

Index: VersionNumbers.java
===================================================================
RCS file: /home/webfunds/cvsroot/java/webfunds/utils/VersionNumbers.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- VersionNumbers.java	2000/09/17 21:02:18	1.4
+++ VersionNumbers.java	2000/10/07 01:17:05	1.5
@@ -1,5 +1,5 @@
 /*
- * $Id: VersionNumbers.java,v 1.4 2000/09/17 21:02:18 iang Exp $
+ * $Id: VersionNumbers.java,v 1.5 2000/10/07 01:17:05 iang Exp $
  *
  * Copyright (c) Systemics Ltd 1995-1999 on behalf of
  * the WebFunds Development Team.  All Rights Reserved.
@@ -54,12 +54,58 @@
         return getList(dir);
     }
 
+    static protected void checkOutDirectory(File dir)
+    {
+        logmsg("directory: " + dir + " list is null");
+        logmsg("absolute path: " + dir.getAbsolutePath());
+        if (!dir.exists())
+           logmsg("version directory: " + dir + " is non existant");
+        else
+        {
+          if (!dir.isDirectory())
+            logmsg("version directory: " + dir + " is not a directory");
+          if (!dir.canRead())
+            logmsg("version directory: " + dir + " is not readable");
+        }
+
+        String pp = dir.getParent();
+        logmsg("pp is " + pp);
+        if (pp == null)
+            pp = ".";
+        File parent = new File(pp);
+        if (!parent.exists())
+        {
+           logmsg("parent directory: " + parent + " is non existant");
+           return ;
+        }
+
+        if (!parent.isDirectory())
+            logmsg("parent directory: " + parent + " is not a directory");
+        else
+        {
+            String[] list = parent.list();
+            if (list == null || (list.length == 0))
+                logmsg("parent directory: " + parent + " has no list "+list);
+            else
+            {
+                for (int i = 0; i < list.length; i++)
+                    logmsg("     ++++ " + i + " " + list[i]);
+            }
+        }
+
+        if (!parent.canRead())
+            logmsg("parent directory: " + parent + " is not readable");
+
+    }
+
+
     static protected String[] getList(File dir)
     {
         String[] list = dir.list();
-        if (list == null)
+        if (list == null)          // means "not a directory" or "IO error"
         {
-            logmsg("version directory: " + dir + " is empty");
+            checkOutDirectory(dir);
+
             return new String[0] ;
         }
         Vector victor = new Vector();