Apr 4th, 2006, 10:03 AM
You've hit the nail right on the head, as usual.
My issue is that the current "reporting (or lack of)" mechanism is called also when events are fired, so in effect, it becomes the main mechanism for errors... When the model changes, I may call the server and fetch some other stuff, so it is far beyond the "type conversion" issues...
So, as far as your options are, I'd say:
- option 1, definitely should be changed, NPE or required are two totally different things...
- option 2, yes, I'd say that the conversion errors are "different" and may not require login.
As for the best mechanism to do that, whether enforcing a specific exception or not... there are as usual pro and cons.
If we don't, we would have to put some "guesswork" in DefaultFormModel to catch the basic conversion exceptions throwns (IllegalArgument? InvalidFormat? etc).
If we add a specific exception, should it be runtime or not? If not, do people create a lot of conversion/binder code? it may be a pain if suddenly their code breaks because of a new exception requirement. However in my mind, this is typically where you would want an exception as you want to catch it and treat it differently from other issues like NPE and other bugs...
my £0.02 comments...
But option 1 and 2, quickly please... ;-)
I'm going to upgrade to the latest code now but I'm willing to spend a bit of time on this, so we could come up with something nice...
Apr 4th, 2006, 10:16 AM
Nor am I recommending that we do so.
What does seem at issue is that the current implementation is hiding or masking development bugs. If we have a clean contract with the type conversion/value settnig code, then it might be easier to find the bug. If, for example, we only allowed the use of specific exceptions to indicate a conversion failure, then we could catch just those exceptions. Any other runtime exception would then percolate up to whatever global handler is installed.
Just some food for thought.
Originally Posted by email@example.com
Apr 4th, 2006, 10:23 AM
I agree with Larry, I think that a conversion-specific exception is the way to go... The question shall this contract be enforced or not (ie RuntimeException or not...)
May be this conversation should be carried on the dev list?