? .classpath
? src/test/org/apache/commons/logging/TestLogSource.java
Index: build.xml
===================================================================
RCS file: /home/cvspublic/jakarta-commons/logging/build.xml,v
retrieving revision 1.9
diff -u -r1.9 build.xml
--- build.xml	3 Feb 2002 01:44:03 -0000	1.9
+++ build.xml	5 Feb 2002 06:03:42 -0000
@@ -19,7 +19,7 @@
 
 
   <!-- The directories corresponding to your necessary dependencies -->
-  <property name="junit.home"              value="/usr/local/junit3.5"/>
+  <property name="junit.home"              value="/usr/local/junit3.7"/>
   <property name="jakarta.home"            value="../.."/>
 
 
Index: src/java/org/apache/commons/logging/LogSource.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/logging/src/java/org/apache/commons/logging/LogSource.java,v
retrieving revision 1.12
diff -u -r1.12 LogSource.java
--- src/java/org/apache/commons/logging/LogSource.java	3 Feb 2002 01:31:54 -0000	1.12
+++ src/java/org/apache/commons/logging/LogSource.java	5 Feb 2002 06:03:42 -0000
@@ -116,6 +116,7 @@
 
     static {
 
+
         // Is Log4J Available?
         try {
             if (null != Class.forName("org.apache.log4j.Category")) {
@@ -123,10 +124,13 @@
             } else {
                 log4jIsAvailable = false;
             }
-        } catch (Throwable t) {
+        } catch (ClassNotFoundException e) {
             log4jIsAvailable = false;
+        } catch (ExceptionInInitializerError e) {
+        	log4jIsAvailable = false;
+        } catch (LinkageError e) {
+        	log4jIsAvailable = false;
         }
-
         // Is JDK 1.4 Logging Available?
         try {
             if (null != Class.forName("java.util.logging.Logger")) {
@@ -134,49 +138,53 @@
             } else {
                 jdk14IsAvailable = false;
             }
-        } catch (Throwable t) {
+        } catch (ClassNotFoundException e) {
             jdk14IsAvailable = false;
+        } catch (ExceptionInInitializerError e) {
+        	jdk14IsAvailable = false;
+        } catch (LinkageError e) {
+        	jdk14IsAvailable = false;
         }
 
         // Set the default Log implementation
         String name = null;
         try {
             name = System.getProperty("org.apache.commons.logging.log");
-        } catch (Throwable t) {
+        } catch (SecurityException e) {
         }
         if (name != null) {
-            try {
-                setLogImplementation(name);
-            } catch (Throwable t) {
-                try {
-                    setLogImplementation
-                            ("org.apache.commons.logging.impl.NoOpLog");
-                } catch (Throwable u) {
-                    ;
-                }
-            }
-        } else {
-            try {
-                if (log4jIsAvailable) {
-                    setLogImplementation
-                            ("org.apache.commons.logging.impl.Log4JCategoryLog");
-                } else if (jdk14IsAvailable) {
-                    setLogImplementation
-                            ("org.apache.commons.logging.impl.Jdk14Logger");
-                } else {
-                    setLogImplementation
-                            ("org.apache.commons.logging.impl.NoOpLog");
+            new ExecuteAround(new SetLogImplCommand(name) {
+                public void execute() throws NoSuchMethodException, ClassNotFoundException {
+                    setLogImplementation(this.name);
                 }
-            } catch (Throwable t) {
-                try {
-                    setLogImplementation
-                            ("org.apache.commons.logging.impl.NoOpLog");
-                } catch (Throwable u) {
-                    ;
+                public void fail() {
+                    new ExecuteAround(new SetLogImplCommand(this.name) {
+                        public void execute() throws NoSuchMethodException, ClassNotFoundException {
+                            setLogImplementation("org.apache.commons.logging.impl.NoOpLog");
+                        }
+                    }).run();
                 }
+            }).run();		
+            } else {
+                new ExecuteAround(new SetLogImplCommand(name) {
+                    public void execute() throws NoSuchMethodException, ClassNotFoundException {
+                        if (log4jIsAvailable) {
+                            setLogImplementation("org.apache.commons.logging.impl.Log4JCategoryLog");
+                        } else if (jdk14IsAvailable) {
+                            setLogImplementation("org.apache.commons.logging.impl.Jdk14Logger");
+                        } else {
+                            setLogImplementation("org.apache.commons.logging.impl.NoOpLog");
+                        }
+                    }
+                    public void fail() {
+                        new ExecuteAround(new SetLogImplCommand(this.name) {
+                            public void execute() throws NoSuchMethodException, ClassNotFoundException {
+                                setLogImplementation("org.apache.commons.logging.impl.NoOpLog");
+                            }
+                        }).run();
+                    }
+                }).run();
             }
-        }
-
     }
 
 
@@ -202,14 +210,10 @@
             LinkageError, ExceptionInInitializerError,
             NoSuchMethodException, SecurityException,
             ClassNotFoundException {
-        try {
             Class logclass = Class.forName(classname);
             Class[] argtypes = new Class[1];
             argtypes[0] = "".getClass();
             logImplctor = logclass.getConstructor(argtypes);
-        } catch (Throwable t) {
-            logImplctor = null;
-        }
     }
 
 
@@ -296,4 +300,35 @@
     }
 
 
+
+}
+
+class SetLogImplCommand {
+	String name;
+	public SetLogImplCommand(String name) {this.name = name;}
+	public void execute() throws NoSuchMethodException, ClassNotFoundException {}
+	public void fail(){}
+}
+
+class ExecuteAround {
+	SetLogImplCommand command;
+	public ExecuteAround(SetLogImplCommand command) {
+		this.command = command;
+	}
+	
+	void run(){
+		try {
+			command.execute();
+		} catch (ExceptionInInitializerError e){
+			command.fail();
+		} catch (LinkageError e) {
+			command.fail();
+		} catch (NoSuchMethodException e) {
+			command.fail();
+		} catch (SecurityException e) {
+			command.fail();
+		} catch (ClassNotFoundException e) {
+			command.fail();
+		} 
+	}	
 }
Index: src/test/org/apache/commons/logging/TestAll.java
===================================================================
RCS file: /home/cvspublic/jakarta-commons/logging/src/test/org/apache/commons/logging/TestAll.java,v
retrieving revision 1.2
diff -u -r1.2 TestAll.java
--- src/test/org/apache/commons/logging/TestAll.java	17 Jan 2002 22:55:43 -0000	1.2
+++ src/test/org/apache/commons/logging/TestAll.java	5 Feb 2002 06:03:42 -0000
@@ -85,7 +85,7 @@
     
     public static Test suite() {
         TestSuite suite = new TestSuite();
-        
+		suite.addTest(TestLogSource.suite());        
         // don't have any tests anymore
         //suite.addTest(TestLogLevels.suite());
         
