lcsim/src/org/lcsim/job
diff -u -r1.15 -r1.16
--- JobControlManager.java 4 Feb 2009 00:20:33 -0000 1.15
+++ JobControlManager.java 11 Mar 2009 19:05:04 -0000 1.16
@@ -4,6 +4,7 @@
import hep.physics.vec.Hep3Vector;
import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
import java.beans.MethodDescriptor;
import java.io.BufferedReader;
import java.io.File;
@@ -771,27 +772,51 @@
type = availableDrivers.get(type);
}
+ //
+ // Get Class, BeanInfo, and Constructor, and setup the new Driver instance.
+ //
+
// Class of the Driver.
Class driverClass;
-
+ try
+ {
+ driverClass = loader.loadClass(type);
+ }
+ catch (ClassNotFoundException x)
+ {
+ throw new RuntimeException("The Driver class " + type + " could not be created."+
+ " Check that the name and package is correct in your xml file.",x);
+ }
+
+ if (printDriversDetailed)
+ logStream.println(driverClass.getCanonicalName());
+
// BeanInfo for the Driver class.
BeanInfo beaninfo;
-
+ try
+ {
+ beaninfo = java.beans.Introspector.getBeanInfo(driverClass);
+ }
+ catch (IntrospectionException x)
+ {
+ throw new RuntimeException("Problem loading a BeanInfo object for Driver class " + type + ".");
+ }
+
// The Driver instance.
Driver newDriver;
-
- // Get Class, BeanInfo, and Constructor, and setup the new Driver instance.
- try
+ try
{
- driverClass = loader.loadClass(type);
- if (printDriversDetailed)
- logStream.println(driverClass.getCanonicalName());
- beaninfo = java.beans.Introspector.getBeanInfo(driverClass);
newDriver = (Driver) driverClass.newInstance();
- }
- catch (Exception x)
+ }
+ catch (InstantiationException x)
{
- throw new RuntimeException(x);
+ throw new RuntimeException("Failed to create a Driver of class " + type + "." +
+ "This class might be missing a public constructor with no arguments.",x);
+ }
+ catch (IllegalAccessException x)
+ {
+ throw new RuntimeException("Cannot access Driver type " + type + "."+
+ "You may need to make this class or its constructor public.",x);
}
// Get a list of Driver parameters.