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.

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>

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).

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

Reply via email to