Beanclass not set on ValidationError added in handleValidationErrors
--------------------------------------------------------------------
Key: STS-542
URL: http://www.stripesframework.org/jira/browse/STS-542
Project: Stripes
Issue Type: Bug
Components: Validation
Affects Versions: Release 1.5
Environment: Stripes SVN build 883
Reporter: Frederic Daoud
ValidationError has a beanclass property which, among other things, serves in
the resource bundle lookup for error messages.
For example, new LocalizableError("haha") in class foo.bar.MyActionBean will
look for foo.bar.MyActionBean.haha=doh! in the resource bundle (among other
keys.)
The beanclass property is set by DispatcherHelper.handleValidationErrors()
which calls fillInValidationErrors(), and that's where the work is done.
The problem I've encountered is this: an Action Bean can implement
ValidationErrorHandler and, in the handleValidationErrors() method, decide what
to do with the validation errors that occurred.
In my use case, if any field errors occurred, I want to add a global error to
be displayed at the top of the page. The problem is that with the errors added
to ValidationErrors at this point, it's too late, fillInValidationErrors() has
already been called and the added errors don't have their beanclass property
set. Using FQN.key in the resource bundle will not be found.
The interesting part of the code is in DispatcherHelper#handleValidationErrors
(lines 351-376). I would add another call to fillInValidationErrors() after
handleValidationErrors() (after line 366), but I'm not sure if this is the
correct solution and/or whether this would have any undesirable side effects.
In the meantime, I can get my code to work by setting the beanclass on the
validation error object myself, but do we want to require users to have to do
this?
Please let me know what you think..
Thanks,
Freddy
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://www.stripesframework.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development