struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <newton.d...@yahoo.com>
Subject Re: Sanity-check regarding ModelDrivenInterceptor vs. stack order
Date Thu, 17 Jul 2008 11:26:32 GMT
--- On Wed, 7/16/08, Gabriel Belingueres <belingueres@gmail.com> wrote:
> I believe that we could check on stack.push() if the object
> to push shadows some other object in the stack with relative ease.
> 
> The basic idea would be to use a Map<String,Object>
> where the key is the property name, and the value is 
> the object in the stack with that property name. If 
> the yet to push object has a property that is already 
> in the Map, then it would shadow it (unless of course 
> it is actually the same object), and a warn can be
> logged/exception thrown (in devMode only).

You lost me--why would we need to keep a shadow map?

The current code checks if a refresh is needed: if it is, the old object is removed via ArrayList.remove(Object),
and if appropriate, the new object is pushed (the stack order change).

To replace the old object ArrayList.indexOf(Object) would retrieve the index and the new object
would be set with ArrayList.set(int, Object).

There's still a potential stack depth issue, though, since if the new value is null it's not
supposed to get put on the stack.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message