catch (ClassNotFoundException cnfe)
{
String err = "The specified class for Uberspect (" + rm
+ ") does not exist or is not accessible to the current classloader.";
log.error(err);
throw new VelocityException(err, cnfe);
}
catch (InstantiationException ie)
{
throw new VelocityException("Could not instantiate class '" + rm + "'", ie);
}
catch (IllegalAccessException ae)
{
throw new VelocityException("Cannot access class '" + rm + "'", ae);
}
if (!(o instanceof Uberspect))
{
String err = "The specified class for Uberspect ("
+ rm + ") does not implement " + Uberspect.class.getName()
+ "; Velocity is not initialized correctly.";
log.error(err);
throw new VelocityException(err);
}
Uberspect u = (Uberspect)o;
if (u instanceof UberspectLoggable)
{
((UberspectLoggable)u).setLog(getLog());
}
if (u instanceof RuntimeServicesAware)
{
((RuntimeServicesAware)u).setRuntimeServices(this);
}
if (uberSpect == null)
{
uberSpect = u;
}
else
{
if (u instanceof ChainableUberspector)
{
((ChainableUberspector)u).wrap(uberSpect);
uberSpect = u;
}
else
{
uberSpect = new LinkingUberspector(uberSpect,u);
}
}
}
if(uberSpect != null)
{
uberSpect.init();
}
else
{
/*
* someone screwed up. Lets not fool around...
*/
String err = "It appears that no class was specified as the"
+ " Uberspect. Please ensure that all configuration"
+ " information is correct.";
log.error(err);
throw new VelocityException(err);
}
}