Hello Barney, thanks for the report. The normal way for contributing code is by attaching a patch to jira [1]. Don't forget to include some unit tests ;-)
TIA! Benedikt [1] https://issues.apache.org/jira 2015-01-02 12:26 GMT+01:00 Barney <b002...@bsxl.com>: > Hi, > > There seems to me to be a bit of a discrepancy between the way push() and > pop() interact with the root object when stack actions are used to change > the object. > > * If a stack action changes the root object when being pushed onto the > stack then the root reference is set to the changed object. > * If a stack action changes the root object when being popped from the > stack then the root reference is not updated. > > I'm not sure if this is intended behaviour or not, but it caught me out > when trying to use stack actions for a specific problem, as I expected > digester.parse() to return the value from stackAction.onPop(). I solved my > specific problem a different way so this no longer affects me, but thought > I'd ask anyway. > > So should Digester.pop() be updated to do this? > > public <T> T pop() > { > try > { > T popped = this.<T> npeSafeCast( stack.pop() ); > if ( stackAction != null ) > { > popped = stackAction.onPop( this, null, popped ); > } > ++ if ( stack.size() == 0 ) > ++ { > ++ root = popped; > ++ } > return popped; > } > catch ( EmptyStackException e ) > { > log.warn( "Empty stack (returning null)" ); > return ( null ); > } > } > > Cheers, > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org > For additional commands, e-mail: dev-h...@commons.apache.org > > -- http://people.apache.org/~britter/ http://www.systemoutprintln.de/ http://twitter.com/BenediktRitter http://github.com/britter