updates, resin support
authoradam <adam@megacz.com>
Sun, 9 Jul 2006 06:33:39 +0000 (06:33 +0000)
committeradam <adam@megacz.com>
Sun, 9 Jul 2006 06:33:39 +0000 (06:33 +0000)
darcs-hash:20060709063339-5007d-c662c2286bc3cc91f87823c09cf100646431fbef.gz

src/org/ibex/jinetd/Host.java
src/org/ibex/jinetd/Main.java

index 96dcf13..d745222 100644 (file)
@@ -32,26 +32,31 @@ public class Host extends TreeClassLoader {
         init(org.ibex.jinetd.Main.ROOT + "/host", "", 0, Main.getRootClassLoader());
     }
     public static void init(String path, String host, int depth, ClassLoader pcl) {
         init(org.ibex.jinetd.Main.ROOT + "/host", "", 0, Main.getRootClassLoader());
     }
     public static void init(String path, String host, int depth, ClassLoader pcl) {
+       if (!new File(path).exists() || !new File(path).isDirectory()) return;
         try {
         try {
-            InetAddress addr = InetAddress.getByName(host);
-            /*
-            boolean good = false;
-            try {
-                if (NetworkInterface.getByInetAddress(addr) != null) good = true;
-                if (!good) Log.warn(Host.class, "host " + host + "resolves to " + addr + " which is not local");
-            } catch (Exception e) {
-                Log.warn(Host.class, "host " + host + "resolves to " + addr + " which is not local because:");
-                Log.warn(Host.class, e);
-            }
-            if (!good) return;
-            */
-            if (new File(path + File.separatorChar + "WEB-INF").exists()) {
-                String pad = "";
-                while(pad.length() + host.length() < 30) pad += " ";
-                Log.info(Main.class, pad + host + " => " + path);
-                hosts.put(host, pcl = new Host(path, host, pcl));
-            }
-        } catch (UnknownHostException e) {
+           Log.warn(Host.class, "resolving " + host);
+           InetAddress addr = InetAddress.getByName(host);
+
+           /*
+           boolean good = false;
+           try {
+               if (NetworkInterface.getByInetAddress(addr) != null) good = true;
+               if (!good) Log.warn(Host.class, "host " + host + "resolves to " + addr + " which is not local");
+           } catch (Exception e) {
+               Log.warn(Host.class, "host " + host + "resolves to " + addr + " which is not local because:");
+               Log.warn(Host.class, e);
+           }
+           if (!good) return;
+           */        
+
+           if (new File(path + File.separatorChar + "WEB-INF").exists()) {
+               String pad = "";
+               while(pad.length() + host.length() < 30) pad += " ";
+               Log.info(Main.class, pad + host + " => " + path);
+               hosts.put(host, pcl = new Host(path, host, pcl));
+               if (!"ibex.org".equals(host)) return;
+           }
+       } catch (UnknownHostException e) {
             if (depth >= 3) return;
         }
         String[] subdirs = new File(path).list();
             if (depth >= 3) return;
         }
         String[] subdirs = new File(path).list();
index a939720..7e3b08d 100644 (file)
@@ -22,8 +22,8 @@ public class Main {
     }
 
     public static String ROOT;
     }
 
     public static String ROOT;
-    public static String LOGFILE;
-    public static PrintStream LOGSTREAM;
+    private static String LOGFILE;
+    private static PrintStream LOGSTREAM;
     public static String defaultDomain;
 
     public static void init() {
     public static String defaultDomain;
 
     public static void init() {
@@ -38,12 +38,14 @@ public class Main {
                 defaultDomain = localMachine.getHostName();
             } catch(java.net.UnknownHostException uhe) { defaultDomain = "localhost"; }
             System.err.println("    jinetd.hostname = " + defaultDomain);
                 defaultDomain = localMachine.getHostName();
             } catch(java.net.UnknownHostException uhe) { defaultDomain = "localhost"; }
             System.err.println("    jinetd.hostname = " + defaultDomain);
-            LOGFILE = System.getProperty("jinetd.logfile", ROOT + File.separatorChar+"log.txt");
-            System.err.println("    jinetd.logfile = " + LOGFILE);
-            System.err.println("    redirecting stdout/stderr to logfile." + LOGFILE);
-            LOGSTREAM = new PrintStream(new FileOutputStream(LOGFILE, true));
-            System.setErr(LOGSTREAM);
-            System.setOut(LOGSTREAM);
+            LOGFILE = System.getProperty("jinetd.logfile", /*ROOT + File.separatorChar+"log.txt"*/null);
+            if (LOGFILE != null) {
+                System.err.println("    jinetd.logfile = " + LOGFILE);
+                System.err.println("    redirecting stdout/stderr to logfile." + LOGFILE);
+                LOGSTREAM = new PrintStream(new FileOutputStream(LOGFILE, true));
+                System.setErr(LOGSTREAM);
+                System.setOut(LOGSTREAM);
+            }
 
             gatherDependencies();
         } catch (Throwable e) {
 
             gatherDependencies();
         } catch (Throwable e) {