Yes indeed! The more I look at the code in these interceptors, the more I question the number of times Ctrl-C and Ctrl-V were pressed!
Scott On 9/21/07, Chris Pratt <[EMAIL PROTECTED]> wrote: > > > On 9/21/07, Dave Newton <[EMAIL PROTECTED]> wrote: > > > public String intercept(ActionInvocation invocation) > > > throws Exception { > > > Object action = invocation.getAction(); > > > if (action instanceof ModelDriven) { > > > ModelDriven modelDriven = (ModelDriven) > > > action; > > > ValueStack stack = invocation.getStack(); > > > if (modelDriven.getModel() != null) { > > > stack.push(modelDriven.getModel()); > > > } > > > } > > > return invocation.invoke(); > > > } > > > > > Yikes, what if getModel() is doing actual work, you're calling it > twice for no apparent reason. Wouldn't it be significantly safer to: > > public String intercept(ActionInvocation invocation) > throws Exception { > Object action = invocation.getAction(); > if (action instanceof ModelDriven) { > ModelDriven modelDriven = (ModelDriven)action; > ValueStack stack = invocation.getStack(); > Object model = modelDriven.getModel(); > if (model != null) { > stack.push(model); > } > } > return invocation.invoke(); > } > > (*Chris*) > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Scott [EMAIL PROTECTED]