Hi Markus
Sure.
See example below (written in Swing but applies the same way to ULC). You can
use inheritance or composition. That's up to you ;-)
Keep in mind that swallowing exceptions can get the servers-side out-of-sync.
We do not experience this as a problem in practice though.
public class WrapperActionListener implements ActionListener {
private ActionListener _delegate;
public WrapperActionListener(ActionListener delegate) {
_delegate = delegate;
}
public void actionPerformed(ActionEvent inEvent) {
try {
_delegate.actionPerformed(inEvent);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
ActionListener myListener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("WrapperActionListener.actionPerformed");
}
};
new JButton().addActionListener(new WrapperActionListener(myListener));
}
}
Etienne
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, January 12, 2007 7:08 AM
To: Etienne Studer
Subject: RE: [ULC-developer] A good way to handle Unrecoverable Exceptions?
Hello Etienne,
thank you for your fast reply.
Can you explain what you mean by wrapping all listeners?
Do you have some example for a wrapper you wrote about in your response?
Best regards,
Markus Kortmann
-----"Etienne Studer" <[EMAIL PROTECTED]> wrote: -----
To: <[email protected]>, <[EMAIL PROTECTED]>
From: "Etienne Studer" <[EMAIL PROTECTED]>
Date: 12.01.2007 16:01
Subject: RE: [ULC-developer] A good way to handle Unrecoverable Exceptions?
Hi Markus
I've made this request to Canoo more than a year ago but so far it has not been
implemented:
http://www.canoo.com/jira/browse/UBA-943
What you can do is wrap all your listener implementations with a wrapper class
that catches all exceptions and then does what you want to do (db write, etc.)
before rethrowing the exception (or swallowing it).
Regards, Etienne
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Friday, January 12, 2007 6:50 AM
To: [email protected]
Subject: [ULC-developer] A good way to handle Unrecoverable Exceptions?
Does anyone here know a good way to handle Unrecoverable Exceptions?
Is it possible to do something like
1. catch even this exception
2. store it in a database / log it somewhere 3. throw it further
at some point?
It would be very helpful to be able to get some information, if an
unrecoverable exception occured and the user already closed it, with some
mechanism like described.
Thank you in advance.
Best regards,
MarkusP°z÷¥¢?«?¨¥?x%?ËT,'^½éh¥êå?Ëlq©è¡Ê&?Ûiÿùb²Û
jz(r?¿?¨¥?©ÿ?+-?wèþé\uëÞ??^
_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer