> -----Original Message----- > From: Drew McAuliffe [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 11, 2003 5:49 PM > To: [EMAIL PROTECTED] > Subject: [OS-webwork] Problem with chaining interceptor and > action errors > > > I've been having a problem with using the "addActionError" > method of ActionSupport in my actions. For some reason that I > couldn't figure out, every time I tried to call this method, > I was receiving an UnsupportedOperationException. The action > errors always seemed to be stored as an unmodifiable > collection by the time my action tried to add to them. > > It appears that the ChainingInterceptor was calling > "getActionErrors" and using that result to call > "setActionErrors". "getActionErrors" returns an unmodifiable > collection (by design), so calling "setActionErrors" to that > value would always force the action to store an unmodifiable > collection, and thus kill any chance of adding real action > errors (note that these getters and setters are in > ValidationAwareSupport). By removing the reference to the > chaining interceptor, I was able to get the problem to go away. > > I have a couple of questions about this: > 1) Is there some way to make sure that when the action errors > are set in ValidationAwareSupport via the setter, the values > are stored in a modifiable array? I understand the need for > having the getter return an unmodifiable collection but it > causes weird problems when going back the other way. Perhaps > the setter should read something like this.actionErrors = new > ArrayList(errorMessages); That would make sure that whatever > is in there would be modifiable, though it does cause a new > array list to be created. Not sure that there's any way > around that, except to turn of the unmodifiable return on the getter.
Hmm... The new Map would work... Or perhaps creating a new Map for the setter? Anyone have any preferences? > > 2) This chaining is happening on a single action, not when > going from one action to another. Is there a problem in how I > have my interceptor stack configured (order of interceptors) > that would cause the chaining interceptor to get set the > properties of an action with its own contents? My stack looks > like this: <interceptor-stack name="webStack"> > <interceptor-ref name="component"/> > <interceptor-ref name="modelDriven"/> > <interceptor-ref name="chain"/> > <interceptor-ref name="params"/> > </interceptor-stack> > I would think it might want to go first, before ModelDriven. I need to look at the ChainingInterceptor and probably put in some checks so it pops off the object it's setting properties onto if its in the stack... > Perhaps "chain" should come last? I'll have to play around > more to see if I can understand why the chaining interceptor > is working the way it does (I'd like to keep it around since > I'll need it). I'll look too, when I get a chance... > > Thanks, > > Drew > > > > ------------------------------------------------------- > This SF.Net email sponsored by: ApacheCon 2003, > 16-19 November in Las Vegas. Learn firsthand the latest > developments in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, > and more! http://www.apachecon.com/ > _______________________________________________ > Opensymphony-webwork mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork > ------------------------------------------------------- This SF.Net email sponsored by: ApacheCon 2003, 16-19 November in Las Vegas. Learn firsthand the latest developments in Apache, PHP, Perl, XML, Java, MySQL, WebDAV, and more! http://www.apachecon.com/ _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork