[Mulgara-svn] r1226 - trunk/src/jar/resolver/java/org/mulgara/resolver

pag at mulgara.org pag at mulgara.org
Wed Sep 3 22:06:08 UTC 2008


Author: pag
Date: 2008-09-03 15:06:07 -0700 (Wed, 03 Sep 2008)
New Revision: 1226

Modified:
   trunk/src/jar/resolver/java/org/mulgara/resolver/ResolverFactoryFactory.java
Log:
Created sensible messages/exceptions when unable to dynamically load classes

Modified: trunk/src/jar/resolver/java/org/mulgara/resolver/ResolverFactoryFactory.java
===================================================================
--- trunk/src/jar/resolver/java/org/mulgara/resolver/ResolverFactoryFactory.java	2008-09-03 22:05:30 UTC (rev 1225)
+++ trunk/src/jar/resolver/java/org/mulgara/resolver/ResolverFactoryFactory.java	2008-09-03 22:06:07 UTC (rev 1226)
@@ -81,12 +81,16 @@
     }
 
     try {
-      Class resolverFactoryClass = Class.forName(className);
+      Class<?> resolverFactoryClass = null;
+      try {
+        resolverFactoryClass = Class.forName(className);
+      } catch (Throwable t) {
+        throw new IllegalArgumentException(className + " could not be loaded", t);
+      }
 
       // Validate that the candidate supports the ResolverFactory interface
       if (!ResolverFactory.class.isAssignableFrom(resolverFactoryClass)) {
-        throw new IllegalArgumentException(
-            className + " is not an " + ResolverFactory.class.getName());
+        throw new IllegalArgumentException(className + " is not an " + ResolverFactory.class.getName());
       }
 
       // Invoke the static ResolverFactory.newInstance method
@@ -133,7 +137,12 @@
     }
 
     try {
-      Class resolverFactoryClass = Class.forName(className);
+      Class<?> resolverFactoryClass = null;
+      try {
+        resolverFactoryClass = Class.forName(className);
+      } catch (Throwable t) {
+        throw new IllegalArgumentException(className + " could not be loaded", t);
+      }
 
       // Validate that the candidate supports the ResolverFactory interface
       if (!SystemResolverFactory.class.isAssignableFrom(resolverFactoryClass)) {




More information about the Mulgara-svn mailing list