On Fri, 2007-05-04 at 09:25 +0200, Geoffrey De Smet wrote:
> Exceptions shouldn't be eaten, but DefaultFormModel does it on
> setValueSilently.
I guess you are referring to DefaultFormModel.ValidatingFormValueModel,
the inner class that wraps valueModels.
> The method setValueSilently is used by comboboxbinders
> and in our use case sometimes contact the back-end.
This wrapper is used on all valueModels, not only in combination with
comboboxbindings (you probably meant the bindING, not the bindER, former
is the actual instance sitting between user input and valueModel while
the latter is the 'factory' for a type of binding).
> That back-end could throw an exception, which is currently eaten:
>
>
> public void setValueSilently(Object value,
> PropertyChangeListener listenerToSkip) {
> try {
> ...
> super.setValueSilently(value, listenerToSkip);
> clearBindingError(this);
> }
> catch (Exception e) {
> logger.debug("Exception occurred setting value", e);
> raiseBindingError(this, value, e);
> }
> }
>
> Is anyone relying on the fact that exceptions are eaten?
The implementation reflects a use-case: when the value is being written,
an exception is raised when the format/type/argument is incorrect this
exception will translate in a validation message to the user in order to
let him correct his input. I'm not sure how often this use-case pops up.
There is indeed a draw-back in this whole issue: all exceptions raised
during the setting of the value, including all exceptions raised in the
listeners, will result in this handling. The bindings are registered as
listeners and thus every exception raised is handled by this catch
routine.
I'll see if I can change the behaviour of these listener-exceptions by
letting them fall through, while still allowing the binding-error
handling. Meanwhile, it's recommended that, when developing, you place a
debug-point at that catch block to see if it doesn't get triggered when
you're not expecting it to.
I don't know if this one is already raised as a jira issue, but it
definitely qualifies as one.
Gr-,
J.
**** DISCLAIMER ****
http://www.schaubroeck.be/maildisclaimer.htm
|