}
FileInputStream fis = null;
try {
fis = new FileInputStream(cfgFile);
ObjectInputStream ois = new ObjectInputStream(fis);
a3config = (A3CMLConfig) ois.readObject();
} catch (Exception exc) {
Log.logger.log(BasicLevel.WARN, "Can't load configuration: " + path, exc);
} finally {
if (fis != null) fis.close();
}
if (Log.logger.isLoggable(BasicLevel.DEBUG))
Log.logger.log(BasicLevel.DEBUG,
"Config.load : a3cmlconfig = " + a3config);
return a3config;
}
//search a3config in path used to load classes.
ClassLoader classLoader = null;
InputStream is = null;
try {
classLoader = A3CMLConfig.class.getClassLoader();
if (classLoader != null) {
Log.logger.log(BasicLevel.WARN,
"Trying to find [" + path + "] using " +
classLoader + " class loader.");
is = classLoader.getResourceAsStream(path);
}
} catch(Throwable t) {
Log.logger.log(BasicLevel.WARN,
"Can't find [" + path + "] using " +
classLoader + " class loader.", t);
is = null;
}
if (is == null) {
// Last ditch attempt: get the resource from the system class path.
Log.logger.log(BasicLevel.WARN,
"Trying to find serialized config using ClassLoader.getSystemResource().");
is = ClassLoader.getSystemResourceAsStream(path);
}
if (is != null) {
ObjectInputStream ois = new ObjectInputStream(is);
a3config = (A3CMLConfig) ois.readObject();
}
if (a3config == null) {
Log.logger.log(BasicLevel.WARN,
"Unable to find configuration file: " + path);