{
RendererConfig rConfig = (RendererConfig) iter.next();
try
{
MessageRenderer renderer = createRenderer(classLoader, rConfig);
if (renderer.getClass().getName().equals(DefaultMessageRenderer.class.getName()))
{
gotDefaultRenderer = true;
}
renderersByClass.put(rConfig.getClassName(), renderer);
renderersByName.put(renderer.getDisplayName(), renderer);
}
catch (Throwable t)
{
log.error("cannot load renderer " + rConfig.getClassName() + ": " + t.getMessage(), t);
if (HermesBrowser.getBrowser() != null)
{
JOptionPane.showMessageDialog(HermesBrowser.getBrowser(), "Cannot load renderer " + rConfig.getClassName() + ":\n" + t.getClass().getName()
+ "\n" + t.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
}
}
}
renderers.clear();
//
// Handle upgrades to Hermes 1.6 where this may be missing.
if (!gotDefaultRenderer)
{
RendererConfig rConfig = new RendererConfig();
rConfig.setClassName(DefaultMessageRenderer.class.getName());
config.getRenderer().add(rConfig);
renderers.add(new DefaultMessageRenderer());
}
final StringTokenizer rendererClasses = new StringTokenizer(System.getProperty(SystemProperties.RENDERER_CLASSES,
SystemProperties.DEFAULT_RENDERER_CLASSES), ",");
while (rendererClasses.hasMoreTokens())
{
final String rendererClassName = rendererClasses.nextToken();
if (renderersByClass.containsKey(rendererClassName))
{
renderers.add(renderersByClass.get(rendererClassName));
}
else
{
try
{
MessageRenderer renderer = (MessageRenderer) Class.forName(rendererClassName).newInstance() ;
renderers.add(renderer);
renderersByClass.put(rendererClassName, renderer);
renderersByName.put(renderer.getDisplayName(), renderer);
}
catch (Throwable t)
{
log.error("cannot instantiate renderer: " + rendererClassName + ": " + t.getMessage(), t);
}