RE: Methods to EventForwardingFactory
Jeremy L Rosenberger <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.barracuda.general |
|---|---|
| Message-ID | <1064951675.17650.3.camel@automatux> |
A method like this, in its current form, is asking for trouble. It
"eats" exceptions that the application would probably want to know about
sooner (by having the opportunity to catch them) rather than later (by
noticing a problem with the application, going back through the logs,
and happening to notice a ClassCastException or something like that).
That's my opinion, anyway.
Cheers,
Jeremy
On Tue, 2003-09-30 at 19:33, Christian Cryder wrote:
> Hmmm...interesting idea. Anyone have any obj
>
> > public void setForwardEvent(String eventClass) {
> > if (null == eventClass) return;
> > try {
> > Class c = Class.forName(eventClass);
> > fevent = (BaseEvent)c.newInstance();
> > } catch (ClassNotFoundException nfe) {
> > logger.error("Event class " + eventClass + " not found", nfe);
> > } catch (InstantiationException ie) {
> > logger.error("Error instantiating " + eventClass, ie);
> > } catch (IllegalAccessException iae) {
> > logger.error("Error instantiating " + eventClass, iae);
> > } catch (ClassCastException ce) {
> > logger.error("The class " + eventClass + " should be a
> > BaseEvent", ce);
> > }
> > }
--
Jeremy L. Rosenberger * [email protected]
http://www.frii.com/~jeremy/